<!---
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.7 $
$Id: unsigned_orders.cfm,v 1.7 2009/10/21 21:39:37 arlen Exp $
$Date: 2009/10/21 21:39:37 $
--->

<!--- Page specific code, such as queries and variable settings should go here --->
<cfquery datasource="#Application.DataSrc#" name="Visits">
	SELECT patient.patient_ID, patient.Status, patient.Last_Name_M0040 AS patientLast, 
	patient.First_Name_M0040 AS patientFirst, 	Assessment_Forms.Assessment_Forms_ID, Assessment_Forms.Form_Type, 
	Assessment_Forms.Date_Sent, patient.Primary_ReferringPhys_ID_M0072, Assessment_Forms.Cert_Start_Item_3a, 
	Assessment_Forms.Cert_End_Item_3b, Assessment_Forms.Cert_Start_Item_3a, Assessment_Forms.Nurse_Digital_Signature, 
	Assessment_Forms.Record_Creation_Date, 
	Physician.Physician_ID, Employee.Last_Name as LastName, Employee.First_Name as FirstName
	FROM #Request.prefix_db_agency#.patient, #Request.prefix_db_agency#.Assessment_Forms, #Request.prefix_db_lookup#.Physician,#Request.prefix_db_lookup#.Employee
	WHERE patient.patient_ID = Assessment_Forms.patient_ID
	AND	patient.Agency_ID = #session.AgencyID#
	AND Physician.Physician_ID = patient.Primary_ReferringPhys_ID_M0072
	AND Assessment_Forms.Form_Status NOT IN ('Signed','Delete')
	AND Employee.Employee_ID = Physician.Employee_ID
	ORDER BY patient.Last_Name_M0040, Assessment_Forms.Cert_End_Item_3b
</cfquery>

<h1>Un-Signed Orders by patient</h1>
<tr>
	<td colspan="2"><cfoutput><a href="index.cfm?page=patient&cat=add_487&id=0">New Order</a></cfoutput>   
	<cfoutput><a href="index.cfm?page=patient&cat=unsigned_orders_date_sent&id=0">by Date Sent</a></cfoutput>   
	<cfoutput><a href="index.cfm?page=patient&cat=unsigned_orders_physician&id=0">by Physician</a></cfoutput>   
	<br><br></td>
</tr>
<cfoutput query="Visits" group="patient_ID">
___________________________________________ <br>
 <b>#patientLast#, #patientFirst#</b> - (#status#) <em>#LastName#</em><br>
	<br>
	<cfoutput><cfif Form_Type IS "Form 487"><font color="##00FF00">    #Form_Type#</font><cfelse><font color="##CC0099">    #Form_Type#</font></cfif> #DateFormat(Cert_Start_Item_3a,"mm/dd/yyyy")# - #DateFormat(Cert_End_Item_3b,"mm/dd/yyyy")# 
		<cfif Form_Type IS "Form 487">  <a href="index.cfm?page=patient&cat=487_update&afid=#assessment_forms_id#">View</a>
		<cfelse>  <a href="index.cfm?page=patient&cat=485_update&afid=#assessment_forms_id#">View</a></cfif> 
	<cfif Form_Type IS "Form 487"><cfif Date_Sent IS NOT "">  <a href="index.cfm?page=patient&cat=487_print&id=#assessment_forms_id#" target=_blank>Print</a><cfelse>  <a href="index.cfm?page=patient&cat=487_print&id=#assessment_forms_id#" style="color:##FF0000; " target=_blank>Print</a></cfif></cfif>
	<cfif Date_Sent IS NOT ""><em><font size="1">  
	mailed #DateFormat(Date_Sent,"mm/dd/yyyy")#</font></em></a></cfif>
	<cfif Record_Creation_Date IS NOT "" and Date_Sent IS ""><em><font size="1">  new #DateFormat(Record_Creation_Date,"mm/dd/yyyy")#</font></em></a></cfif>
	<cfif Nurse_Digital_Signature IS NOT ""><em><font size="1">  Digitally signed by Clinician</font></em><cfelse></cfif><br>
  </cfoutput><br>
</cfoutput> 

