Portal credential enhancements
[openemr.git] / interface / patient_file / summary / demographics.php
blob50e47c8e185960e8464d4f08b123f1ad76401848
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 * @author Stephen Waite <stephen.waite@cmsvt.com>
11 * @author Ranganath Pathak <pathak@scrs1.org>
12 * @copyright Copyright (c) 2017-2019 Brady Miller <brady.g.miller@gmail.com>
13 * @copyright Copyright (c) 2017 Sharon Cohen <sharonco@matrix.co.il>
14 * @copyright Copyright (c) 2018-2019 Stephen Waite <stephen.waite@cmsvt.com>
15 * @copyright Copyright (c) 2018 Ranganath Pathak <pathak@scrs1.org>
16 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
20 require_once("../../globals.php");
21 require_once("$srcdir/patient.inc");
22 require_once("$srcdir/acl.inc");
23 require_once("$srcdir/options.inc.php");
24 require_once("../history/history.inc.php");
25 require_once("$srcdir/clinical_rules.php");
26 require_once("$srcdir/options.js.php");
27 require_once("$srcdir/group.inc");
28 require_once(dirname(__FILE__)."/../../../library/appointments.inc.php");
30 use OpenEMR\Billing\EDI_270;
31 use OpenEMR\Common\Csrf\CsrfUtils;
32 use OpenEMR\Core\Header;
33 use OpenEMR\Menu\PatientMenuRole;
34 use OpenEMR\Reminder\BirthdayReminder;
35 use OpenEMR\OeUI\OemrUI;
36 use OpenEMR\Events\PatientDemographics\ViewEvent;
38 if (isset($_GET['set_pid'])) {
39 include_once("$srcdir/pid.inc");
40 setpid($_GET['set_pid']);
43 $active_reminders = false;
44 $all_allergy_alerts = false;
45 if ($GLOBALS['enable_cdr']) {
46 //CDR Engine stuff
47 if ($GLOBALS['enable_allergy_check'] && $GLOBALS['enable_alert_log']) {
48 //Check for new allergies conflicts and throw popup if any exist(note need alert logging to support this)
49 $new_allergy_alerts = allergy_conflict($pid, 'new', $_SESSION['authUser']);
50 if (!empty($new_allergy_alerts)) {
51 $pod_warnings = '';
52 foreach ($new_allergy_alerts as $new_allergy_alert) {
53 $pod_warnings .= js_escape($new_allergy_alert) . ' + "\n"';
55 echo '<script type="text/javascript">alert(' . xlj('WARNING - FOLLOWING ACTIVE MEDICATIONS ARE ALLERGIES') . ' + "\n" + ' . $pod_warnings . ')</script>';
59 if ((!isset($_SESSION['alert_notify_pid']) || ($_SESSION['alert_notify_pid'] != $pid)) && isset($_GET['set_pid']) && $GLOBALS['enable_cdr_crp']) {
60 // showing a new patient, so check for active reminders and allergy conflicts, which use in active reminder popup
61 $active_reminders = active_alert_summary($pid, "reminders-due", '', 'default', $_SESSION['authUser'], true);
62 if ($GLOBALS['enable_allergy_check']) {
63 $all_allergy_alerts = allergy_conflict($pid, 'all', $_SESSION['authUser'], true);
68 function print_as_money($money)
70 preg_match("/(\d*)\.?(\d*)/", $money, $moneymatches);
71 $tmp = wordwrap(strrev($moneymatches[1]), 3, ",", 1);
72 $ccheck = strrev($tmp);
73 if ($ccheck[0] == ",") {
74 $tmp = substr($ccheck, 1, strlen($ccheck)-1);
77 if ($moneymatches[2] != "") {
78 return "$ " . strrev($tmp) . "." . $moneymatches[2];
79 } else {
80 return "$ " . strrev($tmp);
84 // get an array from Photos category
85 function pic_array($pid, $picture_directory)
87 $pics = array();
88 $sql_query = "select documents.id from documents join categories_to_documents " .
89 "on documents.id = categories_to_documents.document_id " .
90 "join categories on categories.id = categories_to_documents.category_id " .
91 "where categories.name like ? and documents.foreign_id = ?";
92 if ($query = sqlStatement($sql_query, array($picture_directory,$pid))) {
93 while ($results = sqlFetchArray($query)) {
94 array_push($pics, $results['id']);
98 return ($pics);
100 // Get the document ID of the first document in a specific catg.
101 function get_document_by_catg($pid, $doc_catg)
104 $result = array();
106 if ($pid and $doc_catg) {
107 $result = sqlQuery("SELECT d.id, d.date, d.url FROM " .
108 "documents AS d, categories_to_documents AS cd, categories AS c " .
109 "WHERE d.foreign_id = ? " .
110 "AND cd.document_id = d.id " .
111 "AND c.id = cd.category_id " .
112 "AND c.name LIKE ? " .
113 "ORDER BY d.date DESC LIMIT 1", array($pid, $doc_catg));
116 return($result['id']);
119 // Display image in 'widget style'
120 function image_widget($doc_id, $doc_catg)
122 global $pid, $web_root;
123 $docobj = new Document($doc_id);
124 $image_file = $docobj->get_url_file();
125 $image_width = $GLOBALS['generate_doc_thumb'] == 1 ? '' : 'width=100';
126 $extension = substr($image_file, strrpos($image_file, "."));
127 $viewable_types = array('.png','.jpg','.jpeg','.png','.bmp','.PNG','.JPG','.JPEG','.PNG','.BMP');
128 if (in_array($extension, $viewable_types)) { // extension matches list
129 $to_url = "<td> <a href = '$web_root" .
130 "/controller.php?document&retrieve&patient_id=" . attr_url($pid) . "&document_id=" . attr_url($doc_id) . "&as_file=false&original_file=true&disable_exit=false&show_original=true'" .
131 " onclick='top.restoreSession();' class='image_modal'>" .
132 " <img src = '$web_root" .
133 "/controller.php?document&retrieve&patient_id=" . attr_url($pid) . "&document_id=" . attr_url($doc_id) . "&as_file=false'" .
134 " $image_width alt='" . attr($doc_catg) . ":" . attr($image_file) . "'> </a> </td> <td valign='center'>" .
135 text($doc_catg) . '<br />&nbsp;' . text($image_file) .
136 "</td>";
137 } else {
138 $to_url = "<td> <a href='" . $web_root . "/controller.php?document&retrieve" .
139 "&patient_id=" . attr_url($pid) . "&document_id=" . attr_url($doc_id) . "'" .
140 " onclick='top.restoreSession()' class='css_button_small'>" .
141 "<span>" .
142 xlt("View") . "</a> &nbsp;" .
143 text("$doc_catg - $image_file") .
144 "</span> </td>";
147 echo "<table><tr>";
148 echo $to_url;
149 echo "</tr></table>";
152 // Determine if the Vitals form is in use for this site.
153 $tmp = sqlQuery("SELECT count(*) AS count FROM registry WHERE " .
154 "directory = 'vitals' AND state = 1");
155 $vitals_is_registered = $tmp['count'];
157 // Get patient/employer/insurance information.
159 $result = getPatientData($pid, "*, DATE_FORMAT(DOB,'%Y-%m-%d') as DOB_YMD");
160 $result2 = getEmployerData($pid);
161 $result3 = getInsuranceData($pid, "primary", "copay, provider, DATE_FORMAT(`date`,'%Y-%m-%d') as effdate");
162 $insco_name = "";
163 if ($result3['provider']) { // Use provider in case there is an ins record w/ unassigned insco
164 $insco_name = getInsuranceProvider($result3['provider']);
167 <html>
169 <head>
171 <?php Header::setupHeader(['common']); ?>
173 <script type="text/javascript" language="JavaScript">
174 function oldEvt(apptdate, eventid) {
175 let title = <?php echo xlj('Appointments'); ?>;
176 dlgopen('../../main/calendar/add_edit_event.php?date=' + encodeURIComponent(apptdate) + '&eid=' + encodeURIComponent(eventid), '_blank', 725, 500, '', title);
179 function advdirconfigure() {
180 dlgopen('advancedirectives.php', '_blank', 400, 500);
183 function refreshme() {
184 top.restoreSession();
185 location.reload();
188 // Process click on Delete link.
189 function deleteme() { // @todo don't think this is used any longer!!
190 dlgopen('../deleter.php?patient=' + <?php echo js_url($pid); ?> + '&csrf_token_form=' + <?php echo js_url(CsrfUtils::collectCsrfToken()); ?>, '_blank', 500, 450, '', '',{
191 allowResize: false,
192 allowDrag: false,
193 dialogId: 'patdel',
194 type: 'iframe'
196 return false;
199 // Called by the deleteme.php window on a successful delete.
200 function imdeleted() {
201 top.clearPatient();
204 function newEvt() {
205 let title = <?php echo xlj('Appointments'); ?>;
206 let url = '../../main/calendar/add_edit_event.php?patientid=' + <?php echo js_url($pid); ?>;
207 dlgopen(url, '_blank', 725, 500, '', title);
208 return false;
211 </script>
213 <script type="text/javascript">
215 function toggleIndicator(target,div) {
216 // <i id="show_hide" class="fa fa-lg small fa-eye-slash" title="Click to Hide"></i>
217 $mode = $(target).find(".indicator").text();
218 if ( $mode == <?php echo xlj('collapse'); ?> ) {
219 $(target).find(".indicator").text(<?php echo xlj('expand'); ?>);
220 $("#"+div).hide();
221 $.post( "../../../library/ajax/user_settings.php",
223 target: div,
224 mode: 0,
225 csrf_token_form: <?php echo js_escape(CsrfUtils::collectCsrfToken()); ?>
228 } else {
229 $(target).find(".indicator").text(<?php echo xlj('collapse'); ?>);
230 $("#"+div).show();
231 $.post( "../../../library/ajax/user_settings.php",
233 target: div,
234 mode: 1,
235 csrf_token_form: <?php echo js_escape(CsrfUtils::collectCsrfToken()); ?>
241 // edit prescriptions dialog.
242 // called from stats.php.
244 function editScripts(url) {
245 var AddScript = function () {
247 var __this=$(this);
248 __this.find("#clearButton").css("display", "");
249 __this.find("#backButton").css("display", "");
250 __this.find("#addButton").css("display", "none");
252 var iam = top.frames.editScripts;
253 iam.location.href = '<?php echo $GLOBALS['webroot']?>/controller.php?prescription&edit&id=0&pid=' + <?php echo js_url($pid); ?>;
255 var ListScripts = function () {
257 var __this=$(this);
258 __this.find("#clearButton").css("display", "none");
259 __this.find("#backButton").css("display", "none");
260 __this.find("#addButton").css("display", "");
261 var iam = top.frames.editScripts
262 iam.location.href = '<?php echo $GLOBALS['webroot']?>/controller.php?prescription&list&id=' + <?php echo js_url($pid); ?>;
265 let title = <?php echo xlj('Prescriptions'); ?>;
266 let w = 910; // for weno width
268 dlgopen(url, 'editScripts', w, 300, '', '', {
269 buttons: [
270 {text: <?php echo xlj('Add'); ?>, close: false, id: 'addButton', class: 'btn-primary btn-sm', click: AddScript},
271 {text: <?php echo xlj('Clear'); ?>, close: false,id: 'clearButton', style: 'display:none;', class: 'btn-primary btn-sm', click: AddScript},
272 {text: <?php echo xlj('Back'); ?>, close: false, id: 'backButton', style: 'display:none;', class: 'btn-primary btn-sm', click: ListScripts},
273 {text: <?php echo xlj('Done'); ?>, close: true, id: 'doneButton', class: 'btn-default btn-sm'}
275 onClosed: 'refreshme',
276 allowResize: true,
277 allowDrag: true,
278 dialogId: 'editscripts',
279 type: 'iframe'
283 function doPublish() {
284 let title = <?php echo xlj('Publish Patient to FHIR Server'); ?>;
285 let url = top.webroot_url + '/phpfhir/providerPublishUI.php?patient_id=' + <?php echo js_url($pid); ?>;
287 dlgopen(url, 'publish', 'modal-mlg', 750, '', '', {
288 buttons: [
289 {text: <?php echo xlj('Done'); ?>, close: true, style: 'default btn-sm'}
291 allowResize: true,
292 allowDrag: true,
293 dialogId: '',
294 type: 'iframe'
298 $(document).ready(function(){
299 var msg_updation='';
300 <?php
301 if ($GLOBALS['erx_enable']) {
302 //$soap_status=sqlQuery("select soap_import_status from patient_data where pid=?",array($pid));
303 $soap_status=sqlStatement("select soap_import_status,pid from patient_data where pid=? and soap_import_status in ('1','3')", array($pid));
304 while ($row_soapstatus=sqlFetchArray($soap_status)) {
305 //if($soap_status['soap_import_status']=='1' || $soap_status['soap_import_status']=='3'){ ?>
306 top.restoreSession();
307 $.ajax({
308 type: "POST",
309 url: "../../soap_functions/soap_patientfullmedication.php",
310 dataType: "html",
311 data: {
312 patient:<?php echo js_escape($row_soapstatus['pid']); ?>,
314 async: false,
315 success: function(thedata){
316 //alert(thedata);
317 msg_updation+=thedata;
319 error:function(){
320 alert('ajax error');
323 <?php
325 //elseif($soap_status['soap_import_status']=='3'){ ?>
326 top.restoreSession();
327 $.ajax({
328 type: "POST",
329 url: "../../soap_functions/soap_allergy.php",
330 dataType: "html",
331 data: {
332 patient:<?php echo js_escape($row_soapstatus['pid']); ?>,
334 async: false,
335 success: function(thedata){
336 //alert(thedata);
337 msg_updation+=thedata;
339 error:function(){
340 alert('ajax error');
343 <?php
344 if ($GLOBALS['erx_import_status_message']) { ?>
345 if(msg_updation)
346 alert(msg_updation);
347 <?php
354 // load divs
355 $("#stats_div").load("stats.php",
357 embeddedScreen : true,
358 csrf_token_form: <?php echo js_escape(CsrfUtils::collectCsrfToken()); ?>
360 function() {}
362 $("#pnotes_ps_expand").load("pnotes_fragment.php",
364 csrf_token_form: <?php echo js_escape(CsrfUtils::collectCsrfToken()); ?>
367 $("#disclosures_ps_expand").load("disc_fragment.php",
369 csrf_token_form: <?php echo js_escape(CsrfUtils::collectCsrfToken()); ?>
373 <?php if ($GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_crw']) { ?>
374 top.restoreSession();
375 $("#clinical_reminders_ps_expand").load("clinical_reminders_fragment.php",
377 embeddedScreen : true,
378 csrf_token_form: <?php echo js_escape(CsrfUtils::collectCsrfToken()); ?>
380 function() {
381 // (note need to place javascript code here also to get the dynamic link to work)
382 $(".medium_modal").on('click', function(e) {
383 e.preventDefault();e.stopPropagation();
384 dlgopen('', '', 800, 200, '', '', {
385 buttons: [
386 {text: <?php echo xlj('Close'); ?>, close: true, style: 'default btn-sm'}
388 onClosed: 'refreshme',
389 allowResize: false,
390 allowDrag: true,
391 dialogId: 'demreminder',
392 type: 'iframe',
393 url: $(this).attr('href')
397 <?php } // end crw?>
399 <?php if ($GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_prw']) { ?>
400 top.restoreSession();
401 $("#patient_reminders_ps_expand").load("patient_reminders_fragment.php",
403 csrf_token_form: <?php echo js_escape(CsrfUtils::collectCsrfToken()); ?>
406 <?php } // end prw?>
408 <?php if ($vitals_is_registered && acl_check('patients', 'med')) { ?>
409 // Initialize the Vitals form if it is registered and user is authorized.
410 $("#vitals_ps_expand").load("vitals_fragment.php",
412 csrf_token_form: <?php echo js_escape(CsrfUtils::collectCsrfToken()); ?>
415 <?php } ?>
417 // Initialize track_anything
418 $("#track_anything_ps_expand").load("track_anything_fragment.php",
420 csrf_token_form: <?php echo js_escape(CsrfUtils::collectCsrfToken()); ?>
425 // Initialize labdata
426 $("#labdata_ps_expand").load("labdata_fragment.php",
428 csrf_token_form: <?php echo js_escape(CsrfUtils::collectCsrfToken()); ?>
431 <?php
432 // Initialize for each applicable LBF form.
433 $gfres = sqlStatement("SELECT grp_form_id FROM layout_group_properties WHERE " .
434 "grp_form_id LIKE 'LBF%' AND grp_group_id = '' AND grp_repeats > 0 AND grp_activity = 1 " .
435 "ORDER BY grp_seq, grp_title");
436 while ($gfrow = sqlFetchArray($gfres)) {
438 $(<?php echo js_escape("#".$gfrow['grp_form_id']."_ps_expand"); ?>).load("lbf_fragment.php?formname=" + <?php echo js_url($gfrow['grp_form_id']); ?>,
440 csrf_token_form: <?php echo js_escape(CsrfUtils::collectCsrfToken()); ?>
443 <?php
446 tabbify();
448 // modal for dialog boxes
449 $(".large_modal").on('click', function(e) {
450 e.preventDefault();e.stopPropagation();
451 dlgopen('', '', 1000, 600, '', '', {
452 buttons: [
453 {text: <?php echo xlj('Close'); ?>, close: true, style: 'default btn-sm'}
455 allowResize: true,
456 allowDrag: true,
457 dialogId: '',
458 type: 'iframe',
459 url: $(this).attr('href')
463 $(".rx_modal").on('click', function(e) {
464 e.preventDefault();e.stopPropagation();
465 var AddAmendment = function () {
466 var iam = top.frames.editAmendments;
467 iam.location.href = "<?php echo $GLOBALS['webroot']?>/interface/patient_file/summary/add_edit_amendments.php"
469 var ListAmendments = function () {
470 var iam = top.frames.editAmendments;
471 iam.location.href = "<?php echo $GLOBALS['webroot']?>/interface/patient_file/summary/list_amendments.php"
473 var title = <?php echo xlj('Amendments'); ?>;
474 dlgopen('', 'editAmendments', 800, 300, '', title, {
475 buttons: [
476 {text: <?php echo xlj('Add'); ?>, close: false, style: 'primary btn-sm', click: AddAmendment},
477 {text: <?php echo xlj('List'); ?>, close: false, style: 'primary btn-sm', click: ListAmendments},
478 {text: <?php echo xlj('Done'); ?>, close: true, style: 'default btn-sm'}
480 onClosed: 'refreshme',
481 allowResize: true,
482 allowDrag: true,
483 dialogId: '',
484 type: 'iframe',
485 url: $(this).attr('href')
489 // modal for image viewer
490 $(".image_modal").on('click', function(e) {
491 e.preventDefault();e.stopPropagation();
492 dlgopen('', '', 400, 300, '', <?php echo xlj('Patient Images'); ?>, {
493 allowResize: true,
494 allowDrag: true,
495 dialogId: '',
496 type: 'iframe',
497 url: $(this).attr('href')
501 $(".deleter").on('click', function(e) {
502 e.preventDefault();e.stopPropagation();
503 dlgopen('', '', 600, 360, '', '', {
504 buttons: [
505 {text: <?php echo xlj('Close'); ?>, close: true, style: 'default btn-sm'}
507 //onClosed: 'imdeleted',
508 allowResize: false,
509 allowDrag: false,
510 dialogId: 'patdel',
511 type: 'iframe',
512 url: $(this).attr('href')
516 $(".iframe1").on('click', function(e) {
517 e.preventDefault();e.stopPropagation();
518 dlgopen('', '', 350, 300, '', '', {
519 buttons: [
520 {text: <?php echo xlj('Close'); ?>, close: true, style: 'default btn-sm'}
522 allowResize: true,
523 allowDrag: true,
524 dialogId: '',
525 type: 'iframe',
526 url: $(this).attr('href')
529 // for patient portal
530 $(".small_modal").on('click', function(e) {
531 e.preventDefault();e.stopPropagation();
532 dlgopen('', '', 380, 200, '', '', {
533 buttons: [
534 {text: <?php echo xlj('Close'); ?>, close: true, style: 'default btn-sm'}
536 allowResize: true,
537 allowDrag: true,
538 dialogId: '',
539 type: 'iframe',
540 url: $(this).attr('href')
544 function openReminderPopup() {
545 top.restoreSession()
546 dlgopen('', 'reminders', 500, 250, '', '', {
547 buttons: [
548 {text: <?php echo xlj('Close'); ?>, close: true, style: 'default btn-sm'}
550 allowResize: true,
551 allowDrag: true,
552 dialogId: '',
553 type: 'iframe',
554 url: $("#reminder_popup_link").attr('href')
559 <?php if ($GLOBALS['patient_birthday_alert']) {
560 // To display the birthday alert:
561 // 1. The patient is not deceased
562 // 2. The birthday is today (or in the past depending on global selection)
563 // 3. The notification has not been turned off (or shown depending on global selection) for this year
564 $birthdayAlert = new BirthdayReminder($pid, $_SESSION['authId']);
565 if ($birthdayAlert->isDisplayBirthdayAlert()) {
567 // show the active reminder modal
568 dlgopen('', 'bdayreminder', 300, 170, '', false, {
569 allowResize: false,
570 allowDrag: true,
571 dialogId: '',
572 type: 'iframe',
573 url: $("#birthday_popup").attr('href')
576 <?php } elseif ($active_reminders || $all_allergy_alerts) { ?>
577 openReminderPopup();
578 <?php }?>
579 <?php } elseif ($active_reminders || $all_allergy_alerts) { ?>
580 openReminderPopup();
581 <?php }?>
585 // JavaScript stuff to do when a new patient is set.
587 function setMyPatient() {
588 <?php
589 if (isset($_GET['set_pid'])) {
590 $date_of_death = is_patient_deceased($pid)['date_deceased']; ?>
591 parent.left_nav.setPatient(<?php echo js_escape($result['fname'] . " " . $result['lname']) .
592 "," . js_escape($pid) . "," . js_escape($result['pubpid']) . ",'',";
593 if (empty($date_of_death)) {
594 echo js_escape(" " . xl('DOB') . ": " . oeFormatShortDate($result['DOB_YMD']) . " " . xl('Age') . ": " . getPatientAgeDisplay($result['DOB_YMD']));
595 } else {
596 echo js_escape(" " . xl('DOB') . ": " . oeFormatShortDate($result['DOB_YMD']) . " " . xl('Age at death') . ": " . oeFormatAge($result['DOB_YMD'], $date_of_death));
597 }?>);
598 var EncounterDateArray = new Array;
599 var CalendarCategoryArray = new Array;
600 var EncounterIdArray = new Array;
601 var Count = 0;
602 <?php
603 //Encounter details are stored to javacript as array.
604 $result4 = sqlStatement("SELECT fe.encounter,fe.date,openemr_postcalendar_categories.pc_catname FROM form_encounter AS fe ".
605 " left join openemr_postcalendar_categories on fe.pc_catid=openemr_postcalendar_categories.pc_catid WHERE fe.pid = ? order by fe.date desc", array($pid));
606 if (sqlNumRows($result4)>0) {
607 while ($rowresult4 = sqlFetchArray($result4)) {?>
608 EncounterIdArray[Count] = <?php echo js_escape($rowresult4['encounter']); ?>;
609 EncounterDateArray[Count] = <?php echo js_escape(oeFormatShortDate(date("Y-m-d", strtotime($rowresult4['date'])))); ?>;
610 CalendarCategoryArray[Count] = <?php echo js_escape(xl_appt_category($rowresult4['pc_catname'])); ?>;
611 Count++;
612 <?php
616 parent.left_nav.setPatientEncounter(EncounterIdArray,EncounterDateArray,CalendarCategoryArray);
617 <?php
618 } // end setting new pid ?>
619 parent.left_nav.syncRadios();
620 <?php if ((isset($_GET['set_pid']) ) && (isset($_GET['set_encounterid'])) && ( intval($_GET['set_encounterid']) > 0 )) {
621 $encounter = intval($_GET['set_encounterid']);
622 $_SESSION['encounter'] = $encounter;
623 $query_result = sqlQuery("SELECT `date` FROM `form_encounter` WHERE `encounter` = ?", array($encounter)); ?>
624 encurl = 'encounter/encounter_top.php?set_encounter=' + <?php echo js_url($encounter);?> + '&pid=' + <?php echo js_url($pid);?>;
625 parent.left_nav.setEncounter(<?php echo js_escape(oeFormatShortDate(date("Y-m-d", strtotime($query_result['date'])))); ?>, <?php echo js_escape($encounter); ?>, 'enc');
626 top.restoreSession();
627 parent.left_nav.loadFrame('enc2', 'enc', 'patient_file/' + encurl);
628 <?php } // end setting new encounter id (only if new pid is also set) ?>
631 $(window).on('load', function() {
632 setMyPatient();
635 </script>
637 <style type="css/text">
639 #pnotes_ps_expand {
640 height:auto;
641 width:100%;
644 <?php
645 // This is for layout font size override.
646 $grparr = array();
647 getLayoutProperties('DEM', $grparr, 'grp_size');
648 if (!empty($grparr['']['grp_size'])) {
649 $FONTSIZE = $grparr['']['grp_size'];
651 /* Override font sizes in the theme. */
652 #DEM .groupname {
653 font-size: <?php echo attr($FONTSIZE); ?>pt;
655 #DEM .label {
656 font-size: <?php echo attr($FONTSIZE); ?>pt;
658 #DEM .data {
659 font-size: <?php echo attr($FONTSIZE); ?>pt;
661 #DEM .data td {
662 font-size: <?php echo attr($FONTSIZE); ?>pt;
664 <?php } ?>
666 </style>
667 <title><?php echo xlt("Dashboard{{patient file}}"); ?></title>
669 <?php
670 $arrOeUiSettings = array(
671 'heading_title' => xl('Medical Record Dashboard'),
672 'include_patient_name' => true,
673 'expandable' => false,
674 'expandable_files' => array(),//all file names need suffix _xpd
675 'action' => "",//conceal, reveal, search, reset, link or back
676 'action_title' => "",
677 'action_href' => "",//only for actions - reset, link or back
678 'show_help_icon' => true,
679 'help_file_name' => "medical_dashboard_help.php"
681 $oemr_ui = new OemrUI($arrOeUiSettings);
683 </head>
685 <body class="body_top patient-demographics">
686 <div id="container_div" class="<?php echo $oemr_ui->oeContainer();?>">
687 <a href='../reminder/active_reminder_popup.php' id='reminder_popup_link' style='display: none;' onclick='top.restoreSession()'></a>
689 <a href='../birthday_alert/birthday_pop.php?pid=<?php echo attr_url($pid); ?>&user_id=<?php echo attr_url($_SESSION['authId']); ?>' id='birthday_popup' style='display: none;' onclick='top.restoreSession()'></a>
690 <?php
692 $thisauth = acl_check('patients', 'demo');
693 if ($thisauth) {
694 if ($result['squad'] && ! acl_check('squads', $result['squad'])) {
695 $thisauth = 0;
699 // Create and fire the patient demographics view event
700 $viewEvent = new ViewEvent($pid);
701 $viewEvent = $GLOBALS["kernel"]->getEventDispatcher()->dispatch(ViewEvent::EVENT_HANDLE, $viewEvent, 10);
703 if (!$thisauth ||
704 !$viewEvent->authorized()) {
705 echo "<p>(" . xlt('Demographics not authorized') . ")</p>\n";
706 echo "</body>\n</html>\n";
707 exit();
710 <?php
711 if ($thisauth) {?>
712 <div class="row">
713 <div class="col-sm-12">
714 <?php require_once("$include_root/patient_file/summary/dashboard_header.php"); ?>
715 </div>
716 </div>
717 <?php
718 } // $thisauth
721 <div class="row" >
722 <div class="col-sm-12">
723 <?php
724 $list_id = "dashboard"; // to indicate nav item is active, count and give correct id
725 // Collect the patient menu then build it
726 $menuPatient = new PatientMenuRole();
727 $menuPatient->displayHorizNavBarMenu();
728 // Get the document ID of the patient ID card if access to it is wanted here.
729 $idcard_doc_id = false;
730 if ($GLOBALS['patient_id_category_name']) {
731 $idcard_doc_id = get_document_by_catg($pid, $GLOBALS['patient_id_category_name']);
734 </div>
735 </div>
737 <div style='margin-top:10px' class="main"> <!-- start main content div -->
738 <table border="0" cellspacing="0" cellpadding="0" width="100%">
739 <tr>
740 <td class="demographics-box" align="left" valign="top">
741 <!-- start left column div -->
742 <div style='float:left; margin-right:20px'>
744 <table cellspacing=0 cellpadding=0>
745 <?php
746 if (!$GLOBALS['hide_billing_widget']) { ?>
747 <tr>
748 <td>
749 <?php
750 // Billing expand collapse widget
751 $widgetTitle = xl("Billing");
752 $widgetLabel = "billing";
753 $widgetButtonLabel = xl("Edit");
754 $widgetButtonLink = "return newEvt();";
755 $widgetButtonClass = "";
756 $linkMethod = "javascript";
757 $bodyClass = "notab";
758 $widgetAuth = false;
759 $fixedWidth = true;
760 if ($GLOBALS['force_billing_widget_open']) {
761 $forceExpandAlways = true;
762 } else {
763 $forceExpandAlways = false;
766 expand_collapse_widget(
767 $widgetTitle,
768 $widgetLabel,
769 $widgetButtonLabel,
770 $widgetButtonLink,
771 $widgetButtonClass,
772 $linkMethod,
773 $bodyClass,
774 $widgetAuth,
775 $fixedWidth,
776 $forceExpandAlways
779 <br>
780 <?php
781 //PATIENT BALANCE,INS BALANCE naina@capminds.com
782 $patientbalance = get_patient_balance($pid, false);
783 //Debit the patient balance from insurance balance
784 $insurancebalance = get_patient_balance($pid, true) - $patientbalance;
785 $totalbalance=$patientbalance + $insurancebalance;
787 // Show current balance and billing note, if any.
788 echo "<table border='0'><tr><td>" .
789 "<table ><tr><td><span class='bold'><font color='red'>" .
790 xlt('Patient Balance Due') .
791 " : " . text(oeFormatMoney($patientbalance)) .
792 "</font></span></td></tr>".
793 "<tr><td><span class='bold'><font color='red'>" .
794 xlt('Insurance Balance Due') .
795 " : " . text(oeFormatMoney($insurancebalance)) .
796 "</font></span></td></tr>".
797 "<tr><td><span class='bold'><font color='red'>" .
798 xlt('Total Balance Due').
799 " : " . text(oeFormatMoney($totalbalance)) .
800 "</font></span></td></td></tr>";
801 if (!empty($result['billing_note'])) {
802 echo "<tr><td><span class='bold'><font color='red'>" .
803 xlt('Billing Note') . ":" .
804 text($result['billing_note']) .
805 "</font></span></td></tr>";
808 if ($result3['provider']) { // Use provider in case there is an ins record w/ unassigned insco
809 echo "<tr><td><span class='bold'>" .
810 xlt('Primary Insurance') . ': ' . text($insco_name) .
811 "</span>&nbsp;&nbsp;&nbsp;";
812 if ($result3['copay'] > 0) {
813 echo "<span class='bold'>" .
814 xlt('Copay') . ': ' . text($result3['copay']) .
815 "</span>&nbsp;&nbsp;&nbsp;";
817 echo "<span class='bold'>" .
818 xlt('Effective Date') . ': ' . text(oeFormatShortDate($result3['effdate'])) .
819 "</span></td></tr>";
822 echo "</table></td></tr></td></tr></table><br>";
825 </div> <!-- required for expand_collapse_widget -->
826 </td>
827 </tr>
828 <?php } ?>
830 <?php if (acl_check('patients', 'demo')) { ?>
831 <tr>
832 <td>
833 <?php
834 // Demographics expand collapse widget
835 $widgetTitle = xl("Demographics");
836 $widgetLabel = "demographics";
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 <div id="DEM" >
857 <ul class="tabNav">
858 <?php display_layout_tabs('DEM', $result, $result2); ?>
859 </ul>
860 <div class="tabContainer">
861 <?php display_layout_tabs_data('DEM', $result, $result2); ?>
862 </div>
863 </div>
864 <!--</div> required for expand_collapse_widget -->
865 </td>
866 </tr>
868 <tr>
869 <td>
870 <?php
871 $insurance_count = 0;
872 foreach (array('primary','secondary','tertiary') as $instype) {
873 $enddate = 'Present';
874 $query = "SELECT * FROM insurance_data WHERE " .
875 "pid = ? AND type = ? " .
876 "ORDER BY date DESC";
877 $res = sqlStatement($query, array($pid, $instype));
878 while ($row = sqlFetchArray($res)) {
879 if ($row['provider']) {
880 $insurance_count++;
885 if ($insurance_count > 0) {
886 // Insurance expand collapse widget
887 $widgetTitle = xl("Insurance");
888 $widgetLabel = "insurance";
889 $widgetButtonLabel = xl("Edit");
890 $widgetButtonLink = "demographics_full.php";
891 $widgetButtonClass = "";
892 $linkMethod = "html";
893 $bodyClass = "";
894 $widgetAuth = acl_check('patients', 'demo', '', 'write');
895 $fixedWidth = true;
896 expand_collapse_widget(
897 $widgetTitle,
898 $widgetLabel,
899 $widgetButtonLabel,
900 $widgetButtonLink,
901 $widgetButtonClass,
902 $linkMethod,
903 $bodyClass,
904 $widgetAuth,
905 $fixedWidth
908 if ($insurance_count > 0) {
911 <ul class="tabNav"><?php
912 ///////////////////////////////// INSURANCE SECTION
913 $first = true;
914 foreach (array('primary','secondary','tertiary') as $instype) {
915 $query = "SELECT * FROM insurance_data WHERE " .
916 "pid = ? AND type = ? " .
917 "ORDER BY date DESC";
918 $res = sqlStatement($query, array($pid, $instype));
920 $enddate = 'Present';
922 while ($row = sqlFetchArray($res)) {
923 if ($row['provider']) {
924 $ins_description = ucfirst($instype);
925 $ins_description = xl($ins_description);
926 $ins_description .= strcmp($enddate, 'Present') != 0 ? " (".xl('Old').")" : "";
928 <li <?php echo $first ? 'class="current"' : '' ?>><a href="#">
929 <?php echo text($ins_description); ?></a></li>
930 <?php
931 $first = false;
934 $enddate = $row['date'];
938 // Display the eligibility tab
939 echo "<li><a id='eligibility' href='#'>" . xlt('Eligibility') . "</a></li>";
941 ?></ul><?php
942 } ?>
944 <div class="tabContainer">
945 <?php
946 $first = true;
947 foreach (array('primary','secondary','tertiary') as $instype) {
948 $enddate = 'Present';
950 $query = "SELECT * FROM insurance_data WHERE " .
951 "pid = ? AND type = ? " .
952 "ORDER BY date DESC";
953 $res = sqlStatement($query, array($pid, $instype));
954 while ($row = sqlFetchArray($res)) {
955 if ($row['provider']) {
957 <div class="tab <?php echo $first ? 'current' : '' ?>">
958 <table border='0' cellpadding='0' width='100%'>
959 <?php
960 $icobj = new InsuranceCompany($row['provider']);
961 $adobj = $icobj->get_address();
962 $insco_name = trim($icobj->get_name());
964 <tr>
965 <td valign='top' colspan='3'>
966 <span class='text'>
967 <?php
968 if (strcmp($enddate, 'Present') != 0) {
969 echo xlt("Old") . " ";
972 <?php $tempinstype=ucfirst($instype);
973 echo xlt($tempinstype.' Insurance'); ?>
974 <?php if (strcmp($row['date'], '0000-00-00') != 0) { ?>
975 <?php echo ' ' . xlt('from') . ' ' . $row['date']; ?>
976 <?php } ?>
977 <?php echo ' ' . xlt('until') . ' ';
978 echo (strcmp($enddate, 'Present') != 0) ? text($enddate) : xlt('Present'); ?>:</span>
979 </td>
980 </tr>
981 <tr>
982 <td valign='top'>
983 <span class='text'>
984 <?php
985 if ($insco_name) {
986 echo text($insco_name) . '<br>';
987 if (trim($adobj->get_line1())) {
988 echo text($adobj->get_line1()) . '<br>';
989 echo text($adobj->get_city() . ', ' . $adobj->get_state() . ' ' . $adobj->get_zip());
991 } else {
992 echo "<font color='red'><b>" . xlt('Unassigned') . "</b></font>";
995 <br>
996 <?php echo xlt('Policy Number'); ?>: <?php echo text($row['policy_number']) ?><br>
997 <?php echo xlt('Plan Name'); ?>: <?php echo text($row['plan_name']); ?><br>
998 <?php echo xlt('Group Number'); ?>: <?php echo text($row['group_number']); ?>
999 </span>
1000 </td>
1001 <td valign='top'>
1002 <span class='bold'><?php echo xlt('Subscriber'); ?>: </span><br>
1003 <span class='text'><?php echo text($row['subscriber_fname'] . ' ' . $row['subscriber_mname'] . ' ' . $row['subscriber_lname']); ?>
1004 <?php
1005 if ($row['subscriber_relationship'] != "") {
1006 echo "(" . text($row['subscriber_relationship']) . ")";
1009 <br>
1010 <?php echo xlt('S.S.'); ?>:
1011 <?php echo text($row['subscriber_ss']); ?><br>
1012 <?php echo xlt('D.O.B.'); ?>:
1013 <?php
1014 if ($row['subscriber_DOB'] != "0000-00-00 00:00:00") {
1015 echo text($row['subscriber_DOB']);
1017 ?><br>
1018 <?php echo xlt('Phone'); ?>:
1019 <?php echo text($row['subscriber_phone']); ?>
1020 </span>
1021 </td>
1022 <td valign='top'>
1023 <span class='bold'><?php echo xlt('Subscriber Address'); ?>: </span><br>
1024 <span class='text'><?php echo text($row['subscriber_street']); ?><br>
1025 <?php echo text($row['subscriber_city']); ?>
1026 <?php
1027 if ($row['subscriber_state'] != "") {
1028 echo ", ";
1031 echo text($row['subscriber_state']); ?>
1032 <?php
1033 if ($row['subscriber_country'] != "") {
1034 echo ", ";
1037 echo text($row['subscriber_country']); ?>
1038 <?php echo " " . text($row['subscriber_postal_code']); ?></span>
1040 <?php if (trim($row['subscriber_employer'])) { ?>
1041 <br><span class='bold'><?php echo xlt('Subscriber Employer'); ?>: </span><br>
1042 <span class='text'><?php echo text($row['subscriber_employer']); ?><br>
1043 <?php echo text($row['subscriber_employer_street']); ?><br>
1044 <?php echo text($row['subscriber_employer_city']); ?>
1045 <?php
1046 if ($row['subscriber_employer_city'] != "") {
1047 echo ", ";
1050 echo text($row['subscriber_employer_state']); ?>
1051 <?php
1052 if ($row['subscriber_employer_country'] != "") {
1053 echo ", ";
1056 echo text($row['subscriber_employer_country']); ?>
1057 <?php echo " " . text($row['subscriber_employer_postal_code']); ?>
1058 </span>
1059 <?php } ?>
1061 </td>
1062 </tr>
1063 <tr>
1064 <td>
1065 <?php if ($row['copay'] != "") { ?>
1066 <span class='bold'><?php echo xlt('CoPay'); ?>: </span>
1067 <span class='text'><?php echo text($row['copay']); ?></span>
1068 <br />
1069 <?php } ?>
1070 <span class='bold'><?php echo xlt('Accept Assignment'); ?>:</span>
1071 <span class='text'>
1072 <?php
1073 if ($row['accept_assignment'] == "TRUE") {
1074 echo xl("YES");
1076 if ($row['accept_assignment'] == "FALSE") {
1077 echo xl("NO");
1080 </span>
1081 <?php if (!empty($row['policy_type'])) { ?>
1082 <br />
1083 <span class='bold'><?php echo xlt('Secondary Medicare Type'); ?>: </span>
1084 <span class='text'><?php echo text($policy_types[$row['policy_type']]); ?></span>
1085 <?php } ?>
1086 </td>
1087 <td valign='top'></td>
1088 <td valign='top'></td>
1089 </tr>
1091 </table>
1092 </div>
1093 <?php
1094 } // end if ($row['provider'])
1095 $enddate = $row['date'];
1096 $first = false;
1097 } // end while
1098 } // end foreach
1100 // Display the eligibility information
1101 echo "<div class='tab'>\n" .
1102 "<div class='tab-content pre-scrollable' style='width:695px;overflow-x: hidden;'>\n";
1104 if ($GLOBALS['enable_oa']) {
1105 echo "<form method='post' action='./demographics.php'>\n";
1106 echo "<div class='col col-sm-12'>";
1107 echo "<button class='btn btn-success btn-xs btn-transmit pull-right' name='status_update' value='true'>" .
1108 xlt("Update Status") . "</button>";
1109 echo "</div><br>\n";
1110 if ($_POST['status_update'] === 'true') {
1111 unset($_POST['status_update']);
1112 $showEligibility = true;
1113 $ok = EDI_270::requestEligibleTransaction($pid);
1114 if ($ok === true) {
1115 EDI_270::show_eligibility_information($pid, false);
1116 } else {
1117 echo $ok;
1119 } else {
1120 EDI_270::show_eligibility_information($pid, true);
1122 echo "</form>";
1123 } else {
1124 EDI_270::show_eligibility_information($pid, true);
1126 echo "</div></div>";
1128 ///////////////////////////////// END INSURANCE SECTION
1130 </div>
1132 <?php } // ?>
1134 </td>
1135 </tr>
1136 <?php } // end if demographics authorized ?>
1138 <?php if (acl_check('patients', 'notes')) { ?>
1139 <tr>
1140 <td width='650px'>
1141 <?php
1142 // Notes expand collapse widget
1143 $widgetTitle = xl("Messages");
1144 $widgetLabel = "pnotes";
1145 $widgetButtonLabel = xl("Edit");
1146 $widgetButtonLink = "pnotes_full.php?form_active=1";
1147 $widgetButtonClass = "";
1148 $linkMethod = "html";
1149 $bodyClass = "notab";
1150 $widgetAuth = acl_check('patients', 'notes', '', 'write');
1151 $fixedWidth = true;
1152 expand_collapse_widget(
1153 $widgetTitle,
1154 $widgetLabel,
1155 $widgetButtonLabel,
1156 $widgetButtonLink,
1157 $widgetButtonClass,
1158 $linkMethod,
1159 $bodyClass,
1160 $widgetAuth,
1161 $fixedWidth
1164 <br/>
1165 <div style='margin-left:10px' class='text'><img src='../../pic/ajax-loader.gif'/></div><br/>
1166 </div>
1167 </td>
1168 </tr>
1169 <?php } // end if notes authorized ?>
1171 <?php if (acl_check('patients', 'reminder') && $GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_prw']) {
1172 echo "<tr><td width='650px'>";
1173 // patient reminders collapse widget
1174 $widgetTitle = xl("Patient Reminders");
1175 $widgetLabel = "patient_reminders";
1176 $widgetButtonLabel = xl("Edit");
1177 $widgetButtonLink = "../reminder/patient_reminders.php?mode=simple&patient_id=" . attr_url($pid);
1178 $widgetButtonClass = "";
1179 $linkMethod = "html";
1180 $bodyClass = "notab";
1181 $widgetAuth = acl_check('patients', 'reminder', '', 'write');
1182 $fixedWidth = true;
1183 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel, $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth); ?>
1184 <br/>
1185 <div style='margin-left:10px' class='text'><image src='../../pic/ajax-loader.gif'/></div><br/>
1186 </div>
1187 </td>
1188 </tr>
1189 <?php } //end if prw is activated ?>
1191 <?php if (acl_check('patients', 'disclosure')) { ?>
1192 <tr>
1193 <td width='650px'>
1194 <?php
1195 // disclosures expand collapse widget
1196 $widgetTitle = xl("Disclosures");
1197 $widgetLabel = "disclosures";
1198 $widgetButtonLabel = xl("Edit");
1199 $widgetButtonLink = "disclosure_full.php";
1200 $widgetButtonClass = "";
1201 $linkMethod = "html";
1202 $bodyClass = "notab";
1203 $widgetAuth = acl_check('patients', 'disclosure', '', 'write');
1204 $fixedWidth = true;
1205 expand_collapse_widget(
1206 $widgetTitle,
1207 $widgetLabel,
1208 $widgetButtonLabel,
1209 $widgetButtonLink,
1210 $widgetButtonClass,
1211 $linkMethod,
1212 $bodyClass,
1213 $widgetAuth,
1214 $fixedWidth
1217 <br/>
1218 <div style='margin-left:10px' class='text'><img src='../../pic/ajax-loader.gif'/></div><br/>
1219 </div>
1220 </td>
1221 </tr>
1222 <?php } // end if disclosures authorized ?>
1224 <?php if ($GLOBALS['amendments'] && acl_check('patients', 'amendment')) { ?>
1225 <tr>
1226 <td width='650px'>
1227 <?php // Amendments widget
1228 $widgetTitle = xlt('Amendments');
1229 $widgetLabel = "amendments";
1230 $widgetButtonLabel = xlt("Edit");
1231 $widgetButtonLink = $GLOBALS['webroot'] . "/interface/patient_file/summary/list_amendments.php?id=" . attr_url($pid);
1232 $widgetButtonClass = "rx_modal";
1233 $linkMethod = "html";
1234 $bodyClass = "summary_item small";
1235 $widgetAuth = acl_check('patients', 'amendment', '', 'write');
1236 $fixedWidth = false;
1237 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel, $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1238 $sql = "SELECT * FROM amendments WHERE pid = ? ORDER BY amendment_date DESC";
1239 $result = sqlStatement($sql, array($pid));
1241 if (sqlNumRows($result) == 0) {
1242 echo " <table><tr>\n";
1243 echo " <td colspan='" . attr($numcols) . "' class='text'>&nbsp;&nbsp;" . xlt('None{{Amendment}}') . "</td>\n";
1244 echo " </tr></table>\n";
1247 while ($row=sqlFetchArray($result)) {
1248 echo "&nbsp;&nbsp;";
1249 echo "<a class= '" . attr($widgetButtonClass) . "' href='" . $GLOBALS['webroot'] . "/interface/patient_file/summary/add_edit_amendments.php?id=" . attr_url($row['amendment_id']) . "' onclick='top.restoreSession()'>" . text($row['amendment_date']);
1250 echo "&nbsp; " . text($row['amendment_desc']);
1252 echo "</a><br>\n";
1253 } ?>
1254 </td>
1255 </tr>
1256 <?php } // end amendments authorized ?>
1258 <?php if (acl_check('patients', 'lab')) { ?>
1259 <tr>
1260 <td width='650px'>
1261 <?php // labdata expand collapse widget
1262 $widgetTitle = xl("Labs");
1263 $widgetLabel = "labdata";
1264 $widgetButtonLabel = xl("Trend");
1265 $widgetButtonLink = "../summary/labdata.php";#"../encounter/trend_form.php?formname=labdata";
1266 $widgetButtonClass = "";
1267 $linkMethod = "html";
1268 $bodyClass = "notab";
1269 // check to see if any labdata exist
1270 $spruch = "SELECT procedure_report.date_collected AS date " .
1271 "FROM procedure_report " .
1272 "JOIN procedure_order ON procedure_report.procedure_order_id = procedure_order.procedure_order_id " .
1273 "WHERE procedure_order.patient_id = ? " .
1274 "ORDER BY procedure_report.date_collected DESC ";
1275 $existLabdata = sqlQuery($spruch, array($pid));
1276 if ($existLabdata) {
1277 $widgetAuth = true;
1278 } else {
1279 $widgetAuth = false;
1282 $fixedWidth = true;
1283 expand_collapse_widget(
1284 $widgetTitle,
1285 $widgetLabel,
1286 $widgetButtonLabel,
1287 $widgetButtonLink,
1288 $widgetButtonClass,
1289 $linkMethod,
1290 $bodyClass,
1291 $widgetAuth,
1292 $fixedWidth
1295 <br/>
1296 <div style='margin-left:10px' class='text'><img src='../../pic/ajax-loader.gif'/></div><br/>
1297 </div>
1298 </td>
1299 </tr>
1300 <?php } // end labs authorized ?>
1302 <?php if ($vitals_is_registered && acl_check('patients', 'med')) { ?>
1303 <tr>
1304 <td width='650px'>
1305 <?php // vitals expand collapse widget
1306 $widgetTitle = xl("Vitals");
1307 $widgetLabel = "vitals";
1308 $widgetButtonLabel = xl("Trend");
1309 $widgetButtonLink = "../encounter/trend_form.php?formname=vitals";
1310 $widgetButtonClass = "";
1311 $linkMethod = "html";
1312 $bodyClass = "notab";
1313 // check to see if any vitals exist
1314 $existVitals = sqlQuery("SELECT * FROM form_vitals WHERE pid=?", array($pid));
1315 if ($existVitals) {
1316 $widgetAuth = true;
1317 } else {
1318 $widgetAuth = false;
1321 $fixedWidth = true;
1322 expand_collapse_widget(
1323 $widgetTitle,
1324 $widgetLabel,
1325 $widgetButtonLabel,
1326 $widgetButtonLink,
1327 $widgetButtonClass,
1328 $linkMethod,
1329 $bodyClass,
1330 $widgetAuth,
1331 $fixedWidth
1334 <br/>
1335 <div style='margin-left:10px' class='text'><img src='../../pic/ajax-loader.gif'/></div><br/>
1336 </div>
1337 </td>
1338 </tr>
1339 <?php } // end if ($vitals_is_registered && acl_check('patients', 'med')) ?>
1341 <?php
1342 // This generates a section similar to Vitals for each LBF form that
1343 // supports charting. The form ID is used as the "widget label".
1345 $gfres = sqlStatement("SELECT grp_form_id AS option_id, grp_title AS title, grp_aco_spec " .
1346 "FROM layout_group_properties WHERE " .
1347 "grp_form_id LIKE 'LBF%' AND grp_group_id = '' AND grp_repeats > 0 AND grp_activity = 1 " .
1348 "ORDER BY grp_seq, grp_title");
1349 while ($gfrow = sqlFetchArray($gfres)) {
1350 // $jobj = json_decode($gfrow['notes'], true);
1351 $LBF_ACO = empty($gfrow['grp_aco_spec']) ? false : explode('|', $gfrow['grp_aco_spec']);
1352 if ($LBF_ACO && !acl_check($LBF_ACO[0], $LBF_ACO[1])) {
1353 continue;
1354 } ?>
1355 <tr>
1356 <td width='650px'>
1357 <?php // vitals expand collapse widget
1358 $vitals_form_id = $gfrow['option_id'];
1359 $widgetTitle = $gfrow['title'];
1360 $widgetLabel = $vitals_form_id;
1361 $widgetButtonLabel = xl("Trend");
1362 $widgetButtonLink = "../encounter/trend_form.php?formname=" . attr_url($vitals_form_id);
1363 $widgetButtonClass = "";
1364 $linkMethod = "html";
1365 $bodyClass = "notab";
1366 $widgetAuth = false;
1367 if (!$LBF_ACO || acl_check($LBF_ACO[0], $LBF_ACO[1], '', 'write')) {
1368 // check to see if any instances exist for this patient
1369 $existVitals = sqlQuery(
1370 "SELECT * FROM forms WHERE pid = ? AND formdir = ? AND deleted = 0",
1371 array($pid, $vitals_form_id)
1373 $widgetAuth = $existVitals;
1376 $fixedWidth = true;
1377 expand_collapse_widget(
1378 $widgetTitle,
1379 $widgetLabel,
1380 $widgetButtonLabel,
1381 $widgetButtonLink,
1382 $widgetButtonClass,
1383 $linkMethod,
1384 $bodyClass,
1385 $widgetAuth,
1386 $fixedWidth
1387 ); ?>
1388 <br/>
1389 <div style='margin-left:10px' class='text'>
1390 <image src='../../pic/ajax-loader.gif'/>
1391 </div>
1392 <br/>
1393 </div> <!-- This is required by expand_collapse_widget(). -->
1394 </td>
1395 </tr>
1396 <?php
1397 } // end while
1400 </table>
1402 </div>
1403 <!-- end left column div -->
1405 <!-- start right column div -->
1406 <div>
1407 <table>
1408 <tr>
1409 <td>
1411 <div>
1412 <?php
1414 // If there is an ID Card or any Photos show the widget
1415 $photos = pic_array($pid, $GLOBALS['patient_photo_category_name']);
1416 if ($photos or $idcard_doc_id) {
1417 $widgetTitle = xl("ID Card") . '/' . xl("Photos");
1418 $widgetLabel = "photos";
1419 $linkMethod = "javascript";
1420 $bodyClass = "notab-right";
1421 $widgetAuth = false;
1422 $fixedWidth = false;
1423 expand_collapse_widget(
1424 $widgetTitle,
1425 $widgetLabel,
1426 $widgetButtonLabel,
1427 $widgetButtonLink,
1428 $widgetButtonClass,
1429 $linkMethod,
1430 $bodyClass,
1431 $widgetAuth,
1432 $fixedWidth
1435 <br />
1436 <?php
1437 if ($idcard_doc_id) {
1438 image_widget($idcard_doc_id, $GLOBALS['patient_id_category_name']);
1441 foreach ($photos as $photo_doc_id) {
1442 image_widget($photo_doc_id, $GLOBALS['patient_photo_category_name']);
1447 <br />
1448 </div>
1449 <div>
1450 <?php
1451 // Advance Directives
1452 if ($GLOBALS['advance_directives_warning']) {
1453 // advance directives expand collapse widget
1454 $widgetTitle = xl("Advance Directives");
1455 $widgetLabel = "directives";
1456 $widgetButtonLabel = xl("Edit");
1457 $widgetButtonLink = "return advdirconfigure();";
1458 $widgetButtonClass = "";
1459 $linkMethod = "javascript";
1460 $bodyClass = "summary_item small";
1461 $widgetAuth = true;
1462 $fixedWidth = false;
1463 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel, $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1464 $counterFlag = false; //flag to record whether any categories contain ad records
1465 $query = "SELECT id FROM categories WHERE name='Advance Directive'";
1466 $myrow2 = sqlQuery($query);
1467 if ($myrow2) {
1468 $parentId = $myrow2['id'];
1469 $query = "SELECT id, name FROM categories WHERE parent=?";
1470 $resNew1 = sqlStatement($query, array($parentId));
1471 while ($myrows3 = sqlFetchArray($resNew1)) {
1472 $categoryId = $myrows3['id'];
1473 $nameDoc = $myrows3['name'];
1474 $query = "SELECT documents.date, documents.id " .
1475 "FROM documents " .
1476 "INNER JOIN categories_to_documents " .
1477 "ON categories_to_documents.document_id=documents.id " .
1478 "WHERE categories_to_documents.category_id=? " .
1479 "AND documents.foreign_id=? " .
1480 "ORDER BY documents.date DESC";
1481 $resNew2 = sqlStatement($query, array($categoryId, $pid));
1482 $limitCounter = 0; // limit to one entry per category
1483 while (($myrows4 = sqlFetchArray($resNew2)) && ($limitCounter == 0)) {
1484 $dateTimeDoc = $myrows4['date'];
1485 // remove time from datetime stamp
1486 $tempParse = explode(" ", $dateTimeDoc);
1487 $dateDoc = $tempParse[0];
1488 $idDoc = $myrows4['id'];
1489 echo "<a href='$web_root/controller.php?document&retrieve&patient_id=" .
1490 attr_url($pid) . "&document_id=" .
1491 attr_url($idDoc) . "&as_file=true' onclick='top.restoreSession()'>" .
1492 text(xl_document_category($nameDoc)) . "</a> " .
1493 text($dateDoc);
1494 echo "<br>";
1495 $limitCounter = $limitCounter + 1;
1496 $counterFlag = true;
1501 if (!$counterFlag) {
1502 echo "&nbsp;&nbsp;" . xlt('None{{Advanced_Directives}}');
1503 } ?>
1504 </div>
1505 <?php
1506 } // close advanced dir block
1508 // Show Clinical Reminders for any user that has rules that are permitted.
1509 $clin_rem_check = resolve_rules_sql('', '0', true, '', $_SESSION['authUser']);
1510 if (!empty($clin_rem_check) && $GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_crw'] &&
1511 acl_check('patients', 'alert')) {
1512 // clinical summary expand collapse widget
1513 $widgetTitle = xl("Clinical Reminders");
1514 $widgetLabel = "clinical_reminders";
1515 $widgetButtonLabel = xl("Edit");
1516 $widgetButtonLink = "../reminder/clinical_reminders.php?patient_id=" . attr_url($pid);
1518 $widgetButtonClass = "";
1519 $linkMethod = "html";
1520 $bodyClass = "summary_item small";
1521 $widgetAuth = acl_check('patients', 'alert', '', 'write');
1522 $fixedWidth = false;
1523 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel, $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1524 echo "<br/>";
1525 echo "<div style='margin-left:10px' class='text'><image src='../../pic/ajax-loader.gif'/></div><br/>";
1526 echo "</div>";
1527 } // end if crw
1529 // Show current and upcoming appointments.
1531 // Recurring appointment support and Appointment Display Sets
1532 // added to Appointments by Ian Jardine ( epsdky ).
1534 if (isset($pid) && !$GLOBALS['disable_calendar'] && acl_check('patients', 'appt')) {
1536 $current_date2 = date('Y-m-d');
1537 $events = array();
1538 $apptNum = (int)$GLOBALS['number_of_appts_to_show'];
1539 if ($apptNum != 0) {
1540 $apptNum2 = abs($apptNum);
1541 } else {
1542 $apptNum2 = 10;
1546 $mode1 = !$GLOBALS['appt_display_sets_option'];
1547 $colorSet1 = $GLOBALS['appt_display_sets_color_1'];
1548 $colorSet2 = $GLOBALS['appt_display_sets_color_2'];
1549 $colorSet3 = $GLOBALS['appt_display_sets_color_3'];
1550 $colorSet4 = $GLOBALS['appt_display_sets_color_4'];
1552 if ($mode1) {
1553 $extraAppts = 1;
1554 } else {
1555 $extraAppts = 6;
1558 $events = fetchNextXAppts($current_date2, $pid, $apptNum2 + $extraAppts, true);
1559 //////
1560 if ($events) {
1561 $selectNum = 0;
1562 $apptNumber = count($events);
1564 if ($apptNumber <= $apptNum2) {
1565 $extraApptDate = '';
1567 } elseif ($mode1 && $apptNumber == $apptNum2 + 1) {
1568 $extraApptDate = $events[$apptNumber - 1]['pc_eventDate'];
1569 array_pop($events);
1570 --$apptNumber;
1571 $selectNum = 1;
1573 } elseif ($apptNumber == $apptNum2 + 6) {
1574 $extraApptDate = $events[$apptNumber - 1]['pc_eventDate'];
1575 array_pop($events);
1576 --$apptNumber;
1577 $selectNum = 2;
1579 } else { // mode 2 - $apptNum2 < $apptNumber < $apptNum2 + 6
1580 $extraApptDate = '';
1581 $selectNum = 2;
1586 $limitApptIndx = $apptNum2 - 1;
1587 $limitApptDate = $events[$limitApptIndx]['pc_eventDate'];
1589 switch ($selectNum) {
1591 case 2:
1592 $lastApptIndx = $apptNumber - 1;
1593 $thisNumber = $lastApptIndx - $limitApptIndx;
1594 for ($i = 1; $i <= $thisNumber; ++$i) {
1595 if ($events[$limitApptIndx + $i]['pc_eventDate'] != $limitApptDate) {
1596 $extraApptDate = $events[$limitApptIndx + $i]['pc_eventDate'];
1597 $events = array_slice($events, 0, $limitApptIndx + $i);
1598 break;
1603 case 1:
1604 $firstApptIndx = 0;
1605 for ($i = 1; $i <= $limitApptIndx; ++$i) {
1606 if ($events[$limitApptIndx - $i]['pc_eventDate'] != $limitApptDate) {
1607 $firstApptIndx = $apptNum2 - $i;
1608 break;
1616 if ($extraApptDate) {
1617 if ($extraApptDate != $limitApptDate) {
1618 $apptStyle2 = " style='background-color:" . attr($colorSet3) . ";'";
1619 } else {
1620 $apptStyle2 = " style='background-color:" . attr($colorSet4) . ";'";
1625 //////
1627 // appointments expand collapse widget
1628 $widgetTitle = xl("Appointments");
1629 $widgetLabel = "appointments";
1630 $widgetButtonLabel = xl("Add");
1631 $widgetButtonLink = "return newEvt();";
1632 $widgetButtonClass = "";
1633 $linkMethod = "javascript";
1634 $bodyClass = "summary_item small";
1635 $widgetAuth = $resNotNull // $resNotNull reflects state of query in fetchAppointments
1636 && (acl_check('patients', 'appt', '', 'write') || acl_check('patients', 'appt', '', 'addonly'));
1637 $fixedWidth = false;
1638 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel, $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1639 $count = 0;
1641 $toggleSet = true;
1642 $priorDate = "";
1643 $therapyGroupCategories = array();
1644 $query = sqlStatement("SELECT pc_catid FROM openemr_postcalendar_categories WHERE pc_cattype = 3 AND pc_active = 1");
1645 while ($result = sqlFetchArray($query)) {
1646 $therapyGroupCategories[] = $result['pc_catid'];
1650 foreach ($events as $row) { //////
1651 $count++;
1652 $dayname = date("l", strtotime($row['pc_eventDate'])); //////
1653 $dispampm = "am";
1654 $disphour = substr($row['pc_startTime'], 0, 2) + 0;
1655 $dispmin = substr($row['pc_startTime'], 3, 2);
1656 if ($disphour >= 12) {
1657 $dispampm = "pm";
1658 if ($disphour > 12) {
1659 $disphour -= 12;
1663 $etitle = xl('(Click to edit)');
1664 if ($row['pc_hometext'] != "") {
1665 $etitle = xl('Comments').": ".($row['pc_hometext'])."\r\n".$etitle;
1668 //////
1669 if ($extraApptDate && $count > $firstApptIndx) {
1670 $apptStyle = $apptStyle2;
1671 } else {
1672 if ($row['pc_eventDate'] != $priorDate) {
1673 $priorDate = $row['pc_eventDate'];
1674 $toggleSet = !$toggleSet;
1677 if ($toggleSet) {
1678 $apptStyle = " style='background-color:" . attr($colorSet2) . ";'";
1679 } else {
1680 $apptStyle = " style='background-color:" . attr($colorSet1) . ";'";
1684 //////
1685 echo "<div " . $apptStyle . ">";
1686 if (!in_array($row['pc_catid'], $therapyGroupCategories)) {
1687 echo "<a href='javascript:oldEvt(" . attr_js(preg_replace("/-/", "", $row['pc_eventDate'])) . ', ' . attr_js($row['pc_eid']) . ")' title='" . attr($etitle) . "'>";
1688 } else {
1689 echo "<span title='" . attr($etitle) . "'>";
1692 echo "<b>" . text(oeFormatShortDate($row['pc_eventDate'])) . ", ";
1693 echo text(sprintf("%02d", $disphour) .":$dispmin " . xl($dispampm) . " (" . xl($dayname)) . ")</b> ";
1694 if ($row['pc_recurrtype']) {
1695 echo "<img src='" . $GLOBALS['webroot'] . "/interface/main/calendar/modules/PostCalendar/pntemplates/default/images/repeating8.png' border='0' style='margin:0px 2px 0px 2px;' title='" . xla("Repeating event") . "' alt='" . xla("Repeating event") . "'>";
1698 echo "<span title='" . generate_display_field(array('data_type'=>'1','list_id'=>'apptstat'), $row['pc_apptstatus']) . "'>";
1699 echo "<br>" . xlt('Status') . "( " . text($row['pc_apptstatus']) . " ) </span>";
1700 echo text(xl_appt_category($row['pc_catname'])) . "\n";
1701 if (in_array($row['pc_catid'], $therapyGroupCategories)) {
1702 echo "<br><span>" . xlt('Group name') .": " . text(getGroup($row['pc_gid'])['group_name']) . "</span>\n";
1705 if ($row['pc_hometext']) {
1706 echo " <span style='color:green'> Com</span>";
1709 echo "<br>" . text($row['ufname'] . " " . $row['ulname']);
1710 echo !in_array($row['pc_catid'], $therapyGroupCategories) ? '</a>' : '<span>';
1711 echo "</div>\n";
1712 //////
1715 if ($resNotNull) { //////
1716 if ($count < 1) {
1717 echo "&nbsp;&nbsp;" . xlt('No Appointments');
1718 } else { //////
1719 if ($extraApptDate) {
1720 echo "<div style='color:#0000cc;'><b>" . text($extraApptDate) . " ( + ) </b></div>";
1723 // Show Recall if one exists
1724 $query = sqlStatement("SELECT * FROM medex_recalls WHERE r_pid = ?", array($pid));
1726 while ($result2 = sqlFetchArray($query)) {
1727 //tabYourIt('recall', 'main/messages/messages.php?go=' + choice);
1728 //parent.left_nav.loadFrame('1', tabNAME, url);
1729 echo "&nbsp;&nbsp<b>Recall: <a onclick=\"top.left_nav.loadFrame('1', 'rcb', '../interface/main/messages/messages.php?go=addRecall');\">" . text(oeFormatShortDate($result2['r_eventDate'])). " (". text($result2['r_reason']).") </a></b>";
1730 $count2++;
1732 //if there is no appt and no recall
1733 if (($count < 1) && ($count2 < 1)) {
1734 echo "<br /><br />&nbsp;&nbsp;<a onclick=\"top.left_nav.loadFrame('1', 'rcb', '../interface/main/messages/messages.php?go=addRecall');\">" . xlt('No Recall') . "</a>";
1736 $count =0;
1737 echo "</div>";
1739 } // End of Appointments Widget.
1742 /* Widget that shows recurrences for appointments. */
1743 if (isset($pid) && !$GLOBALS['disable_calendar'] && $GLOBALS['appt_recurrences_widget'] &&
1744 acl_check('patients', 'appt')) {
1745 $widgetTitle = xl("Recurrent Appointments");
1746 $widgetLabel = "recurrent_appointments";
1747 $widgetButtonLabel = xl("Add");
1748 $widgetButtonLink = "return newEvt();";
1749 $widgetButtonClass = "";
1750 $linkMethod = "javascript";
1751 $bodyClass = "summary_item small";
1752 $widgetAuth = false;
1753 $fixedWidth = false;
1754 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel, $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1755 $count = 0;
1756 $toggleSet = true;
1757 $priorDate = "";
1759 //Fetch patient's recurrences. Function returns array with recurrence appointments' category, recurrence pattern (interpreted), and end date.
1760 $recurrences = fetchRecurrences($pid);
1761 if (empty($recurrences)) { //if there are no recurrent appointments:
1762 echo "<div>";
1763 echo "<span>" . "&nbsp;&nbsp;" . xlt('None{{Appointment}}') . "</span>";
1764 echo "</div></div>";
1765 } else {
1766 foreach ($recurrences as $row) {
1767 //checks if there are recurrences and if they are current (git didn't end yet)
1768 if (!recurrence_is_current($row['pc_endDate'])) {
1769 continue;
1772 echo "<div>";
1773 echo "<span>" . xlt('Appointment Category') . ": <b>" . xlt($row['pc_catname']) . "</b></span>";
1774 echo "<br>";
1775 echo "<span>" . xlt('Recurrence') . ': ' . text($row['pc_recurrspec']) . "</span>";
1776 echo "<br>";
1777 $red_text = ""; //if ends in a week, make font red
1778 if (ends_in_a_week($row['pc_endDate'])) {
1779 $red_text = " style=\"color:red;\" ";
1782 echo "<span" . $red_text . ">" . xlt('End Date') . ': ' . text(oeFormatShortDate($row['pc_endDate'])) . "</span>";
1783 echo "</div>";
1786 echo "</div>";
1790 /* End of recurrence widget */
1792 // Show PAST appointments.
1793 // added by Terry Hill to allow reverse sorting of the appointments
1794 $direction = "ASC";
1795 if ($GLOBALS['num_past_appointments_to_show'] < 0) {
1796 $direction = "DESC";
1797 ($showpast = -1 * $GLOBALS['num_past_appointments_to_show']);
1798 } else {
1799 $showpast = $GLOBALS['num_past_appointments_to_show'];
1802 if (isset($pid) && !$GLOBALS['disable_calendar'] && $showpast > 0 &&
1803 acl_check('patients', 'appt')) {
1804 $query = "SELECT e.pc_eid, e.pc_aid, e.pc_title, e.pc_eventDate, " .
1805 "e.pc_startTime, e.pc_hometext, u.fname, u.lname, u.mname, " .
1806 "c.pc_catname, e.pc_apptstatus " .
1807 "FROM openemr_postcalendar_events AS e, users AS u, " .
1808 "openemr_postcalendar_categories AS c WHERE " .
1809 "e.pc_pid = ? AND e.pc_eventDate < CURRENT_DATE AND " .
1810 "u.id = e.pc_aid AND e.pc_catid = c.pc_catid " .
1811 "ORDER BY e.pc_eventDate " . escape_sort_order($direction) . " , e.pc_startTime DESC " .
1812 "LIMIT " . escape_limit($showpast);
1814 $pres = sqlStatement($query, array($pid));
1816 // appointments expand collapse widget
1817 $widgetTitle = xl("Past Appointments");
1818 $widgetLabel = "past_appointments";
1819 $widgetButtonLabel = '';
1820 $widgetButtonLink = '';
1821 $widgetButtonClass = '';
1822 $linkMethod = "javascript";
1823 $bodyClass = "summary_item small";
1824 $widgetAuth = false; //no button
1825 $fixedWidth = false;
1826 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel, $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1827 $count = 0;
1828 while ($row = sqlFetchArray($pres)) {
1829 $count++;
1830 $dayname = date("l", strtotime($row['pc_eventDate']));
1831 $dispampm = "am";
1832 $disphour = substr($row['pc_startTime'], 0, 2) + 0;
1833 $dispmin = substr($row['pc_startTime'], 3, 2);
1834 if ($disphour >= 12) {
1835 $dispampm = "pm";
1836 if ($disphour > 12) {
1837 $disphour -= 12;
1841 $petitle = xl('(Click to edit)');
1842 if ($row['pc_hometext'] != "") {
1843 $petitle = xl('Comments').": ".($row['pc_hometext'])."\r\n".$petitle;
1846 echo "<a href='javascript:oldEvt(" . attr_js(preg_replace("/-/", "", $row['pc_eventDate'])) . ', ' . attr_js($row['pc_eid']) . ")' title='" . attr($petitle) . "'>";
1847 echo "<b>" . text(xl($dayname) . ", " . oeFormatShortDate($row['pc_eventDate'])) . "</b> " . xlt("Status") . "(";
1848 echo " " . generate_display_field(array('data_type'=>'1','list_id'=>'apptstat'), $row['pc_apptstatus']) . ")<br>"; // can't use special char parser on this
1849 echo text("$disphour:$dispmin ") . xlt($dispampm) . " ";
1850 echo text($row['fname'] . " " . $row['lname']) . "</a><br>\n";
1853 if (isset($pres) && $res != null) {
1854 if ($count < 1) {
1855 echo "&nbsp;&nbsp;" . xlt('None{{Appointment}}');
1858 echo "</div>";
1862 // END of past appointments
1864 </div>
1866 <div id='stats_div'>
1867 <br/>
1868 <div style='margin-left:10px' class='text'><img src='../../pic/ajax-loader.gif'/></div><br/>
1869 </div>
1870 </td>
1871 </tr>
1873 <?php // TRACK ANYTHING -----
1875 // Determine if track_anything form is in use for this site.
1876 $tmp = sqlQuery("SELECT count(*) AS count FROM registry WHERE " .
1877 "directory = 'track_anything' AND state = 1");
1878 $track_is_registered = $tmp['count'];
1879 if ($track_is_registered) {
1880 echo "<tr> <td>";
1881 // track_anything expand collapse widget
1882 $widgetTitle = xl("Tracks");
1883 $widgetLabel = "track_anything";
1884 $widgetButtonLabel = xl("Tracks");
1885 $widgetButtonLink = "../../forms/track_anything/create.php";
1886 $widgetButtonClass = "";
1887 $widgetAuth = ""; // don't show the button
1888 $linkMethod = "html";
1889 $bodyClass = "notab";
1890 // check to see if any tracks exist
1891 $spruch = "SELECT id " .
1892 "FROM forms " .
1893 "WHERE pid = ? " .
1894 "AND formdir = ? ";
1895 $existTracks = sqlQuery($spruch, array($pid, "track_anything"));
1897 $fixedWidth = false;
1898 expand_collapse_widget(
1899 $widgetTitle,
1900 $widgetLabel,
1901 $widgetButtonLabel,
1902 $widgetButtonLink,
1903 $widgetButtonClass,
1904 $linkMethod,
1905 $bodyClass,
1906 $widgetAuth,
1907 $fixedWidth
1910 <br/>
1911 <div style='margin-left:10px' class='text'><img src='../../pic/ajax-loader.gif'/></div><br/>
1912 <!--</div>-->
1913 </td>
1914 </tr><?php
1915 } // end track_anything ?>
1916 </table>
1918 </div> <!-- end right column div -->
1920 </td>
1922 </tr>
1923 </table>
1925 </div> <!-- end main content div -->
1926 </div><!-- end container div -->
1927 <?php $oemr_ui->oeBelowContainerDiv();?>
1928 <script language='JavaScript'>
1929 // Array of skip conditions for the checkSkipConditions() function.
1930 var skipArray = [
1931 <?php echo $condition_str; ?>
1933 checkSkipConditions();
1935 var isPost = <?php echo js_escape($showEligibility); ?>;
1936 var listId = '#' + <?php echo js_escape($list_id); ?>;
1937 $(document).ready(function(){
1938 $(listId).addClass("active");
1939 if(isPost === true) {
1940 $("#eligibility").click();
1941 $("#eligibility").get(0).scrollIntoView();
1945 </script>
1947 </body>
1948 </html>