<!---
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: med_form_print.cfm,v 1.1 2010/03/22 22:27:55 arlen Exp $
$Date: 2010/03/22 22:27:55 $
--->
<cflock scope="Session" type="ReadOnly" timeout="12" throwontimeout="no">
  <cfset MM_Username=Iif(IsDefined("Session.EmployeeID"),"Session.EmployeeID",DE("")) />
  <cfset MM_UserAuthorization=Iif(IsDefined("Session.MM_UserAuthorization"),"Session.MM_UserAuthorization",DE("")) />
</cflock>
<cfif MM_Username EQ "">
  <cfset MM_referer=CGI.SCRIPT_NAME />
  <cfif CGI.QUERY_STRING NEQ "">
    <cfset MM_referer=MM_referer & "?" & CGI.QUERY_STRING />
  </cfif>
  <cfset MM_failureURL="../login_denied.cfm?accessdenied=" & URLEncodedFormat(MM_referer) />
  <cflocation url="#MM_failureURL#" addtoken="no">
</cfif>
<!--- Page specific code, such as queries and variable settings should go here --->
<cfquery name="GetP" datasource="#Application.DataSrc#">
	SELECT Patient_ID, Last_Name_M0040, First_Name_M0040, Allergies, Primary_ReferringPhys_ID_M0072 FROM #Request.prefix_db_agency#.patient WHERE Patient_ID = #session.cs.patientid#

</cfquery>
<cfquery name="GetM" datasource="#Application.DataSrc#">
	SELECT Drug_Name, Med_Status, DateOrdered, DateDCed, Dose, Route, Freq, Notes, Dose_Units
	FROM #Request.prefix_db_agency#.PatientMeds
	WHERE Patient_ID = #session.cs.patientid# 
	AND Med_Status <> 'delete'
	ORDER By Med_Status, DateDCed, Drug_Name ASC
</cfquery>
<cfquery name="GetPhys" datasource="#Application.DataSrc#">
SELECT Physician.Physician_ID, Employee.Last_Name, Employee.First_Name,Employee.Address1, Employee.City, Employee.State, Employee.Zip, Employee.Home_Phone 
FROM #Request.prefix_db_lookup#.Employee 
LEFT OUTER JOIN Physician on Employee.Employee_ID = Physician.Employee_ID 
WHERE Physician.Physician_ID = #GetP.Primary_ReferringPhys_ID_M0072# AND Employee.EmployeeType = 'Physician'</cfquery>

<!--- End page specific code --->
<cfif 0>
<!--- <cfdocument   format = "PDF"   orientation = "landscape"   overwrite = "yes">
   <cfdocumentitem type="header">
 <div style="font-size:18px;font-weight:bold;"><cfoutput query="getP"><br><br>Medication List - #First_Name_M0040# #Last_Name_M0040#<br>#DateFormat(NOW(), "mmm dd, yyyy")#</cfoutput></div>
   </cfdocumentitem>
   <cfdocumentitem type="footer">
   	<div style="font-size:12px;"><cfinclude template="../../_footer.cfm"></div>
   </cfdocumentitem>     --->
 <cfelse>
 <form><input type="button" value=" Print "
onclick="window.print();return false;" /></form> <br>
 <div style="font-size:18px;font-weight:bold;"><cfoutput query="getP"><br><br>Medication List - #First_Name_M0040# #Last_Name_M0040#<br>#DateFormat(NOW(), "mmm dd, yyyy")#</cfoutput></div>

</cfif>
<br><Br>
<cfoutput query="getP">
  <cfif Allergies NEQ ''>
    Allergies: <em>#Allergies#</em>
  </cfif>
<br>
</cfoutput>
<br>
<cfif GetPhys.Physician_ID NEQ 0>
  <cfoutput query="getPhys">
  <strong>#FirstName# #LastName# </strong><em>Physician</em><br>
    <strong>#Address1#<br>
    #City#, #State# #Zip#<br>
    #Home_Phone#</strong></cfoutput>
	<br><br><cfelse><strong>Physician Unknown</strong>
<br>
<br>
</cfif>
<br>
<table cellpadding="0" cellspacing="5" border="0" class="schedule">
					<tr>
						<td valign="top" style="font-size:12px;"><b>Medication</b></td>
						<td valign="top" style="font-size:12px;"><b>Dose</b></td>
						<td valign="top" style="font-size:12px;"><b>Units</b></td>
						<td valign="top" style="font-size:12px;"><b>Route</b></td>
						<td valign="top" style="font-size:12px;"><b>Freq</b></td>
						<td valign="top" style="font-size:12px;"><b>Notes</b></td>
						<td valign="top" style="font-size:12px;"><b>Status</b></td>
						<td valign="top" style="font-size:12px;"><b>Ordered</b></td>
						<td valign="top" style="font-size:12px;"><b>DCed</b></td>
					</tr>
					<cfoutput query="GetM">
					<tr>
						<td valign="top" style="font-size:16px;">#Drug_Name#</td>
						<td valign="top" style="font-size:16px;">#Dose#</td>
						<td valign="top" style="font-size:16px;">#Dose_Units#</td>
						<td valign="top" style="font-size:16px;">#Route#</td>
						<td valign="top" style="font-size:16px;">#Freq#</td>
						<td valign="top" style="font-size:16px;">#Notes#</td>
						<td valign="top" style="font-size:16px;">#Med_Status#</td>
						<td valign="top" style="font-size:16px;">#DateFormat(DateOrdered, "mm/dd/yy")#</td>
						<td valign="top" style="font-size:16px;">#DateFormat(DateDCed, "mm/dd/yy")#</td>
					</tr>
					</cfoutput>
</table>
<cfif 0>

<!--- </cfdocument> --->
<cfelse>
   	<div style="font-size:10px;"><cfinclude template="../../_footer.cfm"></div>

</cfif>
