SELECT Rev_Code, Rev_CodeID, HCPCS, Visit_Type, Payer_ID, Description FROM #Request.prefix_db_agency#.pRevenue_Code WHERE Agency_ID = And EClaim_Price IS NOT NULL And Status = And Quick_Books_Price IS NOT NULL And Payer_ID = ORDER BY Visit_Type, Rev_Code SELECT F177 AS Certification_Start, F178 AS Certification_End FROM #Request.prefix_db_agency#.pAssessments WHERE Assmt_ID = '#Session.AssessmentID#' SELECT PtPayer_ID AS PatientPayer_ID FROM #Request.prefix_db_agency#.pPtPayer WHERE Patient_ID='#Session.Patient.PatientIDValue#' AND PtPayer_ID= '#Session.Patient.Payer#' AND status < 2 ORDER BY PtPayer_ID DESC SELECT Pay_Name FROM #Request.prefix_db_agency#.pPayer WHERE Pay_ID = '#Session.Patient.Payer#' SELECT Patient_ID, Pt_First, Pt_Last, Pt_Middle, Pt_Pay_ID FROM #Request.prefix_db_agency#.pPatients WHERE Patient_ID = AND status < 2 ORDER BY Pt_Last,Pt_First SELECT * FROM #Request.prefix_db_agency#.pAuths where pAuths = #PatientPayer.PatientPayer_ID# AND STATUS = 0 SELECT Patient_ID,Assmt_ID, F176, F25, F26, F179,F177, F178 FROM #Request.prefix_db_agency#.pAssessments WHERE Patient_Id = AND Status = AND (F26 LIKE '1%' OR F26 LIKE '3%' OR F26 LIKE '4%' OR F26 LIKE '%Evaluation%' OR F26 LIKE '%Hospice%' OR F26 LIKE '%NO ASSESSMENT%' OR F26 LIKE '6%') ORDER BY F179 Desc SELECT Patient_ID, Pt_Last, Pt_First, Pt_Middle FROM #Request.prefix_db_agency#.pPatients WHERE Patient_ID ='#Session.Patient.PatientIDValue#' SELECT Patient_ID, Pt_First, Pt_Last, Pt_Middle, Pt_Pay_ID FROM #Request.prefix_db_agency#.pPatients WHERE Patient_ID = AND status < 2 ORDER BY Pt_Last,Pt_First SELECT Patient_ID,Assmt_ID, F176, F25, F26, F179,F177 AS Certification_Start, F178 AS Certification_End, F26 as Assessment_Reason_M0100 FROM #Request.prefix_db_agency#.pAssessments WHERE Patient_Id = AND Status = AND Assmt_ID = AND (F26 LIKE '1%' OR F26 LIKE '3%' OR F26 LIKE '4%' OR F26 LIKE '%Evaluation%' OR F26 LIKE '%Hospice%' OR F26 LIKE '%NO ASSESSMENT%' OR F26 LIKE '6%') ORDER BY F179 Desc SELECT Emp_ID, Emp_Last, Emp_First FROM #Request.prefix_db_lookup#.pEmployee WHERE Loc_ID = AND Status = AND Emp_Type != 'Physician' ORDER BY Emp_Last, Emp_First SELECT Rev_Code, Rev_CodeID, HCPCS, Visit_Type, Payer_ID, Description FROM #Request.prefix_db_agency#.pRevenue_Code WHERE Agency_ID = And EClaim_Price IS NOT NULL And Status = And Quick_Books_Price IS NOT NULL And Payer_ID = ORDER BY Visit_Type, Rev_Code Certification Start Date of [#GetAssess.Certification_Start#] or Certification End Date of [#GetAssess.Certification_End#] is illegal. SELECT pPatients.Pt_Last, pPatients.Pt_First,pEmployee.Emp_Last, pEmployee.Emp_First, pSchedules.Skill AS Visit_Type,pSchedules.Notes AS Visit_Notes,pSchedules.Progress_Note,pSchedules.Rev_ID, pSchedules.Assmt_ID, pSchedules.Schedule_ID, pSchedules.StartTime, pSchedules.EndTime, pSchedules.Visit_Date,pSchedules.Patient_ID FROM #Request.prefix_db_agency#.pSchedules left outer join #Request.prefix_db_lookup#.pEmployee on pSchedules.Emp_ID = pEmployee.Emp_ID left outer join #Request.prefix_db_agency#.pPatients on pSchedules.Patient_ID = pPatients.Patient_ID left outer join #Request.prefix_db_agency#.pAssessments on (pSchedules.Assmt_ID = pAssessments.Assmt_ID) left outer join #Request.prefix_db_agency#.pPayer pp on pSchedules.pay_id = pp.Pay_id WHERE (pSchedules.Visit_Date >= #CreateODBCDate(GetAssess.Certification_Start)# AND pSchedules.Visit_Date <= #CreateODBCDate(GetAssess.Certification_End)#) AND pSchedules.status < 2 AND pAssessments.Assmt_ID= '#session.CS.AssessmentId#' AND pSchedules.patient_ID IN (#Session.Patient.PatientIDValue#) AND pEmployee.Emp_ID = #Session.EmployeeID# AND pAssessments.Status = 0 ORDER BY StartTime, Pt_Last, Pt_First, Emp_Last, Emp_First
#GetPatient.Pt_Last#, #GetPatient.Pt_First# #GetPatient.Pt_Middle#

