Moved recent v5.0.0 statement fix to current master.
[openemr.git] / interface / patient_file / summary / demographics.php
blobaf1b2a618a573712d5659ebf19294f84b51dec3a
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' : 500,
297 'frameWidth' : 800,
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 option_id FROM list_options WHERE " .
343 "list_id = 'lbfnames' AND option_value > 0 AND activity = 1 ORDER BY seq, title");
344 while ($gfrow = sqlFetchArray($gfres)) { ?>
345 $("#<?php echo $gfrow['option_id']; ?>_ps_expand").load("lbf_fragment.php?formname=<?php echo $gfrow['option_id']; ?>");<?php
349 // fancy box
350 enable_modals();
352 tabbify();
354 // modal for dialog boxes
355 $(".large_modal").fancybox( {
356 'overlayOpacity' : 0.0,
357 'showCloseButton' : true,
358 'frameHeight' : 600,
359 'frameWidth' : 1000,
360 'centerOnScroll' : false
363 // modal for image viewer
364 $(".image_modal").fancybox( {
365 'overlayOpacity' : 0.0,
366 'showCloseButton' : true,
367 'centerOnScroll' : false,
368 'autoscale' : true
371 $(".iframe1").fancybox( {
372 'left':10,
373 'overlayOpacity' : 0.0,
374 'showCloseButton' : true,
375 'frameHeight' : 300,
376 'frameWidth' : 350
378 // special size for patient portal
379 $(".small_modal").fancybox( {
380 'overlayOpacity' : 0.0,
381 'showCloseButton' : true,
382 'frameHeight' : 200,
383 'frameWidth' : 380,
384 'centerOnScroll' : false
387 <?php if ($active_reminders || $all_allergy_alerts) { ?>
388 // show the active reminder modal
389 $("#reminder_popup_link").fancybox({
390 'overlayOpacity' : 0.0,
391 'showCloseButton' : true,
392 'frameHeight' : 500,
393 'frameWidth' : 500,
394 'centerOnScroll' : false
395 }).trigger('click');
396 <?php } ?>
398 <?php if ($GLOBALS['patient_birthday_alert']) {
399 // To display the birthday alert:
400 // 1. The patient is not deceased
401 // 2. The birthday is today (or in the past depending on global selection)
402 // 3. The notification has not been turned off (or shown depending on global selection) for this year
403 $birthdayAlert = new BirthdayReminder($pid, $_SESSION['authId']);
404 if ($birthdayAlert->isDisplayBirthdayAlert()) {
406 // show the active reminder modal
407 $("#birthday_popup").fancybox({
408 'overlayOpacity' : 0.0,
409 'showCloseButton' : true,
410 'frameHeight' : 170,
411 'frameWidth' : 200,
412 'centerOnScroll' : false
413 }).trigger('click');
414 <?php } ?>
415 <?php } ?>
419 // JavaScript stuff to do when a new patient is set.
421 function setMyPatient() {
422 // Avoid race conditions with loading of the left_nav or Title frame.
423 if (!parent.allFramesLoaded()) {
424 setTimeout("setMyPatient()", 500);
425 return;
427 <?php if (isset($_GET['set_pid'])) { ?>
428 parent.left_nav.setPatient(<?php echo "'" . addslashes($result['fname']) . " " . addslashes($result['lname']) .
429 "'," . addslashes($pid) . ",'" . addslashes($result['pubpid']) .
430 "','', ' " . xls('DOB') . ": " . addslashes(oeFormatShortDate($result['DOB_YMD'])) . " " . xls('Age') . ": " . addslashes(getPatientAgeDisplay($result['DOB_YMD'])) . "'"; ?>);
431 var EncounterDateArray = new Array;
432 var CalendarCategoryArray = new Array;
433 var EncounterIdArray = new Array;
434 var Count = 0;
435 <?php
436 //Encounter details are stored to javacript as array.
437 $result4 = sqlStatement("SELECT fe.encounter,fe.date,openemr_postcalendar_categories.pc_catname FROM form_encounter AS fe ".
438 " left join openemr_postcalendar_categories on fe.pc_catid=openemr_postcalendar_categories.pc_catid WHERE fe.pid = ? order by fe.date desc", array($pid));
439 if (sqlNumRows($result4)>0) {
440 while ($rowresult4 = sqlFetchArray($result4)) {
442 EncounterIdArray[Count] = '<?php echo addslashes($rowresult4['encounter']); ?>';
443 EncounterDateArray[Count] = '<?php echo addslashes(oeFormatShortDate(date("Y-m-d", strtotime($rowresult4['date'])))); ?>';
444 CalendarCategoryArray[Count] = '<?php echo addslashes(xl_appt_category($rowresult4['pc_catname'])); ?>';
445 Count++;
446 <?php
450 parent.left_nav.setPatientEncounter(EncounterIdArray,EncounterDateArray,CalendarCategoryArray);
451 <?php } // end setting new pid ?>
452 parent.left_nav.syncRadios();
453 <?php if ((isset($_GET['set_pid']) ) && (isset($_GET['set_encounterid'])) && ( intval($_GET['set_encounterid']) > 0 )) {
454 $encounter = intval($_GET['set_encounterid']);
455 $_SESSION['encounter'] = $encounter;
456 $query_result = sqlQuery("SELECT `date` FROM `form_encounter` WHERE `encounter` = ?", array($encounter)); ?>
457 encurl = 'encounter/encounter_top.php?set_encounter=' + <?php echo attr($encounter);?> + '&pid=' + <?php echo attr($pid);?>;
458 <?php if ($GLOBALS['new_tabs_layout']) { ?>
459 parent.left_nav.setEncounter('<?php echo oeFormatShortDate(date("Y-m-d", strtotime($query_result['date']))); ?>', '<?php echo attr($encounter); ?>', 'enc');
460 top.restoreSession();
461 parent.left_nav.loadFrame('enc2', 'enc', 'patient_file/' + encurl);
462 <?php } else { ?>
463 var othername = (window.name == 'RTop') ? 'RBot' : 'RTop';
464 parent.left_nav.setEncounter('<?php echo oeFormatShortDate(date("Y-m-d", strtotime($query_result['date']))); ?>', '<?php echo attr($encounter); ?>', othername);
465 top.restoreSession();
466 parent.frames[othername].location.href = '../' + encurl;
467 <?php } ?>
468 <?php } // end setting new encounter id (only if new pid is also set) ?>
471 $(window).load(function() {
472 setMyPatient();
475 </script>
477 <style type="css/text">
478 #pnotes_ps_expand {
479 height:auto;
480 width:100%;
482 </style>
484 </head>
486 <body class="body_top patient-demographics">
488 <a href='../reminder/active_reminder_popup.php' id='reminder_popup_link' style='display: none;' class='iframe' onclick='top.restoreSession()'></a>
490 <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>
491 <?php
492 $thisauth = acl_check('patients', 'demo');
493 if ($thisauth) {
494 if ($result['squad'] && ! acl_check('squads', $result['squad'])) {
495 $thisauth = 0;
499 if (!$thisauth) {
500 echo "<p>(" . htmlspecialchars(xl('Demographics not authorized'), ENT_NOQUOTES) . ")</p>\n";
501 echo "</body>\n</html>\n";
502 exit();
505 if ($thisauth) : ?>
507 <table class="table_header">
508 <tr>
509 <td>
510 <span class='title'>
511 <?php echo htmlspecialchars(getPatientName($pid), ENT_NOQUOTES); ?>
512 </span>
513 </td>
514 <?php if (acl_check('admin', 'super') && $GLOBALS['allow_pat_delete']) : ?>
515 <td style='padding-left:1em;' class="delete">
516 <a class='css_button iframe'
517 href='../deleter.php?patient=<?php echo htmlspecialchars($pid, ENT_QUOTES);?>'
518 onclick='top.restoreSession()'>
519 <span><?php echo htmlspecialchars(xl('Delete'), ENT_NOQUOTES);?></span>
520 </a>
521 </td>
522 <?php endif; // Allow PT delete
523 if ($GLOBALS['erx_enable']) : ?>
524 <td style="padding-left:1em;" class="erx">
525 <a class="css_button" href="../../eRx.php?page=medentry" onclick="top.restoreSession()">
526 <span><?php echo htmlspecialchars(xl('NewCrop MedEntry'), ENT_NOQUOTES);?></span>
527 </a>
528 </td>
529 <td style="padding-left:1em;">
530 <a class="css_button iframe1"
531 href="../../soap_functions/soap_accountStatusDetails.php"
532 onclick="top.restoreSession()">
533 <span><?php echo htmlspecialchars(xl('NewCrop Account Status'), ENT_NOQUOTES);?></span>
534 </a>
535 </td>
536 <td id='accountstatus'></td>
537 <?php endif; // eRX Enabled
538 //Patient Portal
539 $portalUserSetting = true; //flag to see if patient has authorized access to portal
540 if (($GLOBALS['portal_onsite_enable'] && $GLOBALS['portal_onsite_address']) ||
541 ($GLOBALS['portal_onsite_two_enable'] && $GLOBALS['portal_onsite_two_address']) ) :
542 $portalStatus = sqlQuery("SELECT allow_patient_portal FROM patient_data WHERE pid=?", array($pid));
543 if ($portalStatus['allow_patient_portal']=='YES') :
544 $portalLogin = sqlQuery("SELECT pid FROM `patient_access_onsite` WHERE `pid`=?", array($pid));?>
545 <td style='padding-left:1em;'>
546 <a class='css_button iframe small_modal'
547 href='create_portallogin.php?portalsite=on&patient=<?php echo htmlspecialchars($pid, ENT_QUOTES);?>'
548 onclick='top.restoreSession()'>
549 <?php $display = (empty($portalLogin)) ? xlt('Create Onsite Portal Credentials') : xlt('Reset Onsite Portal Credentials'); ?>
550 <span><?php echo $display; ?></span>
551 </a>
552 </td>
553 <?php
554 else :
555 $portalUserSetting = false;
556 endif; // allow patient portal
557 endif; // Onsite Patient Portal
558 if ($GLOBALS['portal_offsite_enable'] && $GLOBALS['portal_offsite_address']) :
559 $portalStatus = sqlQuery("SELECT allow_patient_portal FROM patient_data WHERE pid=?", array($pid));
560 if ($portalStatus['allow_patient_portal']=='YES') :
561 $portalLogin = sqlQuery("SELECT pid FROM `patient_access_offsite` WHERE `pid`=?", array($pid));
563 <td style='padding-left:1em;'>
564 <a class='css_button iframe small_modal'
565 href='create_portallogin.php?portalsite=off&patient=<?php echo htmlspecialchars($pid, ENT_QUOTES);?>'
566 onclick='top.restoreSession()'>
567 <span>
568 <?php $text = (empty($portalLogin)) ? xlt('Create Offsite Portal Credentials') : xlt('Reset Offsite Portal Credentials'); ?>
569 <?php echo $text; ?>
570 </span>
571 </a>
572 </td>
573 <?php
574 else :
575 $portalUserSetting = false;
576 endif; // allow_patient_portal
577 endif; // portal_offsite_enable
578 if (!($portalUserSetting)) : // Show that the patient has not authorized portal access ?>
579 <td style='padding-left:1em;'>
580 <?php echo htmlspecialchars(xl('Patient has not authorized the Patient Portal.'), ENT_NOQUOTES);?>
581 </td>
582 <?php endif;
583 //Patient Portal
585 // If patient is deceased, then show this (along with the number of days patient has been deceased for)
586 $days_deceased = is_patient_deceased($pid);
587 if ($days_deceased != null) : ?>
588 <td class="deceased" style="padding-left:1em;font-weight:bold;color:red">
589 <?php
590 if ($days_deceased == 0) {
591 echo xlt("DECEASED (Today)");
592 } else if ($days_deceased == 1) {
593 echo xlt("DECEASED (1 day ago)");
594 } else {
595 echo xlt("DECEASED") . " (" . text($days_deceased) . " " . xlt("days ago") . ")";
596 } ?>
597 </td>
598 <?php endif; ?>
599 </tr>
600 </table>
602 <?php
603 endif; // $thisauth
606 <?php
607 // Get the document ID of the patient ID card if access to it is wanted here.
608 $idcard_doc_id = false;
609 if ($GLOBALS['patient_id_category_name']) {
610 $idcard_doc_id = get_document_by_catg($pid, $GLOBALS['patient_id_category_name']);
614 <table cellspacing='0' cellpadding='0' border='0' class="subnav">
615 <tr>
616 <td class="small" colspan='4'>
617 <a href="../history/history.php" onclick='top.restoreSession()'>
618 <?php echo htmlspecialchars(xl('History'), ENT_NOQUOTES); ?></a>
620 <?php //note that we have temporarily removed report screen from the modal view ?>
621 <a href="../report/patient_report.php" onclick='top.restoreSession()'>
622 <?php echo htmlspecialchars(xl('Report'), ENT_NOQUOTES); ?></a>
624 <?php //note that we have temporarily removed document screen from the modal view ?>
625 <a href="../../../controller.php?document&list&patient_id=<?php echo $pid;?>" onclick='top.restoreSession()'>
626 <?php echo htmlspecialchars(xl('Documents'), ENT_NOQUOTES); ?></a>
628 <a href="../transaction/transactions.php" onclick='top.restoreSession()'>
629 <?php echo htmlspecialchars(xl('Transactions'), ENT_NOQUOTES); ?></a>
631 <a href="stats_full.php?active=all" onclick='top.restoreSession()'>
632 <?php echo htmlspecialchars(xl('Issues'), ENT_NOQUOTES); ?></a>
634 <a href="../../reports/pat_ledger.php?form=1&patient_id=<?php echo attr($pid);?>" onclick='top.restoreSession()'>
635 <?php echo xlt('Ledger'); ?></a>
637 <a href="../../reports/external_data.php" onclick='top.restoreSession()'>
638 <?php echo xlt('External Data'); ?></a>
640 <!-- DISPLAYING HOOKS STARTS HERE -->
641 <?php
642 $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
643 LEFT OUTER JOIN modules_settings AS ms ON obj_name=enabled_hooks AND ms.mod_id=msh.mod_id
644 LEFT OUTER JOIN modules AS m ON m.mod_id=ms.mod_id
645 WHERE fld_type=3 AND mod_active=1 AND sql_run=1 AND attached_to='demographics' ORDER BY mod_id");
646 $DivId = 'mod_installer';
647 if (sqlNumRows($module_query)) {
648 $jid = 0;
649 $modid = '';
650 while ($modulerow = sqlFetchArray($module_query)) {
651 $DivId = 'mod_'.$modulerow['mod_id'];
652 $new_category = $modulerow['mod_ui_name'];
653 $modulePath = "";
654 $added = "";
655 if ($modulerow['type'] == 0) {
656 $modulePath = $GLOBALS['customModDir'];
657 $added = "";
658 } else {
659 $added = "index";
660 $modulePath = $GLOBALS['zendModDir'];
663 if (!acl_check('admin', 'super') && !zh_acl_check($_SESSION['authUserID'], $modulerow['obj_name'])) {
664 continue;
667 $relative_link = "../../modules/".$modulePath."/".$modulerow['path'];
668 $nickname = $modulerow['menu_name'] ? $modulerow['menu_name'] : 'Noname';
669 $jid++;
670 $modid = $modulerow['mod_id'];
673 <a href="<?php echo $relative_link; ?>" onclick='top.restoreSession()'>
674 <?php echo xlt($nickname); ?></a>
675 <?php
679 <!-- DISPLAYING HOOKS ENDS HERE -->
681 </td>
682 </tr>
683 </table> <!-- end header -->
685 <div style='margin-top:10px' class="main"> <!-- start main content div -->
686 <table border="0" cellspacing="0" cellpadding="0" width="100%">
687 <tr>
688 <td class="demographics-box" align="left" valign="top">
689 <!-- start left column div -->
690 <div style='float:left; margin-right:20px'>
692 <table cellspacing=0 cellpadding=0>
693 <?php if (!$GLOBALS['hide_billing_widget']) { ?>
694 <tr>
695 <td>
696 <?php
697 // Billing expand collapse widget
698 $widgetTitle = xl("Billing");
699 $widgetLabel = "billing";
700 $widgetButtonLabel = xl("Edit");
701 $widgetButtonLink = "return newEvt();";
702 $widgetButtonClass = "";
703 $linkMethod = "javascript";
704 $bodyClass = "notab";
705 $widgetAuth = false;
706 $fixedWidth = true;
707 if ($GLOBALS['force_billing_widget_open']) {
708 $forceExpandAlways = true;
709 } else {
710 $forceExpandAlways = false;
713 expand_collapse_widget(
714 $widgetTitle,
715 $widgetLabel,
716 $widgetButtonLabel,
717 $widgetButtonLink,
718 $widgetButtonClass,
719 $linkMethod,
720 $bodyClass,
721 $widgetAuth,
722 $fixedWidth,
723 $forceExpandAlways
726 <br>
727 <?php
728 //PATIENT BALANCE,INS BALANCE naina@capminds.com
729 $patientbalance = get_patient_balance($pid, false);
730 //Debit the patient balance from insurance balance
731 $insurancebalance = get_patient_balance($pid, true) - $patientbalance;
732 $totalbalance=$patientbalance + $insurancebalance;
734 // Show current balance and billing note, if any.
735 echo "<table border='0'><tr><td>" .
736 "<table ><tr><td><span class='bold'><font color='red'>" .
737 xlt('Patient Balance Due') .
738 " : " . text(oeFormatMoney($patientbalance)) .
739 "</font></span></td></tr>".
740 "<tr><td><span class='bold'><font color='red'>" .
741 xlt('Insurance Balance Due') .
742 " : " . text(oeFormatMoney($insurancebalance)) .
743 "</font></span></td></tr>".
744 "<tr><td><span class='bold'><font color='red'>" .
745 xlt('Total Balance Due').
746 " : " . text(oeFormatMoney($totalbalance)) .
747 "</font></span></td></td></tr>";
748 if (!empty($result['billing_note'])) {
749 echo "<tr><td><span class='bold'><font color='red'>" .
750 xlt('Billing Note') . ":" .
751 text($result['billing_note']) .
752 "</font></span></td></tr>";
755 if ($result3['provider']) { // Use provider in case there is an ins record w/ unassigned insco
756 echo "<tr><td><span class='bold'>" .
757 xlt('Primary Insurance') . ': ' . text($insco_name) .
758 "</span>&nbsp;&nbsp;&nbsp;";
759 if ($result3['copay'] > 0) {
760 echo "<span class='bold'>" .
761 xlt('Copay') . ': ' . text($result3['copay']) .
762 "</span>&nbsp;&nbsp;&nbsp;";
765 echo "<span class='bold'>" .
766 xlt('Effective Date') . ': ' . text(oeFormatShortDate($result3['effdate'])) .
767 "</span></td></tr>";
770 echo "</table></td></tr></td></tr></table><br>";
773 </div> <!-- required for expand_collapse_widget -->
774 </td>
775 </tr>
776 <?php } ?>
778 <?php if (acl_check('patients', 'demo')) { ?>
779 <tr>
780 <td>
781 <?php
782 // Demographics expand collapse widget
783 $widgetTitle = xl("Demographics");
784 $widgetLabel = "demographics";
785 $widgetButtonLabel = xl("Edit");
786 $widgetButtonLink = "demographics_full.php";
787 $widgetButtonClass = "";
788 $linkMethod = "html";
789 $bodyClass = "";
790 $widgetAuth = acl_check('patients', 'demo', '', 'write');
791 $fixedWidth = true;
792 expand_collapse_widget(
793 $widgetTitle,
794 $widgetLabel,
795 $widgetButtonLabel,
796 $widgetButtonLink,
797 $widgetButtonClass,
798 $linkMethod,
799 $bodyClass,
800 $widgetAuth,
801 $fixedWidth
804 <div id="DEM" >
805 <ul class="tabNav">
806 <?php display_layout_tabs('DEM', $result, $result2); ?>
807 </ul>
808 <div class="tabContainer">
809 <?php display_layout_tabs_data('DEM', $result, $result2); ?>
810 </div>
811 </div>
812 </div> <!-- required for expand_collapse_widget -->
813 </td>
814 </tr>
816 <tr>
817 <td>
818 <?php
819 $insurance_count = 0;
820 foreach (array('primary','secondary','tertiary') as $instype) {
821 $enddate = 'Present';
822 $query = "SELECT * FROM insurance_data WHERE " .
823 "pid = ? AND type = ? " .
824 "ORDER BY date DESC";
825 $res = sqlStatement($query, array($pid, $instype));
826 while ($row = sqlFetchArray($res)) {
827 if ($row['provider']) {
828 $insurance_count++;
833 if ($insurance_count > 0) {
834 // Insurance expand collapse widget
835 $widgetTitle = xl("Insurance");
836 $widgetLabel = "insurance";
837 $widgetButtonLabel = xl("Edit");
838 $widgetButtonLink = "demographics_full.php";
839 $widgetButtonClass = "";
840 $linkMethod = "html";
841 $bodyClass = "";
842 $widgetAuth = acl_check('patients', 'demo', '', 'write');
843 $fixedWidth = true;
844 expand_collapse_widget(
845 $widgetTitle,
846 $widgetLabel,
847 $widgetButtonLabel,
848 $widgetButtonLink,
849 $widgetButtonClass,
850 $linkMethod,
851 $bodyClass,
852 $widgetAuth,
853 $fixedWidth
856 if ($insurance_count > 0) {
859 <ul class="tabNav"><?php
860 ///////////////////////////////// INSURANCE SECTION
861 $first = true;
862 foreach (array('primary','secondary','tertiary') as $instype) {
863 $query = "SELECT * FROM insurance_data WHERE " .
864 "pid = ? AND type = ? " .
865 "ORDER BY date DESC";
866 $res = sqlStatement($query, array($pid, $instype));
868 $enddate = 'Present';
870 while ($row = sqlFetchArray($res)) {
871 if ($row['provider']) {
872 $ins_description = ucfirst($instype);
873 $ins_description = xl($ins_description);
874 $ins_description .= strcmp($enddate, 'Present') != 0 ? " (".xl('Old').")" : "";
876 <li <?php echo $first ? 'class="current"' : '' ?>><a href="#">
877 <?php echo htmlspecialchars($ins_description, ENT_NOQUOTES); ?></a></li>
878 <?php
879 $first = false;
882 $enddate = $row['date'];
886 // Display the eligibility tab
887 echo "<li><a href='#'>" .
888 htmlspecialchars(xl('Eligibility'), ENT_NOQUOTES) . "</a></li>";
890 ?></ul><?php
891 } ?>
893 <div class="tabContainer">
894 <?php
895 $first = true;
896 foreach (array('primary','secondary','tertiary') as $instype) {
897 $enddate = 'Present';
899 $query = "SELECT * FROM insurance_data WHERE " .
900 "pid = ? AND type = ? " .
901 "ORDER BY date DESC";
902 $res = sqlStatement($query, array($pid, $instype));
903 while ($row = sqlFetchArray($res)) {
904 if ($row['provider']) {
906 <div class="tab <?php echo $first ? 'current' : '' ?>">
907 <table border='0' cellpadding='0' width='100%'>
908 <?php
909 $icobj = new InsuranceCompany($row['provider']);
910 $adobj = $icobj->get_address();
911 $insco_name = trim($icobj->get_name());
913 <tr>
914 <td valign='top' colspan='3'>
915 <span class='text'>
916 <?php
917 if (strcmp($enddate, 'Present') != 0) {
918 echo htmlspecialchars(xl("Old"), ENT_NOQUOTES)." ";
921 <?php $tempinstype=ucfirst($instype);
922 echo htmlspecialchars(xl($tempinstype.' Insurance'), ENT_NOQUOTES); ?>
923 <?php if (strcmp($row['date'], '0000-00-00') != 0) { ?>
924 <?php echo htmlspecialchars(xl('from', '', ' ', ' ').$row['date'], ENT_NOQUOTES); ?>
925 <?php } ?>
926 <?php echo htmlspecialchars(xl('until', '', ' ', ' '), ENT_NOQUOTES);
927 echo (strcmp($enddate, 'Present') != 0) ? $enddate : htmlspecialchars(xl('Present'), ENT_NOQUOTES); ?>:</span>
928 </td>
929 </tr>
930 <tr>
931 <td valign='top'>
932 <span class='text'>
933 <?php
934 if ($insco_name) {
935 echo htmlspecialchars($insco_name, ENT_NOQUOTES) . '<br>';
936 if (trim($adobj->get_line1())) {
937 echo htmlspecialchars($adobj->get_line1(), ENT_NOQUOTES) . '<br>';
938 echo htmlspecialchars($adobj->get_city() . ', ' . $adobj->get_state() . ' ' . $adobj->get_zip(), ENT_NOQUOTES);
940 } else {
941 echo "<font color='red'><b>".htmlspecialchars(xl('Unassigned'), ENT_NOQUOTES)."</b></font>";
944 <br>
945 <?php echo htmlspecialchars(xl('Policy Number'), ENT_NOQUOTES); ?>:
946 <?php echo htmlspecialchars($row['policy_number'], ENT_NOQUOTES) ?><br>
947 <?php echo htmlspecialchars(xl('Plan Name'), ENT_NOQUOTES); ?>:
948 <?php echo htmlspecialchars($row['plan_name'], ENT_NOQUOTES); ?><br>
949 <?php echo htmlspecialchars(xl('Group Number'), ENT_NOQUOTES); ?>:
950 <?php echo htmlspecialchars($row['group_number'], ENT_NOQUOTES); ?></span>
951 </td>
952 <td valign='top'>
953 <span class='bold'><?php echo htmlspecialchars(xl('Subscriber'), ENT_NOQUOTES); ?>: </span><br>
954 <span class='text'><?php echo htmlspecialchars($row['subscriber_fname'] . ' ' . $row['subscriber_mname'] . ' ' . $row['subscriber_lname'], ENT_NOQUOTES); ?>
955 <?php
956 if ($row['subscriber_relationship'] != "") {
957 echo "(" . htmlspecialchars($row['subscriber_relationship'], ENT_NOQUOTES) . ")";
960 <br>
961 <?php echo htmlspecialchars(xl('S.S.'), ENT_NOQUOTES); ?>:
962 <?php echo htmlspecialchars($row['subscriber_ss'], ENT_NOQUOTES); ?><br>
963 <?php echo htmlspecialchars(xl('D.O.B.'), ENT_NOQUOTES); ?>:
964 <?php
965 if ($row['subscriber_DOB'] != "0000-00-00 00:00:00") {
966 echo htmlspecialchars($row['subscriber_DOB'], ENT_NOQUOTES);
968 ?><br>
969 <?php echo htmlspecialchars(xl('Phone'), ENT_NOQUOTES); ?>:
970 <?php echo htmlspecialchars($row['subscriber_phone'], ENT_NOQUOTES); ?>
971 </span>
972 </td>
973 <td valign='top'>
974 <span class='bold'><?php echo htmlspecialchars(xl('Subscriber Address'), ENT_NOQUOTES); ?>: </span><br>
975 <span class='text'><?php echo htmlspecialchars($row['subscriber_street'], ENT_NOQUOTES); ?><br>
976 <?php echo htmlspecialchars($row['subscriber_city'], ENT_NOQUOTES); ?>
977 <?php
978 if ($row['subscriber_state'] != "") {
979 echo ", ";
982 echo htmlspecialchars($row['subscriber_state'], ENT_NOQUOTES); ?>
983 <?php
984 if ($row['subscriber_country'] != "") {
985 echo ", ";
988 echo htmlspecialchars($row['subscriber_country'], ENT_NOQUOTES); ?>
989 <?php echo " " . htmlspecialchars($row['subscriber_postal_code'], ENT_NOQUOTES); ?></span>
991 <?php if (trim($row['subscriber_employer'])) { ?>
992 <br><span class='bold'><?php echo htmlspecialchars(xl('Subscriber Employer'), ENT_NOQUOTES); ?>: </span><br>
993 <span class='text'><?php echo htmlspecialchars($row['subscriber_employer'], ENT_NOQUOTES); ?><br>
994 <?php echo htmlspecialchars($row['subscriber_employer_street'], ENT_NOQUOTES); ?><br>
995 <?php echo htmlspecialchars($row['subscriber_employer_city'], ENT_NOQUOTES); ?>
996 <?php
997 if ($row['subscriber_employer_city'] != "") {
998 echo ", ";
1001 echo htmlspecialchars($row['subscriber_employer_state'], ENT_NOQUOTES); ?>
1002 <?php
1003 if ($row['subscriber_employer_country'] != "") {
1004 echo ", ";
1007 echo htmlspecialchars($row['subscriber_employer_country'], ENT_NOQUOTES); ?>
1008 <?php echo " " . htmlspecialchars($row['subscriber_employer_postal_code'], ENT_NOQUOTES); ?>
1009 </span>
1010 <?php } ?>
1012 </td>
1013 </tr>
1014 <tr>
1015 <td>
1016 <?php if ($row['copay'] != "") { ?>
1017 <span class='bold'><?php echo htmlspecialchars(xl('CoPay'), ENT_NOQUOTES); ?>: </span>
1018 <span class='text'><?php echo htmlspecialchars($row['copay'], ENT_NOQUOTES); ?></span>
1019 <br />
1020 <?php } ?>
1021 <span class='bold'><?php echo htmlspecialchars(xl('Accept Assignment'), ENT_NOQUOTES); ?>:</span>
1022 <span class='text'>
1023 <?php
1024 if ($row['accept_assignment'] == "TRUE") {
1025 echo xl("YES");
1027 if ($row['accept_assignment'] == "FALSE") {
1028 echo xl("NO");
1031 </span>
1032 <?php if (!empty($row['policy_type'])) { ?>
1033 <br />
1034 <span class='bold'><?php echo htmlspecialchars(xl('Secondary Medicare Type'), ENT_NOQUOTES); ?>: </span>
1035 <span class='text'><?php echo htmlspecialchars($policy_types[$row['policy_type']], ENT_NOQUOTES); ?></span>
1036 <?php } ?>
1037 </td>
1038 <td valign='top'></td>
1039 <td valign='top'></td>
1040 </tr>
1042 </table>
1043 </div>
1044 <?php
1045 } // end if ($row['provider'])
1046 $enddate = $row['date'];
1047 $first = false;
1048 } // end while
1049 } // end foreach
1051 // Display the eligibility information
1052 echo "<div class='tab'>";
1053 show_eligibility_information($pid, true);
1054 echo "</div>";
1056 ///////////////////////////////// END INSURANCE SECTION
1058 </div>
1060 <?php } // ?>
1062 </td>
1063 </tr>
1064 <?php } // end if demographics authorized ?>
1066 <?php if (acl_check('patients', 'notes')) { ?>
1067 <tr>
1068 <td width='650px'>
1069 <?php
1070 // Notes expand collapse widget
1071 $widgetTitle = xl("Notes");
1072 $widgetLabel = "pnotes";
1073 $widgetButtonLabel = xl("Edit");
1074 $widgetButtonLink = "pnotes_full.php?form_active=1";
1075 $widgetButtonClass = "";
1076 $linkMethod = "html";
1077 $bodyClass = "notab";
1078 $widgetAuth = acl_check('patients', 'notes', '', 'write');
1079 $fixedWidth = true;
1080 expand_collapse_widget(
1081 $widgetTitle,
1082 $widgetLabel,
1083 $widgetButtonLabel,
1084 $widgetButtonLink,
1085 $widgetButtonClass,
1086 $linkMethod,
1087 $bodyClass,
1088 $widgetAuth,
1089 $fixedWidth
1092 <br/>
1093 <div style='margin-left:10px' class='text'><img src='../../pic/ajax-loader.gif'/></div><br/>
1094 </div>
1095 </td>
1096 </tr>
1097 <?php } // end if notes authorized ?>
1099 <?php if (acl_check('patients', 'reminder') && $GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_prw']) {
1100 echo "<tr><td width='650px'>";
1101 // patient reminders collapse widget
1102 $widgetTitle = xl("Patient Reminders");
1103 $widgetLabel = "patient_reminders";
1104 $widgetButtonLabel = xl("Edit");
1105 $widgetButtonLink = "../reminder/patient_reminders.php?mode=simple&patient_id=".$pid;
1106 $widgetButtonClass = "";
1107 $linkMethod = "html";
1108 $bodyClass = "notab";
1109 $widgetAuth = acl_check('patients', 'reminder', '', 'write');
1110 $fixedWidth = true;
1111 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel, $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth); ?>
1112 <br/>
1113 <div style='margin-left:10px' class='text'><image src='../../pic/ajax-loader.gif'/></div><br/>
1114 </div>
1115 </td>
1116 </tr>
1117 <?php } //end if prw is activated ?>
1119 <?php if (acl_check('patients', 'disclosure')) { ?>
1120 <tr>
1121 <td width='650px'>
1122 <?php
1123 // disclosures expand collapse widget
1124 $widgetTitle = xl("Disclosures");
1125 $widgetLabel = "disclosures";
1126 $widgetButtonLabel = xl("Edit");
1127 $widgetButtonLink = "disclosure_full.php";
1128 $widgetButtonClass = "";
1129 $linkMethod = "html";
1130 $bodyClass = "notab";
1131 $widgetAuth = acl_check('patients', 'disclosure', '', 'write');
1132 $fixedWidth = true;
1133 expand_collapse_widget(
1134 $widgetTitle,
1135 $widgetLabel,
1136 $widgetButtonLabel,
1137 $widgetButtonLink,
1138 $widgetButtonClass,
1139 $linkMethod,
1140 $bodyClass,
1141 $widgetAuth,
1142 $fixedWidth
1145 <br/>
1146 <div style='margin-left:10px' class='text'><img src='../../pic/ajax-loader.gif'/></div><br/>
1147 </div>
1148 </td>
1149 </tr>
1150 <?php } // end if disclosures authorized ?>
1152 <?php if ($GLOBALS['amendments'] && acl_check('patients', 'amendment')) { ?>
1153 <tr>
1154 <td width='650px'>
1155 <?php // Amendments widget
1156 $widgetTitle = xlt('Amendments');
1157 $widgetLabel = "amendments";
1158 $widgetButtonLabel = xlt("Edit");
1159 $widgetButtonLink = $GLOBALS['webroot'] . "/interface/patient_file/summary/main_frameset.php?feature=amendment";
1160 $widgetButtonClass = "iframe rx_modal";
1161 $linkMethod = "html";
1162 $bodyClass = "summary_item small";
1163 $widgetAuth = acl_check('patients', 'amendment', '', 'write');
1164 $fixedWidth = false;
1165 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel, $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1166 $sql = "SELECT * FROM amendments WHERE pid = ? ORDER BY amendment_date DESC";
1167 $result = sqlStatement($sql, array($pid));
1169 if (sqlNumRows($result) == 0) {
1170 echo " <table><tr>\n";
1171 echo " <td colspan='$numcols' class='text'>&nbsp;&nbsp;" . xlt('None') . "</td>\n";
1172 echo " </tr></table>\n";
1175 while ($row=sqlFetchArray($result)) {
1176 echo "&nbsp;&nbsp;";
1177 echo "<a class= '" . $widgetButtonClass . "' href='" . $widgetButtonLink . "&id=" . attr($row['amendment_id']) . "' onclick='top.restoreSession()'>" . text($row['amendment_date']);
1178 echo "&nbsp; " . text($row['amendment_desc']);
1180 echo "</a><br>\n";
1181 } ?>
1182 </td>
1183 </tr>
1184 <?php } // end amendments authorized ?>
1186 <?php if (acl_check('patients', 'lab')) { ?>
1187 <tr>
1188 <td width='650px'>
1189 <?php // labdata expand collapse widget
1190 $widgetTitle = xl("Labs");
1191 $widgetLabel = "labdata";
1192 $widgetButtonLabel = xl("Trend");
1193 $widgetButtonLink = "../summary/labdata.php";#"../encounter/trend_form.php?formname=labdata";
1194 $widgetButtonClass = "";
1195 $linkMethod = "html";
1196 $bodyClass = "notab";
1197 // check to see if any labdata exist
1198 $spruch = "SELECT procedure_report.date_collected AS date " .
1199 "FROM procedure_report " .
1200 "JOIN procedure_order ON procedure_report.procedure_order_id = procedure_order.procedure_order_id " .
1201 "WHERE procedure_order.patient_id = ? " .
1202 "ORDER BY procedure_report.date_collected DESC ";
1203 $existLabdata = sqlQuery($spruch, array($pid));
1204 if ($existLabdata) {
1205 $widgetAuth = true;
1206 } else {
1207 $widgetAuth = false;
1210 $fixedWidth = true;
1211 expand_collapse_widget(
1212 $widgetTitle,
1213 $widgetLabel,
1214 $widgetButtonLabel,
1215 $widgetButtonLink,
1216 $widgetButtonClass,
1217 $linkMethod,
1218 $bodyClass,
1219 $widgetAuth,
1220 $fixedWidth
1223 <br/>
1224 <div style='margin-left:10px' class='text'><img src='../../pic/ajax-loader.gif'/></div><br/>
1225 </div>
1226 </td>
1227 </tr>
1228 <?php } // end labs authorized ?>
1230 <?php if ($vitals_is_registered && acl_check('patients', 'med')) { ?>
1231 <tr>
1232 <td width='650px'>
1233 <?php // vitals expand collapse widget
1234 $widgetTitle = xl("Vitals");
1235 $widgetLabel = "vitals";
1236 $widgetButtonLabel = xl("Trend");
1237 $widgetButtonLink = "../encounter/trend_form.php?formname=vitals";
1238 $widgetButtonClass = "";
1239 $linkMethod = "html";
1240 $bodyClass = "notab";
1241 // check to see if any vitals exist
1242 $existVitals = sqlQuery("SELECT * FROM form_vitals WHERE pid=?", array($pid));
1243 if ($existVitals) {
1244 $widgetAuth = true;
1245 } else {
1246 $widgetAuth = false;
1249 $fixedWidth = true;
1250 expand_collapse_widget(
1251 $widgetTitle,
1252 $widgetLabel,
1253 $widgetButtonLabel,
1254 $widgetButtonLink,
1255 $widgetButtonClass,
1256 $linkMethod,
1257 $bodyClass,
1258 $widgetAuth,
1259 $fixedWidth
1262 <br/>
1263 <div style='margin-left:10px' class='text'><img src='../../pic/ajax-loader.gif'/></div><br/>
1264 </div>
1265 </td>
1266 </tr>
1267 <?php } // end if ($vitals_is_registered && acl_check('patients', 'med')) ?>
1269 <?php
1270 // This generates a section similar to Vitals for each LBF form that
1271 // supports charting. The form ID is used as the "widget label".
1273 $gfres = sqlStatement("SELECT option_id, title, notes FROM list_options WHERE " .
1274 "list_id = 'lbfnames' AND " .
1275 "option_value > 0 AND activity = 1 " .
1276 "ORDER BY seq, title");
1277 while ($gfrow = sqlFetchArray($gfres)) {
1278 $jobj = json_decode($gfrow['notes'], true);
1279 $LBF_ACO = empty($jobj['aco']) ? false : explode('|', $jobj['aco']);
1280 if ($LBF_ACO && !acl_check($LBF_ACO[0], $LBF_ACO[1])) {
1281 continue;
1282 } ?>
1283 <tr>
1284 <td width='650px'>
1285 <?php // vitals expand collapse widget
1286 $vitals_form_id = $gfrow['option_id'];
1287 $widgetTitle = $gfrow['title'];
1288 $widgetLabel = $vitals_form_id;
1289 $widgetButtonLabel = xl("Trend");
1290 $widgetButtonLink = "../encounter/trend_form.php?formname=$vitals_form_id";
1291 $widgetButtonClass = "";
1292 $linkMethod = "html";
1293 $bodyClass = "notab";
1294 $widgetAuth = false;
1295 if (!$LBF_ACO || acl_check($LBF_ACO[0], $LBF_ACO[1], '', 'write')) {
1296 // check to see if any instances exist for this patient
1297 $existVitals = sqlQuery(
1298 "SELECT * FROM forms WHERE pid = ? AND formdir = ? AND deleted = 0",
1299 array($pid, $vitals_form_id)
1301 $widgetAuth = $existVitals;
1304 $fixedWidth = true;
1305 expand_collapse_widget(
1306 $widgetTitle,
1307 $widgetLabel,
1308 $widgetButtonLabel,
1309 $widgetButtonLink,
1310 $widgetButtonClass,
1311 $linkMethod,
1312 $bodyClass,
1313 $widgetAuth,
1314 $fixedWidth
1315 ); ?>
1316 <br/>
1317 <div style='margin-left:10px' class='text'>
1318 <image src='../../pic/ajax-loader.gif'/>
1319 </div>
1320 <br/>
1321 </div> <!-- This is required by expand_collapse_widget(). -->
1322 </td>
1323 </tr>
1324 <?php
1325 } // end while
1328 </table>
1330 </div>
1331 <!-- end left column div -->
1333 <!-- start right column div -->
1334 <div>
1335 <table>
1336 <tr>
1337 <td>
1339 <div>
1340 <?php
1342 // If there is an ID Card or any Photos show the widget
1343 $photos = pic_array($pid, $GLOBALS['patient_photo_category_name']);
1344 if ($photos or $idcard_doc_id) {
1345 $widgetTitle = xl("ID Card") . '/' . xl("Photos");
1346 $widgetLabel = "photos";
1347 $linkMethod = "javascript";
1348 $bodyClass = "notab-right";
1349 $widgetAuth = false;
1350 $fixedWidth = false;
1351 expand_collapse_widget(
1352 $widgetTitle,
1353 $widgetLabel,
1354 $widgetButtonLabel,
1355 $widgetButtonLink,
1356 $widgetButtonClass,
1357 $linkMethod,
1358 $bodyClass,
1359 $widgetAuth,
1360 $fixedWidth
1363 <br />
1364 <?php
1365 if ($idcard_doc_id) {
1366 image_widget($idcard_doc_id, $GLOBALS['patient_id_category_name']);
1369 foreach ($photos as $photo_doc_id) {
1370 image_widget($photo_doc_id, $GLOBALS['patient_photo_category_name']);
1375 <br />
1376 </div>
1377 <div>
1378 <?php
1379 // Advance Directives
1380 if ($GLOBALS['advance_directives_warning']) {
1381 // advance directives expand collapse widget
1382 $widgetTitle = xl("Advance Directives");
1383 $widgetLabel = "directives";
1384 $widgetButtonLabel = xl("Edit");
1385 $widgetButtonLink = "return advdirconfigure();";
1386 $widgetButtonClass = "";
1387 $linkMethod = "javascript";
1388 $bodyClass = "summary_item small";
1389 $widgetAuth = true;
1390 $fixedWidth = false;
1391 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel, $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1392 $counterFlag = false; //flag to record whether any categories contain ad records
1393 $query = "SELECT id FROM categories WHERE name='Advance Directive'";
1394 $myrow2 = sqlQuery($query);
1395 if ($myrow2) {
1396 $parentId = $myrow2['id'];
1397 $query = "SELECT id, name FROM categories WHERE parent=?";
1398 $resNew1 = sqlStatement($query, array($parentId));
1399 while ($myrows3 = sqlFetchArray($resNew1)) {
1400 $categoryId = $myrows3['id'];
1401 $nameDoc = $myrows3['name'];
1402 $query = "SELECT documents.date, documents.id " .
1403 "FROM documents " .
1404 "INNER JOIN categories_to_documents " .
1405 "ON categories_to_documents.document_id=documents.id " .
1406 "WHERE categories_to_documents.category_id=? " .
1407 "AND documents.foreign_id=? " .
1408 "ORDER BY documents.date DESC";
1409 $resNew2 = sqlStatement($query, array($categoryId, $pid));
1410 $limitCounter = 0; // limit to one entry per category
1411 while (($myrows4 = sqlFetchArray($resNew2)) && ($limitCounter == 0)) {
1412 $dateTimeDoc = $myrows4['date'];
1413 // remove time from datetime stamp
1414 $tempParse = explode(" ", $dateTimeDoc);
1415 $dateDoc = $tempParse[0];
1416 $idDoc = $myrows4['id'];
1417 echo "<a href='$web_root/controller.php?document&retrieve&patient_id=" .
1418 htmlspecialchars($pid, ENT_QUOTES) . "&document_id=" .
1419 htmlspecialchars($idDoc, ENT_QUOTES) . "&as_file=true' onclick='top.restoreSession()'>" .
1420 htmlspecialchars(xl_document_category($nameDoc), ENT_NOQUOTES) . "</a> " .
1421 htmlspecialchars($dateDoc, ENT_NOQUOTES);
1422 echo "<br>";
1423 $limitCounter = $limitCounter + 1;
1424 $counterFlag = true;
1429 if (!$counterFlag) {
1430 echo "&nbsp;&nbsp;" . htmlspecialchars(xl('None'), ENT_NOQUOTES);
1431 } ?>
1432 </div>
1433 <?php
1434 } // close advanced dir block
1436 // Show Clinical Reminders for any user that has rules that are permitted.
1437 $clin_rem_check = resolve_rules_sql('', '0', true, '', $_SESSION['authUser']);
1438 if (!empty($clin_rem_check) && $GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_crw'] &&
1439 acl_check('patients', 'alert')) {
1440 // clinical summary expand collapse widget
1441 $widgetTitle = xl("Clinical Reminders");
1442 $widgetLabel = "clinical_reminders";
1443 $widgetButtonLabel = xl("Edit");
1444 $widgetButtonLink = "../reminder/clinical_reminders.php?patient_id=".$pid;
1446 $widgetButtonClass = "";
1447 $linkMethod = "html";
1448 $bodyClass = "summary_item small";
1449 $widgetAuth = acl_check('patients', 'alert', '', 'write');
1450 $fixedWidth = false;
1451 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel, $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1452 echo "<br/>";
1453 echo "<div style='margin-left:10px' class='text'><image src='../../pic/ajax-loader.gif'/></div><br/>";
1454 echo "</div>";
1455 } // end if crw
1457 // Show current and upcoming appointments.
1459 // Recurring appointment support and Appointment Display Sets
1460 // added to Appointments by Ian Jardine ( epsdky ).
1462 if (isset($pid) && !$GLOBALS['disable_calendar'] && acl_check('patients', 'appt')) {
1464 $current_date2 = date('Y-m-d');
1465 $events = array();
1466 $apptNum = (int)$GLOBALS['number_of_appts_to_show'];
1467 if ($apptNum != 0) {
1468 $apptNum2 = abs($apptNum);
1469 } else {
1470 $apptNum2 = 10;
1474 $mode1 = !$GLOBALS['appt_display_sets_option'];
1475 $colorSet1 = $GLOBALS['appt_display_sets_color_1'];
1476 $colorSet2 = $GLOBALS['appt_display_sets_color_2'];
1477 $colorSet3 = $GLOBALS['appt_display_sets_color_3'];
1478 $colorSet4 = $GLOBALS['appt_display_sets_color_4'];
1480 if ($mode1) {
1481 $extraAppts = 1;
1482 } else {
1483 $extraAppts = 6;
1486 $events = fetchNextXAppts($current_date2, $pid, $apptNum2 + $extraAppts, true);
1487 //////
1488 if ($events) {
1489 $selectNum = 0;
1490 $apptNumber = count($events);
1492 if ($apptNumber <= $apptNum2) {
1493 $extraApptDate = '';
1495 } else if ($mode1 && $apptNumber == $apptNum2 + 1) {
1496 $extraApptDate = $events[$apptNumber - 1]['pc_eventDate'];
1497 array_pop($events);
1498 --$apptNumber;
1499 $selectNum = 1;
1501 } else if ($apptNumber == $apptNum2 + 6) {
1502 $extraApptDate = $events[$apptNumber - 1]['pc_eventDate'];
1503 array_pop($events);
1504 --$apptNumber;
1505 $selectNum = 2;
1507 } else { // mode 2 - $apptNum2 < $apptNumber < $apptNum2 + 6
1508 $extraApptDate = '';
1509 $selectNum = 2;
1514 $limitApptIndx = $apptNum2 - 1;
1515 $limitApptDate = $events[$limitApptIndx]['pc_eventDate'];
1517 switch ($selectNum) {
1519 case 2:
1520 $lastApptIndx = $apptNumber - 1;
1521 $thisNumber = $lastApptIndx - $limitApptIndx;
1522 for ($i = 1; $i <= $thisNumber; ++$i) {
1523 if ($events[$limitApptIndx + $i]['pc_eventDate'] != $limitApptDate) {
1524 $extraApptDate = $events[$limitApptIndx + $i]['pc_eventDate'];
1525 $events = array_slice($events, 0, $limitApptIndx + $i);
1526 break;
1531 case 1:
1532 $firstApptIndx = 0;
1533 for ($i = 1; $i <= $limitApptIndx; ++$i) {
1534 if ($events[$limitApptIndx - $i]['pc_eventDate'] != $limitApptDate) {
1535 $firstApptIndx = $apptNum2 - $i;
1536 break;
1544 if ($extraApptDate) {
1545 if ($extraApptDate != $limitApptDate) {
1546 $apptStyle2 = " style='background-color:" . attr($colorSet3) . ";'";
1547 } else {
1548 $apptStyle2 = " style='background-color:" . attr($colorSet4) . ";'";
1553 //////
1555 // appointments expand collapse widget
1556 $widgetTitle = xl("Appointments");
1557 $widgetLabel = "appointments";
1558 $widgetButtonLabel = xl("Add");
1559 $widgetButtonLink = "return newEvt();";
1560 $widgetButtonClass = "";
1561 $linkMethod = "javascript";
1562 $bodyClass = "summary_item small";
1563 $widgetAuth = $resNotNull // $resNotNull reflects state of query in fetchAppointments
1564 && (acl_check('patients', 'appt', '', 'write') || acl_check('patients', 'appt', '', 'addonly'));
1565 $fixedWidth = false;
1566 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel, $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1567 $count = 0;
1569 $toggleSet = true;
1570 $priorDate = "";
1571 $therapyGroupCategories = array();
1572 $query = sqlStatement("SELECT pc_catid FROM openemr_postcalendar_categories WHERE pc_cattype = 3 AND pc_active = 1");
1573 while ($result = sqlFetchArray($query)) {
1574 $therapyGroupCategories[] = $result['pc_catid'];
1578 foreach ($events as $row) { //////
1579 $count++;
1580 $dayname = date("l", strtotime($row['pc_eventDate'])); //////
1581 $dispampm = "am";
1582 $disphour = substr($row['pc_startTime'], 0, 2) + 0;
1583 $dispmin = substr($row['pc_startTime'], 3, 2);
1584 if ($disphour >= 12) {
1585 $dispampm = "pm";
1586 if ($disphour > 12) {
1587 $disphour -= 12;
1591 $etitle = xl('(Click to edit)');
1592 if ($row['pc_hometext'] != "") {
1593 $etitle = xl('Comments').": ".($row['pc_hometext'])."\r\n".$etitle;
1596 //////
1597 if ($extraApptDate && $count > $firstApptIndx) {
1598 $apptStyle = $apptStyle2;
1599 } else {
1600 if ($row['pc_eventDate'] != $priorDate) {
1601 $priorDate = $row['pc_eventDate'];
1602 $toggleSet = !$toggleSet;
1605 if ($toggleSet) {
1606 $apptStyle = " style='background-color:" . attr($colorSet2) . ";'";
1607 } else {
1608 $apptStyle = " style='background-color:" . attr($colorSet1) . ";'";
1612 //////
1613 echo "<div " . $apptStyle . ">";
1614 if (!in_array($row['pc_catid'], $therapyGroupCategories)) {
1615 echo "<a href='javascript:oldEvt(" . htmlspecialchars(preg_replace("/-/", "", $row['pc_eventDate']), ENT_QUOTES) . ', ' . htmlspecialchars($row['pc_eid'], ENT_QUOTES) . ")' title='" . htmlspecialchars($etitle, ENT_QUOTES) . "'>";
1616 } else {
1617 echo "<span title='" . htmlspecialchars($etitle, ENT_QUOTES) . "'>";
1620 echo "<b>" . htmlspecialchars($row['pc_eventDate'], ENT_NOQUOTES) . ", ";
1621 echo htmlspecialchars(sprintf("%02d", $disphour) .":$dispmin " . xl($dispampm) . " (" . xl($dayname), ENT_NOQUOTES) . ")</b> ";
1622 if ($row['pc_recurrtype']) {
1623 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)."'>";
1626 echo "<span title='" . generate_display_field(array('data_type'=>'1','list_id'=>'apptstat'), $row['pc_apptstatus']) . "'>";
1627 echo "<br>" . xlt('Status') . "( " . htmlspecialchars($row['pc_apptstatus'], ENT_NOQUOTES) . " ) </span>";
1628 echo htmlspecialchars(xl_appt_category($row['pc_catname']), ENT_NOQUOTES) . "\n";
1629 if (in_array($row['pc_catid'], $therapyGroupCategories)) {
1630 echo "<br><span>" . xlt('Group name') .": " . text(getGroup($row['pc_gid'])['group_name']) . "</span>\n";
1633 if ($row['pc_hometext']) {
1634 echo " <span style='color:green'> Com</span>";
1637 echo "<br>" . htmlspecialchars($row['ufname'] . " " . $row['ulname'], ENT_NOQUOTES);
1638 echo !in_array($row['pc_catid'], $therapyGroupCategories) ? '</a>' : '<span>';
1639 echo "</div>\n";
1640 //////
1643 if ($resNotNull) { //////
1644 if ($count < 1) {
1645 echo "&nbsp;&nbsp;" . htmlspecialchars(xl('None'), ENT_NOQUOTES);
1646 } else { //////
1647 if ($extraApptDate) {
1648 echo "<div style='color:#0000cc;'><b>" . attr($extraApptDate) . " ( + ) </b></div>";
1649 } else {
1650 echo "<div><hr></div>";
1654 echo "</div>";
1656 } // End of Appointments.
1659 /* Widget that shows recurrences for appointments. */
1660 if (isset($pid) && !$GLOBALS['disable_calendar'] && $GLOBALS['appt_recurrences_widget'] &&
1661 acl_check('patients', 'appt')) {
1662 $widgetTitle = xl("Recurrent Appointments");
1663 $widgetLabel = "recurrent_appointments";
1664 $widgetButtonLabel = xl("Add");
1665 $widgetButtonLink = "return newEvt();";
1666 $widgetButtonClass = "";
1667 $linkMethod = "javascript";
1668 $bodyClass = "summary_item small";
1669 $widgetAuth = false;
1670 $fixedWidth = false;
1671 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel, $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1672 $count = 0;
1673 $toggleSet = true;
1674 $priorDate = "";
1676 //Fetch patient's recurrences. Function returns array with recurrence appointments' category, recurrence pattern (interpreted), and end date.
1677 $recurrences = fetchRecurrences($pid);
1678 if ($recurrences[0] == false) { //if there are no recurrent appointments:
1679 echo "<div>";
1680 echo "<span>" . "&nbsp;&nbsp;" . xlt('None') . "</span>";
1681 echo "</div></div>";
1682 } else {
1683 foreach ($recurrences as $row) {
1684 //checks if there are recurrences and if they are current (git didn't end yet)
1685 if ($row == false || !recurrence_is_current($row['pc_endDate'])) {
1686 continue;
1689 echo "<div>";
1690 echo "<span>" . xlt('Appointment Category') . ': ' . xlt($row['pc_catname']) . "</span>";
1691 echo "<br>";
1692 echo "<span>" . xlt('Recurrence') . ': ' . text($row['pc_recurrspec']) . "</span>";
1693 echo "<br>";
1694 $red_text = ""; //if ends in a week, make font red
1695 if (ends_in_a_week($row['pc_endDate'])) {
1696 $red_text = " style=\"color:red;\" ";
1699 echo "<span" . $red_text . ">" . xlt('End Date') . ': ' . text($row['pc_endDate']) . "</span>";
1700 echo "</div>";
1703 echo "</div>";
1707 /* End of recurrence widget */
1709 // Show PAST appointments.
1710 // added by Terry Hill to allow reverse sorting of the appointments
1711 $direction = "ASC";
1712 if ($GLOBALS['num_past_appointments_to_show'] < 0) {
1713 $direction = "DESC";
1714 ($showpast = -1 * $GLOBALS['num_past_appointments_to_show']);
1715 } else {
1716 $showpast = $GLOBALS['num_past_appointments_to_show'];
1719 if (isset($pid) && !$GLOBALS['disable_calendar'] && $showpast > 0 &&
1720 acl_check('patients', 'appt')) {
1721 $query = "SELECT e.pc_eid, e.pc_aid, e.pc_title, e.pc_eventDate, " .
1722 "e.pc_startTime, e.pc_hometext, u.fname, u.lname, u.mname, " .
1723 "c.pc_catname, e.pc_apptstatus " .
1724 "FROM openemr_postcalendar_events AS e, users AS u, " .
1725 "openemr_postcalendar_categories AS c WHERE " .
1726 "e.pc_pid = ? AND e.pc_eventDate < CURRENT_DATE AND " .
1727 "u.id = e.pc_aid AND e.pc_catid = c.pc_catid " .
1728 "ORDER BY e.pc_eventDate $direction , e.pc_startTime DESC " .
1729 "LIMIT " . $showpast;
1731 $pres = sqlStatement($query, array($pid));
1733 // appointments expand collapse widget
1734 $widgetTitle = xl("Past Appointments");
1735 $widgetLabel = "past_appointments";
1736 $widgetButtonLabel = '';
1737 $widgetButtonLink = '';
1738 $widgetButtonClass = '';
1739 $linkMethod = "javascript";
1740 $bodyClass = "summary_item small";
1741 $widgetAuth = false; //no button
1742 $fixedWidth = false;
1743 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel, $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1744 $count = 0;
1745 while ($row = sqlFetchArray($pres)) {
1746 $count++;
1747 $dayname = date("l", strtotime($row['pc_eventDate']));
1748 $dispampm = "am";
1749 $disphour = substr($row['pc_startTime'], 0, 2) + 0;
1750 $dispmin = substr($row['pc_startTime'], 3, 2);
1751 if ($disphour >= 12) {
1752 $dispampm = "pm";
1753 if ($disphour > 12) {
1754 $disphour -= 12;
1758 if ($row['pc_hometext'] != "") {
1759 $etitle = xl('Comments').": ".($row['pc_hometext'])."\r\n".$etitle;
1762 echo "<a href='javascript:oldEvt(" . htmlspecialchars(preg_replace("/-/", "", $row['pc_eventDate']), ENT_QUOTES) . ', ' . htmlspecialchars($row['pc_eid'], ENT_QUOTES) . ")' title='" . htmlspecialchars($etitle, ENT_QUOTES) . "'>";
1763 echo "<b>" . htmlspecialchars(xl($dayname) . ", " . $row['pc_eventDate'], ENT_NOQUOTES) . "</b>" . xlt("Status") . "(";
1764 echo " " . generate_display_field(array('data_type'=>'1','list_id'=>'apptstat'), $row['pc_apptstatus']) . ")<br>"; // can't use special char parser on this
1765 echo htmlspecialchars("$disphour:$dispmin ") . xl($dispampm) . " ";
1766 echo htmlspecialchars($row['fname'] . " " . $row['lname'], ENT_NOQUOTES) . "</a><br>\n";
1769 if (isset($pres) && $res != null) {
1770 if ($count < 1) {
1771 echo "&nbsp;&nbsp;" . htmlspecialchars(xl('None'), ENT_NOQUOTES);
1774 echo "</div>";
1778 // END of past appointments
1780 </div>
1782 <div id='stats_div'>
1783 <br/>
1784 <div style='margin-left:10px' class='text'><img src='../../pic/ajax-loader.gif'/></div><br/>
1785 </div>
1786 </td>
1787 </tr>
1789 <?php // TRACK ANYTHING -----
1791 // Determine if track_anything form is in use for this site.
1792 $tmp = sqlQuery("SELECT count(*) AS count FROM registry WHERE " .
1793 "directory = 'track_anything' AND state = 1");
1794 $track_is_registered = $tmp['count'];
1795 if ($track_is_registered) {
1796 echo "<tr> <td>";
1797 // track_anything expand collapse widget
1798 $widgetTitle = xl("Tracks");
1799 $widgetLabel = "track_anything";
1800 $widgetButtonLabel = xl("Tracks");
1801 $widgetButtonLink = "../../forms/track_anything/create.php";
1802 $widgetButtonClass = "";
1803 $widgetAuth = ""; // don't show the button
1804 $linkMethod = "html";
1805 $bodyClass = "notab";
1806 // check to see if any tracks exist
1807 $spruch = "SELECT id " .
1808 "FROM forms " .
1809 "WHERE pid = ? " .
1810 "AND formdir = ? ";
1811 $existTracks = sqlQuery($spruch, array($pid, "track_anything"));
1813 $fixedWidth = false;
1814 expand_collapse_widget(
1815 $widgetTitle,
1816 $widgetLabel,
1817 $widgetButtonLabel,
1818 $widgetButtonLink,
1819 $widgetButtonClass,
1820 $linkMethod,
1821 $bodyClass,
1822 $widgetAuth,
1823 $fixedWidth
1826 <br/>
1827 <div style='margin-left:10px' class='text'><img src='../../pic/ajax-loader.gif'/></div><br/>
1828 </div>
1829 </td>
1830 </tr><?php
1831 } // end track_anything ?>
1832 </table>
1834 </div> <!-- end right column div -->
1836 </td>
1838 </tr>
1839 </table>
1841 </div> <!-- end main content div -->
1843 <script language='JavaScript'>
1844 // Array of skip conditions for the checkSkipConditions() function.
1845 var skipArray = [
1846 <?php echo $condition_str; ?>
1848 checkSkipConditions();
1849 </script>
1851 </body>
1852 </html>