Increased the windows sizing for the add calender event.
[openemr.git] / interface / patient_file / summary / demographics.php
blobdd81a84eb3bac9785ba41f5da2132b1aa5ecf790
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@sparmy.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/classes/Address.class.php");
34 require_once("$srcdir/classes/InsuranceCompany.class.php");
35 require_once("$srcdir/classes/Document.class.php");
36 require_once("$srcdir/options.inc.php");
37 require_once("../history/history.inc.php");
38 require_once("$srcdir/formatting.inc.php");
39 require_once("$srcdir/edi.inc");
40 require_once("$srcdir/invoice_summary.inc.php");
41 require_once("$srcdir/clinical_rules.php");
42 require_once("$srcdir/options.js.php");
43 ////////////
44 require_once(dirname(__FILE__)."/../../../library/appointments.inc.php");
46 if ($GLOBALS['concurrent_layout'] && isset($_GET['set_pid'])) {
47 include_once("$srcdir/pid.inc");
48 setpid($_GET['set_pid']);
51 $active_reminders = false;
52 $all_allergy_alerts = false;
53 if ($GLOBALS['enable_cdr']) {
54 //CDR Engine stuff
55 if ($GLOBALS['enable_allergy_check'] && $GLOBALS['enable_alert_log']) {
56 //Check for new allergies conflicts and throw popup if any exist(note need alert logging to support this)
57 $new_allergy_alerts = allergy_conflict($pid,'new',$_SESSION['authUser']);
58 if (!empty($new_allergy_alerts)) {
59 $pop_warning = '<script type="text/javascript">alert(\'' . xls('WARNING - FOLLOWING ACTIVE MEDICATIONS ARE ALLERGIES') . ':\n';
60 foreach ($new_allergy_alerts as $new_allergy_alert) {
61 $pop_warning .= addslashes($new_allergy_alert) . '\n';
63 $pop_warning .= '\')</script>';
64 echo $pop_warning;
67 if ((!isset($_SESSION['alert_notify_pid']) || ($_SESSION['alert_notify_pid'] != $pid)) && isset($_GET['set_pid']) && $GLOBALS['enable_cdr_crp']) {
68 // showing a new patient, so check for active reminders and allergy conflicts, which use in active reminder popup
69 $active_reminders = active_alert_summary($pid,"reminders-due",'','default',$_SESSION['authUser'],TRUE);
70 if ($GLOBALS['enable_allergy_check']) {
71 $all_allergy_alerts = allergy_conflict($pid,'all',$_SESSION['authUser'],TRUE);
76 function print_as_money($money) {
77 preg_match("/(\d*)\.?(\d*)/",$money,$moneymatches);
78 $tmp = wordwrap(strrev($moneymatches[1]),3,",",1);
79 $ccheck = strrev($tmp);
80 if ($ccheck[0] == ",") {
81 $tmp = substr($ccheck,1,strlen($ccheck)-1);
83 if ($moneymatches[2] != "") {
84 return "$ " . strrev($tmp) . "." . $moneymatches[2];
85 } else {
86 return "$ " . strrev($tmp);
90 // get an array from Photos category
91 function pic_array($pid,$picture_directory) {
92 $pics = array();
93 $sql_query = "select documents.id from documents join categories_to_documents " .
94 "on documents.id = categories_to_documents.document_id " .
95 "join categories on categories.id = categories_to_documents.category_id " .
96 "where categories.name like ? and documents.foreign_id = ?";
97 if ($query = sqlStatement($sql_query, array($picture_directory,$pid))) {
98 while( $results = sqlFetchArray($query) ) {
99 array_push($pics,$results['id']);
102 return ($pics);
104 // Get the document ID of the first document in a specific catg.
105 function get_document_by_catg($pid,$doc_catg) {
107 $result = array();
109 if ($pid and $doc_catg) {
110 $result = sqlQuery("SELECT d.id, d.date, d.url FROM " .
111 "documents AS d, categories_to_documents AS cd, categories AS c " .
112 "WHERE d.foreign_id = ? " .
113 "AND cd.document_id = d.id " .
114 "AND c.id = cd.category_id " .
115 "AND c.name LIKE ? " .
116 "ORDER BY d.date DESC LIMIT 1", array($pid, $doc_catg) );
119 return($result['id']);
122 // Display image in 'widget style'
123 function image_widget($doc_id,$doc_catg)
125 global $pid, $web_root;
126 $docobj = new Document($doc_id);
127 $image_file = $docobj->get_url_file();
128 $extension = substr($image_file, strrpos($image_file,"."));
129 $viewable_types = array('.png','.jpg','.jpeg','.png','.bmp','.PNG','.JPG','.JPEG','.PNG','.BMP'); // image ext supported by fancybox viewer
130 if ( in_array($extension,$viewable_types) ) { // extention matches list
131 $to_url = "<td> <a href = $web_root" .
132 "/controller.php?document&retrieve&patient_id=$pid&document_id=$doc_id" .
133 "/tmp$extension" . // Force image type URL for fancybox
134 " onclick=top.restoreSession(); class='image_modal'>" .
135 " <img src = $web_root" .
136 "/controller.php?document&retrieve&patient_id=$pid&document_id=$doc_id" .
137 " width=100 alt='$doc_catg:$image_file'> </a> </td> <td valign='center'>".
138 htmlspecialchars($doc_catg) . '<br />&nbsp;' . htmlspecialchars($image_file) .
139 "</td>";
141 else {
142 $to_url = "<td> <a href='" . $web_root . "/controller.php?document&retrieve" .
143 "&patient_id=$pid&document_id=$doc_id'" .
144 " onclick='top.restoreSession()' class='css_button_small'>" .
145 "<span>" .
146 htmlspecialchars( xl("View"), ENT_QUOTES )."</a> &nbsp;" .
147 htmlspecialchars( "$doc_catg - $image_file", ENT_QUOTES ) .
148 "</span> </td>";
150 echo "<table><tr>";
151 echo $to_url;
152 echo "</tr></table>";
155 // Determine if the Vitals form is in use for this site.
156 $tmp = sqlQuery("SELECT count(*) AS count FROM registry WHERE " .
157 "directory = 'vitals' AND state = 1");
158 $vitals_is_registered = $tmp['count'];
160 // Get patient/employer/insurance information.
162 $result = getPatientData($pid, "*, DATE_FORMAT(DOB,'%Y-%m-%d') as DOB_YMD");
163 $result2 = getEmployerData($pid);
164 $result3 = getInsuranceData($pid, "primary", "copay, provider, DATE_FORMAT(`date`,'%Y-%m-%d') as effdate");
165 $insco_name = "";
166 if ($result3['provider']) { // Use provider in case there is an ins record w/ unassigned insco
167 $insco_name = getInsuranceProvider($result3['provider']);
170 <html>
172 <head>
173 <?php html_header_show();?>
174 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
175 <link rel="stylesheet" type="text/css" href="../../../library/js/fancybox/jquery.fancybox-1.2.6.css" media="screen" />
176 <style type="text/css">@import url(../../../library/dynarch_calendar.css);</style>
177 <script type="text/javascript" src="../../../library/textformat.js"></script>
178 <script type="text/javascript" src="../../../library/dynarch_calendar.js"></script>
179 <?php include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?>
180 <script type="text/javascript" src="../../../library/dynarch_calendar_setup.js"></script>
181 <script type="text/javascript" src="../../../library/dialog.js"></script>
182 <script type="text/javascript" src="../../../library/js/jquery-1.6.4.min.js"></script>
183 <script type="text/javascript" src="../../../library/js/common.js"></script>
184 <script type="text/javascript" src="../../../library/js/fancybox/jquery.fancybox-1.2.6.js"></script>
185 <script type="text/javascript" language="JavaScript">
187 var mypcc = '<?php echo htmlspecialchars($GLOBALS['phone_country_code'],ENT_QUOTES); ?>';
188 //////////
189 function oldEvt(apptdate, eventid) {
190 dlgopen('../../main/calendar/add_edit_event.php?date=' + apptdate + '&eid=' + eventid, '_blank', 775, 375);
193 function advdirconfigure() {
194 dlgopen('advancedirectives.php', '_blank', 500, 450);
197 function refreshme() {
198 top.restoreSession();
199 location.reload();
202 // Process click on Delete link.
203 function deleteme() {
204 dlgopen('../deleter.php?patient=<?php echo htmlspecialchars($pid,ENT_QUOTES); ?>', '_blank', 500, 450);
205 return false;
208 // Called by the deleteme.php window on a successful delete.
209 function imdeleted() {
210 <?php if ($GLOBALS['concurrent_layout']) { ?>
211 parent.left_nav.clearPatient();
212 <?php } else { ?>
213 top.restoreSession();
214 top.location.href = '../main/main_screen.php';
215 <?php } ?>
218 function validate() {
219 var f = document.forms[0];
220 <?php
221 if ($GLOBALS['athletic_team']) {
222 echo " if (f.form_userdate1.value != f.form_original_userdate1.value) {\n";
223 $irow = sqlQuery("SELECT id, title FROM lists WHERE " .
224 "pid = ? AND enddate IS NULL ORDER BY begdate DESC LIMIT 1", array($pid));
225 if (!empty($irow)) {
227 if (confirm('Do you wish to also set this new return date in the issue titled "<?php echo htmlspecialchars($irow['title'],ENT_QUOTES); ?>"?')) {
228 f.form_issue_id.value = '<?php echo htmlspecialchars($irow['id'],ENT_QUOTES); ?>';
229 } else {
230 alert('OK, you will need to manually update the return date in any affected issue(s).');
232 <?php } else { ?>
233 alert('You have changed the return date but there are no open issues. You probably need to create or modify one.');
234 <?php
235 } // end empty $irow
236 echo " }\n";
237 } // end athletic team
239 return true;
242 function newEvt() {
243 dlgopen('../../main/calendar/add_edit_event.php?patientid=<?php echo htmlspecialchars($pid,ENT_QUOTES); ?>', '_blank', 775, 375);
244 return false;
247 function sendimage(pid, what) {
248 // alert('Not yet implemented.'); return false;
249 dlgopen('../upload_dialog.php?patientid=' + pid + '&file=' + what,
250 '_blank', 500, 400);
251 return false;
254 </script>
256 <script type="text/javascript">
258 function toggleIndicator(target,div) {
260 $mode = $(target).find(".indicator").text();
261 if ( $mode == "<?php echo htmlspecialchars(xl('collapse'),ENT_QUOTES); ?>" ) {
262 $(target).find(".indicator").text( "<?php echo htmlspecialchars(xl('expand'),ENT_QUOTES); ?>" );
263 $("#"+div).hide();
264 $.post( "../../../library/ajax/user_settings.php", { target: div, mode: 0 });
265 } else {
266 $(target).find(".indicator").text( "<?php echo htmlspecialchars(xl('collapse'),ENT_QUOTES); ?>" );
267 $("#"+div).show();
268 $.post( "../../../library/ajax/user_settings.php", { target: div, mode: 1 });
272 $(document).ready(function(){
273 var msg_updation='';
274 <?php
275 if($GLOBALS['erx_enable']){
276 //$soap_status=sqlQuery("select soap_import_status from patient_data where pid=?",array($pid));
277 $soap_status=sqlStatement("select soap_import_status,pid from patient_data where pid=? and soap_import_status in ('1','3')",array($pid));
278 while($row_soapstatus=sqlFetchArray($soap_status)){
279 //if($soap_status['soap_import_status']=='1' || $soap_status['soap_import_status']=='3'){ ?>
280 top.restoreSession();
281 $.ajax({
282 type: "POST",
283 url: "../../soap_functions/soap_patientfullmedication.php",
284 dataType: "html",
285 data: {
286 patient:<?php echo $row_soapstatus['pid']; ?>,
288 async: false,
289 success: function(thedata){
290 //alert(thedata);
291 msg_updation+=thedata;
293 error:function(){
294 alert('ajax error');
297 <?php
298 //}
299 //elseif($soap_status['soap_import_status']=='3'){ ?>
300 top.restoreSession();
301 $.ajax({
302 type: "POST",
303 url: "../../soap_functions/soap_allergy.php",
304 dataType: "html",
305 data: {
306 patient:<?php echo $row_soapstatus['pid']; ?>,
308 async: false,
309 success: function(thedata){
310 //alert(thedata);
311 msg_updation+=thedata;
313 error:function(){
314 alert('ajax error');
317 <?php
318 if($GLOBALS['erx_import_status_message']){ ?>
319 if(msg_updation)
320 alert(msg_updation);
321 <?php
323 //}
327 // load divs
328 $("#stats_div").load("stats.php", { 'embeddedScreen' : true }, function() {
329 // (note need to place javascript code here also to get the dynamic link to work)
330 $(".rx_modal").fancybox( {
331 'overlayOpacity' : 0.0,
332 'showCloseButton' : true,
333 'frameHeight' : 500,
334 'frameWidth' : 800,
335 'centerOnScroll' : false,
336 'callbackOnClose' : function() {
337 refreshme();
341 $("#pnotes_ps_expand").load("pnotes_fragment.php");
342 $("#disclosures_ps_expand").load("disc_fragment.php");
344 <?php if ($GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_crw']) { ?>
345 top.restoreSession();
346 $("#clinical_reminders_ps_expand").load("clinical_reminders_fragment.php", { 'embeddedScreen' : true }, function() {
347 // (note need to place javascript code here also to get the dynamic link to work)
348 $(".medium_modal").fancybox( {
349 'overlayOpacity' : 0.0,
350 'showCloseButton' : true,
351 'frameHeight' : 500,
352 'frameWidth' : 800,
353 'centerOnScroll' : false,
354 'callbackOnClose' : function() {
355 refreshme();
359 <?php } // end crw?>
361 <?php if ($GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_prw']) { ?>
362 top.restoreSession();
363 $("#patient_reminders_ps_expand").load("patient_reminders_fragment.php");
364 <?php } // end prw?>
366 <?php if ($vitals_is_registered && acl_check('patients', 'med')) { ?>
367 // Initialize the Vitals form if it is registered and user is authorized.
368 $("#vitals_ps_expand").load("vitals_fragment.php");
369 <?php } ?>
371 // Initialize track_anything
372 $("#track_anything_ps_expand").load("track_anything_fragment.php");
375 // Initialize labdata
376 $("#labdata_ps_expand").load("labdata_fragment.php");
377 <?php
378 // Initialize for each applicable LBF form.
379 $gfres = sqlStatement("SELECT option_id FROM list_options WHERE " .
380 "list_id = 'lbfnames' AND option_value > 0 ORDER BY seq, title");
381 while($gfrow = sqlFetchArray($gfres)) {
383 $("#<?php echo $gfrow['option_id']; ?>_ps_expand").load("lbf_fragment.php?formname=<?php echo $gfrow['option_id']; ?>");
384 <?php
388 // fancy box
389 enable_modals();
391 tabbify();
393 // modal for dialog boxes
394 $(".large_modal").fancybox( {
395 'overlayOpacity' : 0.0,
396 'showCloseButton' : true,
397 'frameHeight' : 600,
398 'frameWidth' : 1000,
399 'centerOnScroll' : false
402 // modal for image viewer
403 $(".image_modal").fancybox( {
404 'overlayOpacity' : 0.0,
405 'showCloseButton' : true,
406 'centerOnScroll' : false,
407 'autoscale' : true
410 $(".iframe1").fancybox( {
411 'left':10,
412 'overlayOpacity' : 0.0,
413 'showCloseButton' : true,
414 'frameHeight' : 300,
415 'frameWidth' : 350
417 // special size for patient portal
418 $(".small_modal").fancybox( {
419 'overlayOpacity' : 0.0,
420 'showCloseButton' : true,
421 'frameHeight' : 200,
422 'frameWidth' : 380,
423 'centerOnScroll' : false
426 <?php if ($active_reminders || $all_allergy_alerts) { ?>
427 // show the active reminder modal
428 $("#reminder_popup_link").fancybox({
429 'overlayOpacity' : 0.0,
430 'showCloseButton' : true,
431 'frameHeight' : 500,
432 'frameWidth' : 500,
433 'centerOnScroll' : false
434 }).trigger('click');
435 <?php } ?>
439 // JavaScript stuff to do when a new patient is set.
441 function setMyPatient() {
442 <?php if ($GLOBALS['concurrent_layout']) { ?>
443 // Avoid race conditions with loading of the left_nav or Title frame.
444 if (!parent.allFramesLoaded()) {
445 setTimeout("setMyPatient()", 500);
446 return;
448 <?php if (isset($_GET['set_pid'])) { ?>
449 parent.left_nav.setPatient(<?php echo "'" . htmlspecialchars(($result['fname']) . " " . ($result['lname']),ENT_QUOTES) .
450 "'," . htmlspecialchars($pid,ENT_QUOTES) . ",'" . htmlspecialchars(($result['pubpid']),ENT_QUOTES) .
451 "','', ' " . htmlspecialchars(xl('DOB') . ": " . oeFormatShortDate($result['DOB_YMD']) . " " . xl('Age') . ": " . getPatientAgeDisplay($result['DOB_YMD']), ENT_QUOTES) . "'"; ?>);
452 var EncounterDateArray = new Array;
453 var CalendarCategoryArray = new Array;
454 var EncounterIdArray = new Array;
455 var Count = 0;
456 <?php
457 //Encounter details are stored to javacript as array.
458 $result4 = sqlStatement("SELECT fe.encounter,fe.date,openemr_postcalendar_categories.pc_catname FROM form_encounter AS fe ".
459 " left join openemr_postcalendar_categories on fe.pc_catid=openemr_postcalendar_categories.pc_catid WHERE fe.pid = ? order by fe.date desc", array($pid));
460 if(sqlNumRows($result4)>0) {
461 while($rowresult4 = sqlFetchArray($result4)) {
463 EncounterIdArray[Count] = '<?php echo htmlspecialchars($rowresult4['encounter'], ENT_QUOTES); ?>';
464 EncounterDateArray[Count] = '<?php echo htmlspecialchars(oeFormatShortDate(date("Y-m-d", strtotime($rowresult4['date']))), ENT_QUOTES); ?>';
465 CalendarCategoryArray[Count] = '<?php echo htmlspecialchars(xl_appt_category($rowresult4['pc_catname']), ENT_QUOTES); ?>';
466 Count++;
467 <?php
471 parent.left_nav.setPatientEncounter(EncounterIdArray,EncounterDateArray,CalendarCategoryArray);
472 <?php } // end setting new pid ?>
473 parent.left_nav.setRadio(window.name, 'dem');
474 parent.left_nav.syncRadios();
475 <?php if ( (isset($_GET['set_pid']) ) && (isset($_GET['set_encounterid'])) && ( intval($_GET['set_encounterid']) > 0 ) ) {
476 $encounter = intval($_GET['set_encounterid']);
477 $_SESSION['encounter'] = $encounter;
478 $query_result = sqlQuery("SELECT `date` FROM `form_encounter` WHERE `encounter` = ?", array($encounter)); ?>
479 var othername = (window.name == 'RTop') ? 'RBot' : 'RTop';
480 parent.left_nav.setEncounter('<?php echo oeFormatShortDate(date("Y-m-d", strtotime($query_result['date']))); ?>', '<?php echo attr($encounter); ?>', othername);
481 parent.left_nav.setRadio(othername, 'enc');
482 parent.frames[othername].location.href = '../encounter/encounter_top.php?set_encounter=' + <?php echo attr($encounter);?> + '&pid=' + <?php echo attr($pid);?>;
483 <?php } // end setting new encounter id (only if new pid is also set) ?>
484 <?php } // end concurrent layout ?>
487 $(window).load(function() {
488 setMyPatient();
491 </script>
493 <style type="css/text">
494 #pnotes_ps_expand {
495 height:auto;
496 width:100%;
498 </style>
500 </head>
502 <body class="body_top">
504 <a href='../reminder/active_reminder_popup.php' id='reminder_popup_link' style='visibility: false;' class='iframe' onclick='top.restoreSession()'></a>
506 <?php
507 $thisauth = acl_check('patients', 'demo');
508 if ($thisauth) {
509 if ($result['squad'] && ! acl_check('squads', $result['squad']))
510 $thisauth = 0;
512 if (!$thisauth) {
513 echo "<p>(" . htmlspecialchars(xl('Demographics not authorized'),ENT_NOQUOTES) . ")</p>\n";
514 echo "</body>\n</html>\n";
515 exit();
517 if ($thisauth) {
518 echo "<table><tr><td><span class='title'>" .
519 htmlspecialchars(getPatientName($pid),ENT_NOQUOTES) .
520 "</span></td>";
522 if (acl_check('admin', 'super')) {
523 echo "<td style='padding-left:1em;'><a class='css_button iframe' href='../deleter.php?patient=" .
524 htmlspecialchars($pid,ENT_QUOTES) . "' onclick='top.restoreSession()'>" .
525 "<span>".htmlspecialchars(xl('Delete'),ENT_NOQUOTES).
526 "</span></a></td>";
528 if($GLOBALS['erx_enable']){
529 echo '<td style="padding-left:1em;"><a class="css_button" href="../../eRx.php?page=medentry" onclick="top.restoreSession()">';
530 echo "<span>".htmlspecialchars(xl('NewCrop MedEntry'),ENT_NOQUOTES)."</span></a></td>";
531 echo '<td style="padding-left:1em;"><a class="css_button iframe1" href="../../soap_functions/soap_accountStatusDetails.php" onclick="top.restoreSession()">';
532 echo "<span>".htmlspecialchars(xl('NewCrop Account Status'),ENT_NOQUOTES)."</span></a></td><td id='accountstatus'></td>";
534 //Patient Portal
535 $portalUserSetting = true; //flag to see if patient has authorized access to portal
536 if($GLOBALS['portal_onsite_enable'] && $GLOBALS['portal_onsite_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_onsite` WHERE `pid`=?", array($pid));
540 echo "<td style='padding-left:1em;'><a class='css_button iframe small_modal' href='create_portallogin.php?portalsite=on&patient=" . htmlspecialchars($pid,ENT_QUOTES) . "' onclick='top.restoreSession()'>";
541 if (empty($portalLogin)) {
542 echo "<span>".htmlspecialchars(xl('Create Onsite Portal Credentials'),ENT_NOQUOTES)."</span></a></td>";
544 else {
545 echo "<span>".htmlspecialchars(xl('Reset Onsite Portal Credentials'),ENT_NOQUOTES)."</span></a></td>";
548 else {
549 $portalUserSetting = false;
552 if($GLOBALS['portal_offsite_enable'] && $GLOBALS['portal_offsite_address']){
553 $portalStatus = sqlQuery("SELECT allow_patient_portal FROM patient_data WHERE pid=?",array($pid));
554 if ($portalStatus['allow_patient_portal']=='YES') {
555 $portalLogin = sqlQuery("SELECT pid FROM `patient_access_offsite` WHERE `pid`=?", array($pid));
556 echo "<td style='padding-left:1em;'><a class='css_button iframe small_modal' href='create_portallogin.php?portalsite=off&patient=" . htmlspecialchars($pid,ENT_QUOTES) . "' onclick='top.restoreSession()'>";
557 if (empty($portalLogin)) {
558 echo "<span>".htmlspecialchars(xl('Create Offsite Portal Credentials'),ENT_NOQUOTES)."</span></a></td>";
560 else {
561 echo "<span>".htmlspecialchars(xl('Reset Offsite Portal Credentials'),ENT_NOQUOTES)."</span></a></td>";
564 else {
565 $portalUserSetting = false;
568 if (!($portalUserSetting)) {
569 // Show that the patient has not authorized portal access
570 echo "<td style='padding-left:1em;'>" . htmlspecialchars( xl('Patient has not authorized the Patient Portal.'), ENT_NOQUOTES) . "</td>";
572 //Patient Portal
574 // If patient is deceased, then show this (along with the number of days patient has been deceased for)
575 $days_deceased = is_patient_deceased($pid);
576 if ($days_deceased) {
577 echo "<td style='padding-left:1em;font-weight:bold;color:red'>" . htmlspecialchars( xl('DECEASED') ,ENT_NOQUOTES) . " (" . htmlspecialchars($days_deceased,ENT_NOQUOTES) . " " . htmlspecialchars( xl('days ago') ,ENT_NOQUOTES) . ")</td>";
580 echo "</tr></table>";
583 // Get the document ID of the patient ID card if access to it is wanted here.
584 $idcard_doc_id = false;
585 if ($GLOBALS['patient_id_category_name']) {
586 $idcard_doc_id = get_document_by_catg($pid, $GLOBALS['patient_id_category_name']);
590 <table cellspacing='0' cellpadding='0' border='0'>
591 <tr>
592 <td class="small" colspan='4'>
593 <a href="../history/history.php" onclick='top.restoreSession()'>
594 <?php echo htmlspecialchars(xl('History'),ENT_NOQUOTES); ?></a>
596 <?php //note that we have temporarily removed report screen from the modal view ?>
597 <a href="../report/patient_report.php" onclick='top.restoreSession()'>
598 <?php echo htmlspecialchars(xl('Report'),ENT_NOQUOTES); ?></a>
600 <?php //note that we have temporarily removed document screen from the modal view ?>
601 <a href="../../../controller.php?document&list&patient_id=<?php echo $pid;?>" onclick='top.restoreSession()'>
602 <?php echo htmlspecialchars(xl('Documents'),ENT_NOQUOTES); ?></a>
604 <a href="../transaction/transactions.php" class='iframe large_modal' onclick='top.restoreSession()'>
605 <?php echo htmlspecialchars(xl('Transactions'),ENT_NOQUOTES); ?></a>
607 <a href="stats_full.php?active=all" onclick='top.restoreSession()'>
608 <?php echo htmlspecialchars(xl('Issues'),ENT_NOQUOTES); ?></a>
610 <a href="../../reports/pat_ledger.php?form=1&patient_id=<?php echo attr($pid);?>" onclick='top.restoreSession()'>
611 <?php echo xlt('Ledger'); ?></a>
613 <a href="../../reports/external_data.php" onclick='top.restoreSession()'>
614 <?php echo xlt('External Data'); ?></a>
616 <!-- DISPLAYING HOOKS STARTS HERE -->
617 <?php
618 $module_query = sqlStatement("SELECT msh.*,ms.menu_name,ms.path,m.mod_ui_name,m.type FROM modules_hooks_settings AS msh
619 LEFT OUTER JOIN modules_settings AS ms ON obj_name=enabled_hooks AND ms.mod_id=msh.mod_id
620 LEFT OUTER JOIN modules AS m ON m.mod_id=ms.mod_id
621 WHERE fld_type=3 AND mod_active=1 AND sql_run=1 AND attached_to='demographics' ORDER BY mod_id");
622 $DivId = 'mod_installer';
623 if (sqlNumRows($module_query)) {
624 $jid = 0;
625 $modid = '';
626 while ($modulerow = sqlFetchArray($module_query)) {
627 $DivId = 'mod_'.$modulerow['mod_id'];
628 $new_category = $modulerow['mod_ui_name'];
629 $modulePath = "";
630 $added = "";
631 if($modulerow['type'] == 0) {
632 $modulePath = $GLOBALS['customModDir'];
633 $added = "";
635 else{
636 $added = "index";
637 $modulePath = $GLOBALS['zendModDir'];
639 $relative_link = "../../modules/".$modulePath."/".$modulerow['path'];
640 $nickname = $modulerow['menu_name'] ? $modulerow['menu_name'] : 'Noname';
641 $jid++;
642 $modid = $modulerow['mod_id'];
645 <a href="<?php echo $relative_link; ?>" onclick='top.restoreSession()'>
646 <?php echo htmlspecialchars($nickname,ENT_NOQUOTES); ?></a>
647 <?php
651 <!-- DISPLAYING HOOKS ENDS HERE -->
653 </td>
654 </tr>
656 </table> <!-- end header -->
658 <div style='margin-top:10px'> <!-- start main content div -->
659 <table border="0" cellspacing="0" cellpadding="0" width="100%">
660 <tr>
661 <td class="demographics-box" align="left" valign="top">
662 <!-- start left column div -->
663 <div style='float:left; margin-right:20px'>
664 <table cellspacing=0 cellpadding=0>
665 <tr<?php if ($GLOBALS['athletic_team']) echo " style='display:none;'"; ?>>
666 <td>
667 <?php
668 // Billing expand collapse widget
669 $widgetTitle = xl("Billing");
670 $widgetLabel = "billing";
671 $widgetButtonLabel = xl("Edit");
672 $widgetButtonLink = "return newEvt();";
673 $widgetButtonClass = "";
674 $linkMethod = "javascript";
675 $bodyClass = "notab";
676 $widgetAuth = false;
677 $fixedWidth = true;
678 if ($GLOBALS['force_billing_widget_open']) {
679 $forceExpandAlways = true;
681 else {
682 $forceExpandAlways = false;
684 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
685 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
686 $widgetAuth, $fixedWidth, $forceExpandAlways);
688 <br>
689 <?php
690 //PATIENT BALANCE,INS BALANCE naina@capminds.com
691 $patientbalance = get_patient_balance($pid, false);
692 //Debit the patient balance from insurance balance
693 $insurancebalance = get_patient_balance($pid, true) - $patientbalance;
694 $totalbalance=$patientbalance + $insurancebalance;
695 if ($GLOBALS['oer_config']['ws_accounting']['enabled']) {
696 // Show current balance and billing note, if any.
697 echo "<table border='0'><tr><td>" .
698 "<table ><tr><td><span class='bold'><font color='red'>" .
699 xlt('Patient Balance Due') .
700 " : " . text(oeFormatMoney($patientbalance)) .
701 "</font></span></td></tr>".
702 "<tr><td><span class='bold'><font color='red'>" .
703 xlt('Insurance Balance Due') .
704 " : " . text(oeFormatMoney($insurancebalance)) .
705 "</font></span></td></tr>".
706 "<tr><td><span class='bold'><font color='red'>" .
707 xlt('Total Balance Due').
708 " : " . text(oeFormatMoney($totalbalance)) .
709 "</font></span></td></td></tr>";
710 if (!empty($result['billing_note'])) {
711 echo "<tr><td><span class='bold'><font color='red'>" .
712 xlt('Billing Note') . ":" .
713 text($result['billing_note']) .
714 "</font></span></td></tr>";
716 if ($result3['provider']) { // Use provider in case there is an ins record w/ unassigned insco
717 echo "<tr><td><span class='bold'>" .
718 xlt('Primary Insurance') . ': ' . text($insco_name) .
719 "</span>&nbsp;&nbsp;&nbsp;";
720 if ($result3['copay'] > 0) {
721 echo "<span class='bold'>" .
722 xlt('Copay') . ': ' . text($result3['copay']) .
723 "</span>&nbsp;&nbsp;&nbsp;";
725 echo "<span class='bold'>" .
726 xlt('Effective Date') . ': ' . text(oeFormatShortDate($result3['effdate'])) .
727 "</span></td></tr>";
729 echo "</table></td></tr></td></tr></table><br>";
732 </div> <!-- required for expand_collapse_widget -->
733 </td>
734 </tr>
735 <tr>
736 <td>
737 <?php
738 // Demographics expand collapse widget
739 $widgetTitle = xl("Demographics");
740 $widgetLabel = "demographics";
741 $widgetButtonLabel = xl("Edit");
742 $widgetButtonLink = "demographics_full.php";
743 $widgetButtonClass = "";
744 $linkMethod = "html";
745 $bodyClass = "";
746 $widgetAuth = acl_check('patients', 'demo', '', 'write');
747 $fixedWidth = true;
748 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
749 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
750 $widgetAuth, $fixedWidth);
752 <div id="DEM" >
753 <ul class="tabNav">
754 <?php display_layout_tabs('DEM', $result, $result2); ?>
755 </ul>
756 <div class="tabContainer">
757 <?php display_layout_tabs_data('DEM', $result, $result2); ?>
758 </div>
759 </div>
760 </div> <!-- required for expand_collapse_widget -->
761 </td>
762 </tr>
764 <tr>
765 <td>
766 <?php
767 $insurance_count = 0;
768 foreach (array('primary','secondary','tertiary') as $instype) {
769 $enddate = 'Present';
770 $query = "SELECT * FROM insurance_data WHERE " .
771 "pid = ? AND type = ? " .
772 "ORDER BY date DESC";
773 $res = sqlStatement($query, array($pid, $instype) );
774 while( $row = sqlFetchArray($res) ) {
775 if ($row['provider'] ) $insurance_count++;
779 if ( $insurance_count > 0 ) {
780 // Insurance expand collapse widget
781 $widgetTitle = xl("Insurance");
782 $widgetLabel = "insurance";
783 $widgetButtonLabel = xl("Edit");
784 $widgetButtonLink = "demographics_full.php";
785 $widgetButtonClass = "";
786 $linkMethod = "html";
787 $bodyClass = "";
788 $widgetAuth = acl_check('patients', 'demo', '', 'write');
789 $fixedWidth = true;
790 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
791 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
792 $widgetAuth, $fixedWidth);
794 if ( $insurance_count > 0 ) {
797 <ul class="tabNav"><?php
798 ///////////////////////////////// INSURANCE SECTION
799 $first = true;
800 foreach (array('primary','secondary','tertiary') as $instype) {
802 $query = "SELECT * FROM insurance_data WHERE " .
803 "pid = ? AND type = ? " .
804 "ORDER BY date DESC";
805 $res = sqlStatement($query, array($pid, $instype) );
807 $enddate = 'Present';
809 while( $row = sqlFetchArray($res) ) {
810 if ($row['provider'] ) {
812 $ins_description = ucfirst($instype);
813 $ins_description = xl($ins_description);
814 $ins_description .= strcmp($enddate, 'Present') != 0 ? " (".xl('Old').")" : "";
816 <li <?php echo $first ? 'class="current"' : '' ?>><a href="/play/javascript-tabbed-navigation/">
817 <?php echo htmlspecialchars($ins_description,ENT_NOQUOTES); ?></a></li>
818 <?php
819 $first = false;
821 $enddate = $row['date'];
824 // Display the eligibility tab
825 echo "<li><a href='/play/javascript-tabbed-navigation/'>" .
826 htmlspecialchars( xl('Eligibility'), ENT_NOQUOTES) . "</a></li>";
828 ?></ul><?php
830 } ?>
832 <div class="tabContainer">
833 <?php
834 $first = true;
835 foreach (array('primary','secondary','tertiary') as $instype) {
836 $enddate = 'Present';
838 $query = "SELECT * FROM insurance_data WHERE " .
839 "pid = ? AND type = ? " .
840 "ORDER BY date DESC";
841 $res = sqlStatement($query, array($pid, $instype) );
842 while( $row = sqlFetchArray($res) ) {
843 if ($row['provider'] ) {
845 <div class="tab <?php echo $first ? 'current' : '' ?>">
846 <table border='0' cellpadding='0' width='100%'>
847 <?php
848 $icobj = new InsuranceCompany($row['provider']);
849 $adobj = $icobj->get_address();
850 $insco_name = trim($icobj->get_name());
852 <tr>
853 <td valign='top' colspan='3'>
854 <span class='text'>
855 <?php if (strcmp($enddate, 'Present') != 0) echo htmlspecialchars(xl("Old"),ENT_NOQUOTES)." "; ?>
856 <?php $tempinstype=ucfirst($instype); echo htmlspecialchars(xl($tempinstype.' Insurance'),ENT_NOQUOTES); ?>
857 <?php if (strcmp($row['date'], '0000-00-00') != 0) { ?>
858 <?php echo htmlspecialchars(xl('from','',' ',' ').$row['date'],ENT_NOQUOTES); ?>
859 <?php } ?>
860 <?php echo htmlspecialchars(xl('until','',' ',' '),ENT_NOQUOTES);
861 echo (strcmp($enddate, 'Present') != 0) ? $enddate : htmlspecialchars(xl('Present'),ENT_NOQUOTES); ?>:</span>
862 </td>
863 </tr>
864 <tr>
865 <td valign='top'>
866 <span class='text'>
867 <?php
868 if ($insco_name) {
869 echo htmlspecialchars($insco_name,ENT_NOQUOTES) . '<br>';
870 if (trim($adobj->get_line1())) {
871 echo htmlspecialchars($adobj->get_line1(),ENT_NOQUOTES) . '<br>';
872 echo htmlspecialchars($adobj->get_city() . ', ' . $adobj->get_state() . ' ' . $adobj->get_zip(),ENT_NOQUOTES);
874 } else {
875 echo "<font color='red'><b>".htmlspecialchars(xl('Unassigned'),ENT_NOQUOTES)."</b></font>";
878 <br>
879 <?php echo htmlspecialchars(xl('Policy Number'),ENT_NOQUOTES); ?>:
880 <?php echo htmlspecialchars($row['policy_number'],ENT_NOQUOTES) ?><br>
881 <?php echo htmlspecialchars(xl('Plan Name'),ENT_NOQUOTES); ?>:
882 <?php echo htmlspecialchars($row['plan_name'],ENT_NOQUOTES); ?><br>
883 <?php echo htmlspecialchars(xl('Group Number'),ENT_NOQUOTES); ?>:
884 <?php echo htmlspecialchars($row['group_number'],ENT_NOQUOTES); ?></span>
885 </td>
886 <td valign='top'>
887 <span class='bold'><?php echo htmlspecialchars(xl('Subscriber'),ENT_NOQUOTES); ?>: </span><br>
888 <span class='text'><?php echo htmlspecialchars($row['subscriber_fname'] . ' ' . $row['subscriber_mname'] . ' ' . $row['subscriber_lname'],ENT_NOQUOTES); ?>
889 <?php
890 if ($row['subscriber_relationship'] != "") {
891 echo "(" . htmlspecialchars($row['subscriber_relationship'],ENT_NOQUOTES) . ")";
894 <br>
895 <?php echo htmlspecialchars(xl('S.S.'),ENT_NOQUOTES); ?>:
896 <?php echo htmlspecialchars($row['subscriber_ss'],ENT_NOQUOTES); ?><br>
897 <?php echo htmlspecialchars(xl('D.O.B.'),ENT_NOQUOTES); ?>:
898 <?php if ($row['subscriber_DOB'] != "0000-00-00 00:00:00") echo htmlspecialchars($row['subscriber_DOB'],ENT_NOQUOTES); ?><br>
899 <?php echo htmlspecialchars(xl('Phone'),ENT_NOQUOTES); ?>:
900 <?php echo htmlspecialchars($row['subscriber_phone'],ENT_NOQUOTES); ?>
901 </span>
902 </td>
903 <td valign='top'>
904 <span class='bold'><?php echo htmlspecialchars(xl('Subscriber Address'),ENT_NOQUOTES); ?>: </span><br>
905 <span class='text'><?php echo htmlspecialchars($row['subscriber_street'],ENT_NOQUOTES); ?><br>
906 <?php echo htmlspecialchars($row['subscriber_city'],ENT_NOQUOTES); ?>
907 <?php if($row['subscriber_state'] != "") echo ", "; echo htmlspecialchars($row['subscriber_state'],ENT_NOQUOTES); ?>
908 <?php if($row['subscriber_country'] != "") echo ", "; echo htmlspecialchars($row['subscriber_country'],ENT_NOQUOTES); ?>
909 <?php echo " " . htmlspecialchars($row['subscriber_postal_code'],ENT_NOQUOTES); ?></span>
911 <?php if (trim($row['subscriber_employer'])) { ?>
912 <br><span class='bold'><?php echo htmlspecialchars(xl('Subscriber Employer'),ENT_NOQUOTES); ?>: </span><br>
913 <span class='text'><?php echo htmlspecialchars($row['subscriber_employer'],ENT_NOQUOTES); ?><br>
914 <?php echo htmlspecialchars($row['subscriber_employer_street'],ENT_NOQUOTES); ?><br>
915 <?php echo htmlspecialchars($row['subscriber_employer_city'],ENT_NOQUOTES); ?>
916 <?php if($row['subscriber_employer_city'] != "") echo ", "; echo htmlspecialchars($row['subscriber_employer_state'],ENT_NOQUOTES); ?>
917 <?php if($row['subscriber_employer_country'] != "") echo ", "; echo htmlspecialchars($row['subscriber_employer_country'],ENT_NOQUOTES); ?>
918 <?php echo " " . htmlspecialchars($row['subscriber_employer_postal_code'],ENT_NOQUOTES); ?>
919 </span>
920 <?php } ?>
922 </td>
923 </tr>
924 <tr>
925 <td>
926 <?php if ($row['copay'] != "") { ?>
927 <span class='bold'><?php echo htmlspecialchars(xl('CoPay'),ENT_NOQUOTES); ?>: </span>
928 <span class='text'><?php echo htmlspecialchars($row['copay'],ENT_NOQUOTES); ?></span>
929 <br />
930 <?php } ?>
931 <span class='bold'><?php echo htmlspecialchars(xl('Accept Assignment'),ENT_NOQUOTES); ?>:</span>
932 <span class='text'><?php if($row['accept_assignment'] == "TRUE") echo xl("YES"); ?>
933 <?php if($row['accept_assignment'] == "FALSE") echo xl("NO"); ?></span>
934 <?php if (!empty($row['policy_type'])) { ?>
935 <br />
936 <span class='bold'><?php echo htmlspecialchars(xl('Secondary Medicare Type'),ENT_NOQUOTES); ?>: </span>
937 <span class='text'><?php echo htmlspecialchars($policy_types[$row['policy_type']],ENT_NOQUOTES); ?></span>
938 <?php } ?>
939 </td>
940 <td valign='top'></td>
941 <td valign='top'></td>
942 </tr>
944 </table>
945 </div>
946 <?php
948 } // end if ($row['provider'])
949 $enddate = $row['date'];
950 $first = false;
951 } // end while
952 } // end foreach
954 // Display the eligibility information
955 echo "<div class='tab'>";
956 show_eligibility_information($pid,true);
957 echo "</div>";
959 ///////////////////////////////// END INSURANCE SECTION
961 </div>
963 <?php } // ?>
965 </td>
966 </tr>
968 <tr>
969 <td width='650px'>
971 <?php
972 // Notes expand collapse widget
973 $widgetTitle = xl("Notes");
974 $widgetLabel = "pnotes";
975 $widgetButtonLabel = xl("Edit");
976 $widgetButtonLink = "pnotes_full.php?form_active=1";
977 $widgetButtonClass = "";
978 $linkMethod = "html";
979 $bodyClass = "notab";
980 $widgetAuth = true;
981 $fixedWidth = true;
982 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
983 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
984 $widgetAuth, $fixedWidth);
987 <br/>
988 <div style='margin-left:10px' class='text'><img src='../../pic/ajax-loader.gif'/></div><br/>
989 </div>
990 </td>
991 </tr>
992 <?php if ( (acl_check('patients', 'med')) && ($GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_prw']) ) {
993 echo "<tr><td width='650px'>";
994 // patient reminders collapse widget
995 $widgetTitle = xl("Patient Reminders");
996 $widgetLabel = "patient_reminders";
997 $widgetButtonLabel = xl("Edit");
998 $widgetButtonLink = "../reminder/patient_reminders.php?mode=simple&patient_id=".$pid;
999 $widgetButtonClass = "";
1000 $linkMethod = "html";
1001 $bodyClass = "notab";
1002 $widgetAuth = true;
1003 $fixedWidth = true;
1004 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth); ?>
1005 <br/>
1006 <div style='margin-left:10px' class='text'><image src='../../pic/ajax-loader.gif'/></div><br/>
1007 </div>
1008 </td>
1009 </tr>
1010 <?php } //end if prw is activated ?>
1012 <tr>
1013 <td width='650px'>
1014 <?php
1015 // disclosures expand collapse widget
1016 $widgetTitle = xl("Disclosures");
1017 $widgetLabel = "disclosures";
1018 $widgetButtonLabel = xl("Edit");
1019 $widgetButtonLink = "disclosure_full.php";
1020 $widgetButtonClass = "";
1021 $linkMethod = "html";
1022 $bodyClass = "notab";
1023 $widgetAuth = true;
1024 $fixedWidth = true;
1025 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
1026 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
1027 $widgetAuth, $fixedWidth);
1029 <br/>
1030 <div style='margin-left:10px' class='text'><img src='../../pic/ajax-loader.gif'/></div><br/>
1031 </div>
1032 </td>
1033 </tr>
1034 <?php if ($GLOBALS['amendments']) { ?>
1035 <tr>
1036 <td width='650px'>
1037 <?php // Amendments widget
1038 $widgetTitle = xlt('Amendments');
1039 $widgetLabel = "amendments";
1040 $widgetButtonLabel = xlt("Edit");
1041 $widgetButtonLink = $GLOBALS['webroot'] . "/interface/patient_file/summary/main_frameset.php?feature=amendment";
1042 $widgetButtonClass = "iframe rx_modal";
1043 $linkMethod = "html";
1044 $bodyClass = "summary_item small";
1045 $widgetAuth = true;
1046 $fixedWidth = false;
1047 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1048 $sql = "SELECT * FROM amendments WHERE pid = ? ORDER BY amendment_date DESC";
1049 $result = sqlStatement($sql, array($pid) );
1051 if (sqlNumRows($result) == 0) {
1052 echo " <table><tr>\n";
1053 echo " <td colspan='$numcols' class='text'>&nbsp;&nbsp;" . xlt('None') . "</td>\n";
1054 echo " </tr></table>\n";
1057 while ($row=sqlFetchArray($result)){
1058 echo "&nbsp;&nbsp;";
1059 echo "<a class= '" . $widgetButtonClass . "' href='" . $widgetButtonLink . "&id=" . attr($row['amendment_id']) . "' onclick='top.restoreSession()'>" . text($row['amendment_date']);
1060 echo "&nbsp; " . text($row['amendment_desc']);
1062 echo "</a><br>\n";
1063 } ?>
1064 </td>
1065 </tr>
1066 <?php } ?>
1067 <?php // labdata ?>
1068 <tr>
1069 <td width='650px'>
1070 <?php // labdata expand collapse widget
1071 $widgetTitle = xl("Labs");
1072 $widgetLabel = "labdata";
1073 $widgetButtonLabel = xl("Trend");
1074 $widgetButtonLink = "../summary/labdata.php";#"../encounter/trend_form.php?formname=labdata";
1075 $widgetButtonClass = "";
1076 $linkMethod = "html";
1077 $bodyClass = "notab";
1078 // check to see if any labdata exist
1079 $spruch = "SELECT procedure_report.date_collected AS date " .
1080 "FROM procedure_report " .
1081 "JOIN procedure_order ON procedure_report.procedure_order_id = procedure_order.procedure_order_id " .
1082 "WHERE procedure_order.patient_id = ? " .
1083 "ORDER BY procedure_report.date_collected DESC ";
1084 $existLabdata = sqlQuery($spruch, array($pid) );
1085 if ($existLabdata) {
1086 $widgetAuth = true;
1088 else {
1089 $widgetAuth = false;
1091 $fixedWidth = true;
1092 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
1093 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
1094 $widgetAuth, $fixedWidth);
1096 <br/>
1097 <div style='margin-left:10px' class='text'><img src='../../pic/ajax-loader.gif'/></div><br/>
1098 </div>
1099 </td>
1100 </tr>
1101 <?php // end labdata ?>
1106 <?php if ($vitals_is_registered && acl_check('patients', 'med')) { ?>
1107 <tr>
1108 <td width='650px'>
1109 <?php // vitals expand collapse widget
1110 $widgetTitle = xl("Vitals");
1111 $widgetLabel = "vitals";
1112 $widgetButtonLabel = xl("Trend");
1113 $widgetButtonLink = "../encounter/trend_form.php?formname=vitals";
1114 $widgetButtonClass = "";
1115 $linkMethod = "html";
1116 $bodyClass = "notab";
1117 // check to see if any vitals exist
1118 $existVitals = sqlQuery("SELECT * FROM form_vitals WHERE pid=?", array($pid) );
1119 if ($existVitals) {
1120 $widgetAuth = true;
1122 else {
1123 $widgetAuth = false;
1125 $fixedWidth = true;
1126 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
1127 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
1128 $widgetAuth, $fixedWidth);
1130 <br/>
1131 <div style='margin-left:10px' class='text'><img src='../../pic/ajax-loader.gif'/></div><br/>
1132 </div>
1133 </td>
1134 </tr>
1135 <?php } // end if ($vitals_is_registered && acl_check('patients', 'med')) ?>
1137 <?php
1138 // This generates a section similar to Vitals for each LBF form that
1139 // supports charting. The form ID is used as the "widget label".
1141 $gfres = sqlStatement("SELECT option_id, title FROM list_options WHERE " .
1142 "list_id = 'lbfnames' AND option_value > 0 ORDER BY seq, title");
1143 while($gfrow = sqlFetchArray($gfres)) {
1145 <tr>
1146 <td width='650px'>
1147 <?php // vitals expand collapse widget
1148 $vitals_form_id = $gfrow['option_id'];
1149 $widgetTitle = $gfrow['title'];
1150 $widgetLabel = $vitals_form_id;
1151 $widgetButtonLabel = xl("Trend");
1152 $widgetButtonLink = "../encounter/trend_form.php?formname=$vitals_form_id";
1153 $widgetButtonClass = "";
1154 $linkMethod = "html";
1155 $bodyClass = "notab";
1156 // check to see if any instances exist for this patient
1157 $existVitals = sqlQuery(
1158 "SELECT * FROM forms WHERE pid = ? AND formdir = ? AND deleted = 0",
1159 array($pid, $vitals_form_id));
1160 $widgetAuth = $existVitals ? true : false;
1161 $fixedWidth = true;
1162 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
1163 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
1164 $widgetAuth, $fixedWidth);
1166 <br/>
1167 <div style='margin-left:10px' class='text'>
1168 <image src='../../pic/ajax-loader.gif'/>
1169 </div>
1170 <br/>
1171 </div> <!-- This is required by expand_collapse_widget(). -->
1172 </td>
1173 </tr>
1174 <?php
1175 } // end while
1178 </table>
1180 </div>
1181 <!-- end left column div -->
1183 <!-- start right column div -->
1184 <div>
1185 <table>
1186 <tr>
1187 <td>
1189 <div>
1190 <?php
1192 // If there is an ID Card or any Photos show the widget
1193 $photos = pic_array($pid, $GLOBALS['patient_photo_category_name']);
1194 if ($photos or $idcard_doc_id )
1196 $widgetTitle = xl("ID Card") . '/' . xl("Photos");
1197 $widgetLabel = "photos";
1198 $linkMethod = "javascript";
1199 $bodyClass = "notab-right";
1200 $widgetAuth = false;
1201 $fixedWidth = false;
1202 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel ,
1203 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
1204 $widgetAuth, $fixedWidth);
1206 <br />
1207 <?php
1208 if ($idcard_doc_id) {
1209 image_widget($idcard_doc_id, $GLOBALS['patient_id_category_name']);
1212 foreach ($photos as $photo_doc_id) {
1213 image_widget($photo_doc_id, $GLOBALS['patient_photo_category_name']);
1218 <br />
1219 </div>
1220 <div>
1221 <?php
1222 // Advance Directives
1223 if ($GLOBALS['advance_directives_warning']) {
1224 // advance directives expand collapse widget
1225 $widgetTitle = xl("Advance Directives");
1226 $widgetLabel = "directives";
1227 $widgetButtonLabel = xl("Edit");
1228 $widgetButtonLink = "return advdirconfigure();";
1229 $widgetButtonClass = "";
1230 $linkMethod = "javascript";
1231 $bodyClass = "summary_item small";
1232 $widgetAuth = true;
1233 $fixedWidth = false;
1234 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1235 $counterFlag = false; //flag to record whether any categories contain ad records
1236 $query = "SELECT id FROM categories WHERE name='Advance Directive'";
1237 $myrow2 = sqlQuery($query);
1238 if ($myrow2) {
1239 $parentId = $myrow2['id'];
1240 $query = "SELECT id, name FROM categories WHERE parent=?";
1241 $resNew1 = sqlStatement($query, array($parentId) );
1242 while ($myrows3 = sqlFetchArray($resNew1)) {
1243 $categoryId = $myrows3['id'];
1244 $nameDoc = $myrows3['name'];
1245 $query = "SELECT documents.date, documents.id " .
1246 "FROM documents " .
1247 "INNER JOIN categories_to_documents " .
1248 "ON categories_to_documents.document_id=documents.id " .
1249 "WHERE categories_to_documents.category_id=? " .
1250 "AND documents.foreign_id=? " .
1251 "ORDER BY documents.date DESC";
1252 $resNew2 = sqlStatement($query, array($categoryId, $pid) );
1253 $limitCounter = 0; // limit to one entry per category
1254 while (($myrows4 = sqlFetchArray($resNew2)) && ($limitCounter == 0)) {
1255 $dateTimeDoc = $myrows4['date'];
1256 // remove time from datetime stamp
1257 $tempParse = explode(" ",$dateTimeDoc);
1258 $dateDoc = $tempParse[0];
1259 $idDoc = $myrows4['id'];
1260 echo "<a href='$web_root/controller.php?document&retrieve&patient_id=" .
1261 htmlspecialchars($pid,ENT_QUOTES) . "&document_id=" .
1262 htmlspecialchars($idDoc,ENT_QUOTES) . "&as_file=true' onclick='top.restoreSession()'>" .
1263 htmlspecialchars(xl_document_category($nameDoc),ENT_NOQUOTES) . "</a> " .
1264 htmlspecialchars($dateDoc,ENT_NOQUOTES);
1265 echo "<br>";
1266 $limitCounter = $limitCounter + 1;
1267 $counterFlag = true;
1271 if (!$counterFlag) {
1272 echo "&nbsp;&nbsp;" . htmlspecialchars(xl('None'),ENT_NOQUOTES);
1273 } ?>
1274 </div>
1275 <?php } // close advanced dir block
1277 // This is a feature for a specific client. -- Rod
1278 if ($GLOBALS['cene_specific']) {
1279 echo " <br />\n";
1281 $imagedir = $GLOBALS['OE_SITE_DIR'] . "/documents/$pid/demographics";
1282 $imagepath = "$web_root/sites/" . $_SESSION['site_id'] . "/documents/$pid/demographics";
1284 echo " <a href='' onclick=\"return sendimage($pid, 'photo');\" " .
1285 "title='Click to attach patient image'>\n";
1286 if (is_file("$imagedir/photo.jpg")) {
1287 echo " <img src='$imagepath/photo.jpg' /></a>\n";
1288 } else {
1289 echo " Attach Patient Image</a><br />\n";
1291 echo " <br />&nbsp;<br />\n";
1293 echo " <a href='' onclick=\"return sendimage($pid, 'fingerprint');\" " .
1294 "title='Click to attach fingerprint'>\n";
1295 if (is_file("$imagedir/fingerprint.jpg")) {
1296 echo " <img src='$imagepath/fingerprint.jpg' /></a>\n";
1297 } else {
1298 echo " Attach Biometric Fingerprint</a><br />\n";
1300 echo " <br />&nbsp;<br />\n";
1303 // This stuff only applies to athletic team use of OpenEMR. The client
1304 // insisted on being able to quickly change fitness and return date here:
1306 if (false && $GLOBALS['athletic_team']) {
1307 // blue green yellow red orange
1308 $fitcolors = array('#6677ff','#00cc00','#ffff00','#ff3333','#ff8800','#ffeecc','#ffccaa');
1309 if (!empty($GLOBALS['fitness_colors'])) $fitcolors = $GLOBALS['fitness_colors'];
1310 $fitcolor = $fitcolors[0];
1311 $form_fitness = $_POST['form_fitness'];
1312 $form_userdate1 = fixDate($_POST['form_userdate1'], '');
1313 $form_issue_id = $_POST['form_issue_id'];
1314 if ($form_submit) {
1315 $returndate = $form_userdate1 ? "'$form_userdate1'" : "NULL";
1316 sqlStatement("UPDATE patient_data SET fitness = ?, " .
1317 "userdate1 = ? WHERE pid = ?", array($form_fitness, $returndate, $pid) );
1318 // Update return date in the designated issue, if requested.
1319 if ($form_issue_id) {
1320 sqlStatement("UPDATE lists SET returndate = ? WHERE " .
1321 "id = ?", array($returndate, $form_issue_id) );
1323 } else {
1324 $form_fitness = $result['fitness'];
1325 if (! $form_fitness) $form_fitness = 1;
1326 $form_userdate1 = $result['userdate1'];
1328 $fitcolor = $fitcolors[$form_fitness - 1];
1329 echo " <form method='post' action='demographics.php' onsubmit='return validate()'>\n";
1330 echo " <span class='bold'>Fitness to Play:</span><br />\n";
1331 echo " <select name='form_fitness' style='background-color:$fitcolor'>\n";
1332 $res = sqlStatement("SELECT * FROM list_options WHERE " .
1333 "list_id = 'fitness' ORDER BY seq");
1334 while ($row = sqlFetchArray($res)) {
1335 $key = $row['option_id'];
1336 echo " <option value='" . htmlspecialchars($key,ENT_QUOTES) . "'";
1337 if ($key == $form_fitness) echo " selected";
1338 echo ">" . htmlspecialchars($row['title'],ENT_NOQUOTES) . "</option>\n";
1340 echo " </select>\n";
1341 echo " <br /><span class='bold'>Return to Play:</span><br>\n";
1342 echo " <input type='text' size='10' name='form_userdate1' id='form_userdate1' " .
1343 "value='$form_userdate1' " .
1344 "title='" . htmlspecialchars(xl('yyyy-mm-dd Date of return to play'),ENT_QUOTES) . "' " .
1345 "onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)' />\n" .
1346 " <img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22' " .
1347 "id='img_userdate1' border='0' alt='[?]' style='cursor:pointer' " .
1348 "title='" . htmlspecialchars(xl('Click here to choose a date'),ENT_QUOTES) . "'>\n";
1349 echo " <input type='hidden' name='form_original_userdate1' value='" . htmlspecialchars($form_userdate1,ENT_QUOTES) . "' />\n";
1350 echo " <input type='hidden' name='form_issue_id' value='' />\n";
1351 echo "<p><input type='submit' name='form_submit' value='Change' /></p>\n";
1352 echo " </form>\n";
1355 // Show current and upcoming appointments.
1356 if (isset($pid) && !$GLOBALS['disable_calendar']) {
1358 $current_date2 = date('Y-m-d');
1359 $events = array();
1360 $apptNum = (int)$GLOBALS['number_of_appts_to_show'];
1361 if($apptNum != 0) $apptNum2 = abs($apptNum);
1362 else $apptNum2 = 10;
1363 $events = fetchNextXAppts($current_date2, $pid, $apptNum2);
1364 $events = sortAppointments($events);
1365 //////
1367 // Show Clinical Reminders for any user that has rules that are permitted.
1368 $clin_rem_check = resolve_rules_sql('','0',TRUE,'',$_SESSION['authUser']);
1369 if ( (!empty($clin_rem_check)) && ($GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_crw']) ) {
1370 // clinical summary expand collapse widget
1371 $widgetTitle = xl("Clinical Reminders");
1372 $widgetLabel = "clinical_reminders";
1373 $widgetButtonLabel = xl("Edit");
1374 $widgetButtonLink = "../reminder/clinical_reminders.php?patient_id=".$pid;;
1375 $widgetButtonClass = "";
1376 $linkMethod = "html";
1377 $bodyClass = "summary_item small";
1378 $widgetAuth = true;
1379 $fixedWidth = false;
1380 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1381 echo "<br/>";
1382 echo "<div style='margin-left:10px' class='text'><image src='../../pic/ajax-loader.gif'/></div><br/>";
1383 echo "</div>";
1384 } // end if crw
1386 // appointments expand collapse widget
1387 $widgetTitle = xl("Appointments");
1388 $widgetLabel = "appointments";
1389 $widgetButtonLabel = xl("Add");
1390 $widgetButtonLink = "return newEvt();";
1391 $widgetButtonClass = "";
1392 $linkMethod = "javascript";
1393 $bodyClass = "summary_item small";
1394 $widgetAuth = $resNotNull; // $resNotNull refects state of query (appts) in fetchAppointments()
1395 $fixedWidth = false;
1396 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1397 $count = 0;
1398 foreach($events as $row) { //////
1399 $count++;
1400 $dayname = date("D", strtotime($row['pc_eventDate'])); //////
1401 $dispampm = "am";
1402 $disphour = substr($row['pc_startTime'], 0, 2) + 0;
1403 $dispmin = substr($row['pc_startTime'], 3, 2);
1404 if ($disphour >= 12) {
1405 $dispampm = "pm";
1406 if ($disphour > 12) $disphour -= 12;
1408 $etitle = xl('(Click to edit)');
1409 if ($row['pc_hometext'] != "") {
1410 $etitle = xl('Comments').": ".($row['pc_hometext'])."\r\n".$etitle;
1412 ////////////
1413 echo "<a href='javascript:oldEvt(" . htmlspecialchars(preg_replace("/-/", "", $row['pc_eventDate']),ENT_QUOTES) . ', ' . htmlspecialchars($row['pc_eid'],ENT_QUOTES) . ")' title='" . htmlspecialchars($etitle,ENT_QUOTES) . "'>";
1414 ////////////
1415 echo "<b>" . htmlspecialchars($row['pc_eventDate'] . " (" . xl($dayname),ENT_NOQUOTES) . ")</b><br>";
1416 echo htmlspecialchars("$disphour:$dispmin " . xl($dispampm),ENT_NOQUOTES) . " ";
1417 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)."'>";
1418 echo "<span title='" . generate_display_field(array('data_type'=>'1','list_id'=>'apptstat'),$row['pc_apptstatus']) . "'> ( " . htmlspecialchars($row['pc_apptstatus'],ENT_NOQUOTES) . " )</span>";
1419 if ($row['pc_hometext']) echo "<font color='green'> CMT</font>";
1420 echo "<br>" . htmlspecialchars(xl_appt_category($row['pc_catname']),ENT_NOQUOTES) . "<br>\n";
1421 echo htmlspecialchars($row['ufname'] . " " . $row['ulname'],ENT_NOQUOTES) . "</a><br>\n";
1423 if ($resNotNull) { //////
1424 if ( $count < 1 ) {
1425 echo "&nbsp;&nbsp;" . htmlspecialchars(xl('None'),ENT_NOQUOTES);
1427 echo "</div>";
1431 // Show PAST appointments.
1432 // added by Terry Hill to allow reverse sorting of the appointments
1433 $direction = "ASC";
1434 if ($GLOBALS['num_past_appointments_to_show'] < 0) {
1435 $direction = "DESC";
1436 ($showpast = -1 * $GLOBALS['num_past_appointments_to_show'] );
1438 else
1440 $showpast = $GLOBALS['num_past_appointments_to_show'];
1443 if (isset($pid) && !$GLOBALS['disable_calendar'] && $showpast > 0) {
1444 $query = "SELECT e.pc_eid, e.pc_aid, e.pc_title, e.pc_eventDate, " .
1445 "e.pc_startTime, e.pc_hometext, u.fname, u.lname, u.mname, " .
1446 "c.pc_catname, e.pc_apptstatus " .
1447 "FROM openemr_postcalendar_events AS e, users AS u, " .
1448 "openemr_postcalendar_categories AS c WHERE " .
1449 "e.pc_pid = ? AND e.pc_eventDate < CURRENT_DATE AND " .
1450 "u.id = e.pc_aid AND e.pc_catid = c.pc_catid " .
1451 "ORDER BY e.pc_eventDate $direction , e.pc_startTime DESC " .
1452 "LIMIT " . $showpast;
1454 $pres = sqlStatement($query, array($pid) );
1456 // appointments expand collapse widget
1457 $widgetTitle = xl("Past Appoinments");
1458 $widgetLabel = "past_appointments";
1459 $widgetButtonLabel = '';
1460 $widgetButtonLink = '';
1461 $widgetButtonClass = '';
1462 $linkMethod = "javascript";
1463 $bodyClass = "summary_item small";
1464 $widgetAuth = false; //no button
1465 $fixedWidth = false;
1466 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1467 $count = 0;
1468 while($row = sqlFetchArray($pres)) {
1469 $count++;
1470 $dayname = date("l", strtotime($row['pc_eventDate']));
1471 $dispampm = "am";
1472 $disphour = substr($row['pc_startTime'], 0, 2) + 0;
1473 $dispmin = substr($row['pc_startTime'], 3, 2);
1474 if ($disphour >= 12) {
1475 $dispampm = "pm";
1476 if ($disphour > 12) $disphour -= 12;
1478 if ($row['pc_hometext'] != "") {
1479 $etitle = xl('Comments').": ".($row['pc_hometext'])."\r\n".$etitle;
1481 echo "<a href='javascript:oldEvt(" . htmlspecialchars($row['pc_eid'],ENT_QUOTES) . ")' title='" . htmlspecialchars($etitle,ENT_QUOTES) . "'>";
1482 echo "<b>" . htmlspecialchars(xl($dayname) . ", " . $row['pc_eventDate'],ENT_NOQUOTES) . "</b>" . xlt("Status") . "(";
1483 echo " " . generate_display_field(array('data_type'=>'1','list_id'=>'apptstat'),$row['pc_apptstatus']) . ")<br>"; // can't use special char parser on this
1484 echo htmlspecialchars("$disphour:$dispmin ") . xl($dispampm) . " ";
1485 echo htmlspecialchars($row['fname'] . " " . $row['lname'],ENT_NOQUOTES) . "</a><br>\n";
1487 if (isset($pres) && $res != null) {
1488 if ( $count < 1 ) {
1489 echo "&nbsp;&nbsp;" . htmlspecialchars(xl('None'),ENT_NOQUOTES);
1491 echo "</div>";
1494 // END of past appointments
1497 </div>
1499 <div id='stats_div'>
1500 <br/>
1501 <div style='margin-left:10px' class='text'><img src='../../pic/ajax-loader.gif'/></div><br/>
1502 </div>
1503 </td>
1504 </tr>
1506 <?php // TRACK ANYTHING -----
1508 // Determine if track_anything form is in use for this site.
1509 $tmp = sqlQuery("SELECT count(*) AS count FROM registry WHERE " .
1510 "directory = 'track_anything' AND state = 1");
1511 $track_is_registered = $tmp['count'];
1512 if($track_is_registered){
1513 echo "<tr> <td>";
1514 // track_anything expand collapse widget
1515 $widgetTitle = xl("Tracks");
1516 $widgetLabel = "track_anything";
1517 $widgetButtonLabel = xl("Tracks");
1518 $widgetButtonLink = "../../forms/track_anything/create.php";
1519 $widgetButtonClass = "";
1520 $widgetAuth = ""; // don't show the button
1521 $linkMethod = "html";
1522 $bodyClass = "notab";
1523 // check to see if any tracks exist
1524 $spruch = "SELECT id " .
1525 "FROM forms " .
1526 "WHERE pid = ? " .
1527 "AND formdir = ? ";
1528 $existTracks = sqlQuery($spruch, array($pid, "track_anything") );
1530 $fixedWidth = false;
1531 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
1532 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
1533 $widgetAuth, $fixedWidth);
1535 <br/>
1536 <div style='margin-left:10px' class='text'><img src='../../pic/ajax-loader.gif'/></div><br/>
1537 </div>
1538 </td>
1539 </tr>
1540 <?php } // end track_anything ?>
1541 </table>
1543 </div> <!-- end right column div -->
1545 </td>
1547 </tr>
1548 </table>
1550 </div> <!-- end main content div -->
1552 <?php if (false && $GLOBALS['athletic_team']) { ?>
1553 <script language='JavaScript'>
1554 Calendar.setup({inputField:"form_userdate1", ifFormat:"%Y-%m-%d", button:"img_userdate1"});
1555 </script>
1556 <?php } ?>
1557 <script language='JavaScript'>
1558 // Array of skip conditions for the checkSkipConditions() function.
1559 var skipArray = [
1560 <?php echo $condition_str; ?>
1562 checkSkipConditions();
1563 </script>
1565 </body>
1566 </html>