<!---
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: new_orders.cfm,v 1.1 2009/11/19 14:19:33 melissa Exp $
$Date: 2009/11/19 14:19:33 $
--->
<!--- 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
	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
	<cfif application.NoEmptyDates>
	AND Assessment_Forms.Record_Creation_Date != '0000-00-00' 
	AND Assessment_Forms.Date_Sent != '0000-00-00' 
	AND Assessment_Forms.Cert_Start_Item_3a != '0000-00-00' 
	AND Assessment_Forms.Cert_End_Item_3b != '0000-00-00' 
	</cfif>
	AND	patient.Agency_ID = #session.AgencyID#
	AND Physician.Physician_ID = patient.Primary_ReferringPhys_ID_M0072
	AND Employee.Employee_ID = Physician.Employee_ID
	AND Assessment_Forms.Date_Sent IS NULL
	AND Assessment_Forms.Form_Status NOT IN ('Signed','Delete')
	ORDER BY patient.Last_Name_M0040, Assessment_Forms.Cert_End_Item_3b
</cfquery>
<!--- End page specific code --->
 <h1>New orders that need to be printed and sent</h1> 
<cfoutput query="Visits" group="Patient_ID"> ___________________________________________ <br> 
  <h2><a href="javascript:void(0);" onclick="javascript:secureHREF('index.cfm?page=patient&cat=patient_chart&ID=#visits.patient_id#')"> #PatientLast#, #PatientFirst#</a></b> - (#status#) <em>#Last_Name#</em></h2> 
  <br> 
  <cfoutput>&nbsp;&nbsp;&nbsp;&nbsp; 
    <cfif Form_Type IS "Form 487"> 
      <a href="/patientadmin_new/index.cfm?a=1&page=patient&cat=487_update&id=#patient_id#&afid=#assessment_forms_id#"><font color="##FF6699">Form 487</font></a> 
    <cfelse> 
      <a href="/patientadmin_new/index.cfm?a=1&page=patient&cat=485_update&id=#patient_id#&afid=#assessment_forms_id#"><font color="##66CC33">Form 485</font></a> 
    </cfif> 
    #DateFormat(Cert_Start_Item_3a,"mm/dd/yyyy")# - #DateFormat(Cert_End_Item_3b,"mm/dd/yyyy")# 
    <cfif Form_Type IS "Form 487"> 
&nbsp;&nbsp;<a href="index.cfm?page=dashboard&cat=&rpt=487_print&id=#assessment_forms_id#" target='p'>Print</a><cfelse> <em><font size="1"><font color="##6699FF">print in PowerPath</font></font></em>
    </cfif> 
    <cfif Record_Creation_Date IS NOT "" and Date_Sent IS ""> 
      <em><font size="1">&nbsp;&nbsp;created #DateFormat(Record_Creation_Date,"mm/dd/yyyy")#</font></em></a> 
    </cfif> 
    <cfif Nurse_Digital_Signature IS NOT ""> 
      <em><font size="1">&nbsp;&nbsp;Digitally signed by Clinician</font></em> 
      <cfelse> 
    </cfif> 
    <br> 
  </cfoutput><br> 
</cfoutput> 