Highway to PSR2
[openemr.git] / interface / patient_file / summary / demographics.php
blob9133f86a6a65fbe3f61db8b6c85b89ab3f865aca
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 * @copyright Copyright (c) 2017 Brady Miller <brady.g.miller@gmail.com>
10 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
14 require_once("../../globals.php");
15 require_once("$srcdir/patient.inc");
16 require_once("$srcdir/acl.inc");
17 require_once("$srcdir/options.inc.php");
18 require_once("../history/history.inc.php");
19 require_once("$srcdir/edi.inc");
20 require_once("$srcdir/invoice_summary.inc.php");
21 require_once("$srcdir/clinical_rules.php");
22 require_once("$srcdir/options.js.php");
23 require_once("$srcdir/group.inc");
24 ////////////
25 require_once(dirname(__FILE__)."/../../../library/appointments.inc.php");
27 if (isset($_GET['set_pid'])) {
28 include_once("$srcdir/pid.inc");
29 setpid($_GET['set_pid']);
32 $active_reminders = false;
33 $all_allergy_alerts = false;
34 if ($GLOBALS['enable_cdr']) {
35 //CDR Engine stuff
36 if ($GLOBALS['enable_allergy_check'] && $GLOBALS['enable_alert_log']) {
37 //Check for new allergies conflicts and throw popup if any exist(note need alert logging to support this)
38 $new_allergy_alerts = allergy_conflict($pid, 'new', $_SESSION['authUser']);
39 if (!empty($new_allergy_alerts)) {
40 $pop_warning = '<script type="text/javascript">alert(\'' . xls('WARNING - FOLLOWING ACTIVE MEDICATIONS ARE ALLERGIES') . ':\n';
41 foreach ($new_allergy_alerts as $new_allergy_alert) {
42 $pop_warning .= addslashes($new_allergy_alert) . '\n';
45 $pop_warning .= '\')</script>';
46 echo $pop_warning;
50 if ((!isset($_SESSION['alert_notify_pid']) || ($_SESSION['alert_notify_pid'] != $pid)) && isset($_GET['set_pid']) && $GLOBALS['enable_cdr_crp']) {
51 // showing a new patient, so check for active reminders and allergy conflicts, which use in active reminder popup
52 $active_reminders = active_alert_summary($pid, "reminders-due", '', 'default', $_SESSION['authUser'], true);
53 if ($GLOBALS['enable_allergy_check']) {
54 $all_allergy_alerts = allergy_conflict($pid, 'all', $_SESSION['authUser'], true);
59 function print_as_money($money)
61 preg_match("/(\d*)\.?(\d*)/", $money, $moneymatches);
62 $tmp = wordwrap(strrev($moneymatches[1]), 3, ",", 1);
63 $ccheck = strrev($tmp);
64 if ($ccheck[0] == ",") {
65 $tmp = substr($ccheck, 1, strlen($ccheck)-1);
68 if ($moneymatches[2] != "") {
69 return "$ " . strrev($tmp) . "." . $moneymatches[2];
70 } else {
71 return "$ " . strrev($tmp);
75 // get an array from Photos category
76 function pic_array($pid, $picture_directory)
78 $pics = array();
79 $sql_query = "select documents.id from documents join categories_to_documents " .
80 "on documents.id = categories_to_documents.document_id " .
81 "join categories on categories.id = categories_to_documents.category_id " .
82 "where categories.name like ? and documents.foreign_id = ?";
83 if ($query = sqlStatement($sql_query, array($picture_directory,$pid))) {
84 while ($results = sqlFetchArray($query)) {
85 array_push($pics, $results['id']);
89 return ($pics);
91 // Get the document ID of the first document in a specific catg.
92 function get_document_by_catg($pid, $doc_catg)
95 $result = array();
97 if ($pid and $doc_catg) {
98 $result = sqlQuery("SELECT d.id, d.date, d.url FROM " .
99 "documents AS d, categories_to_documents AS cd, categories AS c " .
100 "WHERE d.foreign_id = ? " .
101 "AND cd.document_id = d.id " .
102 "AND c.id = cd.category_id " .
103 "AND c.name LIKE ? " .
104 "ORDER BY d.date DESC LIMIT 1", array($pid, $doc_catg));
107 return($result['id']);
110 // Display image in 'widget style'
111 function image_widget($doc_id, $doc_catg)
113 global $pid, $web_root;
114 $docobj = new Document($doc_id);
115 $image_file = $docobj->get_url_file();
116 $image_width = $GLOBALS['generate_doc_thumb'] == 1 ? '' : 'width=100';
117 $extension = substr($image_file, strrpos($image_file, "."));
118 $viewable_types = array('.png','.jpg','.jpeg','.png','.bmp','.PNG','.JPG','.JPEG','.PNG','.BMP'); // image ext supported by fancybox viewer
119 if (in_array($extension, $viewable_types)) { // extention matches list
120 $to_url = "<td> <a href = $web_root" .
121 "/controller.php?document&retrieve&patient_id=$pid&document_id=$doc_id&as_file=false&original_file=true&disable_exit=false&show_original=true" .
122 "/tmp$extension" . // Force image type URL for fancybo
123 " onclick=top.restoreSession(); class='image_modal'>" .
124 " <img src = $web_root" .
125 "/controller.php?document&retrieve&patient_id=$pid&document_id=$doc_id&as_file=false" .
126 " $image_width alt='$doc_catg:$image_file'> </a> </td> <td valign='center'>".
127 htmlspecialchars($doc_catg) . '<br />&nbsp;' . htmlspecialchars($image_file) .
128 "</td>";
129 } else {
130 $to_url = "<td> <a href='" . $web_root . "/controller.php?document&retrieve" .
131 "&patient_id=$pid&document_id=$doc_id'" .
132 " onclick='top.restoreSession()' class='css_button_small'>" .
133 "<span>" .
134 htmlspecialchars(xl("View"), ENT_QUOTES)."</a> &nbsp;" .
135 htmlspecialchars("$doc_catg - $image_file", ENT_QUOTES) .
136 "</span> </td>";
139 echo "<table><tr>";
140 echo $to_url;
141 echo "</tr></table>";
144 // Determine if the Vitals form is in use for this site.
145 $tmp = sqlQuery("SELECT count(*) AS count FROM registry WHERE " .
146 "directory = 'vitals' AND state = 1");
147 $vitals_is_registered = $tmp['count'];
149 // Get patient/employer/insurance information.
151 $result = getPatientData($pid, "*, DATE_FORMAT(DOB,'%Y-%m-%d') as DOB_YMD");
152 $result2 = getEmployerData($pid);
153 $result3 = getInsuranceData($pid, "primary", "copay, provider, DATE_FORMAT(`date`,'%Y-%m-%d') as effdate");
154 $insco_name = "";
155 if ($result3['provider']) { // Use provider in case there is an ins record w/ unassigned insco
156 $insco_name = getInsuranceProvider($result3['provider']);
159 <html>
161 <head>
162 <?php html_header_show();?>
163 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
164 <link rel="stylesheet" type="text/css" href="../../../library/js/fancybox/jquery.fancybox-1.2.6.css" media="screen" />
165 <script type="text/javascript" src="../../../library/textformat.js?v=<?php echo $v_js_includes; ?>"></script>
166 <script type="text/javascript" src="../../../library/dialog.js?v=<?php echo $v_js_includes; ?>"></script>
167 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-7-2/index.js"></script>
168 <script type="text/javascript" src="../../../library/js/common.js?v=<?php echo $v_js_includes; ?>"></script>
169 <script type="text/javascript" src="../../../library/js/fancybox/jquery.fancybox-1.2.6.js"></script>
170 <script type="text/javascript" language="JavaScript">
172 var mypcc = '<?php echo htmlspecialchars($GLOBALS['phone_country_code'], ENT_QUOTES); ?>';
173 //////////
174 function oldEvt(apptdate, eventid) {
175 dlgopen('../../main/calendar/add_edit_event.php?date=' + apptdate + '&eid=' + eventid, '_blank', 775, 500);
178 function advdirconfigure() {
179 dlgopen('advancedirectives.php', '_blank', 400, 500);
182 function refreshme() {
183 top.restoreSession();
184 location.reload();
187 // Process click on Delete link.
188 function deleteme() {
189 dlgopen('../deleter.php?patient=<?php echo htmlspecialchars($pid, ENT_QUOTES); ?>', '_blank', 500, 450);
190 return false;
193 // Called by the deleteme.php window on a successful delete.
194 function imdeleted() {
195 <?php if ($GLOBALS['new_tabs_layout']) { ?>
196 top.clearPatient();
197 <?php } else { ?>
198 parent.left_nav.clearPatient();
199 <?php } ?>
202 function newEvt() {
203 dlgopen('../../main/calendar/add_edit_event.php?patientid=<?php echo htmlspecialchars($pid, ENT_QUOTES); ?>', '_blank', 775, 500);
204 return false;
207 function sendimage(pid, what) {
208 // alert('Not yet implemented.'); return false;
209 dlgopen('../upload_dialog.php?patientid=' + pid + '&file=' + what,
210 '_blank', 500, 400);
211 return false;
214 </script>
216 <script type="text/javascript">
218 function toggleIndicator(target,div) {
220 $mode = $(target).find(".indicator").text();
221 if ( $mode == "<?php echo htmlspecialchars(xl('collapse'), ENT_QUOTES); ?>" ) {
222 $(target).find(".indicator").text( "<?php echo htmlspecialchars(xl('expand'), ENT_QUOTES); ?>" );
223 $("#"+div).hide();
224 $.post( "../../../library/ajax/user_settings.php", { target: div, mode: 0 });
225 } else {
226 $(target).find(".indicator").text( "<?php echo htmlspecialchars(xl('collapse'), ENT_QUOTES); ?>" );
227 $("#"+div).show();
228 $.post( "../../../library/ajax/user_settings.php", { target: div, mode: 1 });
232 $(document).ready(function(){
233 var msg_updation='';
234 <?php
235 if ($GLOBALS['erx_enable']) {
236 //$soap_status=sqlQuery("select soap_import_status from patient_data where pid=?",array($pid));
237 $soap_status=sqlStatement("select soap_import_status,pid from patient_data where pid=? and soap_import_status in ('1','3')", array($pid));
238 while ($row_soapstatus=sqlFetchArray($soap_status)) {
239 //if($soap_status['soap_import_status']=='1' || $soap_status['soap_import_status']=='3'){ ?>
240 top.restoreSession();
241 $.ajax({
242 type: "POST",
243 url: "../../soap_functions/soap_patientfullmedication.php",
244 dataType: "html",
245 data: {
246 patient:<?php echo $row_soapstatus['pid']; ?>,
248 async: false,
249 success: function(thedata){
250 //alert(thedata);
251 msg_updation+=thedata;
253 error:function(){
254 alert('ajax error');
257 <?php
259 //elseif($soap_status['soap_import_status']=='3'){ ?>
260 top.restoreSession();
261 $.ajax({
262 type: "POST",
263 url: "../../soap_functions/soap_allergy.php",
264 dataType: "html",
265 data: {
266 patient:<?php echo $row_soapstatus['pid']; ?>,
268 async: false,
269 success: function(thedata){
270 //alert(thedata);
271 msg_updation+=thedata;
273 error:function(){
274 alert('ajax error');
277 <?php
278 if ($GLOBALS['erx_import_status_message']) { ?>
279 if(msg_updation)
280 alert(msg_updation);
281 <?php
288 // load divs
289 $("#stats_div").load("stats.php", { 'embeddedScreen' : true }, function() {
290 // (note need to place javascript code here also to get the dynamic link to work)
291 $(".rx_modal").fancybox( {
292 'overlayOpacity' : 0.0,
293 'showCloseButton' : true,
294 'frameHeight' : 500,
295 'frameWidth' : 800,
296 'centerOnScroll' : false,
297 'callbackOnClose' : function() {
298 refreshme();
302 $("#pnotes_ps_expand").load("pnotes_fragment.php");
303 $("#disclosures_ps_expand").load("disc_fragment.php");
305 <?php if ($GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_crw']) { ?>
306 top.restoreSession();
307 $("#clinical_reminders_ps_expand").load("clinical_reminders_fragment.php", { 'embeddedScreen' : true }, function() {
308 // (note need to place javascript code here also to get the dynamic link to work)
309 $(".medium_modal").fancybox( {
310 'overlayOpacity' : 0.0,
311 'showCloseButton' : true,
312 'frameHeight' : 500,
313 'frameWidth' : 800,
314 'centerOnScroll' : false,
315 'callbackOnClose' : function() {
316 refreshme();
320 <?php } // end crw?>
322 <?php if ($GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_prw']) { ?>
323 top.restoreSession();
324 $("#patient_reminders_ps_expand").load("patient_reminders_fragment.php");
325 <?php } // end prw?>
327 <?php if ($vitals_is_registered && acl_check('patients', 'med')) { ?>
328 // Initialize the Vitals form if it is registered and user is authorized.
329 $("#vitals_ps_expand").load("vitals_fragment.php");
330 <?php } ?>
332 // Initialize track_anything
333 $("#track_anything_ps_expand").load("track_anything_fragment.php");
336 // Initialize labdata
337 $("#labdata_ps_expand").load("labdata_fragment.php");
338 <?php
339 // Initialize for each applicable LBF form.
340 $gfres = sqlStatement("SELECT option_id FROM list_options WHERE " .
341 "list_id = 'lbfnames' AND option_value > 0 AND activity = 1 ORDER BY seq, title");
342 while ($gfrow = sqlFetchArray($gfres)) { ?>
343 $("#<?php echo $gfrow['option_id']; ?>_ps_expand").load("lbf_fragment.php?formname=<?php echo $gfrow['option_id']; ?>");<?php
347 // fancy box
348 enable_modals();
350 tabbify();
352 // modal for dialog boxes
353 $(".large_modal").fancybox( {
354 'overlayOpacity' : 0.0,
355 'showCloseButton' : true,
356 'frameHeight' : 600,
357 'frameWidth' : 1000,
358 'centerOnScroll' : false
361 // modal for image viewer
362 $(".image_modal").fancybox( {
363 'overlayOpacity' : 0.0,
364 'showCloseButton' : true,
365 'centerOnScroll' : false,
366 'autoscale' : true
369 $(".iframe1").fancybox( {
370 'left':10,
371 'overlayOpacity' : 0.0,
372 'showCloseButton' : true,
373 'frameHeight' : 300,
374 'frameWidth' : 350
376 // special size for patient portal
377 $(".small_modal").fancybox( {
378 'overlayOpacity' : 0.0,
379 'showCloseButton' : true,
380 'frameHeight' : 200,
381 'frameWidth' : 380,
382 'centerOnScroll' : false
385 <?php if ($active_reminders || $all_allergy_alerts) { ?>
386 // show the active reminder modal
387 $("#reminder_popup_link").fancybox({
388 'overlayOpacity' : 0.0,
389 'showCloseButton' : true,
390 'frameHeight' : 500,
391 'frameWidth' : 500,
392 'centerOnScroll' : false
393 }).trigger('click');
394 <?php } ?>
398 // JavaScript stuff to do when a new patient is set.
400 function setMyPatient() {
401 // Avoid race conditions with loading of the left_nav or Title frame.
402 if (!parent.allFramesLoaded()) {
403 setTimeout("setMyPatient()", 500);
404 return;
406 <?php if (isset($_GET['set_pid'])) { ?>
407 parent.left_nav.setPatient(<?php echo "'" . addslashes($result['fname']) . " " . addslashes($result['lname']) .
408 "'," . addslashes($pid) . ",'" . addslashes($result['pubpid']) .
409 "','', ' " . xls('DOB') . ": " . addslashes(oeFormatShortDate($result['DOB_YMD'])) . " " . xls('Age') . ": " . addslashes(getPatientAgeDisplay($result['DOB_YMD'])) . "'"; ?>);
410 var EncounterDateArray = new Array;
411 var CalendarCategoryArray = new Array;
412 var EncounterIdArray = new Array;
413 var Count = 0;
414 <?php
415 //Encounter details are stored to javacript as array.
416 $result4 = sqlStatement("SELECT fe.encounter,fe.date,openemr_postcalendar_categories.pc_catname FROM form_encounter AS fe ".
417 " left join openemr_postcalendar_categories on fe.pc_catid=openemr_postcalendar_categories.pc_catid WHERE fe.pid = ? order by fe.date desc", array($pid));
418 if (sqlNumRows($result4)>0) {
419 while ($rowresult4 = sqlFetchArray($result4)) {
421 EncounterIdArray[Count] = '<?php echo addslashes($rowresult4['encounter']); ?>';
422 EncounterDateArray[Count] = '<?php echo addslashes(oeFormatShortDate(date("Y-m-d", strtotime($rowresult4['date'])))); ?>';
423 CalendarCategoryArray[Count] = '<?php echo addslashes(xl_appt_category($rowresult4['pc_catname'])); ?>';
424 Count++;
425 <?php
429 parent.left_nav.setPatientEncounter(EncounterIdArray,EncounterDateArray,CalendarCategoryArray);
430 <?php } // end setting new pid ?>
431 parent.left_nav.syncRadios();
432 <?php if ((isset($_GET['set_pid']) ) && (isset($_GET['set_encounterid'])) && ( intval($_GET['set_encounterid']) > 0 )) {
433 $encounter = intval($_GET['set_encounterid']);
434 $_SESSION['encounter'] = $encounter;
435 $query_result = sqlQuery("SELECT `date` FROM `form_encounter` WHERE `encounter` = ?", array($encounter)); ?>
436 encurl = 'encounter/encounter_top.php?set_encounter=' + <?php echo attr($encounter);?> + '&pid=' + <?php echo attr($pid);?>;
437 <?php if ($GLOBALS['new_tabs_layout']) { ?>
438 parent.left_nav.setEncounter('<?php echo oeFormatShortDate(date("Y-m-d", strtotime($query_result['date']))); ?>', '<?php echo attr($encounter); ?>', 'enc');
439 top.restoreSession();
440 parent.left_nav.loadFrame('enc2', 'enc', 'patient_file/' + encurl);
441 <?php } else { ?>
442 var othername = (window.name == 'RTop') ? 'RBot' : 'RTop';
443 parent.left_nav.setEncounter('<?php echo oeFormatShortDate(date("Y-m-d", strtotime($query_result['date']))); ?>', '<?php echo attr($encounter); ?>', othername);
444 top.restoreSession();
445 parent.frames[othername].location.href = '../' + encurl;
446 <?php } ?>
447 <?php } // end setting new encounter id (only if new pid is also set) ?>
450 $(window).load(function() {
451 setMyPatient();
454 </script>
456 <style type="css/text">
457 #pnotes_ps_expand {
458 height:auto;
459 width:100%;
461 </style>
463 </head>
465 <body class="body_top patient-demographics">
467 <a href='../reminder/active_reminder_popup.php' id='reminder_popup_link' style='visibility: false;' class='iframe' onclick='top.restoreSession()'></a>
469 <?php
470 $thisauth = acl_check('patients', 'demo');
471 if ($thisauth) {
472 if ($result['squad'] && ! acl_check('squads', $result['squad'])) {
473 $thisauth = 0;
477 if (!$thisauth) {
478 echo "<p>(" . htmlspecialchars(xl('Demographics not authorized'), ENT_NOQUOTES) . ")</p>\n";
479 echo "</body>\n</html>\n";
480 exit();
483 if ($thisauth) : ?>
485 <table class="table_header">
486 <tr>
487 <td>
488 <span class='title'>
489 <?php echo htmlspecialchars(getPatientName($pid), ENT_NOQUOTES); ?>
490 </span>
491 </td>
492 <?php if (acl_check('admin', 'super') && $GLOBALS['allow_pat_delete']) : ?>
493 <td style='padding-left:1em;' class="delete">
494 <a class='css_button iframe'
495 href='../deleter.php?patient=<?php echo htmlspecialchars($pid, ENT_QUOTES);?>'
496 onclick='top.restoreSession()'>
497 <span><?php echo htmlspecialchars(xl('Delete'), ENT_NOQUOTES);?></span>
498 </a>
499 </td>
500 <?php endif; // Allow PT delete
501 if ($GLOBALS['erx_enable']) : ?>
502 <td style="padding-left:1em;" class="erx">
503 <a class="css_button" href="../../eRx.php?page=medentry" onclick="top.restoreSession()">
504 <span><?php echo htmlspecialchars(xl('NewCrop MedEntry'), ENT_NOQUOTES);?></span>
505 </a>
506 </td>
507 <td style="padding-left:1em;">
508 <a class="css_button iframe1"
509 href="../../soap_functions/soap_accountStatusDetails.php"
510 onclick="top.restoreSession()">
511 <span><?php echo htmlspecialchars(xl('NewCrop Account Status'), ENT_NOQUOTES);?></span>
512 </a>
513 </td>
514 <td id='accountstatus'></td>
515 <?php endif; // eRX Enabled
516 //Patient Portal
517 $portalUserSetting = true; //flag to see if patient has authorized access to portal
518 if (($GLOBALS['portal_onsite_enable'] && $GLOBALS['portal_onsite_address']) ||
519 ($GLOBALS['portal_onsite_two_enable'] && $GLOBALS['portal_onsite_two_address']) ) :
520 $portalStatus = sqlQuery("SELECT allow_patient_portal FROM patient_data WHERE pid=?", array($pid));
521 if ($portalStatus['allow_patient_portal']=='YES') :
522 $portalLogin = sqlQuery("SELECT pid FROM `patient_access_onsite` WHERE `pid`=?", array($pid));?>
523 <td style='padding-left:1em;'>
524 <a class='css_button iframe small_modal'
525 href='create_portallogin.php?portalsite=on&patient=<?php echo htmlspecialchars($pid, ENT_QUOTES);?>'
526 onclick='top.restoreSession()'>
527 <?php $display = (empty($portalLogin)) ? xlt('Create Onsite Portal Credentials') : xlt('Reset Onsite Portal Credentials'); ?>
528 <span><?php echo $display; ?></span>
529 </a>
530 </td>
531 <?php
532 else :
533 $portalUserSetting = false;
534 endif; // allow patient portal
535 endif; // Onsite Patient Portal
536 if ($GLOBALS['portal_offsite_enable'] && $GLOBALS['portal_offsite_address']) :
537 $portalStatus = sqlQuery("SELECT allow_patient_portal FROM patient_data WHERE pid=?", array($pid));
538 if ($portalStatus['allow_patient_portal']=='YES') :
539 $portalLogin = sqlQuery("SELECT pid FROM `patient_access_offsite` WHERE `pid`=?", array($pid));
541 <td style='padding-left:1em;'>
542 <a class='css_button iframe small_modal'
543 href='create_portallogin.php?portalsite=off&patient=<?php echo htmlspecialchars($pid, ENT_QUOTES);?>'
544 onclick='top.restoreSession()'>
545 <span>
546 <?php $text = (empty($portalLogin)) ? xlt('Create Offsite Portal Credentials') : xlt('Reset Offsite Portal Credentials'); ?>
547 <?php echo $text; ?>
548 </span>
549 </a>
550 </td>
551 <?php
552 else :
553 $portalUserSetting = false;
554 endif; // allow_patient_portal
555 endif; // portal_offsite_enable
556 if (!($portalUserSetting)) : // Show that the patient has not authorized portal access ?>
557 <td style='padding-left:1em;'>
558 <?php echo htmlspecialchars(xl('Patient has not authorized the Patient Portal.'), ENT_NOQUOTES);?>
559 </td>
560 <?php endif;
561 //Patient Portal
563 // If patient is deceased, then show this (along with the number of days patient has been deceased for)
564 $days_deceased = is_patient_deceased($pid);
565 if ($days_deceased != null) : ?>
566 <td class="deceased" style="padding-left:1em;font-weight:bold;color:red">
567 <?php
568 if ($days_deceased == 0) {
569 echo xlt("DECEASED (Today)");
570 } else if ($days_deceased == 1) {
571 echo xlt("DECEASED (1 day ago)");
572 } else {
573 echo xlt("DECEASED") . " (" . text($days_deceased) . " " . xlt("days ago") . ")";
574 } ?>
575 </td>
576 <?php endif; ?>
577 </tr>
578 </table>
580 <?php
581 endif; // $thisauth
584 <?php
585 // Get the document ID of the patient ID card if access to it is wanted here.
586 $idcard_doc_id = false;
587 if ($GLOBALS['patient_id_category_name']) {
588 $idcard_doc_id = get_document_by_catg($pid, $GLOBALS['patient_id_category_name']);
592 <table cellspacing='0' cellpadding='0' border='0' class="subnav">
593 <tr>
594 <td class="small" colspan='4'>
595 <a href="../history/history.php" onclick='top.restoreSession()'>
596 <?php echo htmlspecialchars(xl('History'), ENT_NOQUOTES); ?></a>
598 <?php //note that we have temporarily removed report screen from the modal view ?>
599 <a href="../report/patient_report.php" onclick='top.restoreSession()'>
600 <?php echo htmlspecialchars(xl('Report'), ENT_NOQUOTES); ?></a>
602 <?php //note that we have temporarily removed document screen from the modal view ?>
603 <a href="../../../controller.php?document&list&patient_id=<?php echo $pid;?>" onclick='top.restoreSession()'>
604 <?php echo htmlspecialchars(xl('Documents'), ENT_NOQUOTES); ?></a>
606 <a href="../transaction/transactions.php" onclick='top.restoreSession()'>
607 <?php echo htmlspecialchars(xl('Transactions'), ENT_NOQUOTES); ?></a>
609 <a href="stats_full.php?active=all" onclick='top.restoreSession()'>
610 <?php echo htmlspecialchars(xl('Issues'), ENT_NOQUOTES); ?></a>
612 <a href="../../reports/pat_ledger.php?form=1&patient_id=<?php echo attr($pid);?>" onclick='top.restoreSession()'>
613 <?php echo xlt('Ledger'); ?></a>
615 <a href="../../reports/external_data.php" onclick='top.restoreSession()'>
616 <?php echo xlt('External Data'); ?></a>
618 <!-- DISPLAYING HOOKS STARTS HERE -->
619 <?php
620 $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
621 LEFT OUTER JOIN modules_settings AS ms ON obj_name=enabled_hooks AND ms.mod_id=msh.mod_id
622 LEFT OUTER JOIN modules AS m ON m.mod_id=ms.mod_id
623 WHERE fld_type=3 AND mod_active=1 AND sql_run=1 AND attached_to='demographics' ORDER BY mod_id");
624 $DivId = 'mod_installer';
625 if (sqlNumRows($module_query)) {
626 $jid = 0;
627 $modid = '';
628 while ($modulerow = sqlFetchArray($module_query)) {
629 $DivId = 'mod_'.$modulerow['mod_id'];
630 $new_category = $modulerow['mod_ui_name'];
631 $modulePath = "";
632 $added = "";
633 if ($modulerow['type'] == 0) {
634 $modulePath = $GLOBALS['customModDir'];
635 $added = "";
636 } else {
637 $added = "index";
638 $modulePath = $GLOBALS['zendModDir'];
641 if (!acl_check('admin', 'super') && !zh_acl_check($_SESSION['authUserID'], $modulerow['obj_name'])) {
642 continue;
645 $relative_link = "../../modules/".$modulePath."/".$modulerow['path'];
646 $nickname = $modulerow['menu_name'] ? $modulerow['menu_name'] : 'Noname';
647 $jid++;
648 $modid = $modulerow['mod_id'];
651 <a href="<?php echo $relative_link; ?>" onclick='top.restoreSession()'>
652 <?php echo xlt($nickname); ?></a>
653 <?php
657 <!-- DISPLAYING HOOKS ENDS HERE -->
659 </td>
660 </tr>
661 </table> <!-- end header -->
663 <div style='margin-top:10px' class="main"> <!-- start main content div -->
664 <table border="0" cellspacing="0" cellpadding="0" width="100%">
665 <tr>
666 <td class="demographics-box" align="left" valign="top">
667 <!-- start left column div -->
668 <div style='float:left; margin-right:20px'>
670 <table cellspacing=0 cellpadding=0>
671 <?php if (!$GLOBALS['hide_billing_widget']) { ?>
672 <tr>
673 <td>
674 <?php
675 // Billing expand collapse widget
676 $widgetTitle = xl("Billing");
677 $widgetLabel = "billing";
678 $widgetButtonLabel = xl("Edit");
679 $widgetButtonLink = "return newEvt();";
680 $widgetButtonClass = "";
681 $linkMethod = "javascript";
682 $bodyClass = "notab";
683 $widgetAuth = false;
684 $fixedWidth = true;
685 if ($GLOBALS['force_billing_widget_open']) {
686 $forceExpandAlways = true;
687 } else {
688 $forceExpandAlways = false;
691 expand_collapse_widget(
692 $widgetTitle,
693 $widgetLabel,
694 $widgetButtonLabel,
695 $widgetButtonLink,
696 $widgetButtonClass,
697 $linkMethod,
698 $bodyClass,
699 $widgetAuth,
700 $fixedWidth,
701 $forceExpandAlways
704 <br>
705 <?php
706 //PATIENT BALANCE,INS BALANCE naina@capminds.com
707 $patientbalance = get_patient_balance($pid, false);
708 //Debit the patient balance from insurance balance
709 $insurancebalance = get_patient_balance($pid, true) - $patientbalance;
710 $totalbalance=$patientbalance + $insurancebalance;
712 // Show current balance and billing note, if any.
713 echo "<table border='0'><tr><td>" .
714 "<table ><tr><td><span class='bold'><font color='red'>" .
715 xlt('Patient Balance Due') .
716 " : " . text(oeFormatMoney($patientbalance)) .
717 "</font></span></td></tr>".
718 "<tr><td><span class='bold'><font color='red'>" .
719 xlt('Insurance Balance Due') .
720 " : " . text(oeFormatMoney($insurancebalance)) .
721 "</font></span></td></tr>".
722 "<tr><td><span class='bold'><font color='red'>" .
723 xlt('Total Balance Due').
724 " : " . text(oeFormatMoney($totalbalance)) .
725 "</font></span></td></td></tr>";
726 if (!empty($result['billing_note'])) {
727 echo "<tr><td><span class='bold'><font color='red'>" .
728 xlt('Billing Note') . ":" .
729 text($result['billing_note']) .
730 "</font></span></td></tr>";
733 if ($result3['provider']) { // Use provider in case there is an ins record w/ unassigned insco
734 echo "<tr><td><span class='bold'>" .
735 xlt('Primary Insurance') . ': ' . text($insco_name) .
736 "</span>&nbsp;&nbsp;&nbsp;";
737 if ($result3['copay'] > 0) {
738 echo "<span class='bold'>" .
739 xlt('Copay') . ': ' . text($result3['copay']) .
740 "</span>&nbsp;&nbsp;&nbsp;";
743 echo "<span class='bold'>" .
744 xlt('Effective Date') . ': ' . text(oeFormatShortDate($result3['effdate'])) .
745 "</span></td></tr>";
748 echo "</table></td></tr></td></tr></table><br>";
751 </div> <!-- required for expand_collapse_widget -->
752 </td>
753 </tr>
754 <?php } ?>
756 <?php if (acl_check('patients', 'demo')) { ?>
757 <tr>
758 <td>
759 <?php
760 // Demographics expand collapse widget
761 $widgetTitle = xl("Demographics");
762 $widgetLabel = "demographics";
763 $widgetButtonLabel = xl("Edit");
764 $widgetButtonLink = "demographics_full.php";
765 $widgetButtonClass = "";
766 $linkMethod = "html";
767 $bodyClass = "";
768 $widgetAuth = acl_check('patients', 'demo', '', 'write');
769 $fixedWidth = true;
770 expand_collapse_widget(
771 $widgetTitle,
772 $widgetLabel,
773 $widgetButtonLabel,
774 $widgetButtonLink,
775 $widgetButtonClass,
776 $linkMethod,
777 $bodyClass,
778 $widgetAuth,
779 $fixedWidth
782 <div id="DEM" >
783 <ul class="tabNav">
784 <?php display_layout_tabs('DEM', $result, $result2); ?>
785 </ul>
786 <div class="tabContainer">
787 <?php display_layout_tabs_data('DEM', $result, $result2); ?>
788 </div>
789 </div>
790 </div> <!-- required for expand_collapse_widget -->
791 </td>
792 </tr>
794 <tr>
795 <td>
796 <?php
797 $insurance_count = 0;
798 foreach (array('primary','secondary','tertiary') as $instype) {
799 $enddate = 'Present';
800 $query = "SELECT * FROM insurance_data WHERE " .
801 "pid = ? AND type = ? " .
802 "ORDER BY date DESC";
803 $res = sqlStatement($query, array($pid, $instype));
804 while ($row = sqlFetchArray($res)) {
805 if ($row['provider']) {
806 $insurance_count++;
811 if ($insurance_count > 0) {
812 // Insurance expand collapse widget
813 $widgetTitle = xl("Insurance");
814 $widgetLabel = "insurance";
815 $widgetButtonLabel = xl("Edit");
816 $widgetButtonLink = "demographics_full.php";
817 $widgetButtonClass = "";
818 $linkMethod = "html";
819 $bodyClass = "";
820 $widgetAuth = acl_check('patients', 'demo', '', 'write');
821 $fixedWidth = true;
822 expand_collapse_widget(
823 $widgetTitle,
824 $widgetLabel,
825 $widgetButtonLabel,
826 $widgetButtonLink,
827 $widgetButtonClass,
828 $linkMethod,
829 $bodyClass,
830 $widgetAuth,
831 $fixedWidth
834 if ($insurance_count > 0) {
837 <ul class="tabNav"><?php
838 ///////////////////////////////// INSURANCE SECTION
839 $first = true;
840 foreach (array('primary','secondary','tertiary') as $instype) {
841 $query = "SELECT * FROM insurance_data WHERE " .
842 "pid = ? AND type = ? " .
843 "ORDER BY date DESC";
844 $res = sqlStatement($query, array($pid, $instype));
846 $enddate = 'Present';
848 while ($row = sqlFetchArray($res)) {
849 if ($row['provider']) {
850 $ins_description = ucfirst($instype);
851 $ins_description = xl($ins_description);
852 $ins_description .= strcmp($enddate, 'Present') != 0 ? " (".xl('Old').")" : "";
854 <li <?php echo $first ? 'class="current"' : '' ?>><a href="#">
855 <?php echo htmlspecialchars($ins_description, ENT_NOQUOTES); ?></a></li>
856 <?php
857 $first = false;
860 $enddate = $row['date'];
864 // Display the eligibility tab
865 echo "<li><a href='#'>" .
866 htmlspecialchars(xl('Eligibility'), ENT_NOQUOTES) . "</a></li>";
868 ?></ul><?php
869 } ?>
871 <div class="tabContainer">
872 <?php
873 $first = true;
874 foreach (array('primary','secondary','tertiary') as $instype) {
875 $enddate = 'Present';
877 $query = "SELECT * FROM insurance_data WHERE " .
878 "pid = ? AND type = ? " .
879 "ORDER BY date DESC";
880 $res = sqlStatement($query, array($pid, $instype));
881 while ($row = sqlFetchArray($res)) {
882 if ($row['provider']) {
884 <div class="tab <?php echo $first ? 'current' : '' ?>">
885 <table border='0' cellpadding='0' width='100%'>
886 <?php
887 $icobj = new InsuranceCompany($row['provider']);
888 $adobj = $icobj->get_address();
889 $insco_name = trim($icobj->get_name());
891 <tr>
892 <td valign='top' colspan='3'>
893 <span class='text'>
894 <?php if (strcmp($enddate, 'Present') != 0) {
895 echo htmlspecialchars(xl("Old"), ENT_NOQUOTES)." ";
896 } ?>
897 <?php $tempinstype=ucfirst($instype);
898 echo htmlspecialchars(xl($tempinstype.' Insurance'), ENT_NOQUOTES); ?>
899 <?php if (strcmp($row['date'], '0000-00-00') != 0) { ?>
900 <?php echo htmlspecialchars(xl('from', '', ' ', ' ').$row['date'], ENT_NOQUOTES); ?>
901 <?php } ?>
902 <?php echo htmlspecialchars(xl('until', '', ' ', ' '), ENT_NOQUOTES);
903 echo (strcmp($enddate, 'Present') != 0) ? $enddate : htmlspecialchars(xl('Present'), ENT_NOQUOTES); ?>:</span>
904 </td>
905 </tr>
906 <tr>
907 <td valign='top'>
908 <span class='text'>
909 <?php
910 if ($insco_name) {
911 echo htmlspecialchars($insco_name, ENT_NOQUOTES) . '<br>';
912 if (trim($adobj->get_line1())) {
913 echo htmlspecialchars($adobj->get_line1(), ENT_NOQUOTES) . '<br>';
914 echo htmlspecialchars($adobj->get_city() . ', ' . $adobj->get_state() . ' ' . $adobj->get_zip(), ENT_NOQUOTES);
916 } else {
917 echo "<font color='red'><b>".htmlspecialchars(xl('Unassigned'), ENT_NOQUOTES)."</b></font>";
920 <br>
921 <?php echo htmlspecialchars(xl('Policy Number'), ENT_NOQUOTES); ?>:
922 <?php echo htmlspecialchars($row['policy_number'], ENT_NOQUOTES) ?><br>
923 <?php echo htmlspecialchars(xl('Plan Name'), ENT_NOQUOTES); ?>:
924 <?php echo htmlspecialchars($row['plan_name'], ENT_NOQUOTES); ?><br>
925 <?php echo htmlspecialchars(xl('Group Number'), ENT_NOQUOTES); ?>:
926 <?php echo htmlspecialchars($row['group_number'], ENT_NOQUOTES); ?></span>
927 </td>
928 <td valign='top'>
929 <span class='bold'><?php echo htmlspecialchars(xl('Subscriber'), ENT_NOQUOTES); ?>: </span><br>
930 <span class='text'><?php echo htmlspecialchars($row['subscriber_fname'] . ' ' . $row['subscriber_mname'] . ' ' . $row['subscriber_lname'], ENT_NOQUOTES); ?>
931 <?php
932 if ($row['subscriber_relationship'] != "") {
933 echo "(" . htmlspecialchars($row['subscriber_relationship'], ENT_NOQUOTES) . ")";
936 <br>
937 <?php echo htmlspecialchars(xl('S.S.'), ENT_NOQUOTES); ?>:
938 <?php echo htmlspecialchars($row['subscriber_ss'], ENT_NOQUOTES); ?><br>
939 <?php echo htmlspecialchars(xl('D.O.B.'), ENT_NOQUOTES); ?>:
940 <?php if ($row['subscriber_DOB'] != "0000-00-00 00:00:00") {
941 echo htmlspecialchars($row['subscriber_DOB'], ENT_NOQUOTES);
942 } ?><br>
943 <?php echo htmlspecialchars(xl('Phone'), ENT_NOQUOTES); ?>:
944 <?php echo htmlspecialchars($row['subscriber_phone'], ENT_NOQUOTES); ?>
945 </span>
946 </td>
947 <td valign='top'>
948 <span class='bold'><?php echo htmlspecialchars(xl('Subscriber Address'), ENT_NOQUOTES); ?>: </span><br>
949 <span class='text'><?php echo htmlspecialchars($row['subscriber_street'], ENT_NOQUOTES); ?><br>
950 <?php echo htmlspecialchars($row['subscriber_city'], ENT_NOQUOTES); ?>
951 <?php if ($row['subscriber_state'] != "") {
952 echo ", ";
955 echo htmlspecialchars($row['subscriber_state'], ENT_NOQUOTES); ?>
956 <?php if ($row['subscriber_country'] != "") {
957 echo ", ";
960 echo htmlspecialchars($row['subscriber_country'], ENT_NOQUOTES); ?>
961 <?php echo " " . htmlspecialchars($row['subscriber_postal_code'], ENT_NOQUOTES); ?></span>
963 <?php if (trim($row['subscriber_employer'])) { ?>
964 <br><span class='bold'><?php echo htmlspecialchars(xl('Subscriber Employer'), ENT_NOQUOTES); ?>: </span><br>
965 <span class='text'><?php echo htmlspecialchars($row['subscriber_employer'], ENT_NOQUOTES); ?><br>
966 <?php echo htmlspecialchars($row['subscriber_employer_street'], ENT_NOQUOTES); ?><br>
967 <?php echo htmlspecialchars($row['subscriber_employer_city'], ENT_NOQUOTES); ?>
968 <?php if ($row['subscriber_employer_city'] != "") {
969 echo ", ";
972 echo htmlspecialchars($row['subscriber_employer_state'], ENT_NOQUOTES); ?>
973 <?php if ($row['subscriber_employer_country'] != "") {
974 echo ", ";
977 echo htmlspecialchars($row['subscriber_employer_country'], ENT_NOQUOTES); ?>
978 <?php echo " " . htmlspecialchars($row['subscriber_employer_postal_code'], ENT_NOQUOTES); ?>
979 </span>
980 <?php } ?>
982 </td>
983 </tr>
984 <tr>
985 <td>
986 <?php if ($row['copay'] != "") { ?>
987 <span class='bold'><?php echo htmlspecialchars(xl('CoPay'), ENT_NOQUOTES); ?>: </span>
988 <span class='text'><?php echo htmlspecialchars($row['copay'], ENT_NOQUOTES); ?></span>
989 <br />
990 <?php } ?>
991 <span class='bold'><?php echo htmlspecialchars(xl('Accept Assignment'), ENT_NOQUOTES); ?>:</span>
992 <span class='text'><?php if ($row['accept_assignment'] == "TRUE") {
993 echo xl("YES");
994 } ?>
995 <?php if ($row['accept_assignment'] == "FALSE") {
996 echo xl("NO");
997 } ?></span>
998 <?php if (!empty($row['policy_type'])) { ?>
999 <br />
1000 <span class='bold'><?php echo htmlspecialchars(xl('Secondary Medicare Type'), ENT_NOQUOTES); ?>: </span>
1001 <span class='text'><?php echo htmlspecialchars($policy_types[$row['policy_type']], ENT_NOQUOTES); ?></span>
1002 <?php } ?>
1003 </td>
1004 <td valign='top'></td>
1005 <td valign='top'></td>
1006 </tr>
1008 </table>
1009 </div>
1010 <?php
1011 } // end if ($row['provider'])
1012 $enddate = $row['date'];
1013 $first = false;
1014 } // end while
1015 } // end foreach
1017 // Display the eligibility information
1018 echo "<div class='tab'>";
1019 show_eligibility_information($pid, true);
1020 echo "</div>";
1022 ///////////////////////////////// END INSURANCE SECTION
1024 </div>
1026 <?php } // ?>
1028 </td>
1029 </tr>
1030 <?php } // end if demographics authorized ?>
1032 <?php if (acl_check('patients', 'notes')) { ?>
1033 <tr>
1034 <td width='650px'>
1035 <?php
1036 // Notes expand collapse widget
1037 $widgetTitle = xl("Notes");
1038 $widgetLabel = "pnotes";
1039 $widgetButtonLabel = xl("Edit");
1040 $widgetButtonLink = "pnotes_full.php?form_active=1";
1041 $widgetButtonClass = "";
1042 $linkMethod = "html";
1043 $bodyClass = "notab";
1044 $widgetAuth = acl_check('patients', 'notes', '', 'write');
1045 $fixedWidth = true;
1046 expand_collapse_widget(
1047 $widgetTitle,
1048 $widgetLabel,
1049 $widgetButtonLabel,
1050 $widgetButtonLink,
1051 $widgetButtonClass,
1052 $linkMethod,
1053 $bodyClass,
1054 $widgetAuth,
1055 $fixedWidth
1058 <br/>
1059 <div style='margin-left:10px' class='text'><img src='../../pic/ajax-loader.gif'/></div><br/>
1060 </div>
1061 </td>
1062 </tr>
1063 <?php } // end if notes authorized ?>
1065 <?php if (acl_check('patients', 'reminder') && $GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_prw']) {
1066 echo "<tr><td width='650px'>";
1067 // patient reminders collapse widget
1068 $widgetTitle = xl("Patient Reminders");
1069 $widgetLabel = "patient_reminders";
1070 $widgetButtonLabel = xl("Edit");
1071 $widgetButtonLink = "../reminder/patient_reminders.php?mode=simple&patient_id=".$pid;
1072 $widgetButtonClass = "";
1073 $linkMethod = "html";
1074 $bodyClass = "notab";
1075 $widgetAuth = acl_check('patients', 'reminder', '', 'write');
1076 $fixedWidth = true;
1077 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel, $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth); ?>
1078 <br/>
1079 <div style='margin-left:10px' class='text'><image src='../../pic/ajax-loader.gif'/></div><br/>
1080 </div>
1081 </td>
1082 </tr>
1083 <?php } //end if prw is activated ?>
1085 <?php if (acl_check('patients', 'disclosure')) { ?>
1086 <tr>
1087 <td width='650px'>
1088 <?php
1089 // disclosures expand collapse widget
1090 $widgetTitle = xl("Disclosures");
1091 $widgetLabel = "disclosures";
1092 $widgetButtonLabel = xl("Edit");
1093 $widgetButtonLink = "disclosure_full.php";
1094 $widgetButtonClass = "";
1095 $linkMethod = "html";
1096 $bodyClass = "notab";
1097 $widgetAuth = acl_check('patients', 'disclosure', '', 'write');
1098 $fixedWidth = true;
1099 expand_collapse_widget(
1100 $widgetTitle,
1101 $widgetLabel,
1102 $widgetButtonLabel,
1103 $widgetButtonLink,
1104 $widgetButtonClass,
1105 $linkMethod,
1106 $bodyClass,
1107 $widgetAuth,
1108 $fixedWidth
1111 <br/>
1112 <div style='margin-left:10px' class='text'><img src='../../pic/ajax-loader.gif'/></div><br/>
1113 </div>
1114 </td>
1115 </tr>
1116 <?php } // end if disclosures authorized ?>
1118 <?php if ($GLOBALS['amendments'] && acl_check('patients', 'amendment')) { ?>
1119 <tr>
1120 <td width='650px'>
1121 <?php // Amendments widget
1122 $widgetTitle = xlt('Amendments');
1123 $widgetLabel = "amendments";
1124 $widgetButtonLabel = xlt("Edit");
1125 $widgetButtonLink = $GLOBALS['webroot'] . "/interface/patient_file/summary/main_frameset.php?feature=amendment";
1126 $widgetButtonClass = "iframe rx_modal";
1127 $linkMethod = "html";
1128 $bodyClass = "summary_item small";
1129 $widgetAuth = acl_check('patients', 'amendment', '', 'write');
1130 $fixedWidth = false;
1131 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel, $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1132 $sql = "SELECT * FROM amendments WHERE pid = ? ORDER BY amendment_date DESC";
1133 $result = sqlStatement($sql, array($pid));
1135 if (sqlNumRows($result) == 0) {
1136 echo " <table><tr>\n";
1137 echo " <td colspan='$numcols' class='text'>&nbsp;&nbsp;" . xlt('None') . "</td>\n";
1138 echo " </tr></table>\n";
1141 while ($row=sqlFetchArray($result)) {
1142 echo "&nbsp;&nbsp;";
1143 echo "<a class= '" . $widgetButtonClass . "' href='" . $widgetButtonLink . "&id=" . attr($row['amendment_id']) . "' onclick='top.restoreSession()'>" . text($row['amendment_date']);
1144 echo "&nbsp; " . text($row['amendment_desc']);
1146 echo "</a><br>\n";
1147 } ?>
1148 </td>
1149 </tr>
1150 <?php } // end amendments authorized ?>
1152 <?php if (acl_check('patients', 'lab')) { ?>
1153 <tr>
1154 <td width='650px'>
1155 <?php // labdata expand collapse widget
1156 $widgetTitle = xl("Labs");
1157 $widgetLabel = "labdata";
1158 $widgetButtonLabel = xl("Trend");
1159 $widgetButtonLink = "../summary/labdata.php";#"../encounter/trend_form.php?formname=labdata";
1160 $widgetButtonClass = "";
1161 $linkMethod = "html";
1162 $bodyClass = "notab";
1163 // check to see if any labdata exist
1164 $spruch = "SELECT procedure_report.date_collected AS date " .
1165 "FROM procedure_report " .
1166 "JOIN procedure_order ON procedure_report.procedure_order_id = procedure_order.procedure_order_id " .
1167 "WHERE procedure_order.patient_id = ? " .
1168 "ORDER BY procedure_report.date_collected DESC ";
1169 $existLabdata = sqlQuery($spruch, array($pid));
1170 if ($existLabdata) {
1171 $widgetAuth = true;
1172 } else {
1173 $widgetAuth = false;
1176 $fixedWidth = true;
1177 expand_collapse_widget(
1178 $widgetTitle,
1179 $widgetLabel,
1180 $widgetButtonLabel,
1181 $widgetButtonLink,
1182 $widgetButtonClass,
1183 $linkMethod,
1184 $bodyClass,
1185 $widgetAuth,
1186 $fixedWidth
1189 <br/>
1190 <div style='margin-left:10px' class='text'><img src='../../pic/ajax-loader.gif'/></div><br/>
1191 </div>
1192 </td>
1193 </tr>
1194 <?php } // end labs authorized ?>
1196 <?php if ($vitals_is_registered && acl_check('patients', 'med')) { ?>
1197 <tr>
1198 <td width='650px'>
1199 <?php // vitals expand collapse widget
1200 $widgetTitle = xl("Vitals");
1201 $widgetLabel = "vitals";
1202 $widgetButtonLabel = xl("Trend");
1203 $widgetButtonLink = "../encounter/trend_form.php?formname=vitals";
1204 $widgetButtonClass = "";
1205 $linkMethod = "html";
1206 $bodyClass = "notab";
1207 // check to see if any vitals exist
1208 $existVitals = sqlQuery("SELECT * FROM form_vitals WHERE pid=?", array($pid));
1209 if ($existVitals) {
1210 $widgetAuth = true;
1211 } else {
1212 $widgetAuth = false;
1215 $fixedWidth = true;
1216 expand_collapse_widget(
1217 $widgetTitle,
1218 $widgetLabel,
1219 $widgetButtonLabel,
1220 $widgetButtonLink,
1221 $widgetButtonClass,
1222 $linkMethod,
1223 $bodyClass,
1224 $widgetAuth,
1225 $fixedWidth
1228 <br/>
1229 <div style='margin-left:10px' class='text'><img src='../../pic/ajax-loader.gif'/></div><br/>
1230 </div>
1231 </td>
1232 </tr>
1233 <?php } // end if ($vitals_is_registered && acl_check('patients', 'med')) ?>
1235 <?php
1236 // This generates a section similar to Vitals for each LBF form that
1237 // supports charting. The form ID is used as the "widget label".
1239 $gfres = sqlStatement("SELECT option_id, title, notes FROM list_options WHERE " .
1240 "list_id = 'lbfnames' AND " .
1241 "option_value > 0 AND activity = 1 " .
1242 "ORDER BY seq, title");
1243 while ($gfrow = sqlFetchArray($gfres)) {
1244 $jobj = json_decode($gfrow['notes'], true);
1245 $LBF_ACO = empty($jobj['aco']) ? false : explode('|', $jobj['aco']);
1246 if ($LBF_ACO && !acl_check($LBF_ACO[0], $LBF_ACO[1])) {
1247 continue;
1248 } ?>
1249 <tr>
1250 <td width='650px'>
1251 <?php // vitals expand collapse widget
1252 $vitals_form_id = $gfrow['option_id'];
1253 $widgetTitle = $gfrow['title'];
1254 $widgetLabel = $vitals_form_id;
1255 $widgetButtonLabel = xl("Trend");
1256 $widgetButtonLink = "../encounter/trend_form.php?formname=$vitals_form_id";
1257 $widgetButtonClass = "";
1258 $linkMethod = "html";
1259 $bodyClass = "notab";
1260 $widgetAuth = false;
1261 if (!$LBF_ACO || acl_check($LBF_ACO[0], $LBF_ACO[1], '', 'write')) {
1262 // check to see if any instances exist for this patient
1263 $existVitals = sqlQuery(
1264 "SELECT * FROM forms WHERE pid = ? AND formdir = ? AND deleted = 0",
1265 array($pid, $vitals_form_id)
1267 $widgetAuth = $existVitals;
1270 $fixedWidth = true;
1271 expand_collapse_widget(
1272 $widgetTitle,
1273 $widgetLabel,
1274 $widgetButtonLabel,
1275 $widgetButtonLink,
1276 $widgetButtonClass,
1277 $linkMethod,
1278 $bodyClass,
1279 $widgetAuth,
1280 $fixedWidth
1281 ); ?>
1282 <br/>
1283 <div style='margin-left:10px' class='text'>
1284 <image src='../../pic/ajax-loader.gif'/>
1285 </div>
1286 <br/>
1287 </div> <!-- This is required by expand_collapse_widget(). -->
1288 </td>
1289 </tr>
1290 <?php
1291 } // end while
1294 </table>
1296 </div>
1297 <!-- end left column div -->
1299 <!-- start right column div -->
1300 <div>
1301 <table>
1302 <tr>
1303 <td>
1305 <div>
1306 <?php
1308 // If there is an ID Card or any Photos show the widget
1309 $photos = pic_array($pid, $GLOBALS['patient_photo_category_name']);
1310 if ($photos or $idcard_doc_id) {
1311 $widgetTitle = xl("ID Card") . '/' . xl("Photos");
1312 $widgetLabel = "photos";
1313 $linkMethod = "javascript";
1314 $bodyClass = "notab-right";
1315 $widgetAuth = false;
1316 $fixedWidth = false;
1317 expand_collapse_widget(
1318 $widgetTitle,
1319 $widgetLabel,
1320 $widgetButtonLabel,
1321 $widgetButtonLink,
1322 $widgetButtonClass,
1323 $linkMethod,
1324 $bodyClass,
1325 $widgetAuth,
1326 $fixedWidth
1329 <br />
1330 <?php
1331 if ($idcard_doc_id) {
1332 image_widget($idcard_doc_id, $GLOBALS['patient_id_category_name']);
1335 foreach ($photos as $photo_doc_id) {
1336 image_widget($photo_doc_id, $GLOBALS['patient_photo_category_name']);
1341 <br />
1342 </div>
1343 <div>
1344 <?php
1345 // Advance Directives
1346 if ($GLOBALS['advance_directives_warning']) {
1347 // advance directives expand collapse widget
1348 $widgetTitle = xl("Advance Directives");
1349 $widgetLabel = "directives";
1350 $widgetButtonLabel = xl("Edit");
1351 $widgetButtonLink = "return advdirconfigure();";
1352 $widgetButtonClass = "";
1353 $linkMethod = "javascript";
1354 $bodyClass = "summary_item small";
1355 $widgetAuth = true;
1356 $fixedWidth = false;
1357 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel, $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1358 $counterFlag = false; //flag to record whether any categories contain ad records
1359 $query = "SELECT id FROM categories WHERE name='Advance Directive'";
1360 $myrow2 = sqlQuery($query);
1361 if ($myrow2) {
1362 $parentId = $myrow2['id'];
1363 $query = "SELECT id, name FROM categories WHERE parent=?";
1364 $resNew1 = sqlStatement($query, array($parentId));
1365 while ($myrows3 = sqlFetchArray($resNew1)) {
1366 $categoryId = $myrows3['id'];
1367 $nameDoc = $myrows3['name'];
1368 $query = "SELECT documents.date, documents.id " .
1369 "FROM documents " .
1370 "INNER JOIN categories_to_documents " .
1371 "ON categories_to_documents.document_id=documents.id " .
1372 "WHERE categories_to_documents.category_id=? " .
1373 "AND documents.foreign_id=? " .
1374 "ORDER BY documents.date DESC";
1375 $resNew2 = sqlStatement($query, array($categoryId, $pid));
1376 $limitCounter = 0; // limit to one entry per category
1377 while (($myrows4 = sqlFetchArray($resNew2)) && ($limitCounter == 0)) {
1378 $dateTimeDoc = $myrows4['date'];
1379 // remove time from datetime stamp
1380 $tempParse = explode(" ", $dateTimeDoc);
1381 $dateDoc = $tempParse[0];
1382 $idDoc = $myrows4['id'];
1383 echo "<a href='$web_root/controller.php?document&retrieve&patient_id=" .
1384 htmlspecialchars($pid, ENT_QUOTES) . "&document_id=" .
1385 htmlspecialchars($idDoc, ENT_QUOTES) . "&as_file=true' onclick='top.restoreSession()'>" .
1386 htmlspecialchars(xl_document_category($nameDoc), ENT_NOQUOTES) . "</a> " .
1387 htmlspecialchars($dateDoc, ENT_NOQUOTES);
1388 echo "<br>";
1389 $limitCounter = $limitCounter + 1;
1390 $counterFlag = true;
1395 if (!$counterFlag) {
1396 echo "&nbsp;&nbsp;" . htmlspecialchars(xl('None'), ENT_NOQUOTES);
1397 } ?>
1398 </div>
1399 <?php
1400 } // close advanced dir block
1402 // Show Clinical Reminders for any user that has rules that are permitted.
1403 $clin_rem_check = resolve_rules_sql('', '0', true, '', $_SESSION['authUser']);
1404 if (!empty($clin_rem_check) && $GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_crw'] &&
1405 acl_check('patients', 'alert')) {
1406 // clinical summary expand collapse widget
1407 $widgetTitle = xl("Clinical Reminders");
1408 $widgetLabel = "clinical_reminders";
1409 $widgetButtonLabel = xl("Edit");
1410 $widgetButtonLink = "../reminder/clinical_reminders.php?patient_id=".$pid;
1412 $widgetButtonClass = "";
1413 $linkMethod = "html";
1414 $bodyClass = "summary_item small";
1415 $widgetAuth = acl_check('patients', 'alert', '', 'write');
1416 $fixedWidth = false;
1417 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel, $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1418 echo "<br/>";
1419 echo "<div style='margin-left:10px' class='text'><image src='../../pic/ajax-loader.gif'/></div><br/>";
1420 echo "</div>";
1421 } // end if crw
1423 // Show current and upcoming appointments.
1425 // Recurring appointment support and Appointment Display Sets
1426 // added to Appointments by Ian Jardine ( epsdky ).
1428 if (isset($pid) && !$GLOBALS['disable_calendar'] && acl_check('patients', 'appt')) {
1430 $current_date2 = date('Y-m-d');
1431 $events = array();
1432 $apptNum = (int)$GLOBALS['number_of_appts_to_show'];
1433 if ($apptNum != 0) {
1434 $apptNum2 = abs($apptNum);
1435 } else {
1436 $apptNum2 = 10;
1440 $mode1 = !$GLOBALS['appt_display_sets_option'];
1441 $colorSet1 = $GLOBALS['appt_display_sets_color_1'];
1442 $colorSet2 = $GLOBALS['appt_display_sets_color_2'];
1443 $colorSet3 = $GLOBALS['appt_display_sets_color_3'];
1444 $colorSet4 = $GLOBALS['appt_display_sets_color_4'];
1446 if ($mode1) {
1447 $extraAppts = 1;
1448 } else {
1449 $extraAppts = 6;
1452 $events = fetchNextXAppts($current_date2, $pid, $apptNum2 + $extraAppts, true);
1453 //////
1454 if ($events) {
1455 $selectNum = 0;
1456 $apptNumber = count($events);
1458 if ($apptNumber <= $apptNum2) {
1459 $extraApptDate = '';
1461 } else if ($mode1 && $apptNumber == $apptNum2 + 1) {
1462 $extraApptDate = $events[$apptNumber - 1]['pc_eventDate'];
1463 array_pop($events);
1464 --$apptNumber;
1465 $selectNum = 1;
1467 } else if ($apptNumber == $apptNum2 + 6) {
1468 $extraApptDate = $events[$apptNumber - 1]['pc_eventDate'];
1469 array_pop($events);
1470 --$apptNumber;
1471 $selectNum = 2;
1473 } else { // mode 2 - $apptNum2 < $apptNumber < $apptNum2 + 6
1474 $extraApptDate = '';
1475 $selectNum = 2;
1480 $limitApptIndx = $apptNum2 - 1;
1481 $limitApptDate = $events[$limitApptIndx]['pc_eventDate'];
1483 switch ($selectNum) {
1485 case 2:
1486 $lastApptIndx = $apptNumber - 1;
1487 $thisNumber = $lastApptIndx - $limitApptIndx;
1488 for ($i = 1; $i <= $thisNumber; ++$i) {
1489 if ($events[$limitApptIndx + $i]['pc_eventDate'] != $limitApptDate) {
1490 $extraApptDate = $events[$limitApptIndx + $i]['pc_eventDate'];
1491 $events = array_slice($events, 0, $limitApptIndx + $i);
1492 break;
1497 case 1:
1498 $firstApptIndx = 0;
1499 for ($i = 1; $i <= $limitApptIndx; ++$i) {
1500 if ($events[$limitApptIndx - $i]['pc_eventDate'] != $limitApptDate) {
1501 $firstApptIndx = $apptNum2 - $i;
1502 break;
1510 if ($extraApptDate) {
1511 if ($extraApptDate != $limitApptDate) {
1512 $apptStyle2 = " style='background-color:" . attr($colorSet3) . ";'";
1513 } else {
1514 $apptStyle2 = " style='background-color:" . attr($colorSet4) . ";'";
1519 //////
1521 // appointments expand collapse widget
1522 $widgetTitle = xl("Appointments");
1523 $widgetLabel = "appointments";
1524 $widgetButtonLabel = xl("Add");
1525 $widgetButtonLink = "return newEvt();";
1526 $widgetButtonClass = "";
1527 $linkMethod = "javascript";
1528 $bodyClass = "summary_item small";
1529 $widgetAuth = $resNotNull // $resNotNull reflects state of query in fetchAppointments
1530 && (acl_check('patients', 'appt', '', 'write') || acl_check('patients', 'appt', '', 'addonly'));
1531 $fixedWidth = false;
1532 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel, $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1533 $count = 0;
1535 $toggleSet = true;
1536 $priorDate = "";
1537 $therapyGroupCategories = array();
1538 $query = sqlStatement("SELECT pc_catid FROM openemr_postcalendar_categories WHERE pc_cattype = 3 AND pc_active = 1");
1539 while ($result = sqlFetchArray($query)) {
1540 $therapyGroupCategories[] = $result['pc_catid'];
1544 foreach ($events as $row) { //////
1545 $count++;
1546 $dayname = date("l", strtotime($row['pc_eventDate'])); //////
1547 $dispampm = "am";
1548 $disphour = substr($row['pc_startTime'], 0, 2) + 0;
1549 $dispmin = substr($row['pc_startTime'], 3, 2);
1550 if ($disphour >= 12) {
1551 $dispampm = "pm";
1552 if ($disphour > 12) {
1553 $disphour -= 12;
1557 $etitle = xl('(Click to edit)');
1558 if ($row['pc_hometext'] != "") {
1559 $etitle = xl('Comments').": ".($row['pc_hometext'])."\r\n".$etitle;
1562 //////
1563 if ($extraApptDate && $count > $firstApptIndx) {
1564 $apptStyle = $apptStyle2;
1565 } else {
1566 if ($row['pc_eventDate'] != $priorDate) {
1567 $priorDate = $row['pc_eventDate'];
1568 $toggleSet = !$toggleSet;
1571 if ($toggleSet) {
1572 $apptStyle = " style='background-color:" . attr($colorSet2) . ";'";
1573 } else {
1574 $apptStyle = " style='background-color:" . attr($colorSet1) . ";'";
1578 //////
1579 echo "<div " . $apptStyle . ">";
1580 if (!in_array($row['pc_catid'], $therapyGroupCategories)) {
1581 echo "<a href='javascript:oldEvt(" . htmlspecialchars(preg_replace("/-/", "", $row['pc_eventDate']), ENT_QUOTES) . ', ' . htmlspecialchars($row['pc_eid'], ENT_QUOTES) . ")' title='" . htmlspecialchars($etitle, ENT_QUOTES) . "'>";
1582 } else {
1583 echo "<span title='" . htmlspecialchars($etitle, ENT_QUOTES) . "'>";
1586 echo "<b>" . htmlspecialchars($row['pc_eventDate'], ENT_NOQUOTES) . ", ";
1587 echo htmlspecialchars(sprintf("%02d", $disphour) .":$dispmin " . xl($dispampm) . " (" . xl($dayname), ENT_NOQUOTES) . ")</b> ";
1588 if ($row['pc_recurrtype']) {
1589 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)."'>";
1592 echo "<span title='" . generate_display_field(array('data_type'=>'1','list_id'=>'apptstat'), $row['pc_apptstatus']) . "'>";
1593 echo "<br>" . xlt('Status') . "( " . htmlspecialchars($row['pc_apptstatus'], ENT_NOQUOTES) . " ) </span>";
1594 echo htmlspecialchars(xl_appt_category($row['pc_catname']), ENT_NOQUOTES) . "\n";
1595 if (in_array($row['pc_catid'], $therapyGroupCategories)) {
1596 echo "<br><span>" . xlt('Group name') .": " . text(getGroup($row['pc_gid'])['group_name']) . "</span>\n";
1599 if ($row['pc_hometext']) {
1600 echo " <span style='color:green'> Com</span>";
1603 echo "<br>" . htmlspecialchars($row['ufname'] . " " . $row['ulname'], ENT_NOQUOTES);
1604 echo !in_array($row['pc_catid'], $therapyGroupCategories) ? '</a>' : '<span>';
1605 echo "</div>\n";
1606 //////
1609 if ($resNotNull) { //////
1610 if ($count < 1) {
1611 echo "&nbsp;&nbsp;" . htmlspecialchars(xl('None'), ENT_NOQUOTES);
1612 } else { //////
1613 if ($extraApptDate) {
1614 echo "<div style='color:#0000cc;'><b>" . attr($extraApptDate) . " ( + ) </b></div>";
1615 } else {
1616 echo "<div><hr></div>";
1620 echo "</div>";
1622 } // End of Appointments.
1625 /* Widget that shows recurrences for appointments. */
1626 if (isset($pid) && !$GLOBALS['disable_calendar'] && $GLOBALS['appt_recurrences_widget'] &&
1627 acl_check('patients', 'appt')) {
1628 $widgetTitle = xl("Recurrent Appointments");
1629 $widgetLabel = "recurrent_appointments";
1630 $widgetButtonLabel = xl("Add");
1631 $widgetButtonLink = "return newEvt();";
1632 $widgetButtonClass = "";
1633 $linkMethod = "javascript";
1634 $bodyClass = "summary_item small";
1635 $widgetAuth = false;
1636 $fixedWidth = false;
1637 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel, $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1638 $count = 0;
1639 $toggleSet = true;
1640 $priorDate = "";
1642 //Fetch patient's recurrences. Function returns array with recurrence appointments' category, recurrence pattern (interpreted), and end date.
1643 $recurrences = fetchRecurrences($pid);
1644 if ($recurrences[0] == false) { //if there are no recurrent appointments:
1645 echo "<div>";
1646 echo "<span>" . "&nbsp;&nbsp;" . xlt('None') . "</span>";
1647 echo "</div></div>";
1648 } else {
1649 foreach ($recurrences as $row) {
1650 //checks if there are recurrences and if they are current (git didn't end yet)
1651 if ($row == false || !recurrence_is_current($row['pc_endDate'])) {
1652 continue;
1655 echo "<div>";
1656 echo "<span>" . xlt('Appointment Category') . ': ' . xlt($row['pc_catname']) . "</span>";
1657 echo "<br>";
1658 echo "<span>" . xlt('Recurrence') . ': ' . text($row['pc_recurrspec']) . "</span>";
1659 echo "<br>";
1660 $red_text = ""; //if ends in a week, make font red
1661 if (ends_in_a_week($row['pc_endDate'])) {
1662 $red_text = " style=\"color:red;\" ";
1665 echo "<span" . $red_text . ">" . xlt('End Date') . ': ' . text($row['pc_endDate']) . "</span>";
1666 echo "</div>";
1669 echo "</div>";
1673 /* End of recurrence widget */
1675 // Show PAST appointments.
1676 // added by Terry Hill to allow reverse sorting of the appointments
1677 $direction = "ASC";
1678 if ($GLOBALS['num_past_appointments_to_show'] < 0) {
1679 $direction = "DESC";
1680 ($showpast = -1 * $GLOBALS['num_past_appointments_to_show']);
1681 } else {
1682 $showpast = $GLOBALS['num_past_appointments_to_show'];
1685 if (isset($pid) && !$GLOBALS['disable_calendar'] && $showpast > 0 &&
1686 acl_check('patients', 'appt')) {
1687 $query = "SELECT e.pc_eid, e.pc_aid, e.pc_title, e.pc_eventDate, " .
1688 "e.pc_startTime, e.pc_hometext, u.fname, u.lname, u.mname, " .
1689 "c.pc_catname, e.pc_apptstatus " .
1690 "FROM openemr_postcalendar_events AS e, users AS u, " .
1691 "openemr_postcalendar_categories AS c WHERE " .
1692 "e.pc_pid = ? AND e.pc_eventDate < CURRENT_DATE AND " .
1693 "u.id = e.pc_aid AND e.pc_catid = c.pc_catid " .
1694 "ORDER BY e.pc_eventDate $direction , e.pc_startTime DESC " .
1695 "LIMIT " . $showpast;
1697 $pres = sqlStatement($query, array($pid));
1699 // appointments expand collapse widget
1700 $widgetTitle = xl("Past Appointments");
1701 $widgetLabel = "past_appointments";
1702 $widgetButtonLabel = '';
1703 $widgetButtonLink = '';
1704 $widgetButtonClass = '';
1705 $linkMethod = "javascript";
1706 $bodyClass = "summary_item small";
1707 $widgetAuth = false; //no button
1708 $fixedWidth = false;
1709 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel, $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1710 $count = 0;
1711 while ($row = sqlFetchArray($pres)) {
1712 $count++;
1713 $dayname = date("l", strtotime($row['pc_eventDate']));
1714 $dispampm = "am";
1715 $disphour = substr($row['pc_startTime'], 0, 2) + 0;
1716 $dispmin = substr($row['pc_startTime'], 3, 2);
1717 if ($disphour >= 12) {
1718 $dispampm = "pm";
1719 if ($disphour > 12) {
1720 $disphour -= 12;
1724 if ($row['pc_hometext'] != "") {
1725 $etitle = xl('Comments').": ".($row['pc_hometext'])."\r\n".$etitle;
1728 echo "<a href='javascript:oldEvt(" . htmlspecialchars(preg_replace("/-/", "", $row['pc_eventDate']), ENT_QUOTES) . ', ' . htmlspecialchars($row['pc_eid'], ENT_QUOTES) . ")' title='" . htmlspecialchars($etitle, ENT_QUOTES) . "'>";
1729 echo "<b>" . htmlspecialchars(xl($dayname) . ", " . $row['pc_eventDate'], ENT_NOQUOTES) . "</b>" . xlt("Status") . "(";
1730 echo " " . generate_display_field(array('data_type'=>'1','list_id'=>'apptstat'), $row['pc_apptstatus']) . ")<br>"; // can't use special char parser on this
1731 echo htmlspecialchars("$disphour:$dispmin ") . xl($dispampm) . " ";
1732 echo htmlspecialchars($row['fname'] . " " . $row['lname'], ENT_NOQUOTES) . "</a><br>\n";
1735 if (isset($pres) && $res != null) {
1736 if ($count < 1) {
1737 echo "&nbsp;&nbsp;" . htmlspecialchars(xl('None'), ENT_NOQUOTES);
1740 echo "</div>";
1744 // END of past appointments
1746 </div>
1748 <div id='stats_div'>
1749 <br/>
1750 <div style='margin-left:10px' class='text'><img src='../../pic/ajax-loader.gif'/></div><br/>
1751 </div>
1752 </td>
1753 </tr>
1755 <?php // TRACK ANYTHING -----
1757 // Determine if track_anything form is in use for this site.
1758 $tmp = sqlQuery("SELECT count(*) AS count FROM registry WHERE " .
1759 "directory = 'track_anything' AND state = 1");
1760 $track_is_registered = $tmp['count'];
1761 if ($track_is_registered) {
1762 echo "<tr> <td>";
1763 // track_anything expand collapse widget
1764 $widgetTitle = xl("Tracks");
1765 $widgetLabel = "track_anything";
1766 $widgetButtonLabel = xl("Tracks");
1767 $widgetButtonLink = "../../forms/track_anything/create.php";
1768 $widgetButtonClass = "";
1769 $widgetAuth = ""; // don't show the button
1770 $linkMethod = "html";
1771 $bodyClass = "notab";
1772 // check to see if any tracks exist
1773 $spruch = "SELECT id " .
1774 "FROM forms " .
1775 "WHERE pid = ? " .
1776 "AND formdir = ? ";
1777 $existTracks = sqlQuery($spruch, array($pid, "track_anything"));
1779 $fixedWidth = false;
1780 expand_collapse_widget(
1781 $widgetTitle,
1782 $widgetLabel,
1783 $widgetButtonLabel,
1784 $widgetButtonLink,
1785 $widgetButtonClass,
1786 $linkMethod,
1787 $bodyClass,
1788 $widgetAuth,
1789 $fixedWidth
1792 <br/>
1793 <div style='margin-left:10px' class='text'><img src='../../pic/ajax-loader.gif'/></div><br/>
1794 </div>
1795 </td>
1796 </tr><?php
1797 } // end track_anything ?>
1798 </table>
1800 </div> <!-- end right column div -->
1802 </td>
1804 </tr>
1805 </table>
1807 </div> <!-- end main content div -->
1809 <script language='JavaScript'>
1810 // Array of skip conditions for the checkSkipConditions() function.
1811 var skipArray = [
1812 <?php echo $condition_str; ?>
1814 checkSkipConditions();
1815 </script>
1817 </body>
1818 </html>