Skip to content

Commit

Permalink
Recurring appointment Fixes, take 2.
Browse files Browse the repository at this point in the history
SUMMARY OF ISSUES DEALT WITH AND ADDITIONS -
-Appointment Report -
--Duplicate appointments -
For all recurring appointment dates that have been edited (e.g. change of status), two representations of these dates will appear in the report.
--Missing appointments -
All dates corresponding to recurring appointments set with options such as "2nd Tuesday" or "Last Friday" and on a date that is prior to the "From" date of the report will be missing from the report.
--Non existant and missing appointments -
This effects same type of appointment as in prior issue and locations with a positive UTC offset. If an appointment is set on a weekday that is the 4th occurance of that weekday and that weekday is the last weekday that has a 5th occurance, and the "Last <weekday>" option is selected, then a non existant appointment date will appear on  the report (with same date that the recurring appointment was set), also the first date of the series (first (or only) last <weekday>) will be missing (Calendar does not have this problem).
--Disageement with Calendar -
The output of the code that produces the report disagrees with the Calendar for some dates related to recurring appointments of same type as prior issue, set on 29th 30th or 31st of a month. The Calendar is getting some of these dates wrong, and the report does not.

-Patient Summary -
--Added support for recurring appointments.
--Appearance of appointments in Patient Summary -
2015-08-06 (Thu)
10:00 am o ( ? ) CMT
Established Patient
Dr Provider
"CMT" (green font) appears when there is a comment present, mousing over displays it.
  • Loading branch information
epsdky authored and bradymiller committed Aug 28, 2015
1 parent acd8b27 commit 6027823
Show file tree
Hide file tree
Showing 2 changed files with 211 additions and 160 deletions.
50 changes: 27 additions & 23 deletions interface/patient_file/summary/demographics.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
require_once("$srcdir/edi.inc");
require_once("$srcdir/invoice_summary.inc.php");
require_once("$srcdir/clinical_rules.php");

////////////
require_once(dirname(__FILE__)."/../../../library/appointments.inc.php");

if ($GLOBALS['concurrent_layout'] && isset($_GET['set_pid'])) {
include_once("$srcdir/pid.inc");
setpid($_GET['set_pid']);
Expand Down Expand Up @@ -163,9 +165,9 @@ function image_widget($doc_id,$doc_catg)
<script type="text/javascript" language="JavaScript">

var mypcc = '<?php echo htmlspecialchars($GLOBALS['phone_country_code'],ENT_QUOTES); ?>';

function oldEvt(eventid) {
dlgopen('../../main/calendar/add_edit_event.php?eid=' + eventid, '_blank', 550, 350);
//////////
function oldEvt(apptdate, eventid) {
dlgopen('../../main/calendar/add_edit_event.php?date=' + apptdate + '&eid=' + eventid, '_blank', 550, 350);
}

function advdirconfigure() {
Expand Down Expand Up @@ -1326,15 +1328,12 @@ function setMyPatient() {

// Show current and upcoming appointments.
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, 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";
$res = sqlStatement($query, array($pid) );
//
$current_date2 = date('Y-m-d');
$events = array();
$events = fetchAppointments($current_date2, null, $pid, null, null, null, null, null, null, null, true); //////
$events = sortAppointments($events);
//////

if ( (acl_check('patients', 'med')) && ($GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_crw']) ) {
// clinical summary expand collapse widget
Expand All @@ -1361,13 +1360,13 @@ function setMyPatient() {
$widgetButtonClass = "";
$linkMethod = "javascript";
$bodyClass = "summary_item small";
$widgetAuth = (isset($res) && $res != null);
$widgetAuth = $resNotNull; // $resNotNull refects state of query (appts) in fetchAppointments()
$fixedWidth = false;
expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
$count = 0;
while($row = sqlFetchArray($res)) {
foreach($events as $row) { //////
$count++;
$dayname = date("l", strtotime($row['pc_eventDate']));
$dayname = date("D", strtotime($row['pc_eventDate'])); //////
$dispampm = "am";
$disphour = substr($row['pc_startTime'], 0, 2) + 0;
$dispmin = substr($row['pc_startTime'], 3, 2);
Expand All @@ -1379,19 +1378,24 @@ function setMyPatient() {
if ($row['pc_hometext'] != "") {
$etitle = xl('Comments').": ".($row['pc_hometext'])."\r\n".$etitle;
}
echo "<a href='javascript:oldEvt(" . htmlspecialchars($row['pc_eid'],ENT_QUOTES) . ")' title='" . htmlspecialchars($etitle,ENT_QUOTES) . "'>";
echo "<b>" . htmlspecialchars(xl($dayname) . ", " . $row['pc_eventDate'],ENT_NOQUOTES) . "</b>" . xlt("Status") . "(";
echo " " . generate_display_field(array('data_type'=>'1','list_id'=>'apptstat'),$row['pc_apptstatus']) . ")<br>"; // can't use special char parser on this
echo htmlspecialchars("$disphour:$dispmin " . xl($dispampm) . " " . xl_appt_category($row['pc_catname']),ENT_NOQUOTES) . "<br>\n";
echo htmlspecialchars($row['fname'] . " " . $row['lname'],ENT_NOQUOTES) . "</a><br>\n";
////////////
echo "<a href='javascript:oldEvt(" . htmlspecialchars(preg_replace("/-/", "", $row['pc_eventDate']),ENT_QUOTES) . ', ' . htmlspecialchars($row['pc_eid'],ENT_QUOTES) . ")' title='" . htmlspecialchars($etitle,ENT_QUOTES) . "'>";
////////////
echo "<b>" . htmlspecialchars($row['pc_eventDate'] . " (" . xl($dayname),ENT_NOQUOTES) . ")</b><br>";
echo htmlspecialchars("$disphour:$dispmin " . xl($dispampm),ENT_NOQUOTES) . " ";
if ($row['pc_recurrtype']) echo "<img src='" . $GLOBALS['webroot'] . "/interface/main/calendar/modules/PostCalendar/pntemplates/default/images/repeating8.png' border='0' style='margin:0px 2px 0px 2px;' title='".htmlspecialchars(xl("Repeating event"),ENT_QUOTES)."' alt='".htmlspecialchars(xl("Repeating event"),ENT_QUOTES)."'>";
echo "<span title='" . generate_display_field(array('data_type'=>'1','list_id'=>'apptstat'),$row['pc_apptstatus']) . "'> ( " . htmlspecialchars($row['pc_apptstatus'],ENT_NOQUOTES) . " )</span>";
if ($row['pc_hometext']) echo "<font color='green'> CMT</font>";
echo "<br>" . htmlspecialchars(xl_appt_category($row['pc_catname']),ENT_NOQUOTES) . "<br>\n";
echo htmlspecialchars($row['ufname'] . " " . $row['ulname'],ENT_NOQUOTES) . "</a><br>\n";
}
if (isset($res) && $res != null) {
if ($resNotNull) { //////
if ( $count < 1 ) {
echo "&nbsp;&nbsp;" . htmlspecialchars(xl('None'),ENT_NOQUOTES);
}
echo "</div>";
}
}
}

// Show PAST appointments.
// added by Terry Hill to allow reverse sorting of the appointments
Expand Down
Loading

0 comments on commit 6027823

Please sign in to comment.