patient delete bug fix for tabs layout (#682)
[openemr.git] / interface / patient_file / summary / demographics.php
bloba7139831e7db485b4d20718355d15f86fdded581
1 <?php
2 /**
4 * Patient summary screen.
6 * LICENSE: This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 3
9 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
17 * @package OpenEMR
18 * @author Brady Miller <brady.g.miller@gmail.com>
19 * @link http://www.open-emr.org
22 //SANITIZE ALL ESCAPES
23 $sanitize_all_escapes=true;
26 //STOP FAKE REGISTER GLOBALS
27 $fake_register_globals=false;
30 require_once("../../globals.php");
31 require_once("$srcdir/patient.inc");
32 require_once("$srcdir/acl.inc");
33 require_once("$srcdir/options.inc.php");
34 require_once("../history/history.inc.php");
35 require_once("$srcdir/edi.inc");
36 require_once("$srcdir/invoice_summary.inc.php");
37 require_once("$srcdir/clinical_rules.php");
38 require_once("$srcdir/options.js.php");
39 require_once("$srcdir/group.inc");
40 ////////////
41 require_once(dirname(__FILE__)."/../../../library/appointments.inc.php");
43 if (isset($_GET['set_pid'])) {
44 include_once("$srcdir/pid.inc");
45 setpid($_GET['set_pid']);
48 $active_reminders = false;
49 $all_allergy_alerts = false;
50 if ($GLOBALS['enable_cdr']) {
51 //CDR Engine stuff
52 if ($GLOBALS['enable_allergy_check'] && $GLOBALS['enable_alert_log']) {
53 //Check for new allergies conflicts and throw popup if any exist(note need alert logging to support this)
54 $new_allergy_alerts = allergy_conflict($pid,'new',$_SESSION['authUser']);
55 if (!empty($new_allergy_alerts)) {
56 $pop_warning = '<script type="text/javascript">alert(\'' . xls('WARNING - FOLLOWING ACTIVE MEDICATIONS ARE ALLERGIES') . ':\n';
57 foreach ($new_allergy_alerts as $new_allergy_alert) {
58 $pop_warning .= addslashes($new_allergy_alert) . '\n';
60 $pop_warning .= '\')</script>';
61 echo $pop_warning;
64 if ((!isset($_SESSION['alert_notify_pid']) || ($_SESSION['alert_notify_pid'] != $pid)) && isset($_GET['set_pid']) && $GLOBALS['enable_cdr_crp']) {
65 // showing a new patient, so check for active reminders and allergy conflicts, which use in active reminder popup
66 $active_reminders = active_alert_summary($pid,"reminders-due",'','default',$_SESSION['authUser'],TRUE);
67 if ($GLOBALS['enable_allergy_check']) {
68 $all_allergy_alerts = allergy_conflict($pid,'all',$_SESSION['authUser'],TRUE);
73 function print_as_money($money) {
74 preg_match("/(\d*)\.?(\d*)/",$money,$moneymatches);
75 $tmp = wordwrap(strrev($moneymatches[1]),3,",",1);
76 $ccheck = strrev($tmp);
77 if ($ccheck[0] == ",") {
78 $tmp = substr($ccheck,1,strlen($ccheck)-1);
80 if ($moneymatches[2] != "") {
81 return "$ " . strrev($tmp) . "." . $moneymatches[2];
82 } else {
83 return "$ " . strrev($tmp);
87 // get an array from Photos category
88 function pic_array($pid,$picture_directory) {
89 $pics = array();
90 $sql_query = "select documents.id from documents join categories_to_documents " .
91 "on documents.id = categories_to_documents.document_id " .
92 "join categories on categories.id = categories_to_documents.category_id " .
93 "where categories.name like ? and documents.foreign_id = ?";
94 if ($query = sqlStatement($sql_query, array($picture_directory,$pid))) {
95 while( $results = sqlFetchArray($query) ) {
96 array_push($pics,$results['id']);
99 return ($pics);
101 // Get the document ID of the first document in a specific catg.
102 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'); // image ext supported by fancybox viewer
128 if ( in_array($extension,$viewable_types) ) { // extention matches list
129 $to_url = "<td> <a href = $web_root" .
130 "/controller.php?document&retrieve&patient_id=$pid&document_id=$doc_id&as_file=false&original_file=true&disable_exit=false&show_original=true" .
131 "/tmp$extension" . // Force image type URL for fancybo
132 " onclick=top.restoreSession(); class='image_modal'>" .
133 " <img src = $web_root" .
134 "/controller.php?document&retrieve&patient_id=$pid&document_id=$doc_id&as_file=false" .
135 " $image_width alt='$doc_catg:$image_file'> </a> </td> <td valign='center'>".
136 htmlspecialchars($doc_catg) . '<br />&nbsp;' . htmlspecialchars($image_file) .
137 "</td>";
139 else {
140 $to_url = "<td> <a href='" . $web_root . "/controller.php?document&retrieve" .
141 "&patient_id=$pid&document_id=$doc_id'" .
142 " onclick='top.restoreSession()' class='css_button_small'>" .
143 "<span>" .
144 htmlspecialchars( xl("View"), ENT_QUOTES )."</a> &nbsp;" .
145 htmlspecialchars( "$doc_catg - $image_file", ENT_QUOTES ) .
146 "</span> </td>";
148 echo "<table><tr>";
149 echo $to_url;
150 echo "</tr></table>";
153 // Determine if the Vitals form is in use for this site.
154 $tmp = sqlQuery("SELECT count(*) AS count FROM registry WHERE " .
155 "directory = 'vitals' AND state = 1");
156 $vitals_is_registered = $tmp['count'];
158 // Get patient/employer/insurance information.
160 $result = getPatientData($pid, "*, DATE_FORMAT(DOB,'%Y-%m-%d') as DOB_YMD");
161 $result2 = getEmployerData($pid);
162 $result3 = getInsuranceData($pid, "primary", "copay, provider, DATE_FORMAT(`date`,'%Y-%m-%d') as effdate");
163 $insco_name = "";
164 if ($result3['provider']) { // Use provider in case there is an ins record w/ unassigned insco
165 $insco_name = getInsuranceProvider($result3['provider']);
168 <html>
170 <head>
171 <?php html_header_show();?>
172 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
173 <link rel="stylesheet" type="text/css" href="../../../library/js/fancybox/jquery.fancybox-1.2.6.css" media="screen" />
174 <style type="text/css">@import url(../../../library/dynarch_calendar.css);</style>
175 <script type="text/javascript" src="../../../library/textformat.js"></script>
176 <script type="text/javascript" src="../../../library/dynarch_calendar.js"></script>
177 <?php include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?>
178 <script type="text/javascript" src="../../../library/dynarch_calendar_setup.js"></script>
179 <script type="text/javascript" src="../../../library/dialog.js?v=<?php echo $v_js_includes; ?>"></script>
180 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-6-4/index.js"></script>
181 <script type="text/javascript" src="../../../library/js/common.js"></script>
182 <script type="text/javascript" src="../../../library/js/fancybox/jquery.fancybox-1.2.6.js"></script>
183 <script type="text/javascript" language="JavaScript">
185 var mypcc = '<?php echo htmlspecialchars($GLOBALS['phone_country_code'],ENT_QUOTES); ?>';
186 //////////
187 function oldEvt(apptdate, eventid) {
188 dlgopen('../../main/calendar/add_edit_event.php?date=' + apptdate + '&eid=' + eventid, '_blank', 775, 500);
191 function advdirconfigure() {
192 dlgopen('advancedirectives.php', '_blank', 500, 450);
195 function refreshme() {
196 top.restoreSession();
197 location.reload();
200 // Process click on Delete link.
201 function deleteme() {
202 dlgopen('../deleter.php?patient=<?php echo htmlspecialchars($pid,ENT_QUOTES); ?>', '_blank', 500, 450);
203 return false;
206 // Called by the deleteme.php window on a successful delete.
207 function imdeleted() {
208 <?php if ($GLOBALS['new_tabs_layout']) { ?>
209 top.clearPatient();
210 <?php } else { ?>
211 parent.left_nav.clearPatient();
212 <?php } ?>
215 function newEvt() {
216 dlgopen('../../main/calendar/add_edit_event.php?patientid=<?php echo htmlspecialchars($pid,ENT_QUOTES); ?>', '_blank', 775, 500);
217 return false;
220 function sendimage(pid, what) {
221 // alert('Not yet implemented.'); return false;
222 dlgopen('../upload_dialog.php?patientid=' + pid + '&file=' + what,
223 '_blank', 500, 400);
224 return false;
227 </script>
229 <script type="text/javascript">
231 function toggleIndicator(target,div) {
233 $mode = $(target).find(".indicator").text();
234 if ( $mode == "<?php echo htmlspecialchars(xl('collapse'),ENT_QUOTES); ?>" ) {
235 $(target).find(".indicator").text( "<?php echo htmlspecialchars(xl('expand'),ENT_QUOTES); ?>" );
236 $("#"+div).hide();
237 $.post( "../../../library/ajax/user_settings.php", { target: div, mode: 0 });
238 } else {
239 $(target).find(".indicator").text( "<?php echo htmlspecialchars(xl('collapse'),ENT_QUOTES); ?>" );
240 $("#"+div).show();
241 $.post( "../../../library/ajax/user_settings.php", { target: div, mode: 1 });
245 $(document).ready(function(){
246 var msg_updation='';
247 <?php
248 if($GLOBALS['erx_enable']){
249 //$soap_status=sqlQuery("select soap_import_status from patient_data where pid=?",array($pid));
250 $soap_status=sqlStatement("select soap_import_status,pid from patient_data where pid=? and soap_import_status in ('1','3')",array($pid));
251 while($row_soapstatus=sqlFetchArray($soap_status)){
252 //if($soap_status['soap_import_status']=='1' || $soap_status['soap_import_status']=='3'){ ?>
253 top.restoreSession();
254 $.ajax({
255 type: "POST",
256 url: "../../soap_functions/soap_patientfullmedication.php",
257 dataType: "html",
258 data: {
259 patient:<?php echo $row_soapstatus['pid']; ?>,
261 async: false,
262 success: function(thedata){
263 //alert(thedata);
264 msg_updation+=thedata;
266 error:function(){
267 alert('ajax error');
270 <?php
272 //elseif($soap_status['soap_import_status']=='3'){ ?>
273 top.restoreSession();
274 $.ajax({
275 type: "POST",
276 url: "../../soap_functions/soap_allergy.php",
277 dataType: "html",
278 data: {
279 patient:<?php echo $row_soapstatus['pid']; ?>,
281 async: false,
282 success: function(thedata){
283 //alert(thedata);
284 msg_updation+=thedata;
286 error:function(){
287 alert('ajax error');
290 <?php
291 if($GLOBALS['erx_import_status_message']){ ?>
292 if(msg_updation)
293 alert(msg_updation);
294 <?php
300 // load divs
301 $("#stats_div").load("stats.php", { 'embeddedScreen' : true }, function() {
302 // (note need to place javascript code here also to get the dynamic link to work)
303 $(".rx_modal").fancybox( {
304 'overlayOpacity' : 0.0,
305 'showCloseButton' : true,
306 'frameHeight' : 500,
307 'frameWidth' : 800,
308 'centerOnScroll' : false,
309 'callbackOnClose' : function() {
310 refreshme();
314 $("#pnotes_ps_expand").load("pnotes_fragment.php");
315 $("#disclosures_ps_expand").load("disc_fragment.php");
317 <?php if ($GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_crw']) { ?>
318 top.restoreSession();
319 $("#clinical_reminders_ps_expand").load("clinical_reminders_fragment.php", { 'embeddedScreen' : true }, function() {
320 // (note need to place javascript code here also to get the dynamic link to work)
321 $(".medium_modal").fancybox( {
322 'overlayOpacity' : 0.0,
323 'showCloseButton' : true,
324 'frameHeight' : 500,
325 'frameWidth' : 800,
326 'centerOnScroll' : false,
327 'callbackOnClose' : function() {
328 refreshme();
332 <?php } // end crw?>
334 <?php if ($GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_prw']) { ?>
335 top.restoreSession();
336 $("#patient_reminders_ps_expand").load("patient_reminders_fragment.php");
337 <?php } // end prw?>
339 <?php if ($vitals_is_registered && acl_check('patients', 'med')) { ?>
340 // Initialize the Vitals form if it is registered and user is authorized.
341 $("#vitals_ps_expand").load("vitals_fragment.php");
342 <?php } ?>
344 // Initialize track_anything
345 $("#track_anything_ps_expand").load("track_anything_fragment.php");
348 // Initialize labdata
349 $("#labdata_ps_expand").load("labdata_fragment.php");
350 <?php
351 // Initialize for each applicable LBF form.
352 $gfres = sqlStatement("SELECT option_id FROM list_options WHERE " .
353 "list_id = 'lbfnames' AND option_value > 0 AND activity = 1 ORDER BY seq, title");
354 while($gfrow = sqlFetchArray($gfres)) {
356 $("#<?php echo $gfrow['option_id']; ?>_ps_expand").load("lbf_fragment.php?formname=<?php echo $gfrow['option_id']; ?>");
357 <?php
361 // fancy box
362 enable_modals();
364 tabbify();
366 // modal for dialog boxes
367 $(".large_modal").fancybox( {
368 'overlayOpacity' : 0.0,
369 'showCloseButton' : true,
370 'frameHeight' : 600,
371 'frameWidth' : 1000,
372 'centerOnScroll' : false
375 // modal for image viewer
376 $(".image_modal").fancybox( {
377 'overlayOpacity' : 0.0,
378 'showCloseButton' : true,
379 'centerOnScroll' : false,
380 'autoscale' : true
383 $(".iframe1").fancybox( {
384 'left':10,
385 'overlayOpacity' : 0.0,
386 'showCloseButton' : true,
387 'frameHeight' : 300,
388 'frameWidth' : 350
390 // special size for patient portal
391 $(".small_modal").fancybox( {
392 'overlayOpacity' : 0.0,
393 'showCloseButton' : true,
394 'frameHeight' : 200,
395 'frameWidth' : 380,
396 'centerOnScroll' : false
399 <?php if ($active_reminders || $all_allergy_alerts) { ?>
400 // show the active reminder modal
401 $("#reminder_popup_link").fancybox({
402 'overlayOpacity' : 0.0,
403 'showCloseButton' : true,
404 'frameHeight' : 500,
405 'frameWidth' : 500,
406 'centerOnScroll' : false
407 }).trigger('click');
408 <?php } ?>
412 // JavaScript stuff to do when a new patient is set.
414 function setMyPatient() {
415 // Avoid race conditions with loading of the left_nav or Title frame.
416 if (!parent.allFramesLoaded()) {
417 setTimeout("setMyPatient()", 500);
418 return;
420 <?php if (isset($_GET['set_pid'])) { ?>
421 parent.left_nav.setPatient(<?php echo "'" . addslashes($result['fname']) . " " . addslashes($result['lname']) .
422 "'," . addslashes($pid) . ",'" . addslashes($result['pubpid']) .
423 "','', ' " . xls('DOB') . ": " . addslashes(oeFormatShortDate($result['DOB_YMD'])) . " " . xls('Age') . ": " . addslashes(getPatientAgeDisplay($result['DOB_YMD'])) . "'"; ?>);
424 var EncounterDateArray = new Array;
425 var CalendarCategoryArray = new Array;
426 var EncounterIdArray = new Array;
427 var Count = 0;
428 <?php
429 //Encounter details are stored to javacript as array.
430 $result4 = sqlStatement("SELECT fe.encounter,fe.date,openemr_postcalendar_categories.pc_catname FROM form_encounter AS fe ".
431 " left join openemr_postcalendar_categories on fe.pc_catid=openemr_postcalendar_categories.pc_catid WHERE fe.pid = ? order by fe.date desc", array($pid));
432 if(sqlNumRows($result4)>0) {
433 while($rowresult4 = sqlFetchArray($result4)) {
435 EncounterIdArray[Count] = '<?php echo addslashes($rowresult4['encounter']); ?>';
436 EncounterDateArray[Count] = '<?php echo addslashes(oeFormatShortDate(date("Y-m-d", strtotime($rowresult4['date'])))); ?>';
437 CalendarCategoryArray[Count] = '<?php echo addslashes(xl_appt_category($rowresult4['pc_catname'])); ?>';
438 Count++;
439 <?php
443 parent.left_nav.setPatientEncounter(EncounterIdArray,EncounterDateArray,CalendarCategoryArray);
444 <?php } // end setting new pid ?>
445 parent.left_nav.syncRadios();
446 <?php if ( (isset($_GET['set_pid']) ) && (isset($_GET['set_encounterid'])) && ( intval($_GET['set_encounterid']) > 0 ) ) {
447 $encounter = intval($_GET['set_encounterid']);
448 $_SESSION['encounter'] = $encounter;
449 $query_result = sqlQuery("SELECT `date` FROM `form_encounter` WHERE `encounter` = ?", array($encounter)); ?>
450 encurl = 'encounter/encounter_top.php?set_encounter=' + <?php echo attr($encounter);?> + '&pid=' + <?php echo attr($pid);?>;
451 <?php if ($GLOBALS['new_tabs_layout']) { ?>
452 parent.left_nav.setEncounter('<?php echo oeFormatShortDate(date("Y-m-d", strtotime($query_result['date']))); ?>', '<?php echo attr($encounter); ?>', 'enc');
453 top.restoreSession();
454 parent.left_nav.loadFrame('enc2', 'enc', 'patient_file/' + encurl);
455 <?php } else { ?>
456 var othername = (window.name == 'RTop') ? 'RBot' : 'RTop';
457 parent.left_nav.setEncounter('<?php echo oeFormatShortDate(date("Y-m-d", strtotime($query_result['date']))); ?>', '<?php echo attr($encounter); ?>', othername);
458 top.restoreSession();
459 parent.frames[othername].location.href = '../' + encurl;
460 <?php } ?>
461 <?php } // end setting new encounter id (only if new pid is also set) ?>
464 $(window).load(function() {
465 setMyPatient();
468 </script>
470 <style type="css/text">
471 #pnotes_ps_expand {
472 height:auto;
473 width:100%;
475 </style>
477 </head>
479 <body class="body_top patient-demographics">
481 <a href='../reminder/active_reminder_popup.php' id='reminder_popup_link' style='visibility: false;' class='iframe' onclick='top.restoreSession()'></a>
483 <?php
484 $thisauth = acl_check('patients', 'demo');
485 if ($thisauth) {
486 if ($result['squad'] && ! acl_check('squads', $result['squad'])) {
487 $thisauth = 0;
490 if (!$thisauth) {
491 echo "<p>(" . htmlspecialchars(xl('Demographics not authorized'),ENT_NOQUOTES) . ")</p>\n";
492 echo "</body>\n</html>\n";
493 exit();
495 if ($thisauth): ?>
497 <table class="table_header">
498 <tr>
499 <td>
500 <span class='title'>
501 <?php echo htmlspecialchars(getPatientName($pid),ENT_NOQUOTES); ?>
502 </span>
503 </td>
504 <?php if (acl_check('admin', 'super') && $GLOBALS['allow_pat_delete']) : ?>
505 <td style='padding-left:1em;' class="delete">
506 <a class='css_button iframe'
507 href='../deleter.php?patient=<?php echo htmlspecialchars($pid,ENT_QUOTES);?>'
508 onclick='top.restoreSession()'>
509 <span><?php echo htmlspecialchars(xl('Delete'),ENT_NOQUOTES);?></span>
510 </a>
511 </td>
512 <?php endif; // Allow PT delete
513 if($GLOBALS['erx_enable']): ?>
514 <td style="padding-left:1em;" class="erx">
515 <a class="css_button" href="../../eRx.php?page=medentry" onclick="top.restoreSession()">
516 <span><?php echo htmlspecialchars(xl('NewCrop MedEntry'),ENT_NOQUOTES);?></span>
517 </a>
518 </td>
519 <td style="padding-left:1em;">
520 <a class="css_button iframe1"
521 href="../../soap_functions/soap_accountStatusDetails.php"
522 onclick="top.restoreSession()">
523 <span><?php echo htmlspecialchars(xl('NewCrop Account Status'),ENT_NOQUOTES);?></span>
524 </a>
525 </td>
526 <td id='accountstatus'></td>
527 <?php endif; // eRX Enabled
528 //Patient Portal
529 $portalUserSetting = true; //flag to see if patient has authorized access to portal
530 if( ($GLOBALS['portal_onsite_enable'] && $GLOBALS['portal_onsite_address']) ||
531 ($GLOBALS['portal_onsite_two_enable'] && $GLOBALS['portal_onsite_two_address']) ):
532 $portalStatus = sqlQuery("SELECT allow_patient_portal FROM patient_data WHERE pid=?",array($pid));
533 if ($portalStatus['allow_patient_portal']=='YES'):
534 $portalLogin = sqlQuery("SELECT pid FROM `patient_access_onsite` WHERE `pid`=?", array($pid));?>
535 <td style='padding-left:1em;'>
536 <a class='css_button iframe small_modal'
537 href='create_portallogin.php?portalsite=on&patient=<?php echo htmlspecialchars($pid,ENT_QUOTES);?>'
538 onclick='top.restoreSession()'>
539 <?php $display = (empty($portalLogin)) ? xlt('Create Onsite Portal Credentials') : xlt('Reset Onsite Portal Credentials'); ?>
540 <span><?php echo $display; ?></span>
541 </a>
542 </td>
543 <?php
544 else:
545 $portalUserSetting = false;
546 endif; // allow patient portal
547 endif; // Onsite Patient Portal
548 if($GLOBALS['portal_offsite_enable'] && $GLOBALS['portal_offsite_address']):
549 $portalStatus = sqlQuery("SELECT allow_patient_portal FROM patient_data WHERE pid=?",array($pid));
550 if ($portalStatus['allow_patient_portal']=='YES'):
551 $portalLogin = sqlQuery("SELECT pid FROM `patient_access_offsite` WHERE `pid`=?", array($pid));
553 <td style='padding-left:1em;'>
554 <a class='css_button iframe small_modal'
555 href='create_portallogin.php?portalsite=off&patient=<?php echo htmlspecialchars($pid,ENT_QUOTES);?>'
556 onclick='top.restoreSession()'>
557 <span>
558 <?php $text = (empty($portalLogin)) ? xlt('Create Offsite Portal Credentials') : xlt('Reset Offsite Portal Credentials'); ?>
559 <?php echo $text; ?>
560 </span>
561 </a>
562 </td>
563 <?php
564 else:
565 $portalUserSetting = false;
566 endif; // allow_patient_portal
567 endif; // portal_offsite_enable
568 if (!($portalUserSetting)): // Show that the patient has not authorized portal access ?>
569 <td style='padding-left:1em;'>
570 <?php echo htmlspecialchars( xl('Patient has not authorized the Patient Portal.'), ENT_NOQUOTES);?>
571 </td>
572 <?php endif;
573 //Patient Portal
575 // If patient is deceased, then show this (along with the number of days patient has been deceased for)
576 $days_deceased = is_patient_deceased($pid);
577 if ($days_deceased != null): ?>
578 <td class="deceased" style="padding-left:1em;font-weight:bold;color:red">
579 <?php
580 if ($days_deceased == 0) {
581 echo xlt("DECEASED (Today)");
583 else if ($days_deceased == 1) {
584 echo xlt("DECEASED (1 day ago)");
586 else {
587 echo xlt("DECEASED") . " (" . text($days_deceased) . " " . xlt("days ago") . ")";
588 } ?>
589 </td>
590 <?php endif; ?>
591 </tr>
592 </table>
594 <?php
595 endif; // $thisauth
598 <?php
599 // Get the document ID of the patient ID card if access to it is wanted here.
600 $idcard_doc_id = false;
601 if ($GLOBALS['patient_id_category_name']) {
602 $idcard_doc_id = get_document_by_catg($pid, $GLOBALS['patient_id_category_name']);
606 <table cellspacing='0' cellpadding='0' border='0' class="subnav">
607 <tr>
608 <td class="small" colspan='4'>
609 <a href="../history/history.php" onclick='top.restoreSession()'>
610 <?php echo htmlspecialchars(xl('History'),ENT_NOQUOTES); ?></a>
612 <?php //note that we have temporarily removed report screen from the modal view ?>
613 <a href="../report/patient_report.php" onclick='top.restoreSession()'>
614 <?php echo htmlspecialchars(xl('Report'),ENT_NOQUOTES); ?></a>
616 <?php //note that we have temporarily removed document screen from the modal view ?>
617 <a href="../../../controller.php?document&list&patient_id=<?php echo $pid;?>" onclick='top.restoreSession()'>
618 <?php echo htmlspecialchars(xl('Documents'),ENT_NOQUOTES); ?></a>
620 <a href="../transaction/transactions.php" class='iframe large_modal' onclick='top.restoreSession()'>
621 <?php echo htmlspecialchars(xl('Transactions'),ENT_NOQUOTES); ?></a>
623 <a href="stats_full.php?active=all" onclick='top.restoreSession()'>
624 <?php echo htmlspecialchars(xl('Issues'),ENT_NOQUOTES); ?></a>
626 <a href="../../reports/pat_ledger.php?form=1&patient_id=<?php echo attr($pid);?>" onclick='top.restoreSession()'>
627 <?php echo xlt('Ledger'); ?></a>
629 <a href="../../reports/external_data.php" onclick='top.restoreSession()'>
630 <?php echo xlt('External Data'); ?></a>
632 <!-- DISPLAYING HOOKS STARTS HERE -->
633 <?php
634 $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
635 LEFT OUTER JOIN modules_settings AS ms ON obj_name=enabled_hooks AND ms.mod_id=msh.mod_id
636 LEFT OUTER JOIN modules AS m ON m.mod_id=ms.mod_id
637 WHERE fld_type=3 AND mod_active=1 AND sql_run=1 AND attached_to='demographics' ORDER BY mod_id");
638 $DivId = 'mod_installer';
639 if (sqlNumRows($module_query)) {
640 $jid = 0;
641 $modid = '';
642 while ($modulerow = sqlFetchArray($module_query)) {
643 $DivId = 'mod_'.$modulerow['mod_id'];
644 $new_category = $modulerow['mod_ui_name'];
645 $modulePath = "";
646 $added = "";
647 if($modulerow['type'] == 0) {
648 $modulePath = $GLOBALS['customModDir'];
649 $added = "";
651 else{
652 $added = "index";
653 $modulePath = $GLOBALS['zendModDir'];
655 if(!acl_check('admin', 'super') && !zh_acl_check($_SESSION['authUserID'],$modulerow['obj_name']))continue;
657 $relative_link = "../../modules/".$modulePath."/".$modulerow['path'];
658 $nickname = $modulerow['menu_name'] ? $modulerow['menu_name'] : 'Noname';
659 $jid++;
660 $modid = $modulerow['mod_id'];
663 <a href="<?php echo $relative_link; ?>" onclick='top.restoreSession()'>
664 <?php echo xlt($nickname); ?></a>
665 <?php
669 <!-- DISPLAYING HOOKS ENDS HERE -->
671 </td>
672 </tr>
673 </table> <!-- end header -->
675 <div style='margin-top:10px' class="main"> <!-- start main content div -->
676 <table border="0" cellspacing="0" cellpadding="0" width="100%">
677 <tr>
678 <td class="demographics-box" align="left" valign="top">
679 <!-- start left column div -->
680 <div style='float:left; margin-right:20px'>
682 <table cellspacing=0 cellpadding=0>
683 <?php if (!$GLOBALS['hide_billing_widget']) { ?>
684 <tr>
685 <td>
686 <?php
687 // Billing expand collapse widget
688 $widgetTitle = xl("Billing");
689 $widgetLabel = "billing";
690 $widgetButtonLabel = xl("Edit");
691 $widgetButtonLink = "return newEvt();";
692 $widgetButtonClass = "";
693 $linkMethod = "javascript";
694 $bodyClass = "notab";
695 $widgetAuth = false;
696 $fixedWidth = true;
697 if ($GLOBALS['force_billing_widget_open']) {
698 $forceExpandAlways = true;
700 else {
701 $forceExpandAlways = false;
703 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
704 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
705 $widgetAuth, $fixedWidth, $forceExpandAlways);
707 <br>
708 <?php
709 //PATIENT BALANCE,INS BALANCE naina@capminds.com
710 $patientbalance = get_patient_balance($pid, false);
711 //Debit the patient balance from insurance balance
712 $insurancebalance = get_patient_balance($pid, true) - $patientbalance;
713 $totalbalance=$patientbalance + $insurancebalance;
715 // Show current balance and billing note, if any.
716 echo "<table border='0'><tr><td>" .
717 "<table ><tr><td><span class='bold'><font color='red'>" .
718 xlt('Patient Balance Due') .
719 " : " . text(oeFormatMoney($patientbalance)) .
720 "</font></span></td></tr>".
721 "<tr><td><span class='bold'><font color='red'>" .
722 xlt('Insurance Balance Due') .
723 " : " . text(oeFormatMoney($insurancebalance)) .
724 "</font></span></td></tr>".
725 "<tr><td><span class='bold'><font color='red'>" .
726 xlt('Total Balance Due').
727 " : " . text(oeFormatMoney($totalbalance)) .
728 "</font></span></td></td></tr>";
729 if (!empty($result['billing_note'])) {
730 echo "<tr><td><span class='bold'><font color='red'>" .
731 xlt('Billing Note') . ":" .
732 text($result['billing_note']) .
733 "</font></span></td></tr>";
735 if ($result3['provider']) { // Use provider in case there is an ins record w/ unassigned insco
736 echo "<tr><td><span class='bold'>" .
737 xlt('Primary Insurance') . ': ' . text($insco_name) .
738 "</span>&nbsp;&nbsp;&nbsp;";
739 if ($result3['copay'] > 0) {
740 echo "<span class='bold'>" .
741 xlt('Copay') . ': ' . text($result3['copay']) .
742 "</span>&nbsp;&nbsp;&nbsp;";
744 echo "<span class='bold'>" .
745 xlt('Effective Date') . ': ' . text(oeFormatShortDate($result3['effdate'])) .
746 "</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($widgetTitle, $widgetLabel, $widgetButtonLabel,
771 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
772 $widgetAuth, $fixedWidth);
774 <div id="DEM" >
775 <ul class="tabNav">
776 <?php display_layout_tabs('DEM', $result, $result2); ?>
777 </ul>
778 <div class="tabContainer">
779 <?php display_layout_tabs_data('DEM', $result, $result2); ?>
780 </div>
781 </div>
782 </div> <!-- required for expand_collapse_widget -->
783 </td>
784 </tr>
786 <tr>
787 <td>
788 <?php
789 $insurance_count = 0;
790 foreach (array('primary','secondary','tertiary') as $instype) {
791 $enddate = 'Present';
792 $query = "SELECT * FROM insurance_data WHERE " .
793 "pid = ? AND type = ? " .
794 "ORDER BY date DESC";
795 $res = sqlStatement($query, array($pid, $instype) );
796 while( $row = sqlFetchArray($res) ) {
797 if ($row['provider'] ) $insurance_count++;
801 if ( $insurance_count > 0 ) {
802 // Insurance expand collapse widget
803 $widgetTitle = xl("Insurance");
804 $widgetLabel = "insurance";
805 $widgetButtonLabel = xl("Edit");
806 $widgetButtonLink = "demographics_full.php";
807 $widgetButtonClass = "";
808 $linkMethod = "html";
809 $bodyClass = "";
810 $widgetAuth = acl_check('patients', 'demo', '', 'write');
811 $fixedWidth = true;
812 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
813 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
814 $widgetAuth, $fixedWidth);
816 if ( $insurance_count > 0 ) {
819 <ul class="tabNav"><?php
820 ///////////////////////////////// INSURANCE SECTION
821 $first = true;
822 foreach (array('primary','secondary','tertiary') as $instype) {
824 $query = "SELECT * FROM insurance_data WHERE " .
825 "pid = ? AND type = ? " .
826 "ORDER BY date DESC";
827 $res = sqlStatement($query, array($pid, $instype) );
829 $enddate = 'Present';
831 while( $row = sqlFetchArray($res) ) {
832 if ($row['provider'] ) {
834 $ins_description = ucfirst($instype);
835 $ins_description = xl($ins_description);
836 $ins_description .= strcmp($enddate, 'Present') != 0 ? " (".xl('Old').")" : "";
838 <li <?php echo $first ? 'class="current"' : '' ?>><a href="#">
839 <?php echo htmlspecialchars($ins_description,ENT_NOQUOTES); ?></a></li>
840 <?php
841 $first = false;
843 $enddate = $row['date'];
846 // Display the eligibility tab
847 echo "<li><a href='#'>" .
848 htmlspecialchars( xl('Eligibility'), ENT_NOQUOTES) . "</a></li>";
850 ?></ul><?php
852 } ?>
854 <div class="tabContainer">
855 <?php
856 $first = true;
857 foreach (array('primary','secondary','tertiary') as $instype) {
858 $enddate = 'Present';
860 $query = "SELECT * FROM insurance_data WHERE " .
861 "pid = ? AND type = ? " .
862 "ORDER BY date DESC";
863 $res = sqlStatement($query, array($pid, $instype) );
864 while( $row = sqlFetchArray($res) ) {
865 if ($row['provider'] ) {
867 <div class="tab <?php echo $first ? 'current' : '' ?>">
868 <table border='0' cellpadding='0' width='100%'>
869 <?php
870 $icobj = new InsuranceCompany($row['provider']);
871 $adobj = $icobj->get_address();
872 $insco_name = trim($icobj->get_name());
874 <tr>
875 <td valign='top' colspan='3'>
876 <span class='text'>
877 <?php if (strcmp($enddate, 'Present') != 0) echo htmlspecialchars(xl("Old"),ENT_NOQUOTES)." "; ?>
878 <?php $tempinstype=ucfirst($instype); echo htmlspecialchars(xl($tempinstype.' Insurance'),ENT_NOQUOTES); ?>
879 <?php if (strcmp($row['date'], '0000-00-00') != 0) { ?>
880 <?php echo htmlspecialchars(xl('from','',' ',' ').$row['date'],ENT_NOQUOTES); ?>
881 <?php } ?>
882 <?php echo htmlspecialchars(xl('until','',' ',' '),ENT_NOQUOTES);
883 echo (strcmp($enddate, 'Present') != 0) ? $enddate : htmlspecialchars(xl('Present'),ENT_NOQUOTES); ?>:</span>
884 </td>
885 </tr>
886 <tr>
887 <td valign='top'>
888 <span class='text'>
889 <?php
890 if ($insco_name) {
891 echo htmlspecialchars($insco_name,ENT_NOQUOTES) . '<br>';
892 if (trim($adobj->get_line1())) {
893 echo htmlspecialchars($adobj->get_line1(),ENT_NOQUOTES) . '<br>';
894 echo htmlspecialchars($adobj->get_city() . ', ' . $adobj->get_state() . ' ' . $adobj->get_zip(),ENT_NOQUOTES);
896 } else {
897 echo "<font color='red'><b>".htmlspecialchars(xl('Unassigned'),ENT_NOQUOTES)."</b></font>";
900 <br>
901 <?php echo htmlspecialchars(xl('Policy Number'),ENT_NOQUOTES); ?>:
902 <?php echo htmlspecialchars($row['policy_number'],ENT_NOQUOTES) ?><br>
903 <?php echo htmlspecialchars(xl('Plan Name'),ENT_NOQUOTES); ?>:
904 <?php echo htmlspecialchars($row['plan_name'],ENT_NOQUOTES); ?><br>
905 <?php echo htmlspecialchars(xl('Group Number'),ENT_NOQUOTES); ?>:
906 <?php echo htmlspecialchars($row['group_number'],ENT_NOQUOTES); ?></span>
907 </td>
908 <td valign='top'>
909 <span class='bold'><?php echo htmlspecialchars(xl('Subscriber'),ENT_NOQUOTES); ?>: </span><br>
910 <span class='text'><?php echo htmlspecialchars($row['subscriber_fname'] . ' ' . $row['subscriber_mname'] . ' ' . $row['subscriber_lname'],ENT_NOQUOTES); ?>
911 <?php
912 if ($row['subscriber_relationship'] != "") {
913 echo "(" . htmlspecialchars($row['subscriber_relationship'],ENT_NOQUOTES) . ")";
916 <br>
917 <?php echo htmlspecialchars(xl('S.S.'),ENT_NOQUOTES); ?>:
918 <?php echo htmlspecialchars($row['subscriber_ss'],ENT_NOQUOTES); ?><br>
919 <?php echo htmlspecialchars(xl('D.O.B.'),ENT_NOQUOTES); ?>:
920 <?php if ($row['subscriber_DOB'] != "0000-00-00 00:00:00") echo htmlspecialchars($row['subscriber_DOB'],ENT_NOQUOTES); ?><br>
921 <?php echo htmlspecialchars(xl('Phone'),ENT_NOQUOTES); ?>:
922 <?php echo htmlspecialchars($row['subscriber_phone'],ENT_NOQUOTES); ?>
923 </span>
924 </td>
925 <td valign='top'>
926 <span class='bold'><?php echo htmlspecialchars(xl('Subscriber Address'),ENT_NOQUOTES); ?>: </span><br>
927 <span class='text'><?php echo htmlspecialchars($row['subscriber_street'],ENT_NOQUOTES); ?><br>
928 <?php echo htmlspecialchars($row['subscriber_city'],ENT_NOQUOTES); ?>
929 <?php if($row['subscriber_state'] != "") echo ", "; echo htmlspecialchars($row['subscriber_state'],ENT_NOQUOTES); ?>
930 <?php if($row['subscriber_country'] != "") echo ", "; echo htmlspecialchars($row['subscriber_country'],ENT_NOQUOTES); ?>
931 <?php echo " " . htmlspecialchars($row['subscriber_postal_code'],ENT_NOQUOTES); ?></span>
933 <?php if (trim($row['subscriber_employer'])) { ?>
934 <br><span class='bold'><?php echo htmlspecialchars(xl('Subscriber Employer'),ENT_NOQUOTES); ?>: </span><br>
935 <span class='text'><?php echo htmlspecialchars($row['subscriber_employer'],ENT_NOQUOTES); ?><br>
936 <?php echo htmlspecialchars($row['subscriber_employer_street'],ENT_NOQUOTES); ?><br>
937 <?php echo htmlspecialchars($row['subscriber_employer_city'],ENT_NOQUOTES); ?>
938 <?php if($row['subscriber_employer_city'] != "") echo ", "; echo htmlspecialchars($row['subscriber_employer_state'],ENT_NOQUOTES); ?>
939 <?php if($row['subscriber_employer_country'] != "") echo ", "; echo htmlspecialchars($row['subscriber_employer_country'],ENT_NOQUOTES); ?>
940 <?php echo " " . htmlspecialchars($row['subscriber_employer_postal_code'],ENT_NOQUOTES); ?>
941 </span>
942 <?php } ?>
944 </td>
945 </tr>
946 <tr>
947 <td>
948 <?php if ($row['copay'] != "") { ?>
949 <span class='bold'><?php echo htmlspecialchars(xl('CoPay'),ENT_NOQUOTES); ?>: </span>
950 <span class='text'><?php echo htmlspecialchars($row['copay'],ENT_NOQUOTES); ?></span>
951 <br />
952 <?php } ?>
953 <span class='bold'><?php echo htmlspecialchars(xl('Accept Assignment'),ENT_NOQUOTES); ?>:</span>
954 <span class='text'><?php if($row['accept_assignment'] == "TRUE") echo xl("YES"); ?>
955 <?php if($row['accept_assignment'] == "FALSE") echo xl("NO"); ?></span>
956 <?php if (!empty($row['policy_type'])) { ?>
957 <br />
958 <span class='bold'><?php echo htmlspecialchars(xl('Secondary Medicare Type'),ENT_NOQUOTES); ?>: </span>
959 <span class='text'><?php echo htmlspecialchars($policy_types[$row['policy_type']],ENT_NOQUOTES); ?></span>
960 <?php } ?>
961 </td>
962 <td valign='top'></td>
963 <td valign='top'></td>
964 </tr>
966 </table>
967 </div>
968 <?php
970 } // end if ($row['provider'])
971 $enddate = $row['date'];
972 $first = false;
973 } // end while
974 } // end foreach
976 // Display the eligibility information
977 echo "<div class='tab'>";
978 show_eligibility_information($pid,true);
979 echo "</div>";
981 ///////////////////////////////// END INSURANCE SECTION
983 </div>
985 <?php } // ?>
987 </td>
988 </tr>
989 <?php } // end if demographics authorized ?>
991 <?php if (acl_check('patients', 'notes')) { ?>
992 <tr>
993 <td width='650px'>
994 <?php
995 // Notes expand collapse widget
996 $widgetTitle = xl("Notes");
997 $widgetLabel = "pnotes";
998 $widgetButtonLabel = xl("Edit");
999 $widgetButtonLink = "pnotes_full.php?form_active=1";
1000 $widgetButtonClass = "";
1001 $linkMethod = "html";
1002 $bodyClass = "notab";
1003 $widgetAuth = acl_check('patients', 'notes', '', 'write');
1004 $fixedWidth = true;
1005 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
1006 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
1007 $widgetAuth, $fixedWidth);
1009 <br/>
1010 <div style='margin-left:10px' class='text'><img src='../../pic/ajax-loader.gif'/></div><br/>
1011 </div>
1012 </td>
1013 </tr>
1014 <?php } // end if notes authorized ?>
1016 <?php if (acl_check('patients', 'reminder') && $GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_prw']) {
1017 echo "<tr><td width='650px'>";
1018 // patient reminders collapse widget
1019 $widgetTitle = xl("Patient Reminders");
1020 $widgetLabel = "patient_reminders";
1021 $widgetButtonLabel = xl("Edit");
1022 $widgetButtonLink = "../reminder/patient_reminders.php?mode=simple&patient_id=".$pid;
1023 $widgetButtonClass = "";
1024 $linkMethod = "html";
1025 $bodyClass = "notab";
1026 $widgetAuth = acl_check('patients', 'reminder', '', 'write');
1027 $fixedWidth = true;
1028 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth); ?>
1029 <br/>
1030 <div style='margin-left:10px' class='text'><image src='../../pic/ajax-loader.gif'/></div><br/>
1031 </div>
1032 </td>
1033 </tr>
1034 <?php } //end if prw is activated ?>
1036 <?php if (acl_check('patients', 'disclosure')) { ?>
1037 <tr>
1038 <td width='650px'>
1039 <?php
1040 // disclosures expand collapse widget
1041 $widgetTitle = xl("Disclosures");
1042 $widgetLabel = "disclosures";
1043 $widgetButtonLabel = xl("Edit");
1044 $widgetButtonLink = "disclosure_full.php";
1045 $widgetButtonClass = "";
1046 $linkMethod = "html";
1047 $bodyClass = "notab";
1048 $widgetAuth = acl_check('patients', 'disclosure', '', 'write');
1049 $fixedWidth = true;
1050 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
1051 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
1052 $widgetAuth, $fixedWidth);
1054 <br/>
1055 <div style='margin-left:10px' class='text'><img src='../../pic/ajax-loader.gif'/></div><br/>
1056 </div>
1057 </td>
1058 </tr>
1059 <?php } // end if disclosures authorized ?>
1061 <?php if ($GLOBALS['amendments'] && acl_check('patients', 'amendment')) { ?>
1062 <tr>
1063 <td width='650px'>
1064 <?php // Amendments widget
1065 $widgetTitle = xlt('Amendments');
1066 $widgetLabel = "amendments";
1067 $widgetButtonLabel = xlt("Edit");
1068 $widgetButtonLink = $GLOBALS['webroot'] . "/interface/patient_file/summary/main_frameset.php?feature=amendment";
1069 $widgetButtonClass = "iframe rx_modal";
1070 $linkMethod = "html";
1071 $bodyClass = "summary_item small";
1072 $widgetAuth = acl_check('patients', 'amendment', '', 'write');
1073 $fixedWidth = false;
1074 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1075 $sql = "SELECT * FROM amendments WHERE pid = ? ORDER BY amendment_date DESC";
1076 $result = sqlStatement($sql, array($pid) );
1078 if (sqlNumRows($result) == 0) {
1079 echo " <table><tr>\n";
1080 echo " <td colspan='$numcols' class='text'>&nbsp;&nbsp;" . xlt('None') . "</td>\n";
1081 echo " </tr></table>\n";
1084 while ($row=sqlFetchArray($result)){
1085 echo "&nbsp;&nbsp;";
1086 echo "<a class= '" . $widgetButtonClass . "' href='" . $widgetButtonLink . "&id=" . attr($row['amendment_id']) . "' onclick='top.restoreSession()'>" . text($row['amendment_date']);
1087 echo "&nbsp; " . text($row['amendment_desc']);
1089 echo "</a><br>\n";
1090 } ?>
1091 </td>
1092 </tr>
1093 <?php } // end amendments authorized ?>
1095 <?php if (acl_check('patients', 'lab')) { ?>
1096 <tr>
1097 <td width='650px'>
1098 <?php // labdata expand collapse widget
1099 $widgetTitle = xl("Labs");
1100 $widgetLabel = "labdata";
1101 $widgetButtonLabel = xl("Trend");
1102 $widgetButtonLink = "../summary/labdata.php";#"../encounter/trend_form.php?formname=labdata";
1103 $widgetButtonClass = "";
1104 $linkMethod = "html";
1105 $bodyClass = "notab";
1106 // check to see if any labdata exist
1107 $spruch = "SELECT procedure_report.date_collected AS date " .
1108 "FROM procedure_report " .
1109 "JOIN procedure_order ON procedure_report.procedure_order_id = procedure_order.procedure_order_id " .
1110 "WHERE procedure_order.patient_id = ? " .
1111 "ORDER BY procedure_report.date_collected DESC ";
1112 $existLabdata = sqlQuery($spruch, array($pid) );
1113 if ($existLabdata) {
1114 $widgetAuth = true;
1116 else {
1117 $widgetAuth = false;
1119 $fixedWidth = true;
1120 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
1121 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
1122 $widgetAuth, $fixedWidth);
1124 <br/>
1125 <div style='margin-left:10px' class='text'><img src='../../pic/ajax-loader.gif'/></div><br/>
1126 </div>
1127 </td>
1128 </tr>
1129 <?php } // end labs authorized ?>
1131 <?php if ($vitals_is_registered && acl_check('patients', 'med')) { ?>
1132 <tr>
1133 <td width='650px'>
1134 <?php // vitals expand collapse widget
1135 $widgetTitle = xl("Vitals");
1136 $widgetLabel = "vitals";
1137 $widgetButtonLabel = xl("Trend");
1138 $widgetButtonLink = "../encounter/trend_form.php?formname=vitals";
1139 $widgetButtonClass = "";
1140 $linkMethod = "html";
1141 $bodyClass = "notab";
1142 // check to see if any vitals exist
1143 $existVitals = sqlQuery("SELECT * FROM form_vitals WHERE pid=?", array($pid) );
1144 if ($existVitals) {
1145 $widgetAuth = true;
1147 else {
1148 $widgetAuth = false;
1150 $fixedWidth = true;
1151 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
1152 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
1153 $widgetAuth, $fixedWidth);
1155 <br/>
1156 <div style='margin-left:10px' class='text'><img src='../../pic/ajax-loader.gif'/></div><br/>
1157 </div>
1158 </td>
1159 </tr>
1160 <?php } // end if ($vitals_is_registered && acl_check('patients', 'med')) ?>
1162 <?php
1163 // This generates a section similar to Vitals for each LBF form that
1164 // supports charting. The form ID is used as the "widget label".
1166 $gfres = sqlStatement("SELECT option_id, title, notes FROM list_options WHERE " .
1167 "list_id = 'lbfnames' AND " .
1168 "option_value > 0 AND activity = 1 " .
1169 "ORDER BY seq, title");
1170 while($gfrow = sqlFetchArray($gfres)) {
1171 $jobj = json_decode($gfrow['notes'], true);
1172 $LBF_ACO = empty($jobj['aco']) ? false : explode('|', $jobj['aco']);
1173 if ($LBF_ACO && !acl_check($LBF_ACO[0], $LBF_ACO[1])) continue;
1175 <tr>
1176 <td width='650px'>
1177 <?php // vitals expand collapse widget
1178 $vitals_form_id = $gfrow['option_id'];
1179 $widgetTitle = $gfrow['title'];
1180 $widgetLabel = $vitals_form_id;
1181 $widgetButtonLabel = xl("Trend");
1182 $widgetButtonLink = "../encounter/trend_form.php?formname=$vitals_form_id";
1183 $widgetButtonClass = "";
1184 $linkMethod = "html";
1185 $bodyClass = "notab";
1186 $widgetAuth = false;
1187 if (!$LBF_ACO || acl_check($LBF_ACO[0], $LBF_ACO[1], '', 'write')) {
1188 // check to see if any instances exist for this patient
1189 $existVitals = sqlQuery(
1190 "SELECT * FROM forms WHERE pid = ? AND formdir = ? AND deleted = 0",
1191 array($pid, $vitals_form_id));
1192 $widgetAuth = $existVitals;
1194 $fixedWidth = true;
1195 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
1196 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
1197 $widgetAuth, $fixedWidth);
1199 <br/>
1200 <div style='margin-left:10px' class='text'>
1201 <image src='../../pic/ajax-loader.gif'/>
1202 </div>
1203 <br/>
1204 </div> <!-- This is required by expand_collapse_widget(). -->
1205 </td>
1206 </tr>
1207 <?php
1208 } // end while
1211 </table>
1213 </div>
1214 <!-- end left column div -->
1216 <!-- start right column div -->
1217 <div>
1218 <table>
1219 <tr>
1220 <td>
1222 <div>
1223 <?php
1225 // If there is an ID Card or any Photos show the widget
1226 $photos = pic_array($pid, $GLOBALS['patient_photo_category_name']);
1227 if ($photos or $idcard_doc_id )
1229 $widgetTitle = xl("ID Card") . '/' . xl("Photos");
1230 $widgetLabel = "photos";
1231 $linkMethod = "javascript";
1232 $bodyClass = "notab-right";
1233 $widgetAuth = false;
1234 $fixedWidth = false;
1235 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel ,
1236 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
1237 $widgetAuth, $fixedWidth);
1239 <br />
1240 <?php
1241 if ($idcard_doc_id) {
1242 image_widget($idcard_doc_id, $GLOBALS['patient_id_category_name']);
1245 foreach ($photos as $photo_doc_id) {
1246 image_widget($photo_doc_id, $GLOBALS['patient_photo_category_name']);
1251 <br />
1252 </div>
1253 <div>
1254 <?php
1255 // Advance Directives
1256 if ($GLOBALS['advance_directives_warning']) {
1257 // advance directives expand collapse widget
1258 $widgetTitle = xl("Advance Directives");
1259 $widgetLabel = "directives";
1260 $widgetButtonLabel = xl("Edit");
1261 $widgetButtonLink = "return advdirconfigure();";
1262 $widgetButtonClass = "";
1263 $linkMethod = "javascript";
1264 $bodyClass = "summary_item small";
1265 $widgetAuth = true;
1266 $fixedWidth = false;
1267 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1268 $counterFlag = false; //flag to record whether any categories contain ad records
1269 $query = "SELECT id FROM categories WHERE name='Advance Directive'";
1270 $myrow2 = sqlQuery($query);
1271 if ($myrow2) {
1272 $parentId = $myrow2['id'];
1273 $query = "SELECT id, name FROM categories WHERE parent=?";
1274 $resNew1 = sqlStatement($query, array($parentId) );
1275 while ($myrows3 = sqlFetchArray($resNew1)) {
1276 $categoryId = $myrows3['id'];
1277 $nameDoc = $myrows3['name'];
1278 $query = "SELECT documents.date, documents.id " .
1279 "FROM documents " .
1280 "INNER JOIN categories_to_documents " .
1281 "ON categories_to_documents.document_id=documents.id " .
1282 "WHERE categories_to_documents.category_id=? " .
1283 "AND documents.foreign_id=? " .
1284 "ORDER BY documents.date DESC";
1285 $resNew2 = sqlStatement($query, array($categoryId, $pid) );
1286 $limitCounter = 0; // limit to one entry per category
1287 while (($myrows4 = sqlFetchArray($resNew2)) && ($limitCounter == 0)) {
1288 $dateTimeDoc = $myrows4['date'];
1289 // remove time from datetime stamp
1290 $tempParse = explode(" ",$dateTimeDoc);
1291 $dateDoc = $tempParse[0];
1292 $idDoc = $myrows4['id'];
1293 echo "<a href='$web_root/controller.php?document&retrieve&patient_id=" .
1294 htmlspecialchars($pid,ENT_QUOTES) . "&document_id=" .
1295 htmlspecialchars($idDoc,ENT_QUOTES) . "&as_file=true' onclick='top.restoreSession()'>" .
1296 htmlspecialchars(xl_document_category($nameDoc),ENT_NOQUOTES) . "</a> " .
1297 htmlspecialchars($dateDoc,ENT_NOQUOTES);
1298 echo "<br>";
1299 $limitCounter = $limitCounter + 1;
1300 $counterFlag = true;
1304 if (!$counterFlag) {
1305 echo "&nbsp;&nbsp;" . htmlspecialchars(xl('None'),ENT_NOQUOTES);
1306 } ?>
1307 </div>
1308 <?php } // close advanced dir block
1310 // Show Clinical Reminders for any user that has rules that are permitted.
1311 $clin_rem_check = resolve_rules_sql('','0',TRUE,'',$_SESSION['authUser']);
1312 if (!empty($clin_rem_check) && $GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_crw'] &&
1313 acl_check('patients', 'reminder'))
1315 // clinical summary expand collapse widget
1316 $widgetTitle = xl("Clinical Reminders");
1317 $widgetLabel = "clinical_reminders";
1318 $widgetButtonLabel = xl("Edit");
1319 $widgetButtonLink = "../reminder/clinical_reminders.php?patient_id=".$pid;;
1320 $widgetButtonClass = "";
1321 $linkMethod = "html";
1322 $bodyClass = "summary_item small";
1323 $widgetAuth = acl_check('patients', 'reminder', '', 'write');
1324 $fixedWidth = false;
1325 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1326 echo "<br/>";
1327 echo "<div style='margin-left:10px' class='text'><image src='../../pic/ajax-loader.gif'/></div><br/>";
1328 echo "</div>";
1329 } // end if crw
1331 // Show current and upcoming appointments.
1333 // Recurring appointment support and Appointment Display Sets
1334 // added to Appointments by Ian Jardine ( epsdky ).
1336 if (isset($pid) && !$GLOBALS['disable_calendar'] && acl_check('patients', 'appt')) {
1338 $current_date2 = date('Y-m-d');
1339 $events = array();
1340 $apptNum = (int)$GLOBALS['number_of_appts_to_show'];
1341 if($apptNum != 0) $apptNum2 = abs($apptNum);
1342 else $apptNum2 = 10;
1344 $mode1 = !$GLOBALS['appt_display_sets_option'];
1345 $colorSet1 = $GLOBALS['appt_display_sets_color_1'];
1346 $colorSet2 = $GLOBALS['appt_display_sets_color_2'];
1347 $colorSet3 = $GLOBALS['appt_display_sets_color_3'];
1348 $colorSet4 = $GLOBALS['appt_display_sets_color_4'];
1350 if($mode1) $extraAppts = 1;
1351 else $extraAppts = 6;
1352 $events = fetchNextXAppts($current_date2, $pid, $apptNum2 + $extraAppts, true);
1353 //////
1354 if($events) {
1355 $selectNum = 0;
1356 $apptNumber = count($events);
1358 if($apptNumber <= $apptNum2) {
1359 $extraApptDate = '';
1361 } else if($mode1 && $apptNumber == $apptNum2 + 1) {
1362 $extraApptDate = $events[$apptNumber - 1]['pc_eventDate'];
1363 array_pop($events);
1364 --$apptNumber;
1365 $selectNum = 1;
1367 } else if($apptNumber == $apptNum2 + 6) {
1368 $extraApptDate = $events[$apptNumber - 1]['pc_eventDate'];
1369 array_pop($events);
1370 --$apptNumber;
1371 $selectNum = 2;
1373 } else { // mode 2 - $apptNum2 < $apptNumber < $apptNum2 + 6
1374 $extraApptDate = '';
1375 $selectNum = 2;
1379 $limitApptIndx = $apptNum2 - 1;
1380 $limitApptDate = $events[$limitApptIndx]['pc_eventDate'];
1382 switch ($selectNum) {
1384 case 2:
1385 $lastApptIndx = $apptNumber - 1;
1386 $thisNumber = $lastApptIndx - $limitApptIndx;
1387 for($i = 1; $i <= $thisNumber; ++$i) {
1388 if($events[$limitApptIndx + $i]['pc_eventDate'] != $limitApptDate) {
1389 $extraApptDate = $events[$limitApptIndx + $i]['pc_eventDate'];
1390 $events = array_slice($events, 0, $limitApptIndx + $i);
1391 break;
1395 case 1:
1396 $firstApptIndx = 0;
1397 for($i = 1; $i <= $limitApptIndx; ++$i) {
1398 if($events[$limitApptIndx - $i]['pc_eventDate'] != $limitApptDate) {
1399 $firstApptIndx = $apptNum2 - $i;
1400 break;
1406 if($extraApptDate) {
1407 if($extraApptDate != $limitApptDate) $apptStyle2 = " style='background-color:" . attr($colorSet3) . ";'";
1408 else $apptStyle2 = " style='background-color:" . attr($colorSet4) . ";'";
1411 //////
1413 // appointments expand collapse widget
1414 $widgetTitle = xl("Appointments");
1415 $widgetLabel = "appointments";
1416 $widgetButtonLabel = xl("Add");
1417 $widgetButtonLink = "return newEvt();";
1418 $widgetButtonClass = "";
1419 $linkMethod = "javascript";
1420 $bodyClass = "summary_item small";
1421 $widgetAuth = $resNotNull // $resNotNull reflects state of query in fetchAppointments
1422 && (acl_check('patients', 'appt', '', 'write') || acl_check('patients', 'appt', '', 'addonly'));
1423 $fixedWidth = false;
1424 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1425 $count = 0;
1427 $toggleSet = true;
1428 $priorDate = "";
1429 $therapyGroupCategories = array();
1430 $query = sqlStatement("SELECT pc_catid FROM openemr_postcalendar_categories WHERE pc_cattype = 3 AND pc_active = 1");
1431 while ($result = sqlFetchArray($query)){
1432 $therapyGroupCategories[] = $result['pc_catid'];
1436 foreach($events as $row) { //////
1437 $count++;
1438 $dayname = date("l", strtotime($row['pc_eventDate'])); //////
1439 $dispampm = "am";
1440 $disphour = substr($row['pc_startTime'], 0, 2) + 0;
1441 $dispmin = substr($row['pc_startTime'], 3, 2);
1442 if ($disphour >= 12) {
1443 $dispampm = "pm";
1444 if ($disphour > 12) $disphour -= 12;
1446 $etitle = xl('(Click to edit)');
1447 if ($row['pc_hometext'] != "") {
1448 $etitle = xl('Comments').": ".($row['pc_hometext'])."\r\n".$etitle;
1450 //////
1451 if($extraApptDate && $count > $firstApptIndx) {
1452 $apptStyle = $apptStyle2;
1453 } else {
1454 if($row['pc_eventDate'] != $priorDate) {
1455 $priorDate = $row['pc_eventDate'];
1456 $toggleSet = !$toggleSet;
1458 if($toggleSet) $apptStyle = " style='background-color:" . attr($colorSet2) . ";'";
1459 else $apptStyle = " style='background-color:" . attr($colorSet1) . ";'";
1461 //////
1462 echo "<div " . $apptStyle . ">";
1463 if(!in_array($row['pc_catid'], $therapyGroupCategories)){
1464 echo "<a href='javascript:oldEvt(" . htmlspecialchars(preg_replace("/-/", "", $row['pc_eventDate']),ENT_QUOTES) . ', ' . htmlspecialchars($row['pc_eid'],ENT_QUOTES) . ")' title='" . htmlspecialchars($etitle,ENT_QUOTES) . "'>";
1465 } else {
1466 echo "<span title='" . htmlspecialchars($etitle,ENT_QUOTES) . "'>";
1468 echo "<b>" . htmlspecialchars($row['pc_eventDate'],ENT_NOQUOTES) . ", ";
1469 echo htmlspecialchars(sprintf("%02d", $disphour) .":$dispmin " . xl($dispampm) . " (" . xl($dayname),ENT_NOQUOTES) . ")</b> ";
1470 if ($row['pc_recurrtype']) echo "<img src='" . $GLOBALS['webroot'] . "/interface/main/calendar/modules/PostCalendar/pntemplates/default/images/repeating8.png' border='0' style='margin:0px 2px 0px 2px;' title='".htmlspecialchars(xl("Repeating event"),ENT_QUOTES)."' alt='".htmlspecialchars(xl("Repeating event"),ENT_QUOTES)."'>";
1471 echo "<span title='" . generate_display_field(array('data_type'=>'1','list_id'=>'apptstat'),$row['pc_apptstatus']) . "'>";
1472 echo "<br>" . xlt('Status') . "( " . htmlspecialchars($row['pc_apptstatus'],ENT_NOQUOTES) . " ) </span>";
1473 echo htmlspecialchars(xl_appt_category($row['pc_catname']),ENT_NOQUOTES) . "\n";
1474 if(in_array($row['pc_catid'], $therapyGroupCategories)) echo "<br><span>" . xlt('Group name') .": " . text(getGroup($row['pc_gid'])['group_name']) . "</span>\n";
1475 if ($row['pc_hometext']) echo " <span style='color:green'> Com</span>";
1476 echo "<br>" . htmlspecialchars($row['ufname'] . " " . $row['ulname'],ENT_NOQUOTES);
1477 echo !in_array($row['pc_catid'], $therapyGroupCategories) ? '</a>' : '<span>';
1478 echo "</div>\n";
1479 //////
1481 if ($resNotNull) { //////
1482 if ( $count < 1 ) {
1483 echo "&nbsp;&nbsp;" . htmlspecialchars(xl('None'),ENT_NOQUOTES);
1484 } else { //////
1485 if($extraApptDate) echo "<div style='color:#0000cc;'><b>" . attr($extraApptDate) . " ( + ) </b></div>";
1486 else echo "<div><hr></div>";
1488 echo "</div>";
1490 } // End of Appointments.
1493 /* Widget that shows recurrences for appointments. */
1494 if (isset($pid) && !$GLOBALS['disable_calendar'] && $GLOBALS['appt_recurrences_widget'] &&
1495 acl_check('patients', 'appt'))
1497 $widgetTitle = xl("Recurrent Appointments");
1498 $widgetLabel = "recurrent_appointments";
1499 $widgetButtonLabel = xl("Add");
1500 $widgetButtonLink = "return newEvt();";
1501 $widgetButtonClass = "";
1502 $linkMethod = "javascript";
1503 $bodyClass = "summary_item small";
1504 $widgetAuth = false;
1505 $fixedWidth = false;
1506 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel, $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1507 $count = 0;
1508 $toggleSet = true;
1509 $priorDate = "";
1511 //Fetch patient's recurrences. Function returns array with recurrence appointments' category, recurrence pattern (interpreted), and end date.
1512 $recurrences = fetchRecurrences($pid);
1513 if($recurrences[0] == false){ //if there are no recurrent appointments:
1514 echo "<div>";
1515 echo "<span>" . "&nbsp;&nbsp;" . xlt('None') . "</span>";
1516 echo "</div></div>";
1518 else {
1519 foreach ($recurrences as $row) {
1520 //checks if there are recurrences and if they are current (git didn't end yet)
1521 if ($row == false || !recurrence_is_current($row['pc_endDate']))
1522 continue;
1523 echo "<div>";
1524 echo "<span>" . xlt('Appointment Category') . ': ' . xlt($row['pc_catname']) . "</span>";
1525 echo "<br>";
1526 echo "<span>" . xlt('Recurrence') . ': ' . text($row['pc_recurrspec']) . "</span>";
1527 echo "<br>";
1528 $red_text = ""; //if ends in a week, make font red
1529 if (ends_in_a_week($row['pc_endDate'])) {
1530 $red_text = " style=\"color:red;\" ";
1532 echo "<span" . $red_text . ">" . xlt('End Date') . ': ' . text($row['pc_endDate']) . "</span>";
1533 echo "</div>";
1535 echo "</div>";
1538 /* End of recurrence widget */
1540 // Show PAST appointments.
1541 // added by Terry Hill to allow reverse sorting of the appointments
1542 $direction = "ASC";
1543 if ($GLOBALS['num_past_appointments_to_show'] < 0) {
1544 $direction = "DESC";
1545 ($showpast = -1 * $GLOBALS['num_past_appointments_to_show']);
1547 else {
1548 $showpast = $GLOBALS['num_past_appointments_to_show'];
1550 if (isset($pid) && !$GLOBALS['disable_calendar'] && $showpast > 0 &&
1551 acl_check('patients', 'appt')) {
1552 $query = "SELECT e.pc_eid, e.pc_aid, e.pc_title, e.pc_eventDate, " .
1553 "e.pc_startTime, e.pc_hometext, u.fname, u.lname, u.mname, " .
1554 "c.pc_catname, e.pc_apptstatus " .
1555 "FROM openemr_postcalendar_events AS e, users AS u, " .
1556 "openemr_postcalendar_categories AS c WHERE " .
1557 "e.pc_pid = ? AND e.pc_eventDate < CURRENT_DATE AND " .
1558 "u.id = e.pc_aid AND e.pc_catid = c.pc_catid " .
1559 "ORDER BY e.pc_eventDate $direction , e.pc_startTime DESC " .
1560 "LIMIT " . $showpast;
1562 $pres = sqlStatement($query, array($pid) );
1564 // appointments expand collapse widget
1565 $widgetTitle = xl("Past Appointments");
1566 $widgetLabel = "past_appointments";
1567 $widgetButtonLabel = '';
1568 $widgetButtonLink = '';
1569 $widgetButtonClass = '';
1570 $linkMethod = "javascript";
1571 $bodyClass = "summary_item small";
1572 $widgetAuth = false; //no button
1573 $fixedWidth = false;
1574 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1575 $count = 0;
1576 while($row = sqlFetchArray($pres)) {
1577 $count++;
1578 $dayname = date("l", strtotime($row['pc_eventDate']));
1579 $dispampm = "am";
1580 $disphour = substr($row['pc_startTime'], 0, 2) + 0;
1581 $dispmin = substr($row['pc_startTime'], 3, 2);
1582 if ($disphour >= 12) {
1583 $dispampm = "pm";
1584 if ($disphour > 12) $disphour -= 12;
1586 if ($row['pc_hometext'] != "") {
1587 $etitle = xl('Comments').": ".($row['pc_hometext'])."\r\n".$etitle;
1589 echo "<a href='javascript:oldEvt(" . htmlspecialchars(preg_replace("/-/", "", $row['pc_eventDate']),ENT_QUOTES) . ', ' . htmlspecialchars($row['pc_eid'],ENT_QUOTES) . ")' title='" . htmlspecialchars($etitle,ENT_QUOTES) . "'>";
1590 echo "<b>" . htmlspecialchars(xl($dayname) . ", " . $row['pc_eventDate'],ENT_NOQUOTES) . "</b>" . xlt("Status") . "(";
1591 echo " " . generate_display_field(array('data_type'=>'1','list_id'=>'apptstat'),$row['pc_apptstatus']) . ")<br>"; // can't use special char parser on this
1592 echo htmlspecialchars("$disphour:$dispmin ") . xl($dispampm) . " ";
1593 echo htmlspecialchars($row['fname'] . " " . $row['lname'],ENT_NOQUOTES) . "</a><br>\n";
1595 if (isset($pres) && $res != null) {
1596 if ( $count < 1 ) {
1597 echo "&nbsp;&nbsp;" . htmlspecialchars(xl('None'),ENT_NOQUOTES);
1599 echo "</div>";
1602 // END of past appointments
1604 </div>
1606 <div id='stats_div'>
1607 <br/>
1608 <div style='margin-left:10px' class='text'><img src='../../pic/ajax-loader.gif'/></div><br/>
1609 </div>
1610 </td>
1611 </tr>
1613 <?php // TRACK ANYTHING -----
1615 // Determine if track_anything form is in use for this site.
1616 $tmp = sqlQuery("SELECT count(*) AS count FROM registry WHERE " .
1617 "directory = 'track_anything' AND state = 1");
1618 $track_is_registered = $tmp['count'];
1619 if($track_is_registered){
1620 echo "<tr> <td>";
1621 // track_anything expand collapse widget
1622 $widgetTitle = xl("Tracks");
1623 $widgetLabel = "track_anything";
1624 $widgetButtonLabel = xl("Tracks");
1625 $widgetButtonLink = "../../forms/track_anything/create.php";
1626 $widgetButtonClass = "";
1627 $widgetAuth = ""; // don't show the button
1628 $linkMethod = "html";
1629 $bodyClass = "notab";
1630 // check to see if any tracks exist
1631 $spruch = "SELECT id " .
1632 "FROM forms " .
1633 "WHERE pid = ? " .
1634 "AND formdir = ? ";
1635 $existTracks = sqlQuery($spruch, array($pid, "track_anything") );
1637 $fixedWidth = false;
1638 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
1639 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
1640 $widgetAuth, $fixedWidth);
1642 <br/>
1643 <div style='margin-left:10px' class='text'><img src='../../pic/ajax-loader.gif'/></div><br/>
1644 </div>
1645 </td>
1646 </tr>
1647 <?php } // end track_anything ?>
1648 </table>
1650 </div> <!-- end right column div -->
1652 </td>
1654 </tr>
1655 </table>
1657 </div> <!-- end main content div -->
1659 <script language='JavaScript'>
1660 // Array of skip conditions for the checkSkipConditions() function.
1661 var skipArray = [
1662 <?php echo $condition_str; ?>
1664 checkSkipConditions();
1665 </script>
1667 </body>
1668 </html>