Assessment: #GetAssess.Assessment_Reason_M0100#   Certification from: #DateFormat(GetAssess.Certification_Start, "mmm d, yyyy")# to #DateFormat(GetAssess.Certification_End, "mmm d, yyyy")#   Payer: #TempPayer#

  • style="display:none" id="DateEmployee_#i#" >
     Available Employee:
    SELECT case when Pt_Longitude is not null then Pt_Longitude else 0 end as LATITUDE,case when Pt_Longitude is not null then Pt_Longitude else 0 end as LONGITUDE,(SELECT DAYOFWEEK('#date1#')) as DAYOFDATE FROM #Request.prefix_db_agency#.pPatients WHERE PATIENT_ID='#Session.Patient.PatientIDValue#' select Distinct Emp_ID, concat(Emp_First,' ',Emp_Last) as Emp_Last, (select count(*) from #Request.prefix_db_agency#.preferedpatient where Patient_ID='#Session.Patient.PatientIDValue#' and EmployeeID=Emp_ID) as PreferenceCount, ( SELECT EmployeeWorkschedule_ID FROM #Request.prefix_db_agency#.Employee_Workschedule WHERE ScheduleType='available' and ScheduleDate='#VARIABLES.date#' and (str_to_date('#STime#','%H:%i') between str_to_date(ScheduleStart,'%H:%i') and str_to_date(ScheduleEnd,'%H:%i')) and (str_to_date('#ETime#','%H:%i') between str_to_date(ScheduleStart,'%H:%i') and str_to_date(ScheduleEnd,'%H:%i')) limit 1) as EmployeeWorkschedule_ID from #Request.prefix_db_lookup#.pEmployee e where ( (e.Loc_ID='#Session.AgencyID#') and ( ( SELECT count(1) FROM #Request.prefix_db_agency#.Employee_Workschedule WHERE ScheduleType='available' and ScheduleDate='#VARIABLES.date#' and (str_to_date('#STime#','%H:%i') between str_to_date(ScheduleStart,'%H:%i') and str_to_date(ScheduleEnd,'%H:%i')) and (str_to_date('#ETime#','%H:%i') between str_to_date(ScheduleStart,'%H:%i') and str_to_date(ScheduleEnd,'%H:%i')) and Emp_ID=e.Emp_ID) >0) AND status = 0 and (Emp_Type != 'Physician') ) and ( ( (select count(*) from #Request.prefix_db_agency#.pSchedules WHERE Emp_ID=e.Emp_ID AND Visit_Date = '#VARIABLES.date#') < e.SundayMaxVisit) OR (SundayMaxVisit is null) OR (SundayMaxVisit='0') ) order by PreferenceCount desc,Emp_Last asc select Distinct Emp_ID, concat(Emp_First,' ',Emp_Last) as Emp_Last, (select count(*) from #Request.prefix_db_agency#.preferedpatient where Patient_ID= '#Session.Patient.PatientIDValue#' and EmployeeID=Emp_ID) as PreferenceCount, ( SELECT EmployeeWorkschedule_ID FROM #Request.prefix_db_agency#.Employee_Workschedule WHERE ScheduleType='available' and ScheduleDate='#VARIABLES.date#' and (str_to_date('#STime#','%H:%i') between str_to_date(ScheduleStart,'%H:%i') and str_to_date(ScheduleEnd,'%H:%i')) and (str_to_date('#ETime#','%H:%i') between str_to_date(ScheduleStart,'%H:%i') and str_to_date(ScheduleEnd,'%H:%i')) limit 1) as EmployeeWorkschedule_ID from #Request.prefix_db_lookup#.pEmployee e where ( (Loc_ID ='#Session.AgencyID#') and ( ( SELECT count(1) FROM #Request.prefix_db_agency#.Employee_Workschedule WHERE ScheduleType='available' and ScheduleDate='#VARIABLES.date#' and (str_to_date('#STime#','%H:%i') between str_to_date(ScheduleStart,'%H:%i') and str_to_date(ScheduleEnd,'%H:%i')) and (str_to_date('#ETime#','%H:%i') between str_to_date(ScheduleStart,'%H:%i') and str_to_date(ScheduleEnd,'%H:%i')) and Emp_ID=e.Emp_ID ) >0) AND status = 0 AND (Emp_Type != 'Physician') ) and ( ((select count(*) from #Request.prefix_db_agency#.pSchedules WHERE Emp_ID=e.Emp_ID AND Visit_Date = '#VARIABLES.date#') < e.MondayMaxVisit) OR (MondayMaxVisit is null) OR (MondayMaxVisit='0') ) order by PreferenceCount desc,Emp_Last asc select Distinct Emp_ID, concat(Emp_First,' ',Emp_Last) as Emp_Last, (select count(*) from #Request.prefix_db_agency#.preferedpatient where Patient_ID= '#Session.Patient.PatientIDValue#' and EmployeeID=Emp_ID) as PreferenceCount, ( SELECT EmployeeWorkschedule_ID FROM #Request.prefix_db_agency#.Employee_Workschedule WHERE ScheduleType='available' and ScheduleDate='#VARIABLES.date#' and (str_to_date('#STime#','%H:%i') between str_to_date(ScheduleStart,'%H:%i') and str_to_date(ScheduleEnd,'%H:%i')) and (str_to_date('#ETime#','%H:%i') between str_to_date(ScheduleStart,'%H:%i') and str_to_date(ScheduleEnd,'%H:%i')) limit 1) as EmployeeWorkschedule_ID from #Request.prefix_db_lookup#.pEmployee e where ( (Loc_ID ='#Session.AgencyID#') and ((SELECT count(1) FROM #Request.prefix_db_agency#.Employee_Workschedule WHERE ScheduleType='available' and ScheduleDate='#VARIABLES.date#' and (str_to_date('#STime#','%H:%i') between str_to_date(ScheduleStart,'%H:%i') and str_to_date(ScheduleEnd,'%H:%i')) and (str_to_date('#ETime#','%H:%i') between str_to_date(ScheduleStart,'%H:%i') and str_to_date(ScheduleEnd,'%H:%i')) and Emp_ID=e.Emp_ID ) >0) AND status = 0 AND (Emp_Type != 'Physician') ) and ( ((select count(*) from #Request.prefix_db_agency#.pSchedules WHERE Emp_ID=e.Emp_ID AND Visit_Date = '#VARIABLES.date#')< e.TuesdayMaxVisit ) OR (TuesdayMaxVisit is null) OR (TuesdayMaxVisit='0') ) order by PreferenceCount desc,Emp_Last asc select Distinct Emp_ID, concat(Emp_First,' ',Emp_Last) as Emp_Last, (select count(*) from #Request.prefix_db_agency#.preferedpatient where Patient_ID= '#Session.Patient.PatientIDValue#' and EmployeeID=Emp_ID) as PreferenceCount, ( SELECT EmployeeWorkschedule_ID FROM #Request.prefix_db_agency#.Employee_Workschedule WHERE ScheduleType='available' and ScheduleDate='#VARIABLES.date#' and (str_to_date('#STime#','%H:%i') between str_to_date(ScheduleStart,'%H:%i') and str_to_date(ScheduleEnd,'%H:%i')) and (str_to_date('#ETime#','%H:%i') between str_to_date(ScheduleStart,'%H:%i') and str_to_date(ScheduleEnd,'%H:%i')) limit 1 ) as EmployeeWorkschedule_ID from #Request.prefix_db_lookup#.pEmployee e where ((Agency_Id='#Session.AgencyID#') and (( SELECT count(1) FROM #Request.prefix_db_agency#.Employee_Workschedule WHERE ScheduleType='available' and ScheduleDate='#VARIABLES.date#' and (str_to_date('#STime#','%H:%i') between str_to_date(ScheduleStart,'%H:%i') and str_to_date(ScheduleEnd,'%H:%i')) and (str_to_date('#ETime#','%H:%i') between str_to_date(ScheduleStart,'%H:%i') and str_to_date(ScheduleEnd,'%H:%i')) and Emp_ID=e.Emp_ID ) >0) AND status = 0 AND (Emp_Type != 'Physician') ) and ( ((select count(*) from #Request.prefix_db_agency#.pSchedules WHERE Emp_ID=e.Emp_ID AND Visit_Date = '#VARIABLES.date#') < e.WednesdayMaxVisit ) OR (WednesdayMaxVisit is null) OR (WednesdayMaxVisit='0') ) order by PreferenceCount desc,Emp_Last asc select Distinct Emp_ID, concat(Emp_First,' ',Emp_Last) as Emp_Last, (select count(*) from #Request.prefix_db_agency#.preferedpatient where Patient_ID= '#Session.Patient.PatientIDValue#' and EmployeeID=Emp_ID) as PreferenceCount, ( SELECT EmployeeWorkschedule_ID FROM #Request.prefix_db_agency#.Employee_Workschedule WHERE ScheduleType='available' and ScheduleDate='#VARIABLES.date#' and (str_to_date('#STime#','%H:%i') between str_to_date(ScheduleStart,'%H:%i') and str_to_date(ScheduleEnd,'%H:%i')) and (str_to_date('#ETime#','%H:%i') between str_to_date(ScheduleStart,'%H:%i') and str_to_date(ScheduleEnd,'%H:%i')) limit 1 ) as EmployeeWorkschedule_ID from #Request.prefix_db_lookup#.pEmployee e where ( (Loc_ID='#Session.AgencyID#') and ( ( SELECT count(1) FROM #Request.prefix_db_agency#.Employee_Workschedule WHERE ScheduleType='available' and ScheduleDate='#VARIABLES.date#' and (str_to_date('#STime#','%H:%i') between str_to_date(ScheduleStart,'%H:%i') and str_to_date(ScheduleEnd,'%H:%i')) and (str_to_date('#ETime#','%H:%i') between str_to_date(ScheduleStart,'%H:%i') and str_to_date(ScheduleEnd,'%H:%i')) and Emp_ID=e.Emp_ID ) >0) AND status = 0 AND (Emp_Type != 'Physician') ) and ( ((select count(*) from #Request.prefix_db_agency#.pSchedules WHERE Emp_ID=e.Emp_ID AND Visit_Date = '#VARIABLES.date#') < e.ThursdayMaxVisit ) OR (ThursdayMaxVisit is null) OR (ThursdayMaxVisit='0') ) order by PreferenceCount desc,Emp_Last asc select Distinct Emp_ID, concat(Emp_First,' ',Emp_Last) as Emp_Last, (select count(*) from #Request.prefix_db_agency#.preferedpatient where Patient_ID= '#Session.Patient.PatientIDValue#' and EmployeeID=Emp_ID) as PreferenceCount, ( SELECT EmployeeWorkschedule_ID FROM #Request.prefix_db_agency#.Employee_Workschedule WHERE ScheduleType='available' and ScheduleDate='#VARIABLES.date#' and (str_to_date('#STime#','%H:%i') between str_to_date(ScheduleStart,'%H:%i') and str_to_date(ScheduleEnd,'%H:%i')) and (str_to_date('#ETime#','%H:%i') between str_to_date(ScheduleStart,'%H:%i') and str_to_date(ScheduleEnd,'%H:%i'))limit 1 ) as EmployeeWorkschedule_ID from #Request.prefix_db_lookup#.pEmployee e where ( (Loc_ID='#Session.AgencyID#') and ( ( SELECT count(1) FROM #Request.prefix_db_agency#.Employee_Workschedule WHERE ScheduleType='available' and ScheduleDate='#VARIABLES.date#' and (str_to_date('#STime#','%H:%i') between str_to_date(ScheduleStart,'%H:%i') and str_to_date(ScheduleEnd,'%H:%i')) and (str_to_date('#ETime#','%H:%i') between str_to_date(ScheduleStart,'%H:%i') and str_to_date(ScheduleEnd,'%H:%i')) and Emp_ID=e.Emp_ID ) >0) AND status = 0 AND (Emp_Type != 'Physician') ) and ( ((select count(*) from #Request.prefix_db_agency#.pSchedules WHERE Emp_ID=e.Emp_ID AND Visit_Date = '#VARIABLES.date#') < e.FridayMaxVisit) OR (FridayMaxVisit is null) OR (FridayMaxVisit='0') ) order by PreferenceCount desc,Emp_Last asc select Distinct Emp_ID, concat(Emp_First,' ',Emp_Last) as Emp_Last, (select count(*) from #Request.prefix_db_agency#.preferedpatient where Patient_ID= '#Session.Patient.PatientIDValue#' and EmployeeID=Emp_ID) as PreferenceCount, ( SELECT EmployeeWorkschedule_ID FROM #Request.prefix_db_agency#.Employee_Workschedule WHERE ScheduleType='available' and ScheduleDate='#VARIABLES.date#' and (str_to_date('#STime#','%H:%i') between str_to_date(ScheduleStart,'%H:%i') and str_to_date(ScheduleEnd,'%H:%i')) and (str_to_date('#ETime#','%H:%i') between str_to_date(ScheduleStart,'%H:%i') and str_to_date(ScheduleEnd,'%H:%i'))limit 1) as EmployeeWorkschedule_ID from #Request.prefix_db_lookup#.pEmployee e where ( (Loc_ID='#Session.AgencyID#') and ( ( SELECT count(1) FROM #Request.prefix_db_agency#.Employee_Workschedule WHERE ScheduleType='available' and ScheduleDate='#VARIABLES.date#' and (str_to_date('#STime#','%H:%i') between str_to_date(ScheduleStart,'%H:%i') and str_to_date(ScheduleEnd,'%H:%i')) and (str_to_date('#ETime#','%H:%i') between str_to_date(ScheduleStart,'%H:%i') and str_to_date(ScheduleEnd,'%H:%i')) and Emp_ID=e.Emp_ID ) >0) AND status = 0 AND (Emp_Type != 'Physician') ) ) and ( ( (select count(*) from #Request.prefix_db_agency#.pSchedules WHERE Emp_ID=e.Emp_ID AND Visit_Date= '#VARIABLES.date#') < e.SaturdayMaxVisit ) OR (SaturdayMaxVisit is null) OR (SaturdayMaxVisit='0') ) order by PreferenceCount desc,Emp_Last asc select count(*) as Count from #Request.prefix_db_agency#.pSchedules where str_to_date('#STime#','%H:%i') between str_to_date(StartTime,'%H:%i') and str_to_date(EnDTime,'%H:%i') AND str_to_date('#ETime#','%H:%i') between str_to_date(StartTime,'%H:%i') and str_to_date(EnDTime,'%H:%i') AND Emp_ID='#Session.EmployeeID#' AND Visit_Date = '#VARIABLES.date#';
      Exact Match
    • #divdateform.Emp_Last#
    Closed Match
    SELECT case when Pt_Longitude is not null then Pt_Longitude else 0 end as LATITUDE,case when Pt_Longitude is not null then Pt_Longitude else 0 end as LONGITUDE,(SELECT DAYOFWEEK('#date1#')) as DAYOFDATE FROM #Request.prefix_db_agency#.pPatients WHERE PATIENT_ID='#Session.Patient.PatientIDValue#' select Distinct Emp_ID, concat(Emp_First,' ',Emp_Last) as Emp_Last, (select count(*) from #Request.prefix_db_agency#.preferedpatient where Patient_ID='#Session.Patient.PatientIDValue#' and EmployeeID=Emp_ID) as PreferenceCount, ( SELECT EmployeeWorkschedule_ID FROM #Request.prefix_db_agency#.Employee_Workschedule WHERE ScheduleType='available' and ScheduleDate='#VARIABLES.date#' and (str_to_date('#STime#','%H:%i') between str_to_date(ScheduleStart,'%H:%i') and str_to_date(ScheduleEnd,'%H:%i')) and (str_to_date('#ETime#','%H:%i') between str_to_date(ScheduleStart,'%H:%i') and str_to_date(ScheduleEnd,'%H:%i')) limit 1 ) as EmployeeWorkschedule_ID from #Request.prefix_db_lookup#.pEmployee e where ( (Loc_ID ='#Session.AgencyID#') and (( SELECT count(1) FROM #Request.prefix_db_agency#.Employee_Workschedule WHERE ScheduleType='available' and ScheduleDate='#VARIABLES.date#' and Emp_ID=e.Emp_ID ) >0) and (Status = '0') and (Emp_Type<>'Physician')) and ((select count(*) from #Request.prefix_db_agency#.pSchedules WHERE Emp_ID=e.Emp_ID AND Visit_Date= '#VARIABLES.date#')>e.SundayMaxVisit ) and ((select count(*) from #Request.prefix_db_agency#.pSchedules WHERE Emp_ID=e.Emp_ID AND Visit_Date= '#VARIABLES.date#')<=e.SundayMaxVisit+2 ) order by PreferenceCount desc,Emp_Last asc select Distinct Emp_ID, concat(Emp_First,' ',Emp_Last) as Emp_Last, (select count(*) from #Request.prefix_db_agency#.preferedpatient where Patient_ID= '#Session.Patient.PatientIDValue#' and EmployeeID=Emp_ID) as PreferenceCount, ( SELECT EmployeeWorkschedule_ID FROM #Request.prefix_db_agency#.Employee_Workschedule WHERE ScheduleType='available' and ScheduleDate='#VARIABLES.date#' and (str_to_date('#STime#','%H:%i') between str_to_date(ScheduleStart,'%H:%i') and str_to_date(ScheduleEnd,'%H:%i')) and (str_to_date('#ETime#','%H:%i') between str_to_date(ScheduleStart,'%H:%i') and str_to_date(ScheduleEnd,'%H:%i'))limit 1 ) as EmployeeWorkschedule_ID from #Request.prefix_db_lookup#.pEmployee e where ( (Loc_ID='#Session.AgencyID#') and (( SELECT count(1) FROM #Request.prefix_db_agency#.Employee_Workschedule WHERE ScheduleType='available' and ScheduleDate='#VARIABLES.date#' and Emp_ID=e.Emp_ID ) >0) and (Status = '0') and (Emp_Type<>'Physician') ) and ((select count(*) from #Request.prefix_db_agency#.pSchedules WHERE Emp_ID=e.Emp_ID AND Visit_Date = '#VARIABLES.date#')>e.MondayMaxVisit ) and ((select count(*) from #Request.prefix_db_agency#.pSchedules WHERE Emp_ID=e.Emp_ID AND Visit_Date = '#VARIABLES.date#')<= e.MondayMaxVisit+2 ) order by PreferenceCount desc,Emp_Last asc select Distinct Emp_ID, concat(Emp_First,' ',Emp_Last) as Emp_Last, (select count(*) from #Request.prefix_db_agency#.preferedpatient where Patient_ID= '#Session.Patient.PatientIDValue#' and EmployeeID=Emp_ID) as PreferenceCount, ( SELECT EmployeeWorkschedule_ID FROM #Request.prefix_db_agency#.Employee_Workschedule WHERE ScheduleType='available' and ScheduleDate='#VARIABLES.date#' and (str_to_date('#STime#','%H:%i') between str_to_date(ScheduleStart,'%H:%i') and str_to_date(ScheduleEnd,'%H:%i')) and (str_to_date('#ETime#','%H:%i') between str_to_date(ScheduleStart,'%H:%i') and str_to_date(ScheduleEnd,'%H:%i'))limit 1 ) as EmployeeWorkschedule_ID from #Request.prefix_db_lookup#.pEmployee e where ( (Loc_id='#Session.AgencyID#') and ( ( SELECT count(1) FROM #Request.prefix_db_agency#.Employee_Workschedule WHERE ScheduleType='available' and ScheduleDate='#VARIABLES.date#' and Emp_ID=e.Emp_ID ) >0) and (Status = '0') and (Emp_Type<>'Physician') ) and ((select count(*) from #Request.prefix_db_agency#.pSchedules WHERE Emp_ID=e.Emp_ID AND Visit_Date= '#VARIABLES.date#')>e.TuesdayMaxVisit ) and ((select count(*) from #Request.prefix_db_agency#.pSchedules WHERE Emp_ID=e.Emp_ID AND Visit_Date = '#VARIABLES.date#')<=e.TuesdayMaxVisit+2) order by PreferenceCount desc,Emp_Last asc select Distinct Emp_ID, concat(Emp_First,' ',Emp_Last) as Emp_Last, (select count(*) from #Request.prefix_db_agency#.preferedpatient where Patient_ID= '#Session.Patient.PatientIDValue#' and EmployeeID=Emp_ID) as PreferenceCount, ( SELECT EmployeeWorkschedule_ID FROM #Request.prefix_db_agency#.Employee_Workschedule WHERE ScheduleType='available' and ScheduleDate='#VARIABLES.date#' and (str_to_date('#STime#','%H:%i') between str_to_date(ScheduleStart,'%H:%i') and str_to_date(ScheduleEnd,'%H:%i')) and (str_to_date('#ETime#','%H:%i') between str_to_date(ScheduleStart,'%H:%i') and str_to_date(ScheduleEnd,'%H:%i')) limit 1 ) as EmployeeWorkschedule_ID from #Request.prefix_db_lookup#.pEmployee e where ( (Loc_ID='#Session.AgencyID#') and ( ( SELECT count(1) FROM #Request.prefix_db_agency#.Employee_Workschedule WHERE ScheduleType='available' and ScheduleDate='#VARIABLES.date#' and Emp_ID=e.Emp_ID ) >0) and (Status = 'Active') and (Emp_Type<>'Physician')) and ((select count(*) from #Request.prefix_db_agency#.pSchedules WHERE Emp_ID=e.Emp_ID AND Visit_Date= '#VARIABLES.date#')>e.WednesdayMaxVisit ) and ((select count(*) from #Request.prefix_db_agency#.pSchedules WHERE Emp_ID=e.Emp_ID AND Visit_Date = '#VARIABLES.date#')<=e.WednesdayMaxVisit+2) order by PreferenceCount desc,Emp_Last asc select Distinct Emp_ID, concat(Emp_First,' ',Emp_Last) as Emp_Last, (select count(*) from #Request.prefix_db_agency#.preferedpatient where Patient_ID= '#Session.Patient.PatientIDValue#' and EmployeeID=Emp_ID) as PreferenceCount, ( SELECT EmployeeWorkschedule_ID FROM #Request.prefix_db_agency#.Employee_Workschedule WHERE ScheduleType='available' and ScheduleDate='#VARIABLES.date#' and (str_to_date('#STime#','%H:%i') between str_to_date(ScheduleStart,'%H:%i') and str_to_date(ScheduleEnd,'%H:%i')) and (str_to_date('#ETime#','%H:%i') between str_to_date(ScheduleStart,'%H:%i') and str_to_date(ScheduleEnd,'%H:%i'))limit 1 ) as EmployeeWorkschedule_ID from #Request.prefix_db_lookup#.pEmployee e where ( (Loc_Id='#Session.AgencyID#') and ( ( SELECT count(1) FROM #Request.prefix_db_agency#.Employee_Workschedule WHERE ScheduleType='available' and ScheduleDate='#VARIABLES.date#' and Emp_ID=e.Emp_ID ) >0) and (Status = '0') and (Emp_Type<>'Physician') ) and ((select count(*) from #Request.prefix_db_agency#.pSchedules WHERE Emp_ID=e.Emp_ID AND Visit_Date = '#VARIABLES.date#')>e.ThursdayMaxVisit ) and ((select count(*) from #Request.prefix_db_agency#.pSchedules WHERE Emp_ID=e.Emp_ID AND Visit_Date = '#VARIABLES.date#')<=e.ThursdayMaxVisit+2) order by PreferenceCount desc,Emp_Last asc select Distinct Emp_ID, concat(Emp_First,' ',Emp_Last) as Emp_Last, (select count(*) from #Request.prefix_db_agency#.preferedpatient where Patient_ID= '#Session.Patient.PatientIDValue#' and EmployeeID=Emp_ID) as PreferenceCount, ( SELECT EmployeeWorkschedule_ID FROM #Request.prefix_db_agency#.Employee_Workschedule WHERE ScheduleType='available' and ScheduleDate='#VARIABLES.date#' and (str_to_date('#STime#','%H:%i') between str_to_date(ScheduleStart,'%H:%i') and str_to_date(ScheduleEnd,'%H:%i')) and (str_to_date('#ETime#','%H:%i') between str_to_date(ScheduleStart,'%H:%i') and str_to_date(ScheduleEnd,'%H:%i'))limit 1 ) as EmployeeWorkschedule_ID from #Request.prefix_db_lookup#.pEmployee e where ( (Loc_ID='#Session.AgencyID#') and (( SELECT count(1) FROM #Request.prefix_db_agency#.Employee_Workschedule WHERE ScheduleType='available' and ScheduleDate='#VARIABLES.date#' and Emp_ID=e.Emp_ID ) >0) and (Status = '0') and (Emp_Type<>'Physician') ) and ((select count(*) from #Request.prefix_db_agency#.pSchedules WHERE Emp_ID=e.Emp_ID AND Visit_Date= '#VARIABLES.date#')>e.FridayMaxVisit) and ((select count(*) from #Request.prefix_db_agency#.pSchedules WHERE Emp_ID=e.Emp_ID AND Visit_Date = '#VARIABLES.date#')<=e.FridayMaxVisit+2) order by PreferenceCount desc,Emp_Last asc select Emp_ID, concat(Emp_First,' ',Emp_Last) as Emp_Last, (select count(*) from #Request.prefix_db_agency#.preferedpatient where Patient_ID= '#Session.Patient.PatientIDValue#' and EmployeeID=Emp_ID) as PreferenceCount, ( SELECT EmployeeWorkschedule_ID FROM #Request.prefix_db_agency#.Employee_Workschedule WHERE ScheduleType='available' and ScheduleDate='#VARIABLES.date#' and (str_to_date('#STime#','%H:%i') between str_to_date(ScheduleStart,'%H:%i') and str_to_date(ScheduleEnd,'%H:%i')) and (str_to_date('#ETime#','%H:%i') between str_to_date(ScheduleStart,'%H:%i') and str_to_date(ScheduleEnd,'%H:%i'))limit 1 ) as EmployeeWorkschedule_ID from #Request.prefix_db_lookup#.Employee e where ( (Loc_Id='#Session.AgencyID#') and ( ( SELECT count(1) FROM #Request.prefix_db_agency#.Employee_Workschedule WHERE ScheduleType='available' and ScheduleDate='#VARIABLES.date#' and Emp_ID=e.Emp_ID ) >0) and (Status = '0') and (Emp_Type<>'Physician') ) and ((select count(*) from #Request.prefix_db_agency#.pSchedules WHERE Emp_ID=e.Emp_ID AND Visit_Date = '#VARIABLES.date#')>e.SaturdayMaxVisit) and ((select count(*) from #Request.prefix_db_agency#.pSchedules WHERE Emp_ID=e.Emp_ID AND Visit_Date = '#VARIABLES.date#')<= e.SaturdayMaxVisit+2) order by PreferenceCount desc,Emp_Last asc
    • #getclosematch.Emp_Last#

