From 31dc32c657a6ad3f34d3e162cc0fb7d23a5a3d87 Mon Sep 17 00:00:00 2001 From: tmccormi Date: Wed, 7 Nov 2012 21:39:46 -0800 Subject: [PATCH] Past Appointment Widget, Configurable in Globals Features --- interface/patient_file/summary/demographics.php | 160 ++++++++++++++++-------- library/globals.inc.php | 7 ++ 2 files changed, 115 insertions(+), 52 deletions(-) diff --git a/interface/patient_file/summary/demographics.php b/interface/patient_file/summary/demographics.php index 9b1d42ece..abb2188b3 100644 --- a/interface/patient_file/summary/demographics.php +++ b/interface/patient_file/summary/demographics.php @@ -1174,7 +1174,7 @@ expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel, if (isset($pid) && !$GLOBALS['disable_calendar']) { $query = "SELECT e.pc_eid, e.pc_aid, e.pc_title, e.pc_eventDate, " . "e.pc_startTime, e.pc_hometext, u.fname, u.lname, u.mname, " . - "c.pc_catname " . + "c.pc_catname, e.pc_apptstatus " . "FROM openemr_postcalendar_events AS e, users AS u, " . "openemr_postcalendar_categories AS c WHERE " . "e.pc_pid = ? AND e.pc_eventDate >= CURRENT_DATE AND " . @@ -1182,61 +1182,117 @@ expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel, "ORDER BY e.pc_eventDate, e.pc_startTime"; $res = sqlStatement($query, array($pid) ); - if ( (acl_check('patients', 'med')) && ($GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_crw']) ) { - // clinical summary expand collapse widget - $widgetTitle = xl("Clinical Reminders"); - $widgetLabel = "clinical_reminders"; - $widgetButtonLabel = xl("Edit"); - $widgetButtonLink = "../reminder/clinical_reminders.php?patient_id=".$pid;; - $widgetButtonClass = ""; - $linkMethod = "html"; - $bodyClass = "summary_item small"; - $widgetAuth = true; - $fixedWidth = false; - expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth); - echo "
"; - echo "

"; - echo ""; + if ( (acl_check('patients', 'med')) && ($GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_crw']) ) { + // clinical summary expand collapse widget + $widgetTitle = xl("Clinical Reminders"); + $widgetLabel = "clinical_reminders"; + $widgetButtonLabel = xl("Edit"); + $widgetButtonLink = "../reminder/clinical_reminders.php?patient_id=".$pid;; + $widgetButtonClass = ""; + $linkMethod = "html"; + $bodyClass = "summary_item small"; + $widgetAuth = true; + $fixedWidth = false; + expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth); + echo "
"; + echo "

"; + echo ""; } // end if crw // appointments expand collapse widget - $widgetTitle = xl("Appointments"); - $widgetLabel = "appointments"; - $widgetButtonLabel = xl("Add"); - $widgetButtonLink = "return newEvt();"; - $widgetButtonClass = ""; - $linkMethod = "javascript"; - $bodyClass = "summary_item small"; - $widgetAuth = (isset($res) && $res != null); - $fixedWidth = false; - expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth); + $widgetTitle = xl("Appointments"); + $widgetLabel = "appointments"; + $widgetButtonLabel = xl("Add"); + $widgetButtonLink = "return newEvt();"; + $widgetButtonClass = ""; + $linkMethod = "javascript"; + $bodyClass = "summary_item small"; + $widgetAuth = (isset($res) && $res != null); + $fixedWidth = false; + expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth); + $count = 0; + while($row = sqlFetchArray($res)) { + $count++; + $dayname = date("l", strtotime($row['pc_eventDate'])); + $dispampm = "am"; + $disphour = substr($row['pc_startTime'], 0, 2) + 0; + $dispmin = substr($row['pc_startTime'], 3, 2); + if ($disphour >= 12) { + $dispampm = "pm"; + if ($disphour > 12) $disphour -= 12; + } + $etitle = xl('(Click to edit)'); + if ($row['pc_hometext'] != "") { + $etitle = xl('Comments').": ".($row['pc_hometext'])."\r\n".$etitle; + } + echo ""; + echo "" . htmlspecialchars(xl($dayname) . ", " . $row['pc_eventDate'],ENT_NOQUOTES) . "" . xlt("Status") . "("; + echo " " . generate_display_field(array('data_type'=>'1','list_id'=>'apptstat'),$row['pc_apptstatus']) . ")
"; // can't use special char parser on this + echo htmlspecialchars("$disphour:$dispmin " . xl($dispampm) . " " . xl_appt_category($row['pc_catname']),ENT_NOQUOTES) . "
\n"; + echo htmlspecialchars($row['fname'] . " " . $row['lname'],ENT_NOQUOTES) . "

\n"; + } + if (isset($res) && $res != null) { + if ( $count < 1 ) { + echo "  " . htmlspecialchars(xl('None'),ENT_NOQUOTES); + } + echo ""; + } + } + + // Show PAST appointments. + if (isset($pid) && !$GLOBALS['disable_calendar'] && $GLOBALS['num_past_appointments_to_show'] > 0) { + $query = "SELECT e.pc_eid, e.pc_aid, e.pc_title, e.pc_eventDate, " . + "e.pc_startTime, e.pc_hometext, u.fname, u.lname, u.mname, " . + "c.pc_catname, e.pc_apptstatus " . + "FROM openemr_postcalendar_events AS e, users AS u, " . + "openemr_postcalendar_categories AS c WHERE " . + "e.pc_pid = ? AND e.pc_eventDate < CURRENT_DATE AND " . + "u.id = e.pc_aid AND e.pc_catid = c.pc_catid " . + "ORDER BY e.pc_eventDate, e.pc_startTime DESC " . + "LIMIT " . $GLOBALS['num_past_appointments_to_show']; + + $pres = sqlStatement($query, array($pid) ); - $count = 0; - while($row = sqlFetchArray($res)) { - $count++; - $dayname = date("l", strtotime($row['pc_eventDate'])); - $dispampm = "am"; - $disphour = substr($row['pc_startTime'], 0, 2) + 0; - $dispmin = substr($row['pc_startTime'], 3, 2); - if ($disphour >= 12) { - $dispampm = "pm"; - if ($disphour > 12) $disphour -= 12; - } - $etitle = xl('(Click to edit)'); - if ($row['pc_hometext'] != "") { - $etitle = xl('Comments').": ".($row['pc_hometext'])."\r\n".$etitle; - } - echo ""; - echo "" . htmlspecialchars(xl($dayname) . ", " . $row['pc_eventDate'],ENT_NOQUOTES) . "
"; - echo htmlspecialchars("$disphour:$dispmin " . xl($dispampm) . " " . xl_appt_category($row['pc_catname']),ENT_NOQUOTES) . "
\n"; - echo htmlspecialchars($row['fname'] . " " . $row['lname'],ENT_NOQUOTES) . "

\n"; - } - if (isset($res) && $res != null) { - if ( $count < 1 ) { echo "  " . htmlspecialchars(xl('None'),ENT_NOQUOTES); } - echo ""; - } - } + // appointments expand collapse widget + $widgetTitle = xl("Past Appoinments"); + $widgetLabel = "past_appointments"; + $widgetButtonLabel = ''; + $widgetButtonLink = ''; + $widgetButtonClass = ''; + $linkMethod = "javascript"; + $bodyClass = "summary_item small"; + $widgetAuth = false; //no button + $fixedWidth = false; + expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth); + $count = 0; + while($row = sqlFetchArray($pres)) { + $count++; + $dayname = date("l", strtotime($row['pc_eventDate'])); + $dispampm = "am"; + $disphour = substr($row['pc_startTime'], 0, 2) + 0; + $dispmin = substr($row['pc_startTime'], 3, 2); + if ($disphour >= 12) { + $dispampm = "pm"; + if ($disphour > 12) $disphour -= 12; + } + if ($row['pc_hometext'] != "") { + $etitle = xl('Comments').": ".($row['pc_hometext'])."\r\n".$etitle; + } + echo ""; + echo "" . htmlspecialchars(xl($dayname) . ", " . $row['pc_eventDate'],ENT_NOQUOTES) . "" . xlt("Status") . "("; + echo " " . generate_display_field(array('data_type'=>'1','list_id'=>'apptstat'),$row['pc_apptstatus']) . ")
"; // can't use special char parser on this + echo htmlspecialchars("$disphour:$dispmin ") . xl($dispampm) . " "; + echo htmlspecialchars($row['fname'] . " " . $row['lname'],ENT_NOQUOTES) . "

\n"; + } + if (isset($pres) && $res != null) { + if ( $count < 1 ) { + echo "  " . htmlspecialchars(xl('None'),ENT_NOQUOTES); + } + echo ""; + } + } +// END of past appointments + ?> diff --git a/library/globals.inc.php b/library/globals.inc.php index 40c6a9724..0e198ac16 100644 --- a/library/globals.inc.php +++ b/library/globals.inc.php @@ -595,6 +595,13 @@ $GLOBALS_METADATA = array( '0', // default = false xl('This will force the Billing Widget in the Patient Summary screen to always be open.') ), + + 'num_past_appointments_to_show' => array( + xl('Past Appointment Display Widget'), + 'num', // data type + '0', // default = false + xl('A positive number will show that many past appointments on a Widget in the Patient Summary screen.') + ), 'activate_ccr_ccd_report' => array( xl('Activate CCR/CCD Reporting'), -- 2.11.4.GIT