<!---
This file is Copyright © 1998-2009 by Home Care Business Services. This work may not be reproduced, in whole or in part, 
using any medium, including, but not limited to, electronic transmission, CD-ROM or published in print, without the express 
permission of Home Care Business Services.

$Revision: 1.1 $
$Id: convert_physicians.cfm,v 1.1 2009/09/06 03:07:12 arlen Exp $
$Date: 2009/09/06 03:07:12 $
--->

<cfsetting RequestTimeout = "5000"> 

<cfquery  datasource="#Application.DataSrc#" name="PhysicianList">
	SELECT *
	FROM #Request.prefix_db_lookup#.Physician
	WHERE Employee_ID = 0
</cfquery>

<cfoutput query=PhysicianList>
#Lastname#, #Firstname#<br>
<cftransaction>
	<cfquery  name="Insert" datasource="#Application.DataSrc#">
	INSERT INTO #Request.prefix_db_lookup#.Employee
	(EmployeeType,Agency_ID,Last_name,First_Name,Address1,Address2,City,State,Zip,Home_Phone,Cell_Phone,Beeper,Email,status, Record_creation_Date, Record_created_By, Record_Mod_Date, Record_Mod_By)
	VALUES 
	('Physician',#agency_id#,'#lastname#','#firstname#','#address1#','#address2#','#city#','#state#','#zip#','#telephone1#','#cell#','#beeper#','#email#','#status#', #now()#, 0, #now()#, 0)
	</cfquery>

	<cfquery  name="newvisit" datasource="#Application.DataSrc#">
	SELECT MAX(Employee_ID) as maxid from #Request.prefix_db_lookup#.Employee	
	</cfquery>

	<cfquery  name="Insert" datasource="#Application.DataSrc#">
	Update #Request.prefix_db_lookup#.Physician
	set Employee_ID = #newvisit.maxid#
	where Physician_id = #physician_id#
	</cfquery>

</cftransaction>
</cfoutput>