Previous #Pages# #Pages# Next
select count(*) as count from #Request.prefix_db_agency#.pAuths where Auth_ID = (select Auth_ID from #Request.prefix_db_agency#.pAuths where Patient_ID ='#GetPatient.Patient_Id#' and Rev_ID='#revenuelist.Payer_ID#' AND Status = '0' order by Auth_ID desc limit 1) ; select * FROM #Request.prefix_db_agency#.pAuths a, #Request.prefix_db_lookup#.pRevenue_Code r where a.Rev_ID='#Revcodeid#' and a.Rev_ID = r.Rev_CodeID and a.Patient_ID ='#GetPatient.Patient_Id#' -- and a.PtPayer_ID='#revenuelist.Payer_ID#' AND a.status = 0
Authorized Visits

#GetAuthI.Total_Visits# Visits starting #DateFormat(GetAuthI.Date_Start,"mm/dd/yyyy")# ending #DateFormat(GetAuthI.Date_End,"mm/dd/yyyy")#

Authorized Visits not Scheduled

#Getcount.count#

   Select the dates to schedule visits, by checking them on the calendar below.

select Auth_ID,Date_Start AS StartDate,Date_End AS EndDate from #Request.prefix_db_agency#.pAuths where Rev_ID='#Revcodeid#' and Patient_ID ='#GetPatient.Patient_Id#' and PtPayer_ID='#revenuelist.Payer_ID#' AND Status = 0 order by Auth_ID desc limit 1