From 08a8c597487514a8cc05aaba7609e0bbd7b26b0f Mon Sep 17 00:00:00 2001 From: Kevin Yeh Date: Thu, 14 Feb 2013 15:43:08 -0500 Subject: [PATCH] Filter appointment report by category --- interface/reports/appointments_report.php | 33 +++++++++++++++++++++++++++---- library/appointments.inc.php | 15 ++++++++++++-- 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/interface/reports/appointments_report.php b/interface/reports/appointments_report.php index 2a26cc47e..76b47f57e 100644 --- a/interface/reports/appointments_report.php +++ b/interface/reports/appointments_report.php @@ -189,7 +189,24 @@ $form_orderby = getComparisonOrder( $_REQUEST['form_orderby'] ) ? $_REQUEST['fo : 1,'field_id'=>'apptstatus','list_id'=>'apptstat','empty_title'=>'All'),$_POST['form_apptstatus']);?> -   + + + + @@ -274,8 +291,16 @@ if ($_POST['form_refresh'] || $_POST['form_orderby']) { $lastdocname = ""; //Appointment Status Checking - $form_apptstatus = $_POST['form_apptstatus']; - + $form_apptstatus = $_POST['form_apptstatus']; + $form_apptcat=null; + if(isset($_POST['form_apptcat'])) + { + if($form_apptcat!="ALL") + { + $form_apptcat=intval($_POST['form_apptcat']); + } + } + //Without provider and facility data checking $with_out_provider = null; $with_out_facility = null; @@ -287,7 +312,7 @@ if ($_POST['form_refresh'] || $_POST['form_orderby']) { if( isset($_POST['with_out_facility']) ){ $with_out_facility = $_POST['with_out_facility']; } - $appointments = fetchAppointments( $from_date, $to_date, $patient, $provider, $facility, $form_apptstatus, $with_out_provider, $with_out_facility ); + $appointments = fetchAppointments( $from_date, $to_date, $patient, $provider, $facility, $form_apptstatus, $with_out_provider, $with_out_facility,$form_apptcat ); if ( $show_available_times ) { $availableSlots = getAvailableSlots( $from_date, $to_date, $provider, $facility ); diff --git a/library/appointments.inc.php b/library/appointments.inc.php index 0124c09bf..0bb2cd6cd 100644 --- a/library/appointments.inc.php +++ b/library/appointments.inc.php @@ -92,7 +92,7 @@ function fetchAllEvents( $from_date, $to_date, $provider_id = null, $facility_id return $appointments; } -function fetchAppointments( $from_date, $to_date, $patient_id = null, $provider_id = null, $facility_id = null, $pc_appstatus = null, $with_out_provider = null, $with_out_facility = null ) +function fetchAppointments( $from_date, $to_date, $patient_id = null, $provider_id = null, $facility_id = null, $pc_appstatus = null, $with_out_provider = null, $with_out_facility = null, $pc_catid = null ) { $where = ""; if ( $provider_id ) $where .= " AND e.pc_aid = '$provider_id'"; @@ -117,7 +117,12 @@ function fetchAppointments( $from_date, $to_date, $patient_id = null, $provider_ $filter_appstatus = " AND e.pc_apptstatus = '".$pc_appstatus."'"; } $where .= $filter_appstatus; - + + if($pc_catid !=null) + { + $where .= " AND e.pc_catid=".intval($pc_catid); // using intval to escape this parameter + } + //Without Provider checking $filter_woprovider = ''; if($with_out_provider != ''){ @@ -437,4 +442,10 @@ function compareAppointmentsByStatus( $appointment1, $appointment2 ) return compareBasic( $status1, $status2 ); } +function fetchAppointmentCategories() +{ + $catSQL= " SELECT pc_catid as id, pc_catname as category " + . " FROM openemr_postcalendar_categories WHERE pc_recurrtype=0 and pc_cattype=0 ORDER BY category"; + return sqlStatement($catSQL); +} ?> -- 2.11.4.GIT