Multiple improvements from IPPF related to layouts. (#1081)
[openemr.git] / interface / patient_file / summary / demographics.php
blob1ec3f6ff598983ce9c024ec1ea28b5479ed2ff31
1 <?php
2 /**
4 * Patient summary screen.
6 * @package OpenEMR
7 * @link http://www.open-emr.org
8 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @author Sharon Cohen <sharonco@matrix.co.il>
10 * @copyright Copyright (c) 2017 Brady Miller <brady.g.miller@gmail.com>
11 * @copyright Copyright (c) 2017 Sharon Cohen <sharonco@matrix.co.il>
12 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
16 require_once("../../globals.php");
17 require_once("$srcdir/patient.inc");
18 require_once("$srcdir/acl.inc");
19 require_once("$srcdir/options.inc.php");
20 require_once("../history/history.inc.php");
21 require_once("$srcdir/edi.inc");
22 require_once("$srcdir/invoice_summary.inc.php");
23 require_once("$srcdir/clinical_rules.php");
24 require_once("$srcdir/options.js.php");
25 require_once("$srcdir/group.inc");
26 require_once(dirname(__FILE__)."/../../../library/appointments.inc.php");
27 use OpenEMR\Reminder\BirthdayReminder;
29 if (isset($_GET['set_pid'])) {
30 include_once("$srcdir/pid.inc");
31 setpid($_GET['set_pid']);
34 $active_reminders = false;
35 $all_allergy_alerts = false;
36 if ($GLOBALS['enable_cdr']) {
37 //CDR Engine stuff
38 if ($GLOBALS['enable_allergy_check'] && $GLOBALS['enable_alert_log']) {
39 //Check for new allergies conflicts and throw popup if any exist(note need alert logging to support this)
40 $new_allergy_alerts = allergy_conflict($pid, 'new', $_SESSION['authUser']);
41 if (!empty($new_allergy_alerts)) {
42 $pop_warning = '<script type="text/javascript">alert(\'' . xls('WARNING - FOLLOWING ACTIVE MEDICATIONS ARE ALLERGIES') . ':\n';
43 foreach ($new_allergy_alerts as $new_allergy_alert) {
44 $pop_warning .= addslashes($new_allergy_alert) . '\n';
47 $pop_warning .= '\')</script>';
48 echo $pop_warning;
52 if ((!isset($_SESSION['alert_notify_pid']) || ($_SESSION['alert_notify_pid'] != $pid)) && isset($_GET['set_pid']) && $GLOBALS['enable_cdr_crp']) {
53 // showing a new patient, so check for active reminders and allergy conflicts, which use in active reminder popup
54 $active_reminders = active_alert_summary($pid, "reminders-due", '', 'default', $_SESSION['authUser'], true);
55 if ($GLOBALS['enable_allergy_check']) {
56 $all_allergy_alerts = allergy_conflict($pid, 'all', $_SESSION['authUser'], true);
61 function print_as_money($money)
63 preg_match("/(\d*)\.?(\d*)/", $money, $moneymatches);
64 $tmp = wordwrap(strrev($moneymatches[1]), 3, ",", 1);
65 $ccheck = strrev($tmp);
66 if ($ccheck[0] == ",") {
67 $tmp = substr($ccheck, 1, strlen($ccheck)-1);
70 if ($moneymatches[2] != "") {
71 return "$ " . strrev($tmp) . "." . $moneymatches[2];
72 } else {
73 return "$ " . strrev($tmp);
77 // get an array from Photos category
78 function pic_array($pid, $picture_directory)
80 $pics = array();
81 $sql_query = "select documents.id from documents join categories_to_documents " .
82 "on documents.id = categories_to_documents.document_id " .
83 "join categories on categories.id = categories_to_documents.category_id " .
84 "where categories.name like ? and documents.foreign_id = ?";
85 if ($query = sqlStatement($sql_query, array($picture_directory,$pid))) {
86 while ($results = sqlFetchArray($query)) {
87 array_push($pics, $results['id']);
91 return ($pics);
93 // Get the document ID of the first document in a specific catg.
94 function get_document_by_catg($pid, $doc_catg)
97 $result = array();
99 if ($pid and $doc_catg) {
100 $result = sqlQuery("SELECT d.id, d.date, d.url FROM " .
101 "documents AS d, categories_to_documents AS cd, categories AS c " .
102 "WHERE d.foreign_id = ? " .
103 "AND cd.document_id = d.id " .
104 "AND c.id = cd.category_id " .
105 "AND c.name LIKE ? " .
106 "ORDER BY d.date DESC LIMIT 1", array($pid, $doc_catg));
109 return($result['id']);
112 // Display image in 'widget style'
113 function image_widget($doc_id, $doc_catg)
115 global $pid, $web_root;
116 $docobj = new Document($doc_id);
117 $image_file = $docobj->get_url_file();
118 $image_width = $GLOBALS['generate_doc_thumb'] == 1 ? '' : 'width=100';
119 $extension = substr($image_file, strrpos($image_file, "."));
120 $viewable_types = array('.png','.jpg','.jpeg','.png','.bmp','.PNG','.JPG','.JPEG','.PNG','.BMP'); // image ext supported by fancybox viewer
121 if (in_array($extension, $viewable_types)) { // extention matches list
122 $to_url = "<td> <a href = $web_root" .
123 "/controller.php?document&retrieve&patient_id=$pid&document_id=$doc_id&as_file=false&original_file=true&disable_exit=false&show_original=true" .
124 "/tmp$extension" . // Force image type URL for fancybo
125 " onclick=top.restoreSession(); class='image_modal'>" .
126 " <img src = $web_root" .
127 "/controller.php?document&retrieve&patient_id=$pid&document_id=$doc_id&as_file=false" .
128 " $image_width alt='$doc_catg:$image_file'> </a> </td> <td valign='center'>".
129 htmlspecialchars($doc_catg) . '<br />&nbsp;' . htmlspecialchars($image_file) .
130 "</td>";
131 } else {
132 $to_url = "<td> <a href='" . $web_root . "/controller.php?document&retrieve" .
133 "&patient_id=$pid&document_id=$doc_id'" .
134 " onclick='top.restoreSession()' class='css_button_small'>" .
135 "<span>" .
136 htmlspecialchars(xl("View"), ENT_QUOTES)."</a> &nbsp;" .
137 htmlspecialchars("$doc_catg - $image_file", ENT_QUOTES) .
138 "</span> </td>";
141 echo "<table><tr>";
142 echo $to_url;
143 echo "</tr></table>";
146 // Determine if the Vitals form is in use for this site.
147 $tmp = sqlQuery("SELECT count(*) AS count FROM registry WHERE " .
148 "directory = 'vitals' AND state = 1");
149 $vitals_is_registered = $tmp['count'];
151 // Get patient/employer/insurance information.
153 $result = getPatientData($pid, "*, DATE_FORMAT(DOB,'%Y-%m-%d') as DOB_YMD");
154 $result2 = getEmployerData($pid);
155 $result3 = getInsuranceData($pid, "primary", "copay, provider, DATE_FORMAT(`date`,'%Y-%m-%d') as effdate");
156 $insco_name = "";
157 if ($result3['provider']) { // Use provider in case there is an ins record w/ unassigned insco
158 $insco_name = getInsuranceProvider($result3['provider']);
161 <html>
163 <head>
164 <?php html_header_show();?>
165 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
166 <link rel="stylesheet" type="text/css" href="../../../library/js/fancybox/jquery.fancybox-1.2.6.css" media="screen" />
167 <script type="text/javascript" src="../../../library/textformat.js?v=<?php echo $v_js_includes; ?>"></script>
168 <script type="text/javascript" src="../../../library/dialog.js?v=<?php echo $v_js_includes; ?>"></script>
169 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-7-2/index.js"></script>
170 <script type="text/javascript" src="../../../library/js/common.js?v=<?php echo $v_js_includes; ?>"></script>
171 <script type="text/javascript" src="../../../library/js/fancybox/jquery.fancybox-1.2.6.js"></script>
172 <script type="text/javascript" language="JavaScript">
174 var mypcc = '<?php echo htmlspecialchars($GLOBALS['phone_country_code'], ENT_QUOTES); ?>';
175 //////////
176 function oldEvt(apptdate, eventid) {
177 dlgopen('../../main/calendar/add_edit_event.php?date=' + apptdate + '&eid=' + eventid, '_blank', 775, 500);
180 function advdirconfigure() {
181 dlgopen('advancedirectives.php', '_blank', 400, 500);
184 function refreshme() {
185 top.restoreSession();
186 location.reload();
189 // Process click on Delete link.
190 function deleteme() {
191 dlgopen('../deleter.php?patient=<?php echo htmlspecialchars($pid, ENT_QUOTES); ?>', '_blank', 500, 450);
192 return false;
195 // Called by the deleteme.php window on a successful delete.
196 function imdeleted() {
197 <?php if ($GLOBALS['new_tabs_layout']) { ?>
198 top.clearPatient();
199 <?php } else { ?>
200 parent.left_nav.clearPatient();
201 <?php } ?>
204 function newEvt() {
205 dlgopen('../../main/calendar/add_edit_event.php?patientid=<?php echo htmlspecialchars($pid, ENT_QUOTES); ?>', '_blank', 775, 500);
206 return false;
209 function sendimage(pid, what) {
210 // alert('Not yet implemented.'); return false;
211 dlgopen('../upload_dialog.php?patientid=' + pid + '&file=' + what,
212 '_blank', 500, 400);
213 return false;
216 </script>
218 <script type="text/javascript">
220 function toggleIndicator(target,div) {
222 $mode = $(target).find(".indicator").text();
223 if ( $mode == "<?php echo htmlspecialchars(xl('collapse'), ENT_QUOTES); ?>" ) {
224 $(target).find(".indicator").text( "<?php echo htmlspecialchars(xl('expand'), ENT_QUOTES); ?>" );
225 $("#"+div).hide();
226 $.post( "../../../library/ajax/user_settings.php", { target: div, mode: 0 });
227 } else {
228 $(target).find(".indicator").text( "<?php echo htmlspecialchars(xl('collapse'), ENT_QUOTES); ?>" );
229 $("#"+div).show();
230 $.post( "../../../library/ajax/user_settings.php", { target: div, mode: 1 });
234 $(document).ready(function(){
235 var msg_updation='';
236 <?php
237 if ($GLOBALS['erx_enable']) {
238 //$soap_status=sqlQuery("select soap_import_status from patient_data where pid=?",array($pid));
239 $soap_status=sqlStatement("select soap_import_status,pid from patient_data where pid=? and soap_import_status in ('1','3')", array($pid));
240 while ($row_soapstatus=sqlFetchArray($soap_status)) {
241 //if($soap_status['soap_import_status']=='1' || $soap_status['soap_import_status']=='3'){ ?>
242 top.restoreSession();
243 $.ajax({
244 type: "POST",
245 url: "../../soap_functions/soap_patientfullmedication.php",
246 dataType: "html",
247 data: {
248 patient:<?php echo $row_soapstatus['pid']; ?>,
250 async: false,
251 success: function(thedata){
252 //alert(thedata);
253 msg_updation+=thedata;
255 error:function(){
256 alert('ajax error');
259 <?php
261 //elseif($soap_status['soap_import_status']=='3'){ ?>
262 top.restoreSession();
263 $.ajax({
264 type: "POST",
265 url: "../../soap_functions/soap_allergy.php",
266 dataType: "html",
267 data: {
268 patient:<?php echo $row_soapstatus['pid']; ?>,
270 async: false,
271 success: function(thedata){
272 //alert(thedata);
273 msg_updation+=thedata;
275 error:function(){
276 alert('ajax error');
279 <?php
280 if ($GLOBALS['erx_import_status_message']) { ?>
281 if(msg_updation)
282 alert(msg_updation);
283 <?php
290 // load divs
291 $("#stats_div").load("stats.php", { 'embeddedScreen' : true }, function() {
292 // (note need to place javascript code here also to get the dynamic link to work)
293 $(".rx_modal").fancybox( {
294 'overlayOpacity' : 0.0,
295 'showCloseButton' : true,
296 'frameHeight' : 600,
297 'frameWidth' : 1200,
298 'centerOnScroll' : false,
299 'callbackOnClose' : function() {
300 refreshme();
304 $("#pnotes_ps_expand").load("pnotes_fragment.php");
305 $("#disclosures_ps_expand").load("disc_fragment.php");
307 <?php if ($GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_crw']) { ?>
308 top.restoreSession();
309 $("#clinical_reminders_ps_expand").load("clinical_reminders_fragment.php", { 'embeddedScreen' : true }, function() {
310 // (note need to place javascript code here also to get the dynamic link to work)
311 $(".medium_modal").fancybox( {
312 'overlayOpacity' : 0.0,
313 'showCloseButton' : true,
314 'frameHeight' : 500,
315 'frameWidth' : 800,
316 'centerOnScroll' : false,
317 'callbackOnClose' : function() {
318 refreshme();
322 <?php } // end crw?>
324 <?php if ($GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_prw']) { ?>
325 top.restoreSession();
326 $("#patient_reminders_ps_expand").load("patient_reminders_fragment.php");
327 <?php } // end prw?>
329 <?php if ($vitals_is_registered && acl_check('patients', 'med')) { ?>
330 // Initialize the Vitals form if it is registered and user is authorized.
331 $("#vitals_ps_expand").load("vitals_fragment.php");
332 <?php } ?>
334 // Initialize track_anything
335 $("#track_anything_ps_expand").load("track_anything_fragment.php");
338 // Initialize labdata
339 $("#labdata_ps_expand").load("labdata_fragment.php");
340 <?php
341 // Initialize for each applicable LBF form.
342 $gfres = sqlStatement("SELECT grp_form_id FROM layout_group_properties WHERE " .
343 "grp_form_id LIKE 'LBF%' AND grp_group_id = '' AND grp_repeats > 0 AND grp_activity = 1 " .
344 "ORDER BY grp_seq, grp_title");
345 while ($gfrow = sqlFetchArray($gfres)) {
347 $("#<?php echo attr($gfrow['grp_form_id']); ?>_ps_expand").load("lbf_fragment.php?formname=<?php echo attr($gfrow['grp_form_id']); ?>");
348 <?php
351 // fancy box
352 enable_modals();
354 tabbify();
356 // modal for dialog boxes
357 $(".large_modal").fancybox( {
358 'overlayOpacity' : 0.0,
359 'showCloseButton' : true,
360 'frameHeight' : 600,
361 'frameWidth' : 1000,
362 'centerOnScroll' : false
365 // modal for image viewer
366 $(".image_modal").fancybox( {
367 'overlayOpacity' : 0.0,
368 'showCloseButton' : true,
369 'centerOnScroll' : false,
370 'autoscale' : true
373 $(".iframe1").fancybox( {
374 'left':10,
375 'overlayOpacity' : 0.0,
376 'showCloseButton' : true,
377 'frameHeight' : 300,
378 'frameWidth' : 350
380 // special size for patient portal
381 $(".small_modal").fancybox( {
382 'overlayOpacity' : 0.0,
383 'showCloseButton' : true,
384 'frameHeight' : 200,
385 'frameWidth' : 380,
386 'centerOnScroll' : false
389 function openReminderPopup() {
390 $("#reminder_popup_link").fancybox({
391 'overlayOpacity' : 0.0,
392 'showCloseButton' : true,
393 'frameHeight' : 500,
394 'frameWidth' : 500,
395 'centerOnScroll' : false,
396 }).trigger('click');
400 <?php if ($GLOBALS['patient_birthday_alert']) {
401 // To display the birthday alert:
402 // 1. The patient is not deceased
403 // 2. The birthday is today (or in the past depending on global selection)
404 // 3. The notification has not been turned off (or shown depending on global selection) for this year
405 $birthdayAlert = new BirthdayReminder($pid, $_SESSION['authId']);
406 if ($birthdayAlert->isDisplayBirthdayAlert()) {
408 // show the active reminder modal
409 $("#birthday_popup").fancybox({
410 'overlayOpacity' : 0.0,
411 'showCloseButton' : true,
412 'frameHeight' : 170,
413 'frameWidth' : 200,
414 'centerOnScroll' : false,
415 'callbackOnClose' : function () {
416 <?php if ($active_reminders || $all_allergy_alerts) { ?>
417 //working only with setTimeout 0, must call openReminderPopup only ofter callbackOnClose is finished (fancybox v1 isn't support multi instances)
418 setTimeout(function () {
419 openReminderPopup();
421 <?php }?>
423 }).trigger('click');
424 <?php } elseif ($active_reminders || $all_allergy_alerts) { ?>
425 openReminderPopup();
426 <?php }?>
427 <?php } elseif ($active_reminders || $all_allergy_alerts) { ?>
428 openReminderPopup();
429 <?php }?>
435 // JavaScript stuff to do when a new patient is set.
437 function setMyPatient() {
438 // Avoid race conditions with loading of the left_nav or Title frame.
439 if (!parent.allFramesLoaded()) {
440 setTimeout("setMyPatient()", 500);
441 return;
443 <?php if (isset($_GET['set_pid'])) { ?>
444 parent.left_nav.setPatient(<?php echo "'" . addslashes($result['fname']) . " " . addslashes($result['lname']) .
445 "'," . addslashes($pid) . ",'" . addslashes($result['pubpid']) .
446 "','', ' " . xls('DOB') . ": " . addslashes(oeFormatShortDate($result['DOB_YMD'])) . " " . xls('Age') . ": " . addslashes(getPatientAgeDisplay($result['DOB_YMD'])) . "'"; ?>);
447 var EncounterDateArray = new Array;
448 var CalendarCategoryArray = new Array;
449 var EncounterIdArray = new Array;
450 var Count = 0;
451 <?php
452 //Encounter details are stored to javacript as array.
453 $result4 = sqlStatement("SELECT fe.encounter,fe.date,openemr_postcalendar_categories.pc_catname FROM form_encounter AS fe ".
454 " left join openemr_postcalendar_categories on fe.pc_catid=openemr_postcalendar_categories.pc_catid WHERE fe.pid = ? order by fe.date desc", array($pid));
455 if (sqlNumRows($result4)>0) {
456 while ($rowresult4 = sqlFetchArray($result4)) {
458 EncounterIdArray[Count] = '<?php echo addslashes($rowresult4['encounter']); ?>';
459 EncounterDateArray[Count] = '<?php echo addslashes(oeFormatShortDate(date("Y-m-d", strtotime($rowresult4['date'])))); ?>';
460 CalendarCategoryArray[Count] = '<?php echo addslashes(xl_appt_category($rowresult4['pc_catname'])); ?>';
461 Count++;
462 <?php
466 parent.left_nav.setPatientEncounter(EncounterIdArray,EncounterDateArray,CalendarCategoryArray);
467 <?php } // end setting new pid ?>
468 parent.left_nav.syncRadios();
469 <?php if ((isset($_GET['set_pid']) ) && (isset($_GET['set_encounterid'])) && ( intval($_GET['set_encounterid']) > 0 )) {
470 $encounter = intval($_GET['set_encounterid']);
471 $_SESSION['encounter'] = $encounter;
472 $query_result = sqlQuery("SELECT `date` FROM `form_encounter` WHERE `encounter` = ?", array($encounter)); ?>
473 encurl = 'encounter/encounter_top.php?set_encounter=' + <?php echo attr($encounter);?> + '&pid=' + <?php echo attr($pid);?>;
474 <?php if ($GLOBALS['new_tabs_layout']) { ?>
475 parent.left_nav.setEncounter('<?php echo oeFormatShortDate(date("Y-m-d", strtotime($query_result['date']))); ?>', '<?php echo attr($encounter); ?>', 'enc');
476 top.restoreSession();
477 parent.left_nav.loadFrame('enc2', 'enc', 'patient_file/' + encurl);
478 <?php } else { ?>
479 var othername = (window.name == 'RTop') ? 'RBot' : 'RTop';
480 parent.left_nav.setEncounter('<?php echo oeFormatShortDate(date("Y-m-d", strtotime($query_result['date']))); ?>', '<?php echo attr($encounter); ?>', othername);
481 top.restoreSession();
482 parent.frames[othername].location.href = '../' + encurl;
483 <?php } ?>
484 <?php } // end setting new encounter id (only if new pid is also set) ?>
487 $(window).load(function() {
488 setMyPatient();
491 </script>
493 <style type="css/text">
495 #pnotes_ps_expand {
496 height:auto;
497 width:100%;
500 <?php
501 // This is for layout font size override.
502 $grparr = array();
503 getLayoutProperties('DEM', $grparr, 'grp_size');
504 if (!empty($grparr['']['grp_size'])) {
505 $FONTSIZE = $grparr['']['grp_size'];
507 /* Override font sizes in the theme. */
508 #DEM .groupname {
509 font-size: <?php echo attr($FONTSIZE); ?>pt;
511 #DEM .label {
512 font-size: <?php echo attr($FONTSIZE); ?>pt;
514 #DEM .data {
515 font-size: <?php echo attr($FONTSIZE); ?>pt;
517 #DEM .data td {
518 font-size: <?php echo attr($FONTSIZE); ?>pt;
520 <?php } ?>
522 </style>
524 </head>
526 <body class="body_top patient-demographics">
528 <a href='../reminder/active_reminder_popup.php' id='reminder_popup_link' style='display: none;' class='iframe' onclick='top.restoreSession()'></a>
530 <a href='../birthday_alert/birthday_pop.php?pid=<?php echo attr($pid); ?>&user_id=<?php echo attr($_SESSION['authId']); ?>' id='birthday_popup' style='display: none;' class='iframe' onclick='top.restoreSession()'></a>
531 <?php
532 $thisauth = acl_check('patients', 'demo');
533 if ($thisauth) {
534 if ($result['squad'] && ! acl_check('squads', $result['squad'])) {
535 $thisauth = 0;
539 if (!$thisauth) {
540 echo "<p>(" . htmlspecialchars(xl('Demographics not authorized'), ENT_NOQUOTES) . ")</p>\n";
541 echo "</body>\n</html>\n";
542 exit();
545 if ($thisauth) : ?>
547 <table class="table_header">
548 <tr>
549 <td>
550 <span class='title'>
551 <?php echo htmlspecialchars(getPatientName($pid), ENT_NOQUOTES); ?>
552 </span>
553 </td>
554 <?php if (acl_check('admin', 'super') && $GLOBALS['allow_pat_delete']) : ?>
555 <td style='padding-left:1em;' class="delete">
556 <a class='css_button iframe'
557 href='../deleter.php?patient=<?php echo htmlspecialchars($pid, ENT_QUOTES);?>'
558 onclick='top.restoreSession()'>
559 <span><?php echo htmlspecialchars(xl('Delete'), ENT_NOQUOTES);?></span>
560 </a>
561 </td>
562 <?php endif; // Allow PT delete
563 if ($GLOBALS['erx_enable']) : ?>
564 <td style="padding-left:1em;" class="erx">
565 <a class="css_button" href="../../eRx.php?page=medentry" onclick="top.restoreSession()">
566 <span><?php echo htmlspecialchars(xl('NewCrop MedEntry'), ENT_NOQUOTES);?></span>
567 </a>
568 </td>
569 <td style="padding-left:1em;">
570 <a class="css_button iframe1"
571 href="../../soap_functions/soap_accountStatusDetails.php"
572 onclick="top.restoreSession()">
573 <span><?php echo htmlspecialchars(xl('NewCrop Account Status'), ENT_NOQUOTES);?></span>
574 </a>
575 </td>
576 <td id='accountstatus'></td>
577 <?php endif; // eRX Enabled
578 //Patient Portal
579 $portalUserSetting = true; //flag to see if patient has authorized access to portal
580 if (($GLOBALS['portal_onsite_enable'] && $GLOBALS['portal_onsite_address']) ||
581 ($GLOBALS['portal_onsite_two_enable'] && $GLOBALS['portal_onsite_two_address']) ) :
582 $portalStatus = sqlQuery("SELECT allow_patient_portal FROM patient_data WHERE pid=?", array($pid));
583 if ($portalStatus['allow_patient_portal']=='YES') :
584 $portalLogin = sqlQuery("SELECT pid FROM `patient_access_onsite` WHERE `pid`=?", array($pid));?>
585 <td style='padding-left:1em;'>
586 <a class='css_button iframe small_modal'
587 href='create_portallogin.php?portalsite=on&patient=<?php echo htmlspecialchars($pid, ENT_QUOTES);?>'
588 onclick='top.restoreSession()'>
589 <?php $display = (empty($portalLogin)) ? xlt('Create Onsite Portal Credentials') : xlt('Reset Onsite Portal Credentials'); ?>
590 <span><?php echo $display; ?></span>
591 </a>
592 </td>
593 <?php
594 else :
595 $portalUserSetting = false;
596 endif; // allow patient portal
597 endif; // Onsite Patient Portal
598 if ($GLOBALS['portal_offsite_enable'] && $GLOBALS['portal_offsite_address']) :
599 $portalStatus = sqlQuery("SELECT allow_patient_portal FROM patient_data WHERE pid=?", array($pid));
600 if ($portalStatus['allow_patient_portal']=='YES') :
601 $portalLogin = sqlQuery("SELECT pid FROM `patient_access_offsite` WHERE `pid`=?", array($pid));
603 <td style='padding-left:1em;'>
604 <a class='css_button iframe small_modal'
605 href='create_portallogin.php?portalsite=off&patient=<?php echo htmlspecialchars($pid, ENT_QUOTES);?>'
606 onclick='top.restoreSession()'>
607 <span>
608 <?php $text = (empty($portalLogin)) ? xlt('Create Offsite Portal Credentials') : xlt('Reset Offsite Portal Credentials'); ?>
609 <?php echo $text; ?>
610 </span>
611 </a>
612 </td>
613 <?php
614 else :
615 $portalUserSetting = false;
616 endif; // allow_patient_portal
617 endif; // portal_offsite_enable
618 if (!($portalUserSetting)) : // Show that the patient has not authorized portal access ?>
619 <td style='padding-left:1em;'>
620 <?php echo htmlspecialchars(xl('Patient has not authorized the Patient Portal.'), ENT_NOQUOTES);?>
621 </td>
622 <?php endif;
623 //Patient Portal
625 // If patient is deceased, then show this (along with the number of days patient has been deceased for)
626 $days_deceased = is_patient_deceased($pid);
627 if ($days_deceased != null) : ?>
628 <td class="deceased" style="padding-left:1em;font-weight:bold;color:red">
629 <?php
630 if ($days_deceased == 0) {
631 echo xlt("DECEASED (Today)");
632 } else if ($days_deceased == 1) {
633 echo xlt("DECEASED (1 day ago)");
634 } else {
635 echo xlt("DECEASED") . " (" . text($days_deceased) . " " . xlt("days ago") . ")";
636 } ?>
637 </td>
638 <?php endif; ?>
639 </tr>
640 </table>
642 <?php
643 endif; // $thisauth
646 <?php
647 // Get the document ID of the patient ID card if access to it is wanted here.
648 $idcard_doc_id = false;
649 if ($GLOBALS['patient_id_category_name']) {
650 $idcard_doc_id = get_document_by_catg($pid, $GLOBALS['patient_id_category_name']);
654 <table cellspacing='0' cellpadding='0' border='0' class="subnav">
655 <tr>
656 <td class="small" colspan='4'>
657 <a href="../history/history.php" onclick='top.restoreSession()'>
658 <?php echo htmlspecialchars(xl('History'), ENT_NOQUOTES); ?></a>
660 <?php //note that we have temporarily removed report screen from the modal view ?>
661 <a href="../report/patient_report.php" onclick='top.restoreSession()'>
662 <?php echo htmlspecialchars(xl('Report'), ENT_NOQUOTES); ?></a>
664 <?php //note that we have temporarily removed document screen from the modal view ?>
665 <a href="../../../controller.php?document&list&patient_id=<?php echo $pid;?>" onclick='top.restoreSession()'>
666 <?php echo htmlspecialchars(xl('Documents'), ENT_NOQUOTES); ?></a>
668 <a href="../transaction/transactions.php" onclick='top.restoreSession()'>
669 <?php echo htmlspecialchars(xl('Transactions'), ENT_NOQUOTES); ?></a>
671 <a href="stats_full.php?active=all" onclick='top.restoreSession()'>
672 <?php echo htmlspecialchars(xl('Issues'), ENT_NOQUOTES); ?></a>
674 <a href="../../reports/pat_ledger.php?form=1&patient_id=<?php echo attr($pid);?>" onclick='top.restoreSession()'>
675 <?php echo xlt('Ledger'); ?></a>
677 <a href="../../reports/external_data.php" onclick='top.restoreSession()'>
678 <?php echo xlt('External Data'); ?></a>
680 <!-- DISPLAYING HOOKS STARTS HERE -->
681 <?php
682 $module_query = sqlStatement("SELECT msh.*,ms.obj_name,ms.menu_name,ms.path,m.mod_ui_name,m.type FROM modules_hooks_settings AS msh
683 LEFT OUTER JOIN modules_settings AS ms ON obj_name=enabled_hooks AND ms.mod_id=msh.mod_id
684 LEFT OUTER JOIN modules AS m ON m.mod_id=ms.mod_id
685 WHERE fld_type=3 AND mod_active=1 AND sql_run=1 AND attached_to='demographics' ORDER BY mod_id");
686 $DivId = 'mod_installer';
687 if (sqlNumRows($module_query)) {
688 $jid = 0;
689 $modid = '';
690 while ($modulerow = sqlFetchArray($module_query)) {
691 $DivId = 'mod_'.$modulerow['mod_id'];
692 $new_category = $modulerow['mod_ui_name'];
693 $modulePath = "";
694 $added = "";
695 if ($modulerow['type'] == 0) {
696 $modulePath = $GLOBALS['customModDir'];
697 $added = "";
698 } else {
699 $added = "index";
700 $modulePath = $GLOBALS['zendModDir'];
703 if (!acl_check('admin', 'super') && !zh_acl_check($_SESSION['authUserID'], $modulerow['obj_name'])) {
704 continue;
707 $relative_link = "../../modules/".$modulePath."/".$modulerow['path'];
708 $nickname = $modulerow['menu_name'] ? $modulerow['menu_name'] : 'Noname';
709 $jid++;
710 $modid = $modulerow['mod_id'];
713 <a href="<?php echo $relative_link; ?>" onclick='top.restoreSession()'>
714 <?php echo xlt($nickname); ?></a>
715 <?php
719 <!-- DISPLAYING HOOKS ENDS HERE -->
721 </td>
722 </tr>
723 </table> <!-- end header -->
725 <div style='margin-top:10px' class="main"> <!-- start main content div -->
726 <table border="0" cellspacing="0" cellpadding="0" width="100%">
727 <tr>
728 <td class="demographics-box" align="left" valign="top">
729 <!-- start left column div -->
730 <div style='float:left; margin-right:20px'>
732 <table cellspacing=0 cellpadding=0>
733 <?php if (!$GLOBALS['hide_billing_widget']) { ?>
734 <tr>
735 <td>
736 <?php
737 // Billing expand collapse widget
738 $widgetTitle = xl("Billing");
739 $widgetLabel = "billing";
740 $widgetButtonLabel = xl("Edit");
741 $widgetButtonLink = "return newEvt();";
742 $widgetButtonClass = "";
743 $linkMethod = "javascript";
744 $bodyClass = "notab";
745 $widgetAuth = false;
746 $fixedWidth = true;
747 if ($GLOBALS['force_billing_widget_open']) {
748 $forceExpandAlways = true;
749 } else {
750 $forceExpandAlways = false;
753 expand_collapse_widget(
754 $widgetTitle,
755 $widgetLabel,
756 $widgetButtonLabel,
757 $widgetButtonLink,
758 $widgetButtonClass,
759 $linkMethod,
760 $bodyClass,
761 $widgetAuth,
762 $fixedWidth,
763 $forceExpandAlways
766 <br>
767 <?php
768 //PATIENT BALANCE,INS BALANCE naina@capminds.com
769 $patientbalance = get_patient_balance($pid, false);
770 //Debit the patient balance from insurance balance
771 $insurancebalance = get_patient_balance($pid, true) - $patientbalance;
772 $totalbalance=$patientbalance + $insurancebalance;
774 // Show current balance and billing note, if any.
775 echo "<table border='0'><tr><td>" .
776 "<table ><tr><td><span class='bold'><font color='red'>" .
777 xlt('Patient Balance Due') .
778 " : " . text(oeFormatMoney($patientbalance)) .
779 "</font></span></td></tr>".
780 "<tr><td><span class='bold'><font color='red'>" .
781 xlt('Insurance Balance Due') .
782 " : " . text(oeFormatMoney($insurancebalance)) .
783 "</font></span></td></tr>".
784 "<tr><td><span class='bold'><font color='red'>" .
785 xlt('Total Balance Due').
786 " : " . text(oeFormatMoney($totalbalance)) .
787 "</font></span></td></td></tr>";
788 if (!empty($result['billing_note'])) {
789 echo "<tr><td><span class='bold'><font color='red'>" .
790 xlt('Billing Note') . ":" .
791 text($result['billing_note']) .
792 "</font></span></td></tr>";
795 if ($result3['provider']) { // Use provider in case there is an ins record w/ unassigned insco
796 echo "<tr><td><span class='bold'>" .
797 xlt('Primary Insurance') . ': ' . text($insco_name) .
798 "</span>&nbsp;&nbsp;&nbsp;";
799 if ($result3['copay'] > 0) {
800 echo "<span class='bold'>" .
801 xlt('Copay') . ': ' . text($result3['copay']) .
802 "</span>&nbsp;&nbsp;&nbsp;";
805 echo "<span class='bold'>" .
806 xlt('Effective Date') . ': ' . text(oeFormatShortDate($result3['effdate'])) .
807 "</span></td></tr>";
810 echo "</table></td></tr></td></tr></table><br>";
813 </div> <!-- required for expand_collapse_widget -->
814 </td>
815 </tr>
816 <?php } ?>
818 <?php if (acl_check('patients', 'demo')) { ?>
819 <tr>
820 <td>
821 <?php
822 // Demographics expand collapse widget
823 $widgetTitle = xl("Demographics");
824 $widgetLabel = "demographics";
825 $widgetButtonLabel = xl("Edit");
826 $widgetButtonLink = "demographics_full.php";
827 $widgetButtonClass = "";
828 $linkMethod = "html";
829 $bodyClass = "";
830 $widgetAuth = acl_check('patients', 'demo', '', 'write');
831 $fixedWidth = true;
832 expand_collapse_widget(
833 $widgetTitle,
834 $widgetLabel,
835 $widgetButtonLabel,
836 $widgetButtonLink,
837 $widgetButtonClass,
838 $linkMethod,
839 $bodyClass,
840 $widgetAuth,
841 $fixedWidth
844 <div id="DEM" >
845 <ul class="tabNav">
846 <?php display_layout_tabs('DEM', $result, $result2); ?>
847 </ul>
848 <div class="tabContainer">
849 <?php display_layout_tabs_data('DEM', $result, $result2); ?>
850 </div>
851 </div>
852 </div> <!-- required for expand_collapse_widget -->
853 </td>
854 </tr>
856 <tr>
857 <td>
858 <?php
859 $insurance_count = 0;
860 foreach (array('primary','secondary','tertiary') as $instype) {
861 $enddate = 'Present';
862 $query = "SELECT * FROM insurance_data WHERE " .
863 "pid = ? AND type = ? " .
864 "ORDER BY date DESC";
865 $res = sqlStatement($query, array($pid, $instype));
866 while ($row = sqlFetchArray($res)) {
867 if ($row['provider']) {
868 $insurance_count++;
873 if ($insurance_count > 0) {
874 // Insurance expand collapse widget
875 $widgetTitle = xl("Insurance");
876 $widgetLabel = "insurance";
877 $widgetButtonLabel = xl("Edit");
878 $widgetButtonLink = "demographics_full.php";
879 $widgetButtonClass = "";
880 $linkMethod = "html";
881 $bodyClass = "";
882 $widgetAuth = acl_check('patients', 'demo', '', 'write');
883 $fixedWidth = true;
884 expand_collapse_widget(
885 $widgetTitle,
886 $widgetLabel,
887 $widgetButtonLabel,
888 $widgetButtonLink,
889 $widgetButtonClass,
890 $linkMethod,
891 $bodyClass,
892 $widgetAuth,
893 $fixedWidth
896 if ($insurance_count > 0) {
899 <ul class="tabNav"><?php
900 ///////////////////////////////// INSURANCE SECTION
901 $first = true;
902 foreach (array('primary','secondary','tertiary') as $instype) {
903 $query = "SELECT * FROM insurance_data WHERE " .
904 "pid = ? AND type = ? " .
905 "ORDER BY date DESC";
906 $res = sqlStatement($query, array($pid, $instype));
908 $enddate = 'Present';
910 while ($row = sqlFetchArray($res)) {
911 if ($row['provider']) {
912 $ins_description = ucfirst($instype);
913 $ins_description = xl($ins_description);
914 $ins_description .= strcmp($enddate, 'Present') != 0 ? " (".xl('Old').")" : "";
916 <li <?php echo $first ? 'class="current"' : '' ?>><a href="#">
917 <?php echo htmlspecialchars($ins_description, ENT_NOQUOTES); ?></a></li>
918 <?php
919 $first = false;
922 $enddate = $row['date'];
926 // Display the eligibility tab
927 echo "<li><a href='#'>" .
928 htmlspecialchars(xl('Eligibility'), ENT_NOQUOTES) . "</a></li>";
930 ?></ul><?php
931 } ?>
933 <div class="tabContainer">
934 <?php
935 $first = true;
936 foreach (array('primary','secondary','tertiary') as $instype) {
937 $enddate = 'Present';
939 $query = "SELECT * FROM insurance_data WHERE " .
940 "pid = ? AND type = ? " .
941 "ORDER BY date DESC";
942 $res = sqlStatement($query, array($pid, $instype));
943 while ($row = sqlFetchArray($res)) {
944 if ($row['provider']) {
946 <div class="tab <?php echo $first ? 'current' : '' ?>">
947 <table border='0' cellpadding='0' width='100%'>
948 <?php
949 $icobj = new InsuranceCompany($row['provider']);
950 $adobj = $icobj->get_address();
951 $insco_name = trim($icobj->get_name());
953 <tr>
954 <td valign='top' colspan='3'>
955 <span class='text'>
956 <?php
957 if (strcmp($enddate, 'Present') != 0) {
958 echo htmlspecialchars(xl("Old"), ENT_NOQUOTES)." ";
961 <?php $tempinstype=ucfirst($instype);
962 echo htmlspecialchars(xl($tempinstype.' Insurance'), ENT_NOQUOTES); ?>
963 <?php if (strcmp($row['date'], '0000-00-00') != 0) { ?>
964 <?php echo htmlspecialchars(xl('from', '', ' ', ' ').$row['date'], ENT_NOQUOTES); ?>
965 <?php } ?>
966 <?php echo htmlspecialchars(xl('until', '', ' ', ' '), ENT_NOQUOTES);
967 echo (strcmp($enddate, 'Present') != 0) ? $enddate : htmlspecialchars(xl('Present'), ENT_NOQUOTES); ?>:</span>
968 </td>
969 </tr>
970 <tr>
971 <td valign='top'>
972 <span class='text'>
973 <?php
974 if ($insco_name) {
975 echo htmlspecialchars($insco_name, ENT_NOQUOTES) . '<br>';
976 if (trim($adobj->get_line1())) {
977 echo htmlspecialchars($adobj->get_line1(), ENT_NOQUOTES) . '<br>';
978 echo htmlspecialchars($adobj->get_city() . ', ' . $adobj->get_state() . ' ' . $adobj->get_zip(), ENT_NOQUOTES);
980 } else {
981 echo "<font color='red'><b>".htmlspecialchars(xl('Unassigned'), ENT_NOQUOTES)."</b></font>";
984 <br>
985 <?php echo htmlspecialchars(xl('Policy Number'), ENT_NOQUOTES); ?>:
986 <?php echo htmlspecialchars($row['policy_number'], ENT_NOQUOTES) ?><br>
987 <?php echo htmlspecialchars(xl('Plan Name'), ENT_NOQUOTES); ?>:
988 <?php echo htmlspecialchars($row['plan_name'], ENT_NOQUOTES); ?><br>
989 <?php echo htmlspecialchars(xl('Group Number'), ENT_NOQUOTES); ?>:
990 <?php echo htmlspecialchars($row['group_number'], ENT_NOQUOTES); ?></span>
991 </td>
992 <td valign='top'>
993 <span class='bold'><?php echo htmlspecialchars(xl('Subscriber'), ENT_NOQUOTES); ?>: </span><br>
994 <span class='text'><?php echo htmlspecialchars($row['subscriber_fname'] . ' ' . $row['subscriber_mname'] . ' ' . $row['subscriber_lname'], ENT_NOQUOTES); ?>
995 <?php
996 if ($row['subscriber_relationship'] != "") {
997 echo "(" . htmlspecialchars($row['subscriber_relationship'], ENT_NOQUOTES) . ")";
1000 <br>
1001 <?php echo htmlspecialchars(xl('S.S.'), ENT_NOQUOTES); ?>:
1002 <?php echo htmlspecialchars($row['subscriber_ss'], ENT_NOQUOTES); ?><br>
1003 <?php echo htmlspecialchars(xl('D.O.B.'), ENT_NOQUOTES); ?>:
1004 <?php
1005 if ($row['subscriber_DOB'] != "0000-00-00 00:00:00") {
1006 echo htmlspecialchars($row['subscriber_DOB'], ENT_NOQUOTES);
1008 ?><br>
1009 <?php echo htmlspecialchars(xl('Phone'), ENT_NOQUOTES); ?>:
1010 <?php echo htmlspecialchars($row['subscriber_phone'], ENT_NOQUOTES); ?>
1011 </span>
1012 </td>
1013 <td valign='top'>
1014 <span class='bold'><?php echo htmlspecialchars(xl('Subscriber Address'), ENT_NOQUOTES); ?>: </span><br>
1015 <span class='text'><?php echo htmlspecialchars($row['subscriber_street'], ENT_NOQUOTES); ?><br>
1016 <?php echo htmlspecialchars($row['subscriber_city'], ENT_NOQUOTES); ?>
1017 <?php
1018 if ($row['subscriber_state'] != "") {
1019 echo ", ";
1022 echo htmlspecialchars($row['subscriber_state'], ENT_NOQUOTES); ?>
1023 <?php
1024 if ($row['subscriber_country'] != "") {
1025 echo ", ";
1028 echo htmlspecialchars($row['subscriber_country'], ENT_NOQUOTES); ?>
1029 <?php echo " " . htmlspecialchars($row['subscriber_postal_code'], ENT_NOQUOTES); ?></span>
1031 <?php if (trim($row['subscriber_employer'])) { ?>
1032 <br><span class='bold'><?php echo htmlspecialchars(xl('Subscriber Employer'), ENT_NOQUOTES); ?>: </span><br>
1033 <span class='text'><?php echo htmlspecialchars($row['subscriber_employer'], ENT_NOQUOTES); ?><br>
1034 <?php echo htmlspecialchars($row['subscriber_employer_street'], ENT_NOQUOTES); ?><br>
1035 <?php echo htmlspecialchars($row['subscriber_employer_city'], ENT_NOQUOTES); ?>
1036 <?php
1037 if ($row['subscriber_employer_city'] != "") {
1038 echo ", ";
1041 echo htmlspecialchars($row['subscriber_employer_state'], ENT_NOQUOTES); ?>
1042 <?php
1043 if ($row['subscriber_employer_country'] != "") {
1044 echo ", ";
1047 echo htmlspecialchars($row['subscriber_employer_country'], ENT_NOQUOTES); ?>
1048 <?php echo " " . htmlspecialchars($row['subscriber_employer_postal_code'], ENT_NOQUOTES); ?>
1049 </span>
1050 <?php } ?>
1052 </td>
1053 </tr>
1054 <tr>
1055 <td>
1056 <?php if ($row['copay'] != "") { ?>
1057 <span class='bold'><?php echo htmlspecialchars(xl('CoPay'), ENT_NOQUOTES); ?>: </span>
1058 <span class='text'><?php echo htmlspecialchars($row['copay'], ENT_NOQUOTES); ?></span>
1059 <br />
1060 <?php } ?>
1061 <span class='bold'><?php echo htmlspecialchars(xl('Accept Assignment'), ENT_NOQUOTES); ?>:</span>
1062 <span class='text'>
1063 <?php
1064 if ($row['accept_assignment'] == "TRUE") {
1065 echo xl("YES");
1067 if ($row['accept_assignment'] == "FALSE") {
1068 echo xl("NO");
1071 </span>
1072 <?php if (!empty($row['policy_type'])) { ?>
1073 <br />
1074 <span class='bold'><?php echo htmlspecialchars(xl('Secondary Medicare Type'), ENT_NOQUOTES); ?>: </span>
1075 <span class='text'><?php echo htmlspecialchars($policy_types[$row['policy_type']], ENT_NOQUOTES); ?></span>
1076 <?php } ?>
1077 </td>
1078 <td valign='top'></td>
1079 <td valign='top'></td>
1080 </tr>
1082 </table>
1083 </div>
1084 <?php
1085 } // end if ($row['provider'])
1086 $enddate = $row['date'];
1087 $first = false;
1088 } // end while
1089 } // end foreach
1091 // Display the eligibility information
1092 echo "<div class='tab'>";
1093 show_eligibility_information($pid, true);
1094 echo "</div>";
1096 ///////////////////////////////// END INSURANCE SECTION
1098 </div>
1100 <?php } // ?>
1102 </td>
1103 </tr>
1104 <?php } // end if demographics authorized ?>
1106 <?php if (acl_check('patients', 'notes')) { ?>
1107 <tr>
1108 <td width='650px'>
1109 <?php
1110 // Notes expand collapse widget
1111 $widgetTitle = xl("Notes");
1112 $widgetLabel = "pnotes";
1113 $widgetButtonLabel = xl("Edit");
1114 $widgetButtonLink = "pnotes_full.php?form_active=1";
1115 $widgetButtonClass = "";
1116 $linkMethod = "html";
1117 $bodyClass = "notab";
1118 $widgetAuth = acl_check('patients', 'notes', '', 'write');
1119 $fixedWidth = true;
1120 expand_collapse_widget(
1121 $widgetTitle,
1122 $widgetLabel,
1123 $widgetButtonLabel,
1124 $widgetButtonLink,
1125 $widgetButtonClass,
1126 $linkMethod,
1127 $bodyClass,
1128 $widgetAuth,
1129 $fixedWidth
1132 <br/>
1133 <div style='margin-left:10px' class='text'><img src='../../pic/ajax-loader.gif'/></div><br/>
1134 </div>
1135 </td>
1136 </tr>
1137 <?php } // end if notes authorized ?>
1139 <?php if (acl_check('patients', 'reminder') && $GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_prw']) {
1140 echo "<tr><td width='650px'>";
1141 // patient reminders collapse widget
1142 $widgetTitle = xl("Patient Reminders");
1143 $widgetLabel = "patient_reminders";
1144 $widgetButtonLabel = xl("Edit");
1145 $widgetButtonLink = "../reminder/patient_reminders.php?mode=simple&patient_id=".$pid;
1146 $widgetButtonClass = "";
1147 $linkMethod = "html";
1148 $bodyClass = "notab";
1149 $widgetAuth = acl_check('patients', 'reminder', '', 'write');
1150 $fixedWidth = true;
1151 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel, $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth); ?>
1152 <br/>
1153 <div style='margin-left:10px' class='text'><image src='../../pic/ajax-loader.gif'/></div><br/>
1154 </div>
1155 </td>
1156 </tr>
1157 <?php } //end if prw is activated ?>
1159 <?php if (acl_check('patients', 'disclosure')) { ?>
1160 <tr>
1161 <td width='650px'>
1162 <?php
1163 // disclosures expand collapse widget
1164 $widgetTitle = xl("Disclosures");
1165 $widgetLabel = "disclosures";
1166 $widgetButtonLabel = xl("Edit");
1167 $widgetButtonLink = "disclosure_full.php";
1168 $widgetButtonClass = "";
1169 $linkMethod = "html";
1170 $bodyClass = "notab";
1171 $widgetAuth = acl_check('patients', 'disclosure', '', 'write');
1172 $fixedWidth = true;
1173 expand_collapse_widget(
1174 $widgetTitle,
1175 $widgetLabel,
1176 $widgetButtonLabel,
1177 $widgetButtonLink,
1178 $widgetButtonClass,
1179 $linkMethod,
1180 $bodyClass,
1181 $widgetAuth,
1182 $fixedWidth
1185 <br/>
1186 <div style='margin-left:10px' class='text'><img src='../../pic/ajax-loader.gif'/></div><br/>
1187 </div>
1188 </td>
1189 </tr>
1190 <?php } // end if disclosures authorized ?>
1192 <?php if ($GLOBALS['amendments'] && acl_check('patients', 'amendment')) { ?>
1193 <tr>
1194 <td width='650px'>
1195 <?php // Amendments widget
1196 $widgetTitle = xlt('Amendments');
1197 $widgetLabel = "amendments";
1198 $widgetButtonLabel = xlt("Edit");
1199 $widgetButtonLink = $GLOBALS['webroot'] . "/interface/patient_file/summary/main_frameset.php?feature=amendment";
1200 $widgetButtonClass = "iframe rx_modal";
1201 $linkMethod = "html";
1202 $bodyClass = "summary_item small";
1203 $widgetAuth = acl_check('patients', 'amendment', '', 'write');
1204 $fixedWidth = false;
1205 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel, $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1206 $sql = "SELECT * FROM amendments WHERE pid = ? ORDER BY amendment_date DESC";
1207 $result = sqlStatement($sql, array($pid));
1209 if (sqlNumRows($result) == 0) {
1210 echo " <table><tr>\n";
1211 echo " <td colspan='$numcols' class='text'>&nbsp;&nbsp;" . xlt('None') . "</td>\n";
1212 echo " </tr></table>\n";
1215 while ($row=sqlFetchArray($result)) {
1216 echo "&nbsp;&nbsp;";
1217 echo "<a class= '" . $widgetButtonClass . "' href='" . $widgetButtonLink . "&id=" . attr($row['amendment_id']) . "' onclick='top.restoreSession()'>" . text($row['amendment_date']);
1218 echo "&nbsp; " . text($row['amendment_desc']);
1220 echo "</a><br>\n";
1221 } ?>
1222 </td>
1223 </tr>
1224 <?php } // end amendments authorized ?>
1226 <?php if (acl_check('patients', 'lab')) { ?>
1227 <tr>
1228 <td width='650px'>
1229 <?php // labdata expand collapse widget
1230 $widgetTitle = xl("Labs");
1231 $widgetLabel = "labdata";
1232 $widgetButtonLabel = xl("Trend");
1233 $widgetButtonLink = "../summary/labdata.php";#"../encounter/trend_form.php?formname=labdata";
1234 $widgetButtonClass = "";
1235 $linkMethod = "html";
1236 $bodyClass = "notab";
1237 // check to see if any labdata exist
1238 $spruch = "SELECT procedure_report.date_collected AS date " .
1239 "FROM procedure_report " .
1240 "JOIN procedure_order ON procedure_report.procedure_order_id = procedure_order.procedure_order_id " .
1241 "WHERE procedure_order.patient_id = ? " .
1242 "ORDER BY procedure_report.date_collected DESC ";
1243 $existLabdata = sqlQuery($spruch, array($pid));
1244 if ($existLabdata) {
1245 $widgetAuth = true;
1246 } else {
1247 $widgetAuth = false;
1250 $fixedWidth = true;
1251 expand_collapse_widget(
1252 $widgetTitle,
1253 $widgetLabel,
1254 $widgetButtonLabel,
1255 $widgetButtonLink,
1256 $widgetButtonClass,
1257 $linkMethod,
1258 $bodyClass,
1259 $widgetAuth,
1260 $fixedWidth
1263 <br/>
1264 <div style='margin-left:10px' class='text'><img src='../../pic/ajax-loader.gif'/></div><br/>
1265 </div>
1266 </td>
1267 </tr>
1268 <?php } // end labs authorized ?>
1270 <?php if ($vitals_is_registered && acl_check('patients', 'med')) { ?>
1271 <tr>
1272 <td width='650px'>
1273 <?php // vitals expand collapse widget
1274 $widgetTitle = xl("Vitals");
1275 $widgetLabel = "vitals";
1276 $widgetButtonLabel = xl("Trend");
1277 $widgetButtonLink = "../encounter/trend_form.php?formname=vitals";
1278 $widgetButtonClass = "";
1279 $linkMethod = "html";
1280 $bodyClass = "notab";
1281 // check to see if any vitals exist
1282 $existVitals = sqlQuery("SELECT * FROM form_vitals WHERE pid=?", array($pid));
1283 if ($existVitals) {
1284 $widgetAuth = true;
1285 } else {
1286 $widgetAuth = false;
1289 $fixedWidth = true;
1290 expand_collapse_widget(
1291 $widgetTitle,
1292 $widgetLabel,
1293 $widgetButtonLabel,
1294 $widgetButtonLink,
1295 $widgetButtonClass,
1296 $linkMethod,
1297 $bodyClass,
1298 $widgetAuth,
1299 $fixedWidth
1302 <br/>
1303 <div style='margin-left:10px' class='text'><img src='../../pic/ajax-loader.gif'/></div><br/>
1304 </div>
1305 </td>
1306 </tr>
1307 <?php } // end if ($vitals_is_registered && acl_check('patients', 'med')) ?>
1309 <?php
1310 // This generates a section similar to Vitals for each LBF form that
1311 // supports charting. The form ID is used as the "widget label".
1313 $gfres = sqlStatement("SELECT grp_form_id AS option_id, grp_title AS title, grp_aco_spec " .
1314 "FROM layout_group_properties WHERE " .
1315 "grp_form_id LIKE 'LBF%' AND grp_group_id = '' AND grp_repeats > 0 AND grp_activity = 1 " .
1316 "ORDER BY grp_seq, grp_title");
1317 while ($gfrow = sqlFetchArray($gfres)) {
1318 // $jobj = json_decode($gfrow['notes'], true);
1319 $LBF_ACO = empty($gfrow['grp_aco_spec']) ? false : explode('|', $gfrow['grp_aco_spec']);
1320 if ($LBF_ACO && !acl_check($LBF_ACO[0], $LBF_ACO[1])) {
1321 continue;
1322 } ?>
1323 <tr>
1324 <td width='650px'>
1325 <?php // vitals expand collapse widget
1326 $vitals_form_id = $gfrow['option_id'];
1327 $widgetTitle = $gfrow['title'];
1328 $widgetLabel = $vitals_form_id;
1329 $widgetButtonLabel = xl("Trend");
1330 $widgetButtonLink = "../encounter/trend_form.php?formname=$vitals_form_id";
1331 $widgetButtonClass = "";
1332 $linkMethod = "html";
1333 $bodyClass = "notab";
1334 $widgetAuth = false;
1335 if (!$LBF_ACO || acl_check($LBF_ACO[0], $LBF_ACO[1], '', 'write')) {
1336 // check to see if any instances exist for this patient
1337 $existVitals = sqlQuery(
1338 "SELECT * FROM forms WHERE pid = ? AND formdir = ? AND deleted = 0",
1339 array($pid, $vitals_form_id)
1341 $widgetAuth = $existVitals;
1344 $fixedWidth = true;
1345 expand_collapse_widget(
1346 $widgetTitle,
1347 $widgetLabel,
1348 $widgetButtonLabel,
1349 $widgetButtonLink,
1350 $widgetButtonClass,
1351 $linkMethod,
1352 $bodyClass,
1353 $widgetAuth,
1354 $fixedWidth
1355 ); ?>
1356 <br/>
1357 <div style='margin-left:10px' class='text'>
1358 <image src='../../pic/ajax-loader.gif'/>
1359 </div>
1360 <br/>
1361 </div> <!-- This is required by expand_collapse_widget(). -->
1362 </td>
1363 </tr>
1364 <?php
1365 } // end while
1368 </table>
1370 </div>
1371 <!-- end left column div -->
1373 <!-- start right column div -->
1374 <div>
1375 <table>
1376 <tr>
1377 <td>
1379 <div>
1380 <?php
1382 // If there is an ID Card or any Photos show the widget
1383 $photos = pic_array($pid, $GLOBALS['patient_photo_category_name']);
1384 if ($photos or $idcard_doc_id) {
1385 $widgetTitle = xl("ID Card") . '/' . xl("Photos");
1386 $widgetLabel = "photos";
1387 $linkMethod = "javascript";
1388 $bodyClass = "notab-right";
1389 $widgetAuth = false;
1390 $fixedWidth = false;
1391 expand_collapse_widget(
1392 $widgetTitle,
1393 $widgetLabel,
1394 $widgetButtonLabel,
1395 $widgetButtonLink,
1396 $widgetButtonClass,
1397 $linkMethod,
1398 $bodyClass,
1399 $widgetAuth,
1400 $fixedWidth
1403 <br />
1404 <?php
1405 if ($idcard_doc_id) {
1406 image_widget($idcard_doc_id, $GLOBALS['patient_id_category_name']);
1409 foreach ($photos as $photo_doc_id) {
1410 image_widget($photo_doc_id, $GLOBALS['patient_photo_category_name']);
1415 <br />
1416 </div>
1417 <div>
1418 <?php
1419 // Advance Directives
1420 if ($GLOBALS['advance_directives_warning']) {
1421 // advance directives expand collapse widget
1422 $widgetTitle = xl("Advance Directives");
1423 $widgetLabel = "directives";
1424 $widgetButtonLabel = xl("Edit");
1425 $widgetButtonLink = "return advdirconfigure();";
1426 $widgetButtonClass = "";
1427 $linkMethod = "javascript";
1428 $bodyClass = "summary_item small";
1429 $widgetAuth = true;
1430 $fixedWidth = false;
1431 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel, $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1432 $counterFlag = false; //flag to record whether any categories contain ad records
1433 $query = "SELECT id FROM categories WHERE name='Advance Directive'";
1434 $myrow2 = sqlQuery($query);
1435 if ($myrow2) {
1436 $parentId = $myrow2['id'];
1437 $query = "SELECT id, name FROM categories WHERE parent=?";
1438 $resNew1 = sqlStatement($query, array($parentId));
1439 while ($myrows3 = sqlFetchArray($resNew1)) {
1440 $categoryId = $myrows3['id'];
1441 $nameDoc = $myrows3['name'];
1442 $query = "SELECT documents.date, documents.id " .
1443 "FROM documents " .
1444 "INNER JOIN categories_to_documents " .
1445 "ON categories_to_documents.document_id=documents.id " .
1446 "WHERE categories_to_documents.category_id=? " .
1447 "AND documents.foreign_id=? " .
1448 "ORDER BY documents.date DESC";
1449 $resNew2 = sqlStatement($query, array($categoryId, $pid));
1450 $limitCounter = 0; // limit to one entry per category
1451 while (($myrows4 = sqlFetchArray($resNew2)) && ($limitCounter == 0)) {
1452 $dateTimeDoc = $myrows4['date'];
1453 // remove time from datetime stamp
1454 $tempParse = explode(" ", $dateTimeDoc);
1455 $dateDoc = $tempParse[0];
1456 $idDoc = $myrows4['id'];
1457 echo "<a href='$web_root/controller.php?document&retrieve&patient_id=" .
1458 htmlspecialchars($pid, ENT_QUOTES) . "&document_id=" .
1459 htmlspecialchars($idDoc, ENT_QUOTES) . "&as_file=true' onclick='top.restoreSession()'>" .
1460 htmlspecialchars(xl_document_category($nameDoc), ENT_NOQUOTES) . "</a> " .
1461 htmlspecialchars($dateDoc, ENT_NOQUOTES);
1462 echo "<br>";
1463 $limitCounter = $limitCounter + 1;
1464 $counterFlag = true;
1469 if (!$counterFlag) {
1470 echo "&nbsp;&nbsp;" . htmlspecialchars(xl('None'), ENT_NOQUOTES);
1471 } ?>
1472 </div>
1473 <?php
1474 } // close advanced dir block
1476 // Show Clinical Reminders for any user that has rules that are permitted.
1477 $clin_rem_check = resolve_rules_sql('', '0', true, '', $_SESSION['authUser']);
1478 if (!empty($clin_rem_check) && $GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_crw'] &&
1479 acl_check('patients', 'alert')) {
1480 // clinical summary expand collapse widget
1481 $widgetTitle = xl("Clinical Reminders");
1482 $widgetLabel = "clinical_reminders";
1483 $widgetButtonLabel = xl("Edit");
1484 $widgetButtonLink = "../reminder/clinical_reminders.php?patient_id=".$pid;
1486 $widgetButtonClass = "";
1487 $linkMethod = "html";
1488 $bodyClass = "summary_item small";
1489 $widgetAuth = acl_check('patients', 'alert', '', 'write');
1490 $fixedWidth = false;
1491 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel, $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1492 echo "<br/>";
1493 echo "<div style='margin-left:10px' class='text'><image src='../../pic/ajax-loader.gif'/></div><br/>";
1494 echo "</div>";
1495 } // end if crw
1497 // Show current and upcoming appointments.
1499 // Recurring appointment support and Appointment Display Sets
1500 // added to Appointments by Ian Jardine ( epsdky ).
1502 if (isset($pid) && !$GLOBALS['disable_calendar'] && acl_check('patients', 'appt')) {
1504 $current_date2 = date('Y-m-d');
1505 $events = array();
1506 $apptNum = (int)$GLOBALS['number_of_appts_to_show'];
1507 if ($apptNum != 0) {
1508 $apptNum2 = abs($apptNum);
1509 } else {
1510 $apptNum2 = 10;
1514 $mode1 = !$GLOBALS['appt_display_sets_option'];
1515 $colorSet1 = $GLOBALS['appt_display_sets_color_1'];
1516 $colorSet2 = $GLOBALS['appt_display_sets_color_2'];
1517 $colorSet3 = $GLOBALS['appt_display_sets_color_3'];
1518 $colorSet4 = $GLOBALS['appt_display_sets_color_4'];
1520 if ($mode1) {
1521 $extraAppts = 1;
1522 } else {
1523 $extraAppts = 6;
1526 $events = fetchNextXAppts($current_date2, $pid, $apptNum2 + $extraAppts, true);
1527 //////
1528 if ($events) {
1529 $selectNum = 0;
1530 $apptNumber = count($events);
1532 if ($apptNumber <= $apptNum2) {
1533 $extraApptDate = '';
1535 } else if ($mode1 && $apptNumber == $apptNum2 + 1) {
1536 $extraApptDate = $events[$apptNumber - 1]['pc_eventDate'];
1537 array_pop($events);
1538 --$apptNumber;
1539 $selectNum = 1;
1541 } else if ($apptNumber == $apptNum2 + 6) {
1542 $extraApptDate = $events[$apptNumber - 1]['pc_eventDate'];
1543 array_pop($events);
1544 --$apptNumber;
1545 $selectNum = 2;
1547 } else { // mode 2 - $apptNum2 < $apptNumber < $apptNum2 + 6
1548 $extraApptDate = '';
1549 $selectNum = 2;
1554 $limitApptIndx = $apptNum2 - 1;
1555 $limitApptDate = $events[$limitApptIndx]['pc_eventDate'];
1557 switch ($selectNum) {
1559 case 2:
1560 $lastApptIndx = $apptNumber - 1;
1561 $thisNumber = $lastApptIndx - $limitApptIndx;
1562 for ($i = 1; $i <= $thisNumber; ++$i) {
1563 if ($events[$limitApptIndx + $i]['pc_eventDate'] != $limitApptDate) {
1564 $extraApptDate = $events[$limitApptIndx + $i]['pc_eventDate'];
1565 $events = array_slice($events, 0, $limitApptIndx + $i);
1566 break;
1571 case 1:
1572 $firstApptIndx = 0;
1573 for ($i = 1; $i <= $limitApptIndx; ++$i) {
1574 if ($events[$limitApptIndx - $i]['pc_eventDate'] != $limitApptDate) {
1575 $firstApptIndx = $apptNum2 - $i;
1576 break;
1584 if ($extraApptDate) {
1585 if ($extraApptDate != $limitApptDate) {
1586 $apptStyle2 = " style='background-color:" . attr($colorSet3) . ";'";
1587 } else {
1588 $apptStyle2 = " style='background-color:" . attr($colorSet4) . ";'";
1593 //////
1595 // appointments expand collapse widget
1596 $widgetTitle = xl("Appointments");
1597 $widgetLabel = "appointments";
1598 $widgetButtonLabel = xl("Add");
1599 $widgetButtonLink = "return newEvt();";
1600 $widgetButtonClass = "";
1601 $linkMethod = "javascript";
1602 $bodyClass = "summary_item small";
1603 $widgetAuth = $resNotNull // $resNotNull reflects state of query in fetchAppointments
1604 && (acl_check('patients', 'appt', '', 'write') || acl_check('patients', 'appt', '', 'addonly'));
1605 $fixedWidth = false;
1606 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel, $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1607 $count = 0;
1609 $toggleSet = true;
1610 $priorDate = "";
1611 $therapyGroupCategories = array();
1612 $query = sqlStatement("SELECT pc_catid FROM openemr_postcalendar_categories WHERE pc_cattype = 3 AND pc_active = 1");
1613 while ($result = sqlFetchArray($query)) {
1614 $therapyGroupCategories[] = $result['pc_catid'];
1618 foreach ($events as $row) { //////
1619 $count++;
1620 $dayname = date("l", strtotime($row['pc_eventDate'])); //////
1621 $dispampm = "am";
1622 $disphour = substr($row['pc_startTime'], 0, 2) + 0;
1623 $dispmin = substr($row['pc_startTime'], 3, 2);
1624 if ($disphour >= 12) {
1625 $dispampm = "pm";
1626 if ($disphour > 12) {
1627 $disphour -= 12;
1631 $etitle = xl('(Click to edit)');
1632 if ($row['pc_hometext'] != "") {
1633 $etitle = xl('Comments').": ".($row['pc_hometext'])."\r\n".$etitle;
1636 //////
1637 if ($extraApptDate && $count > $firstApptIndx) {
1638 $apptStyle = $apptStyle2;
1639 } else {
1640 if ($row['pc_eventDate'] != $priorDate) {
1641 $priorDate = $row['pc_eventDate'];
1642 $toggleSet = !$toggleSet;
1645 if ($toggleSet) {
1646 $apptStyle = " style='background-color:" . attr($colorSet2) . ";'";
1647 } else {
1648 $apptStyle = " style='background-color:" . attr($colorSet1) . ";'";
1652 //////
1653 echo "<div " . $apptStyle . ">";
1654 if (!in_array($row['pc_catid'], $therapyGroupCategories)) {
1655 echo "<a href='javascript:oldEvt(" . htmlspecialchars(preg_replace("/-/", "", $row['pc_eventDate']), ENT_QUOTES) . ', ' . htmlspecialchars($row['pc_eid'], ENT_QUOTES) . ")' title='" . htmlspecialchars($etitle, ENT_QUOTES) . "'>";
1656 } else {
1657 echo "<span title='" . htmlspecialchars($etitle, ENT_QUOTES) . "'>";
1660 echo "<b>" . htmlspecialchars($row['pc_eventDate'], ENT_NOQUOTES) . ", ";
1661 echo htmlspecialchars(sprintf("%02d", $disphour) .":$dispmin " . xl($dispampm) . " (" . xl($dayname), ENT_NOQUOTES) . ")</b> ";
1662 if ($row['pc_recurrtype']) {
1663 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)."'>";
1666 echo "<span title='" . generate_display_field(array('data_type'=>'1','list_id'=>'apptstat'), $row['pc_apptstatus']) . "'>";
1667 echo "<br>" . xlt('Status') . "( " . htmlspecialchars($row['pc_apptstatus'], ENT_NOQUOTES) . " ) </span>";
1668 echo htmlspecialchars(xl_appt_category($row['pc_catname']), ENT_NOQUOTES) . "\n";
1669 if (in_array($row['pc_catid'], $therapyGroupCategories)) {
1670 echo "<br><span>" . xlt('Group name') .": " . text(getGroup($row['pc_gid'])['group_name']) . "</span>\n";
1673 if ($row['pc_hometext']) {
1674 echo " <span style='color:green'> Com</span>";
1677 echo "<br>" . htmlspecialchars($row['ufname'] . " " . $row['ulname'], ENT_NOQUOTES);
1678 echo !in_array($row['pc_catid'], $therapyGroupCategories) ? '</a>' : '<span>';
1679 echo "</div>\n";
1680 //////
1683 if ($resNotNull) { //////
1684 if ($count < 1) {
1685 echo "&nbsp;&nbsp;" . htmlspecialchars(xl('None'), ENT_NOQUOTES);
1686 } else { //////
1687 if ($extraApptDate) {
1688 echo "<div style='color:#0000cc;'><b>" . attr($extraApptDate) . " ( + ) </b></div>";
1689 } else {
1690 echo "<div><hr></div>";
1694 echo "</div>";
1696 } // End of Appointments.
1699 /* Widget that shows recurrences for appointments. */
1700 if (isset($pid) && !$GLOBALS['disable_calendar'] && $GLOBALS['appt_recurrences_widget'] &&
1701 acl_check('patients', 'appt')) {
1702 $widgetTitle = xl("Recurrent Appointments");
1703 $widgetLabel = "recurrent_appointments";
1704 $widgetButtonLabel = xl("Add");
1705 $widgetButtonLink = "return newEvt();";
1706 $widgetButtonClass = "";
1707 $linkMethod = "javascript";
1708 $bodyClass = "summary_item small";
1709 $widgetAuth = false;
1710 $fixedWidth = false;
1711 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel, $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1712 $count = 0;
1713 $toggleSet = true;
1714 $priorDate = "";
1716 //Fetch patient's recurrences. Function returns array with recurrence appointments' category, recurrence pattern (interpreted), and end date.
1717 $recurrences = fetchRecurrences($pid);
1718 if ($recurrences[0] == false) { //if there are no recurrent appointments:
1719 echo "<div>";
1720 echo "<span>" . "&nbsp;&nbsp;" . xlt('None') . "</span>";
1721 echo "</div></div>";
1722 } else {
1723 foreach ($recurrences as $row) {
1724 //checks if there are recurrences and if they are current (git didn't end yet)
1725 if ($row == false || !recurrence_is_current($row['pc_endDate'])) {
1726 continue;
1729 echo "<div>";
1730 echo "<span>" . xlt('Appointment Category') . ': ' . xlt($row['pc_catname']) . "</span>";
1731 echo "<br>";
1732 echo "<span>" . xlt('Recurrence') . ': ' . text($row['pc_recurrspec']) . "</span>";
1733 echo "<br>";
1734 $red_text = ""; //if ends in a week, make font red
1735 if (ends_in_a_week($row['pc_endDate'])) {
1736 $red_text = " style=\"color:red;\" ";
1739 echo "<span" . $red_text . ">" . xlt('End Date') . ': ' . text($row['pc_endDate']) . "</span>";
1740 echo "</div>";
1743 echo "</div>";
1747 /* End of recurrence widget */
1749 // Show PAST appointments.
1750 // added by Terry Hill to allow reverse sorting of the appointments
1751 $direction = "ASC";
1752 if ($GLOBALS['num_past_appointments_to_show'] < 0) {
1753 $direction = "DESC";
1754 ($showpast = -1 * $GLOBALS['num_past_appointments_to_show']);
1755 } else {
1756 $showpast = $GLOBALS['num_past_appointments_to_show'];
1759 if (isset($pid) && !$GLOBALS['disable_calendar'] && $showpast > 0 &&
1760 acl_check('patients', 'appt')) {
1761 $query = "SELECT e.pc_eid, e.pc_aid, e.pc_title, e.pc_eventDate, " .
1762 "e.pc_startTime, e.pc_hometext, u.fname, u.lname, u.mname, " .
1763 "c.pc_catname, e.pc_apptstatus " .
1764 "FROM openemr_postcalendar_events AS e, users AS u, " .
1765 "openemr_postcalendar_categories AS c WHERE " .
1766 "e.pc_pid = ? AND e.pc_eventDate < CURRENT_DATE AND " .
1767 "u.id = e.pc_aid AND e.pc_catid = c.pc_catid " .
1768 "ORDER BY e.pc_eventDate $direction , e.pc_startTime DESC " .
1769 "LIMIT " . $showpast;
1771 $pres = sqlStatement($query, array($pid));
1773 // appointments expand collapse widget
1774 $widgetTitle = xl("Past Appointments");
1775 $widgetLabel = "past_appointments";
1776 $widgetButtonLabel = '';
1777 $widgetButtonLink = '';
1778 $widgetButtonClass = '';
1779 $linkMethod = "javascript";
1780 $bodyClass = "summary_item small";
1781 $widgetAuth = false; //no button
1782 $fixedWidth = false;
1783 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel, $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1784 $count = 0;
1785 while ($row = sqlFetchArray($pres)) {
1786 $count++;
1787 $dayname = date("l", strtotime($row['pc_eventDate']));
1788 $dispampm = "am";
1789 $disphour = substr($row['pc_startTime'], 0, 2) + 0;
1790 $dispmin = substr($row['pc_startTime'], 3, 2);
1791 if ($disphour >= 12) {
1792 $dispampm = "pm";
1793 if ($disphour > 12) {
1794 $disphour -= 12;
1798 if ($row['pc_hometext'] != "") {
1799 $etitle = xl('Comments').": ".($row['pc_hometext'])."\r\n".$etitle;
1802 echo "<a href='javascript:oldEvt(" . htmlspecialchars(preg_replace("/-/", "", $row['pc_eventDate']), ENT_QUOTES) . ', ' . htmlspecialchars($row['pc_eid'], ENT_QUOTES) . ")' title='" . htmlspecialchars($etitle, ENT_QUOTES) . "'>";
1803 echo "<b>" . htmlspecialchars(xl($dayname) . ", " . $row['pc_eventDate'], ENT_NOQUOTES) . "</b>" . xlt("Status") . "(";
1804 echo " " . generate_display_field(array('data_type'=>'1','list_id'=>'apptstat'), $row['pc_apptstatus']) . ")<br>"; // can't use special char parser on this
1805 echo htmlspecialchars("$disphour:$dispmin ") . xl($dispampm) . " ";
1806 echo htmlspecialchars($row['fname'] . " " . $row['lname'], ENT_NOQUOTES) . "</a><br>\n";
1809 if (isset($pres) && $res != null) {
1810 if ($count < 1) {
1811 echo "&nbsp;&nbsp;" . htmlspecialchars(xl('None'), ENT_NOQUOTES);
1814 echo "</div>";
1818 // END of past appointments
1820 </div>
1822 <div id='stats_div'>
1823 <br/>
1824 <div style='margin-left:10px' class='text'><img src='../../pic/ajax-loader.gif'/></div><br/>
1825 </div>
1826 </td>
1827 </tr>
1829 <?php // TRACK ANYTHING -----
1831 // Determine if track_anything form is in use for this site.
1832 $tmp = sqlQuery("SELECT count(*) AS count FROM registry WHERE " .
1833 "directory = 'track_anything' AND state = 1");
1834 $track_is_registered = $tmp['count'];
1835 if ($track_is_registered) {
1836 echo "<tr> <td>";
1837 // track_anything expand collapse widget
1838 $widgetTitle = xl("Tracks");
1839 $widgetLabel = "track_anything";
1840 $widgetButtonLabel = xl("Tracks");
1841 $widgetButtonLink = "../../forms/track_anything/create.php";
1842 $widgetButtonClass = "";
1843 $widgetAuth = ""; // don't show the button
1844 $linkMethod = "html";
1845 $bodyClass = "notab";
1846 // check to see if any tracks exist
1847 $spruch = "SELECT id " .
1848 "FROM forms " .
1849 "WHERE pid = ? " .
1850 "AND formdir = ? ";
1851 $existTracks = sqlQuery($spruch, array($pid, "track_anything"));
1853 $fixedWidth = false;
1854 expand_collapse_widget(
1855 $widgetTitle,
1856 $widgetLabel,
1857 $widgetButtonLabel,
1858 $widgetButtonLink,
1859 $widgetButtonClass,
1860 $linkMethod,
1861 $bodyClass,
1862 $widgetAuth,
1863 $fixedWidth
1866 <br/>
1867 <div style='margin-left:10px' class='text'><img src='../../pic/ajax-loader.gif'/></div><br/>
1868 </div>
1869 </td>
1870 </tr><?php
1871 } // end track_anything ?>
1872 </table>
1874 </div> <!-- end right column div -->
1876 </td>
1878 </tr>
1879 </table>
1881 </div> <!-- end main content div -->
1883 <script language='JavaScript'>
1884 // Array of skip conditions for the checkSkipConditions() function.
1885 var skipArray = [
1886 <?php echo $condition_str; ?>
1888 checkSkipConditions();
1889 </script>
1891 </body>
1892 </html>