From 0fd4a35da5395ca30d7bbe72675b40eea6211027 Mon Sep 17 00:00:00 2001 From: Anil siva kumar N Date: Thu, 3 Jan 2013 15:48:00 +0530 Subject: [PATCH] New Selection criteria placed in Appointment report --- interface/reports/appointments_report.php | 72 +++++++++++++++++++++++++++---- library/appointments.inc.php | 39 +++++++++++++++-- 2 files changed, 99 insertions(+), 12 deletions(-) diff --git a/interface/reports/appointments_report.php b/interface/reports/appointments_report.php index 23bcb47d2..2a26cc47e 100644 --- a/interface/reports/appointments_report.php +++ b/interface/reports/appointments_report.php @@ -33,6 +33,17 @@ $show_available_times = false; if ( $_POST['form_show_available'] ) { $show_available_times = true; } + +$chk_with_out_provider = false; +if ( $_POST['with_out_provider'] ) { + $chk_with_out_provider = true; +} + +$chk_with_out_facility = false; +if ( $_POST['with_out_facility'] ) { + $chk_with_out_facility = true; +} + //$to_date = fixDate($_POST['form_to_date'], ''); $provider = $_POST['form_provider']; $facility = $_POST['form_facility']; //(CHEMED) facility filter @@ -174,6 +185,18 @@ $form_orderby = getComparisonOrder( $_REQUEST['form_orderby'] ) ? $_REQUEST['fo border='0' alt='[?]' style='cursor: pointer' title=''> + + + : + 1,'field_id'=>'apptstatus','list_id'=>'apptstat','empty_title'=>'All'),$_POST['form_apptstatus']);?> +   + + + + + + + @@ -235,6 +258,10 @@ if ($_POST['form_refresh'] || $_POST['form_orderby']) { > + + > + > @@ -244,9 +271,23 @@ if ($_POST['form_refresh'] || $_POST['form_orderby']) { @@ -280,11 +323,21 @@ if ($_POST['form_refresh'] || $_POST['form_orderby']) {   -   +   -   +   -   +   + +   +   @@ -297,6 +350,9 @@ if ($_POST['form_refresh'] || $_POST['form_orderby']) { // assign the session key with the $pid_list array - note array might be empty -- handle on the printed_fee_sheet.php page. $_SESSION['pidList'] = $pid_list; ?> + + + diff --git a/library/appointments.inc.php b/library/appointments.inc.php index 718c9bf99..edfc98d4b 100644 --- a/library/appointments.inc.php +++ b/library/appointments.inc.php @@ -16,7 +16,8 @@ $COMPARE_FUNCTION_HASH = array( 'date' => 'compareAppointmentsByDate', 'time' => 'compareAppointmentsByTime', 'type' => 'compareAppointmentsByType', - 'comment' => 'compareAppointmentsByComment' + 'comment' => 'compareAppointmentsByComment', + 'status' => 'compareAppointmentsByStatus' ); $ORDERHASH = array( @@ -26,7 +27,8 @@ $ORDERHASH = array( 'date' => array( 'date', 'time', 'type', 'patient' ), 'time' => array( 'time', 'date', 'patient' ), 'type' => array( 'type', 'date', 'time', 'patient' ), - 'comment' => array( 'comment', 'date', 'time', 'patient' ) + 'comment' => array( 'comment', 'date', 'time', 'patient' ), + 'status' => array( 'status', 'date', 'time', 'patient' ) ); function fetchEvents( $from_date, $to_date, $where_param = null, $orderby_param = null ) @@ -43,7 +45,7 @@ function fetchEvents( $from_date, $to_date, $where_param = null, $orderby_param $query = "SELECT " . "e.pc_eventDate, e.pc_endDate, e.pc_startTime, e.pc_endTime, e.pc_duration, e.pc_recurrtype, e.pc_recurrspec, e.pc_recurrfreq, e.pc_catid, e.pc_eid, " . - "e.pc_title, e.pc_hometext, " . + "e.pc_title, e.pc_hometext, e.pc_apptstatus, " . "p.fname, p.mname, p.lname, p.pid, p.pubpid, p.phone_home, p.phone_cell, " . "u.fname AS ufname, u.mname AS umname, u.lname AS ulname, u.id AS uprovider_id, " . "c.pc_catname, c.pc_catid " . @@ -90,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 ) +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 ) { $where = ""; if ( $provider_id ) $where .= " AND e.pc_aid = '$provider_id'"; @@ -108,6 +110,28 @@ function fetchAppointments( $from_date, $to_date, $patient_id = null, $provider_ } $where .= $facility_filter; + + //Appointment Status Checking + $filter_appstatus = ''; + if($pc_appstatus != ''){ + $filter_appstatus = " AND e.pc_apptstatus = '".$pc_appstatus."'"; + } + $where .= $filter_appstatus; + + //Without Provider checking + $filter_woprovider = ''; + if($with_out_provider != ''){ + $filter_woprovider = " AND e.pc_aid = ''"; + } + $where .= $filter_woprovider; + + //Without Facility checking + $filter_wofacility = ''; + if($with_out_facility != ''){ + $filter_wofacility = " AND e.pc_facility = 0"; + } + $where .= $filter_wofacility; + $appointments = fetchEvents( $from_date, $to_date, $where ); return $appointments; } @@ -370,4 +394,11 @@ function compareAppointmentsByComment( $appointment1, $appointment2 ) return compareBasic( $comment1, $comment2 ); } +function compareAppointmentsByStatus( $appointment1, $appointment2 ) +{ + $status1 = $appointment1['pc_apptstatus']; + $status2 = $appointment2['pc_apptstatus']; + return compareBasic( $status1, $status2 ); +} + ?> -- 2.11.4.GIT