<!---
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.3 $
$Id: unflag_QB_visit.cfm,v 1.3 2009/09/02 01:34:11 arlen Exp $
$Date: 2009/09/02 01:34:11 $
--->

<!--- Page specific code, such as queries and variable settings should go here --->
<cfquery  name="GetP" datasource="#Application.DataSrc#">
	SELECT Patient_ID, First_Name_m0040, Last_Name_m0040, Middle_Initial_M0040
	From #Request.prefix_db_agency#.patient
	Where Agency_ID = #session.AgencyID#
	AND status = 'active'
	Order By Last_Name_m0040
</cfquery>

<cfquery  name="GetE" datasource="#Application.DataSrc#">
	SELECT Employee_ID, Last_Name, First_Name
	FROM #Request.prefix_db_lookup#.Employee
	WHERE Agency_ID = #session.AgencyID#
	AND Status = 'active' AND EmployeeType != 'Physician'
	Order by Last_Name
</cfquery>

<cfquery  name="GetSched" datasource="#Application.DataSrc#">
Select patient.Patient_ID, patient.First_Name_M0040, patient.Last_Name_M0040, patient.Middle_Initial_M0040,   
		ScheduleItems.Employee_ID, ScheduleItems.Visit_Type, ScheduleItems.Payer_ID, 
		ScheduleItems.Visit_Date, ScheduleItems.QB_Export,
		ScheduleItems.Assessment_Tracker_ID
	From #Request.prefix_db_agency#.ScheduleItems, #Request.prefix_db_agency#.patient
	Where ScheduleItems.ScheduleItems_ID = #url.ID#
	AND ScheduleItems.Agency_ID = #session.AgencyID# 
	AND ScheduleItems.Patient_ID = patient.Patient_ID
</cfquery>

<cfquery  name="GetPay" datasource="#Application.DataSrc#">
	SELECT Payer_ID, PayName
	FROM #Request.prefix_db_agency#.Payer
	WHERE Agency_ID = #session.AgencyID#
	ORDER BY PayName
</cfquery>

<h2>Unflag Visit</h2>
<form name="form1" action="unflag_QB_action.cfm" method="post">
<cfoutput>
<input type="hidden" name="ScheduleItems_ID" value="#url.ID#">
<input type="hidden" name="Assessment_Tracker_ID" value="#GetSched.Assessment_Tracker_ID#">
</cfoutput>
<table width="100%"  border="0" cellspacing="0" cellpadding="5" class="form-border">
	<tr>
		<td class="form-label-req">Patient:</td>
		<td>
			<select name="Patient_ID">
			<option value="">-- Select --</option>
			<cfoutput query="GetP">
			<option value="#Patient_ID#" <cfif GetP.Patient_ID eq GetSched.Patient_ID>selected</cfif>>#Last_Name_m0040#, #First_Name_m0040# #Middle_Initial_M0040#</option>
			</cfoutput>
			</select>
			<input type="hidden" name="Patient_ID_required" value="Patient is required." />
		</td>
	</tr>
	<tr>
		<td class="form-label-req">Employee:</td>
		<td>
			<select name="Employee_ID">
			<option value="">-- Select --</option>
			<cfoutput query="GetE">
			<option value="#Employee_ID#" <cfif GetE.Employee_ID eq GetSched.Employee_ID>selected</cfif>>#Last_Name#, #First_Name#</option>
			</cfoutput>
			</select>
			<input type="hidden" name="Employee_ID_required" value="Employee is required." />
		</td>
	</tr>
	<tr>
		<td class="form-label-req">Payer Name:</td>
		<td>
			<select name="Payer_ID">
				<option value="">-- Select --</option>
				<cfoutput query="GetPay">
				<option value="#Payer_ID#" <cfif GetPay.Payer_ID eq GetSched.Payer_ID>selected</cfif>>#PayName#</option>
				</cfoutput>
			</select>
			<input type="hidden" name="Payer_ID_required" value="Payer Name is required." />
		</td>
		<tr>
			<td class="form-label">Re-Export to QB?</td>
			<td><cfoutput query="GetSched">
				<input type="radio" name="QB_Export" value="0" <cfif QB_Export eq '0'>checked</cfif>> Yes&nbsp;&nbsp;&nbsp;
				<input type="radio" name="QB_Export" value="1" <cfif QB_Export eq '1'>checked</cfif>> No
			</cfoutput></td>
		</tr>

	<tr>
		<td class="form-label"><strong>Bold</strong> fields are required.</td>
		<td><input type="submit" value="Submit" class="button"></td>
	</tr>
</table>
</form>

