Onsite Patient Portal:
[openemr.git] / interface / patient_file / summary / demographics.php
blob608f7344e8da4772292693b197f70705bf820841
1 <?php
2 // This program is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU General Public License
4 // as published by the Free Software Foundation; either version 2
5 // of the License, or (at your option) any later version.
7 //SANITIZE ALL ESCAPES
8 $sanitize_all_escapes=true;
9 //
11 //STOP FAKE REGISTER GLOBALS
12 $fake_register_globals=false;
15 require_once("../../globals.php");
16 require_once("$srcdir/patient.inc");
17 require_once("$srcdir/acl.inc");
18 require_once("$srcdir/classes/Address.class.php");
19 require_once("$srcdir/classes/InsuranceCompany.class.php");
20 require_once("$srcdir/classes/Document.class.php");
21 require_once("$srcdir/options.inc.php");
22 require_once("../history/history.inc.php");
23 require_once("$srcdir/formatting.inc.php");
24 require_once("$srcdir/edi.inc");
26 if ($GLOBALS['concurrent_layout'] && $_GET['set_pid']) {
27 include_once("$srcdir/pid.inc");
28 setpid($_GET['set_pid']);
31 function print_as_money($money) {
32 preg_match("/(\d*)\.?(\d*)/",$money,$moneymatches);
33 $tmp = wordwrap(strrev($moneymatches[1]),3,",",1);
34 $ccheck = strrev($tmp);
35 if ($ccheck[0] == ",") {
36 $tmp = substr($ccheck,1,strlen($ccheck)-1);
38 if ($moneymatches[2] != "") {
39 return "$ " . strrev($tmp) . "." . $moneymatches[2];
40 } else {
41 return "$ " . strrev($tmp);
45 // get an array from Photos category
46 function pic_array($pid,$picture_directory) {
47 $pics = array();
48 $sql_query = "select documents.id from documents join categories_to_documents " .
49 "on documents.id = categories_to_documents.document_id " .
50 "join categories on categories.id = categories_to_documents.category_id " .
51 "where categories.name like ? and documents.foreign_id = ?";
52 if ($query = sqlStatement($sql_query, array($picture_directory,$pid))) {
53 while( $results = sqlFetchArray($query) ) {
54 array_push($pics,$results['id']);
57 return ($pics);
59 // Get the document ID of the first document in a specific catg.
60 function get_document_by_catg($pid,$doc_catg) {
62 $result = array();
64 if ($pid and $doc_catg) {
65 $result = sqlQuery("SELECT d.id, d.date, d.url FROM " .
66 "documents AS d, categories_to_documents AS cd, categories AS c " .
67 "WHERE d.foreign_id = ? " .
68 "AND cd.document_id = d.id " .
69 "AND c.id = cd.category_id " .
70 "AND c.name LIKE ? " .
71 "ORDER BY d.date DESC LIMIT 1", array($pid, $doc_catg) );
74 return($result['id']);
77 // Display image in 'widget style'
78 function image_widget($doc_id,$doc_catg)
80 global $pid, $web_root;
81 $docobj = new Document($doc_id);
82 $image_file = $docobj->get_url_file();
83 $extension = substr($image_file, strrpos($image_file,"."));
84 $viewable_types = array('.png','.jpg','.jpeg','.png','.bmp'); // image ext supported by fancybox viewer
85 if ( in_array($extension,$viewable_types) ) { // extention matches list
86 $to_url = "<td> <a href = $web_root" .
87 "/controller.php?document&retrieve&patient_id=$pid&document_id=$doc_id" .
88 "/tmp$extension" . // Force image type URL for fancybox
89 " onclick=top.restoreSession(); class='image_modal'>" .
90 " <img src = $web_root" .
91 "/controller.php?document&retrieve&patient_id=$pid&document_id=$doc_id" .
92 " width=100 alt='$doc_catg:$image_file'> </a> </td> <td valign='center'>".
93 htmlspecialchars($doc_catg) . '<br />&nbsp;' . htmlspecialchars($image_file) .
94 "</td>";
96 else {
97 $to_url = "<td> <a href='" . $web_root . "/controller.php?document&retrieve" .
98 "&patient_id=$pid&document_id=$doc_id'" .
99 " onclick='top.restoreSession()' class='css_button_small'>" .
100 "<span>" .
101 htmlspecialchars( xl("View"), ENT_QUOTES )."</a> &nbsp;" .
102 htmlspecialchars( "$doc_catg - $image_file", ENT_QUOTES ) .
103 "</span> </td>";
105 echo "<table><tr>";
106 echo $to_url;
107 echo "</tr></table>";
110 // Determine if the Vitals form is in use for this site.
111 $tmp = sqlQuery("SELECT count(*) AS count FROM registry WHERE " .
112 "directory = 'vitals' AND state = 1");
113 $vitals_is_registered = $tmp['count'];
115 <html>
117 <head>
118 <?php html_header_show();?>
119 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
120 <link rel="stylesheet" type="text/css" href="../../../library/js/fancybox/jquery.fancybox-1.2.6.css" media="screen" />
121 <style type="text/css">@import url(../../../library/dynarch_calendar.css);</style>
122 <script type="text/javascript" src="../../../library/textformat.js"></script>
123 <script type="text/javascript" src="../../../library/dynarch_calendar.js"></script>
124 <?php include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?>
125 <script type="text/javascript" src="../../../library/dynarch_calendar_setup.js"></script>
126 <script type="text/javascript" src="../../../library/dialog.js"></script>
127 <script type="text/javascript" src="../../../library/js/jquery.1.3.2.js"></script>
128 <script type="text/javascript" src="../../../library/js/common.js"></script>
129 <script type="text/javascript" src="../../../library/js/fancybox/jquery.fancybox-1.2.6.js"></script>
130 <script type="text/javascript" language="JavaScript">
131 //Visolve - sync the radio buttons - Start
132 if((top.window.parent) && (parent.window)){
133 var wname = top.window.parent.left_nav;
134 wname.syncRadios();
135 wname.setRadio(parent.window.name, "dem");
137 //Visolve - sync the radio buttons - End
139 var mypcc = '<?php echo htmlspecialchars($GLOBALS['phone_country_code'],ENT_QUOTES); ?>';
141 function oldEvt(eventid) {
142 dlgopen('../../main/calendar/add_edit_event.php?eid=' + eventid, '_blank', 550, 270);
145 function advdirconfigure() {
146 dlgopen('advancedirectives.php', '_blank', 500, 450);
149 function refreshme() {
150 top.restoreSession();
151 location.reload();
154 // Process click on Delete link.
155 function deleteme() {
156 dlgopen('../deleter.php?patient=<?php echo htmlspecialchars($pid,ENT_QUOTES); ?>', '_blank', 500, 450);
157 return false;
160 // Called by the deleteme.php window on a successful delete.
161 function imdeleted() {
162 <?php if ($GLOBALS['concurrent_layout']) { ?>
163 parent.left_nav.clearPatient();
164 <?php } else { ?>
165 top.restoreSession();
166 top.location.href = '../main/main_screen.php';
167 <?php } ?>
170 function validate() {
171 var f = document.forms[0];
172 <?php
173 if ($GLOBALS['athletic_team']) {
174 echo " if (f.form_userdate1.value != f.form_original_userdate1.value) {\n";
175 $irow = sqlQuery("SELECT id, title FROM lists WHERE " .
176 "pid = ? AND enddate IS NULL ORDER BY begdate DESC LIMIT 1", array($pid));
177 if (!empty($irow)) {
179 if (confirm('Do you wish to also set this new return date in the issue titled "<?php echo htmlspecialchars($irow['title'],ENT_QUOTES); ?>"?')) {
180 f.form_issue_id.value = '<?php echo htmlspecialchars($irow['id'],ENT_QUOTES); ?>';
181 } else {
182 alert('OK, you will need to manually update the return date in any affected issue(s).');
184 <?php } else { ?>
185 alert('You have changed the return date but there are no open issues. You probably need to create or modify one.');
186 <?php
187 } // end empty $irow
188 echo " }\n";
189 } // end athletic team
191 return true;
194 function newEvt() {
195 dlgopen('../../main/calendar/add_edit_event.php?patientid=<?php echo htmlspecialchars($pid,ENT_QUOTES); ?>', '_blank', 550, 270);
196 return false;
199 function sendimage(pid, what) {
200 // alert('Not yet implemented.'); return false;
201 dlgopen('../upload_dialog.php?patientid=' + pid + '&file=' + what,
202 '_blank', 500, 400);
203 return false;
206 </script>
208 <script type="text/javascript">
210 function toggleIndicator(target,div) {
212 $mode = $(target).find(".indicator").text();
213 if ( $mode == "<?php echo htmlspecialchars(xl('collapse'),ENT_QUOTES); ?>" ) {
214 $(target).find(".indicator").text( "<?php echo htmlspecialchars(xl('expand'),ENT_QUOTES); ?>" );
215 $("#"+div).hide();
216 $.post( "../../../library/ajax/user_settings.php", { target: div, mode: 0 });
217 } else {
218 $(target).find(".indicator").text( "<?php echo htmlspecialchars(xl('collapse'),ENT_QUOTES); ?>" );
219 $("#"+div).show();
220 $.post( "../../../library/ajax/user_settings.php", { target: div, mode: 1 });
224 $(document).ready(function(){
226 // load divs
227 $("#stats_div").load("stats.php", { 'embeddedScreen' : true }, function() {
228 // (note need to place javascript code here also to get the dynamic link to work)
229 $(".rx_modal").fancybox( {
230 'overlayOpacity' : 0.0,
231 'showCloseButton' : true,
232 'frameHeight' : 500,
233 'frameWidth' : 800,
234 'centerOnScroll' : false,
235 'callbackOnClose' : function() {
236 refreshme();
240 $("#pnotes_ps_expand").load("pnotes_fragment.php");
241 $("#disclosures_ps_expand").load("disc_fragment.php");
243 <?php if ($GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_crw']) { ?>
244 top.restoreSession();
245 $("#clinical_reminders_ps_expand").load("clinical_reminders_fragment.php", { 'embeddedScreen' : true }, function() {
246 // (note need to place javascript code here also to get the dynamic link to work)
247 $(".medium_modal").fancybox( {
248 'overlayOpacity' : 0.0,
249 'showCloseButton' : true,
250 'frameHeight' : 500,
251 'frameWidth' : 800,
252 'centerOnScroll' : false,
253 'callbackOnClose' : function() {
254 refreshme();
258 <?php } // end crw?>
260 <?php if ($GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_prw']) { ?>
261 top.restoreSession();
262 $("#patient_reminders_ps_expand").load("patient_reminders_fragment.php");
263 <?php } // end prw?>
265 <?php if ($vitals_is_registered) { ?>
266 // Initialize the Vitals form if it is registered.
267 $("#vitals_ps_expand").load("vitals_fragment.php");
268 <?php } ?>
270 <?php
271 // Initialize for each applicable LBF form.
272 $gfres = sqlStatement("SELECT option_id FROM list_options WHERE " .
273 "list_id = 'lbfnames' AND option_value > 0 ORDER BY seq, title");
274 while($gfrow = sqlFetchArray($gfres)) {
276 $("#<?php echo $gfrow['option_id']; ?>_ps_expand").load("lbf_fragment.php?formname=<?php echo $gfrow['option_id']; ?>");
277 <?php
281 // fancy box
282 enable_modals();
284 tabbify();
286 // modal for dialog boxes
287 $(".large_modal").fancybox( {
288 'overlayOpacity' : 0.0,
289 'showCloseButton' : true,
290 'frameHeight' : 600,
291 'frameWidth' : 1000,
292 'centerOnScroll' : false
295 // modal for image viewer
296 $(".image_modal").fancybox( {
297 'overlayOpacity' : 0.0,
298 'showCloseButton' : true,
299 'centerOnScroll' : false,
300 'autoscale' : true
302 // special size for patient portal
303 $(".small_modal").fancybox( {
304 'overlayOpacity' : 0.0,
305 'showCloseButton' : true,
306 'frameHeight' : 180,
307 'frameWidth' : 380,
308 'centerOnScroll' : false
313 </script>
315 <style type="css/text">
316 #pnotes_ps_expand {
317 height:auto;
318 width:100%;
320 </style>
322 </head>
324 <body class="body_top">
326 <?php
327 $result = getPatientData($pid, "*, DATE_FORMAT(DOB,'%Y-%m-%d') as DOB_YMD");
328 $result2 = getEmployerData($pid);
329 $result3 = getInsuranceData($pid, "primary", "copay, provider, DATE_FORMAT(`date`,'%Y-%m-%d') as effdate");
330 $insco_name = "";
332 if ($result3['provider']) { // Use provider in case there is an ins record w/ unassigned insco
333 $insco_name = getInsuranceProvider($result3['provider']);
336 $thisauth = acl_check('patients', 'demo');
337 if ($thisauth) {
338 if ($result['squad'] && ! acl_check('squads', $result['squad']))
339 $thisauth = 0;
342 if (!$thisauth) {
343 echo "<p>(" . htmlspecialchars(xl('Demographics not authorized'),ENT_NOQUOTES) . ")</p>\n";
344 echo "</body>\n</html>\n";
345 exit();
348 if ($thisauth == 'write') {
349 echo "<table><tr><td><span class='title'>" .
350 htmlspecialchars(getPatientName($pid),ENT_NOQUOTES) .
351 "</span></td>";
353 if (acl_check('admin', 'super')) {
354 echo "<td style='padding-left:1em;'><a class='css_button iframe' href='../deleter.php?patient=" .
355 htmlspecialchars($pid,ENT_QUOTES) . "'>" .
356 "<span>".htmlspecialchars(xl('Delete'),ENT_NOQUOTES).
357 "</span></a></td>";
359 //Patient Portal
360 $portalUserSetting = true; //flag to see if patient has authorized access to portal
361 if($GLOBALS['portal_onsite_enable'] && $GLOBALS['portal_onsite_address']){
362 $portalStatus = sqlQuery("SELECT allow_patient_portal FROM patient_data WHERE pid=?",array($pid));
363 if ($portalStatus['allow_patient_portal']=='YES') {
364 $portalLogin = sqlQuery("SELECT pid FROM `patient_access_onsite` WHERE `pid`=?", array($pid));
365 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()'>";
366 if (empty($portalLogin)) {
367 echo "<span>".htmlspecialchars(xl('Create Onsite Portal Credentials'),ENT_NOQUOTES)."</span></a></td>";
369 else {
370 echo "<span>".htmlspecialchars(xl('Reset Onsite Portal Credentials'),ENT_NOQUOTES)."</span></a></td>";
373 else {
374 $portalUserSetting = false;
377 if($GLOBALS['portal_offsite_enable'] && $GLOBALS['portal_offsite_address']){
378 $portalStatus = sqlQuery("SELECT allow_patient_portal FROM patient_data WHERE pid=?",array($pid));
379 if ($portalStatus['allow_patient_portal']=='YES') {
380 $portalLogin = sqlQuery("SELECT pid FROM `patient_access_offsite` WHERE `pid`=?", array($pid));
381 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()'>";
382 if (empty($portalLogin)) {
383 "<span>".htmlspecialchars(xl('Create Offsite Portal Credentials'),ENT_NOQUOTES)."</span></a></td>";
385 else {
386 "<span>".htmlspecialchars(xl('Reset Offsite Portal Credentials'),ENT_NOQUOTES)."</span></a></td>";
389 else {
390 $portalUserSetting = false;
393 if (!($portalUserSetting)) {
394 // Show that the patient has not authorized portal access
395 echo "<td style='padding-left:1em;'>" . htmlspecialchars( xl('Patient has not authorized the Patient Portal.'), ENT_NOQUOTES) . "</td>";
397 //Patient Portal
399 // If patient is deceased, then show this (along with the number of days patient has been deceased for)
400 $days_deceased = is_patient_deceased($pid);
401 if ($days_deceased) {
402 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>";
405 echo "</tr></table>";
408 // Get the document ID of the patient ID card if access to it is wanted here.
409 $idcard_doc_id = false;
410 if ($GLOBALS['patient_id_category_name']) {
411 $idcard_doc_id = get_document_by_catg($pid, $GLOBALS['patient_id_category_name']);
415 <table cellspacing='0' cellpadding='0' border='0'>
416 <tr>
417 <td class="small" colspan='4'>
418 <a href="../history/history.php" onclick='top.restoreSession()'>
419 <?php echo htmlspecialchars(xl('History'),ENT_NOQUOTES); ?></a>
421 <?php //note that we have temporarily removed report screen from the modal view ?>
422 <a href="../report/patient_report.php" onclick='top.restoreSession()'>
423 <?php echo htmlspecialchars(xl('Report'),ENT_NOQUOTES); ?></a>
425 <?php //note that we have temporarily removed document screen from the modal view ?>
426 <a href="../../../controller.php?document&list&patient_id=<?php echo $pid;?>" onclick='top.restoreSession()'>
427 <?php echo htmlspecialchars(xl('Documents'),ENT_NOQUOTES); ?></a>
429 <a href="../transaction/transactions.php" class='iframe large_modal' onclick='top.restoreSession()'>
430 <?php echo htmlspecialchars(xl('Transactions'),ENT_NOQUOTES); ?></a>
432 <a href="stats_full.php?active=all" onclick='top.restoreSession()'>
433 <?php echo htmlspecialchars(xl('Issues'),ENT_NOQUOTES); ?></a>
434 </td>
435 </tr>
436 </table> <!-- end header -->
438 <div style='margin-top:10px'> <!-- start main content div -->
439 <table border="0" cellspacing="0" cellpadding="0" width="100%">
440 <tr>
441 <td align="left" valign="top">
442 <!-- start left column div -->
443 <div style='float:left; margin-right:20px'>
444 <table cellspacing=0 cellpadding=0>
445 <tr>
446 <td>
447 <?php
448 // Billing expand collapse widget
449 $widgetTitle = xl("Billing");
450 $widgetLabel = "billing";
451 $widgetButtonLabel = xl("Edit");
452 $widgetButtonLink = "return newEvt();";
453 $widgetButtonClass = "";
454 $linkMethod = "javascript";
455 $bodyClass = "notab";
456 $widgetAuth = false;
457 $fixedWidth = true;
458 if ($GLOBALS['force_billing_widget_open']) {
459 $forceExpandAlways = true;
461 else {
462 $forceExpandAlways = false;
464 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
465 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
466 $widgetAuth, $fixedWidth, $forceExpandAlways);
468 <br>
469 <?php
470 if ($GLOBALS['oer_config']['ws_accounting']['enabled']) {
471 // Show current balance and billing note, if any.
472 echo " <div style='margin-left: 10px; margin-right: 10px'>" .
473 "<span class='bold'><font color='#ee6600'>" .
474 htmlspecialchars(xl('Balance Due'),ENT_NOQUOTES) .
475 ": " . htmlspecialchars(oeFormatMoney(get_patient_balance($pid)),ENT_NOQUOTES) .
476 "</font></span><br>";
477 if ($result['genericname2'] == 'Billing') {
478 echo "<span class='bold'><font color='red'>" .
479 htmlspecialchars(xl('Billing Note'),ENT_NOQUOTES) . ":" .
480 htmlspecialchars($result['genericval2'],ENT_NOQUOTES) .
481 "</font></span><br>";
483 if ($result3['provider']) { // Use provider in case there is an ins record w/ unassigned insco
484 echo "<span class='bold'>" .
485 htmlspecialchars(xl('Primary Insurance'),ENT_NOQUOTES) . ': ' . htmlspecialchars($insco_name,ENT_NOQUOTES) .
486 "</span>&nbsp;&nbsp;&nbsp;";
487 if ($result3['copay'] > 0) {
488 echo "<span class='bold'>" .
489 htmlspecialchars(xl('Copay'),ENT_NOQUOTES) . ': ' . htmlspecialchars($result3['copay'],ENT_NOQUOTES) .
490 "</span>&nbsp;&nbsp;&nbsp;";
492 echo "<span class='bold'>" .
493 htmlspecialchars(xl('Effective Date'),ENT_NOQUOTES) . ': ' . htmlspecialchars(oeFormatShortDate($result3['effdate'],ENT_NOQUOTES)) .
494 "</span>";
496 echo "</div><br>";
499 </div> <!-- required for expand_collapse_widget -->
500 </td>
501 </tr>
502 <tr>
503 <td>
504 <?php
505 // Demographics expand collapse widget
506 $widgetTitle = xl("Demographics");
507 $widgetLabel = "demographics";
508 $widgetButtonLabel = xl("Edit");
509 $widgetButtonLink = "demographics_full.php";
510 $widgetButtonClass = "";
511 $linkMethod = "html";
512 $bodyClass = "";
513 $widgetAuth = ($thisauth == "write");
514 $fixedWidth = true;
515 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
516 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
517 $widgetAuth, $fixedWidth);
519 <div id="DEM" >
520 <ul class="tabNav">
521 <?php display_layout_tabs('DEM', $result, $result2); ?>
522 </ul>
523 <div class="tabContainer">
524 <?php display_layout_tabs_data('DEM', $result, $result2); ?>
525 </div>
526 </div>
527 </div> <!-- required for expand_collapse_widget -->
528 </td>
529 </tr>
531 <tr>
532 <td>
533 <?php
534 $insurance_count = 0;
535 foreach (array('primary','secondary','tertiary') as $instype) {
536 $enddate = 'Present';
537 $query = "SELECT * FROM insurance_data WHERE " .
538 "pid = ? AND type = ? " .
539 "ORDER BY date DESC";
540 $res = sqlStatement($query, array($pid, $instype) );
541 while( $row = sqlFetchArray($res) ) {
542 if ($row['provider'] ) $insurance_count++;
546 if ( $insurance_count > 0 ) {
547 // Insurance expand collapse widget
548 $widgetTitle = xl("Insurance");
549 $widgetLabel = "insurance";
550 $widgetButtonLabel = xl("Edit");
551 $widgetButtonLink = "demographics_full.php";
552 $widgetButtonClass = "";
553 $linkMethod = "html";
554 $bodyClass = "";
555 $widgetAuth = ($thisauth == "write");
556 $fixedWidth = true;
557 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
558 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
559 $widgetAuth, $fixedWidth);
561 if ( $insurance_count > 0 ) {
564 <ul class="tabNav"><?php
565 ///////////////////////////////// INSURANCE SECTION
566 $first = true;
567 foreach (array('primary','secondary','tertiary') as $instype) {
569 $query = "SELECT * FROM insurance_data WHERE " .
570 "pid = ? AND type = ? " .
571 "ORDER BY date DESC";
572 $res = sqlStatement($query, array($pid, $instype) );
574 $enddate = 'Present';
576 while( $row = sqlFetchArray($res) ) {
577 if ($row['provider'] ) {
579 $ins_description = ucfirst($instype);
580 $ins_description = xl($ins_description);
581 $ins_description .= strcmp($enddate, 'Present') != 0 ? " (".xl('Old').")" : "";
583 <li <?php echo $first ? 'class="current"' : '' ?>><a href="/play/javascript-tabbed-navigation/">
584 <?php echo htmlspecialchars($ins_description,ENT_NOQUOTES); ?></a></li>
585 <?php
586 $first = false;
588 $enddate = $row['date'];
591 // Display the eligibility tab
592 echo "<li><a href='/play/javascript-tabbed-navigation/'>" .
593 htmlspecialchars( xl('Eligibility'), ENT_NOQUOTES) . "</a></li>";
595 ?></ul><?php
597 } ?>
599 <div class="tabContainer">
600 <?php
601 $first = true;
602 foreach (array('primary','secondary','tertiary') as $instype) {
603 $enddate = 'Present';
605 $query = "SELECT * FROM insurance_data WHERE " .
606 "pid = ? AND type = ? " .
607 "ORDER BY date DESC";
608 $res = sqlStatement($query, array($pid, $instype) );
609 while( $row = sqlFetchArray($res) ) {
610 if ($row['provider'] ) {
612 <div class="tab <?php echo $first ? 'current' : '' ?>">
613 <table border='0' cellpadding='0' width='100%'>
614 <?php
615 $icobj = new InsuranceCompany($row['provider']);
616 $adobj = $icobj->get_address();
617 $insco_name = trim($icobj->get_name());
619 <tr>
620 <td valign='top' colspan='3'>
621 <span class='text'>
622 <?php if (strcmp($enddate, 'Present') != 0) echo htmlspecialchars(xl("Old"),ENT_NOQUOTES)." "; ?>
623 <?php $tempinstype=ucfirst($instype); echo htmlspecialchars(xl($tempinstype.' Insurance'),ENT_NOQUOTES); ?>
624 <?php if (strcmp($row['date'], '0000-00-00') != 0) { ?>
625 <?php echo htmlspecialchars(xl('from','',' ',' ').$row['date'],ENT_NOQUOTES); ?>
626 <?php } ?>
627 <?php echo htmlspecialchars(xl('until','',' ',' '),ENT_NOQUOTES);
628 echo (strcmp($enddate, 'Present') != 0) ? $enddate : htmlspecialchars(xl('Present'),ENT_NOQUOTES); ?>:</span>
629 </td>
630 </tr>
631 <tr>
632 <td valign='top'>
633 <span class='text'>
634 <?php
635 if ($insco_name) {
636 echo htmlspecialchars($insco_name,ENT_NOQUOTES) . '<br>';
637 if (trim($adobj->get_line1())) {
638 echo htmlspecialchars($adobj->get_line1(),ENT_NOQUOTES) . '<br>';
639 echo htmlspecialchars($adobj->get_city() . ', ' . $adobj->get_state() . ' ' . $adobj->get_zip(),ENT_NOQUOTES);
641 } else {
642 echo "<font color='red'><b>".htmlspecialchars(xl('Unassigned'),ENT_NOQUOTES)."</b></font>";
645 <br>
646 <?php echo htmlspecialchars(xl('Policy Number'),ENT_NOQUOTES); ?>:
647 <?php echo htmlspecialchars($row['policy_number'],ENT_NOQUOTES) ?><br>
648 <?php echo htmlspecialchars(xl('Plan Name'),ENT_NOQUOTES); ?>:
649 <?php echo htmlspecialchars($row['plan_name'],ENT_NOQUOTES); ?><br>
650 <?php echo htmlspecialchars(xl('Group Number'),ENT_NOQUOTES); ?>:
651 <?php echo htmlspecialchars($row['group_number'],ENT_NOQUOTES); ?></span>
652 </td>
653 <td valign='top'>
654 <span class='bold'><?php echo htmlspecialchars(xl('Subscriber'),ENT_NOQUOTES); ?>: </span><br>
655 <span class='text'><?php echo htmlspecialchars($row['subscriber_fname'] . ' ' . $row['subscriber_mname'] . ' ' . $row['subscriber_lname'],ENT_NOQUOTES); ?>
656 <?php
657 if ($row['subscriber_relationship'] != "") {
658 echo "(" . htmlspecialchars($row['subscriber_relationship'],ENT_NOQUOTES) . ")";
661 <br>
662 <?php echo htmlspecialchars(xl('S.S.'),ENT_NOQUOTES); ?>:
663 <?php echo htmlspecialchars($row['subscriber_ss'],ENT_NOQUOTES); ?><br>
664 <?php echo htmlspecialchars(xl('D.O.B.'),ENT_NOQUOTES); ?>:
665 <?php if ($row['subscriber_DOB'] != "0000-00-00 00:00:00") echo htmlspecialchars($row['subscriber_DOB'],ENT_NOQUOTES); ?><br>
666 <?php echo htmlspecialchars(xl('Phone'),ENT_NOQUOTES); ?>:
667 <?php echo htmlspecialchars($row['subscriber_phone'],ENT_NOQUOTES); ?>
668 </span>
669 </td>
670 <td valign='top'>
671 <span class='bold'><?php echo htmlspecialchars(xl('Subscriber Address'),ENT_NOQUOTES); ?>: </span><br>
672 <span class='text'><?php echo htmlspecialchars($row['subscriber_street'],ENT_NOQUOTES); ?><br>
673 <?php echo htmlspecialchars($row['subscriber_city'],ENT_NOQUOTES); ?>
674 <?php if($row['subscriber_state'] != "") echo ", "; echo htmlspecialchars($row['subscriber_state'],ENT_NOQUOTES); ?>
675 <?php if($row['subscriber_country'] != "") echo ", "; echo htmlspecialchars($row['subscriber_country'],ENT_NOQUOTES); ?>
676 <?php echo " " . htmlspecialchars($row['subscriber_postal_code'],ENT_NOQUOTES); ?></span>
678 <?php if (trim($row['subscriber_employer'])) { ?>
679 <br><span class='bold'><?php echo htmlspecialchars(xl('Subscriber Employer'),ENT_NOQUOTES); ?>: </span><br>
680 <span class='text'><?php echo htmlspecialchars($row['subscriber_employer'],ENT_NOQUOTES); ?><br>
681 <?php echo htmlspecialchars($row['subscriber_employer_street'],ENT_NOQUOTES); ?><br>
682 <?php echo htmlspecialchars($row['subscriber_employer_city'],ENT_NOQUOTES); ?>
683 <?php if($row['subscriber_employer_city'] != "") echo ", "; echo htmlspecialchars($row['subscriber_employer_state'],ENT_NOQUOTES); ?>
684 <?php if($row['subscriber_employer_country'] != "") echo ", "; echo htmlspecialchars($row['subscriber_employer_country'],ENT_NOQUOTES); ?>
685 <?php echo " " . htmlspecialchars($row['subscriber_employer_postal_code'],ENT_NOQUOTES); ?>
686 </span>
687 <?php } ?>
689 </td>
690 </tr>
691 <tr>
692 <td>
693 <?php if ($row['copay'] != "") { ?>
694 <span class='bold'><?php echo htmlspecialchars(xl('CoPay'),ENT_NOQUOTES); ?>: </span>
695 <span class='text'><?php echo htmlspecialchars($row['copay'],ENT_NOQUOTES); ?></span>
696 <?php } ?>
697 <br>
698 <span class='bold'><?php echo htmlspecialchars(xl('Accept Assignment'),ENT_NOQUOTES); ?>:</span>
699 <span class='text'><?php if($row['accept_assignment'] == "TRUE") echo xl("YES"); ?>
700 <?php if($row['accept_assignment'] == "FALSE") echo xl("NO"); ?></span>
701 </td>
702 <td valign='top'></td>
703 <td valign='top'></td>
704 </tr>
706 </table>
707 </div>
708 <?php
710 } // end if ($row['provider'])
711 $enddate = $row['date'];
712 $first = false;
713 } // end while
714 } // end foreach
716 // Display the eligibility information
717 echo "<div class='tab'>";
718 show_eligibility_information($pid,true);
719 echo "</div>";
721 ///////////////////////////////// END INSURANCE SECTION
723 </div>
725 <?php } // ?>
727 </td>
728 </tr>
730 <tr>
731 <td width='650px'>
733 <?php
734 // Notes expand collapse widget
735 $widgetTitle = xl("Notes");
736 $widgetLabel = "pnotes";
737 $widgetButtonLabel = xl("Edit");
738 $widgetButtonLink = "pnotes_full.php";
739 $widgetButtonClass = "";
740 $linkMethod = "html";
741 $bodyClass = "notab";
742 $widgetAuth = true;
743 $fixedWidth = true;
744 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
745 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
746 $widgetAuth, $fixedWidth);
749 <br/>
750 <div style='margin-left:10px' class='text'><img src='../../pic/ajax-loader.gif'/></div><br/>
751 </div>
752 </td>
753 </tr>
754 <?php if ( (acl_check('patients', 'med')) && ($GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_prw']) ) {
755 echo "<tr><td width='650px'>";
756 // patient reminders collapse widget
757 $widgetTitle = xl("Patient Reminders");
758 $widgetLabel = "patient_reminders";
759 $widgetButtonLabel = xl("Edit");
760 $widgetButtonLink = "../reminder/patient_reminders.php?mode=simple&patient_id=".$pid;
761 $widgetButtonClass = "";
762 $linkMethod = "html";
763 $bodyClass = "notab";
764 $widgetAuth = true;
765 $fixedWidth = true;
766 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth); ?>
767 <br/>
768 <div style='margin-left:10px' class='text'><image src='../../pic/ajax-loader.gif'/></div><br/>
769 </div>
770 </td>
771 </tr>
772 <?php } //end if prw is activated ?>
774 <tr>
775 <td width='650px'>
776 <?php
777 // disclosures expand collapse widget
778 $widgetTitle = xl("Disclosures");
779 $widgetLabel = "disclosures";
780 $widgetButtonLabel = xl("Edit");
781 $widgetButtonLink = "disclosure_full.php";
782 $widgetButtonClass = "";
783 $linkMethod = "html";
784 $bodyClass = "notab";
785 $widgetAuth = true;
786 $fixedWidth = true;
787 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
788 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
789 $widgetAuth, $fixedWidth);
791 <br/>
792 <div style='margin-left:10px' class='text'><img src='../../pic/ajax-loader.gif'/></div><br/>
793 </div>
794 </td>
795 </tr>
797 <?php if ($vitals_is_registered) { ?>
798 <tr>
799 <td width='650px'>
800 <?php // vitals expand collapse widget
801 $widgetTitle = xl("Vitals");
802 $widgetLabel = "vitals";
803 $widgetButtonLabel = xl("Trend");
804 $widgetButtonLink = "../encounter/trend_form.php?formname=vitals";
805 $widgetButtonClass = "";
806 $linkMethod = "html";
807 $bodyClass = "notab";
808 // check to see if any vitals exist
809 $existVitals = sqlQuery("SELECT * FROM form_vitals WHERE pid=?", array($pid) );
810 if ($existVitals) {
811 $widgetAuth = true;
813 else {
814 $widgetAuth = false;
816 $fixedWidth = true;
817 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
818 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
819 $widgetAuth, $fixedWidth);
821 <br/>
822 <div style='margin-left:10px' class='text'><img src='../../pic/ajax-loader.gif'/></div><br/>
823 </div>
824 </td>
825 </tr>
826 <?php } // end if ($vitals_is_registered) ?>
828 <?php
829 // This generates a section similar to Vitals for each LBF form that
830 // supports charting. The form ID is used as the "widget label".
832 $gfres = sqlStatement("SELECT option_id, title FROM list_options WHERE " .
833 "list_id = 'lbfnames' AND option_value > 0 ORDER BY seq, title");
834 while($gfrow = sqlFetchArray($gfres)) {
836 <tr>
837 <td width='650px'>
838 <?php // vitals expand collapse widget
839 $vitals_form_id = $gfrow['option_id'];
840 $widgetTitle = $gfrow['title'];
841 $widgetLabel = $vitals_form_id;
842 $widgetButtonLabel = xl("Trend");
843 $widgetButtonLink = "../encounter/trend_form.php?formname=$vitals_form_id";
844 $widgetButtonClass = "";
845 $linkMethod = "html";
846 $bodyClass = "notab";
847 // check to see if any instances exist for this patient
848 $existVitals = sqlQuery(
849 "SELECT * FROM forms WHERE pid = ? AND formdir = ? AND deleted = 0",
850 array($pid, $vitals_form_id));
851 $widgetAuth = $existVitals ? true : false;
852 $fixedWidth = true;
853 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
854 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
855 $widgetAuth, $fixedWidth);
857 <br/>
858 <div style='margin-left:10px' class='text'>
859 <image src='../../pic/ajax-loader.gif'/>
860 </div>
861 <br/>
862 </div> <!-- This is required by expand_collapse_widget(). -->
863 </td>
864 </tr>
865 <?php
866 } // end while
869 </table>
871 </div>
872 <!-- end left column div -->
874 <!-- start right column div -->
875 <div>
876 <table>
877 <tr>
878 <td>
880 <div>
881 <?php
883 // If there is an ID Card or any Photos show the widget
884 $photos = pic_array($pid, $GLOBALS['patient_photo_category_name']);
885 if ($photos or $idcard_doc_id )
887 $widgetTitle = xl("ID Card") . '/' . xl("Photos");
888 $widgetLabel = "photos";
889 $linkMethod = "javascript";
890 $bodyClass = "notab-right";
891 $widgetAuth = false;
892 $fixedWidth = false;
893 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel ,
894 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
895 $widgetAuth, $fixedWidth);
897 <br />
898 <?php
899 if ($idcard_doc_id) {
900 image_widget($idcard_doc_id, $GLOBALS['patient_id_category_name']);
903 foreach ($photos as $photo_doc_id) {
904 image_widget($photo_doc_id, $GLOBALS['patient_photo_category_name']);
909 <br />
910 </div>
911 <div>
912 <?php
913 // Advance Directives
914 if ($GLOBALS['advance_directives_warning']) {
915 // advance directives expand collapse widget
916 $widgetTitle = xl("Advance Directives");
917 $widgetLabel = "directives";
918 $widgetButtonLabel = xl("Edit");
919 $widgetButtonLink = "return advdirconfigure();";
920 $widgetButtonClass = "";
921 $linkMethod = "javascript";
922 $bodyClass = "summary_item small";
923 $widgetAuth = true;
924 $fixedWidth = false;
925 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
926 $counterFlag = false; //flag to record whether any categories contain ad records
927 $query = "SELECT id FROM categories WHERE name='Advance Directive'";
928 $myrow2 = sqlQuery($query);
929 if ($myrow2) {
930 $parentId = $myrow2['id'];
931 $query = "SELECT id, name FROM categories WHERE parent=?";
932 $resNew1 = sqlStatement($query, array($parentId) );
933 while ($myrows3 = sqlFetchArray($resNew1)) {
934 $categoryId = $myrows3['id'];
935 $nameDoc = $myrows3['name'];
936 $query = "SELECT documents.date, documents.id " .
937 "FROM documents " .
938 "INNER JOIN categories_to_documents " .
939 "ON categories_to_documents.document_id=documents.id " .
940 "WHERE categories_to_documents.category_id=? " .
941 "AND documents.foreign_id=? " .
942 "ORDER BY documents.date DESC";
943 $resNew2 = sqlStatement($query, array($categoryId, $pid) );
944 $limitCounter = 0; // limit to one entry per category
945 while (($myrows4 = sqlFetchArray($resNew2)) && ($limitCounter == 0)) {
946 $dateTimeDoc = $myrows4['date'];
947 // remove time from datetime stamp
948 $tempParse = explode(" ",$dateTimeDoc);
949 $dateDoc = $tempParse[0];
950 $idDoc = $myrows4['id'];
951 echo "<a href='$web_root/controller.php?document&retrieve&patient_id=" .
952 htmlspecialchars($pid,ENT_QUOTES) . "&document_id=" .
953 htmlspecialchars($idDoc,ENT_QUOTES) . "&as_file=true'>" .
954 htmlspecialchars(xl_document_category($nameDoc),ENT_NOQUOTES) . "</a> " .
955 htmlspecialchars($dateDoc,ENT_NOQUOTES);
956 echo "<br>";
957 $limitCounter = $limitCounter + 1;
958 $counterFlag = true;
962 if (!$counterFlag) {
963 echo "&nbsp;&nbsp;" . htmlspecialchars(xl('None'),ENT_NOQUOTES);
964 } ?>
965 </div>
966 <?php } // close advanced dir block
968 // This is a feature for a specific client. -- Rod
969 if ($GLOBALS['cene_specific']) {
970 echo " <br />\n";
972 $imagedir = $GLOBALS['OE_SITE_DIR'] . "/documents/$pid/demographics";
973 $imagepath = "$web_root/sites/" . $_SESSION['site_id'] . "/documents/$pid/demographics";
975 echo " <a href='' onclick=\"return sendimage($pid, 'photo');\" " .
976 "title='Click to attach patient image'>\n";
977 if (is_file("$imagedir/photo.jpg")) {
978 echo " <img src='$imagepath/photo.jpg' /></a>\n";
979 } else {
980 echo " Attach Patient Image</a><br />\n";
982 echo " <br />&nbsp;<br />\n";
984 echo " <a href='' onclick=\"return sendimage($pid, 'fingerprint');\" " .
985 "title='Click to attach fingerprint'>\n";
986 if (is_file("$imagedir/fingerprint.jpg")) {
987 echo " <img src='$imagepath/fingerprint.jpg' /></a>\n";
988 } else {
989 echo " Attach Biometric Fingerprint</a><br />\n";
991 echo " <br />&nbsp;<br />\n";
994 // This stuff only applies to athletic team use of OpenEMR. The client
995 // insisted on being able to quickly change fitness and return date here:
997 if (false && $GLOBALS['athletic_team']) {
998 // blue green yellow red orange
999 $fitcolors = array('#6677ff','#00cc00','#ffff00','#ff3333','#ff8800','#ffeecc','#ffccaa');
1000 if (!empty($GLOBALS['fitness_colors'])) $fitcolors = $GLOBALS['fitness_colors'];
1001 $fitcolor = $fitcolors[0];
1002 $form_fitness = $_POST['form_fitness'];
1003 $form_userdate1 = fixDate($_POST['form_userdate1'], '');
1004 $form_issue_id = $_POST['form_issue_id'];
1005 if ($form_submit) {
1006 $returndate = $form_userdate1 ? "'$form_userdate1'" : "NULL";
1007 sqlStatement("UPDATE patient_data SET fitness = ?, " .
1008 "userdate1 = ? WHERE pid = ?", array($form_fitness, $returndate, $pid) );
1009 // Update return date in the designated issue, if requested.
1010 if ($form_issue_id) {
1011 sqlStatement("UPDATE lists SET returndate = ? WHERE " .
1012 "id = ?", array($returndate, $form_issue_id) );
1014 } else {
1015 $form_fitness = $result['fitness'];
1016 if (! $form_fitness) $form_fitness = 1;
1017 $form_userdate1 = $result['userdate1'];
1019 $fitcolor = $fitcolors[$form_fitness - 1];
1020 echo " <form method='post' action='demographics.php' onsubmit='return validate()'>\n";
1021 echo " <span class='bold'>Fitness to Play:</span><br />\n";
1022 echo " <select name='form_fitness' style='background-color:$fitcolor'>\n";
1023 $res = sqlStatement("SELECT * FROM list_options WHERE " .
1024 "list_id = 'fitness' ORDER BY seq");
1025 while ($row = sqlFetchArray($res)) {
1026 $key = $row['option_id'];
1027 echo " <option value='" . htmlspecialchars($key,ENT_QUOTES) . "'";
1028 if ($key == $form_fitness) echo " selected";
1029 echo ">" . htmlspecialchars($row['title'],ENT_NOQUOTES) . "</option>\n";
1031 echo " </select>\n";
1032 echo " <br /><span class='bold'>Return to Play:</span><br>\n";
1033 echo " <input type='text' size='10' name='form_userdate1' id='form_userdate1' " .
1034 "value='$form_userdate1' " .
1035 "title='" . htmlspecialchars(xl('yyyy-mm-dd Date of return to play'),ENT_QUOTES) . "' " .
1036 "onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)' />\n" .
1037 " <img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22' " .
1038 "id='img_userdate1' border='0' alt='[?]' style='cursor:pointer' " .
1039 "title='" . htmlspecialchars(xl('Click here to choose a date'),ENT_QUOTES) . "'>\n";
1040 echo " <input type='hidden' name='form_original_userdate1' value='" . htmlspecialchars($form_userdate1,ENT_QUOTES) . "' />\n";
1041 echo " <input type='hidden' name='form_issue_id' value='' />\n";
1042 echo "<p><input type='submit' name='form_submit' value='Change' /></p>\n";
1043 echo " </form>\n";
1046 // Show current and upcoming appointments.
1047 if (isset($pid) && !$GLOBALS['disable_calendar']) {
1048 $query = "SELECT e.pc_eid, e.pc_aid, e.pc_title, e.pc_eventDate, " .
1049 "e.pc_startTime, e.pc_hometext, u.fname, u.lname, u.mname, " .
1050 "c.pc_catname " .
1051 "FROM openemr_postcalendar_events AS e, users AS u, " .
1052 "openemr_postcalendar_categories AS c WHERE " .
1053 "e.pc_pid = ? AND e.pc_eventDate >= CURRENT_DATE AND " .
1054 "u.id = e.pc_aid AND e.pc_catid = c.pc_catid " .
1055 "ORDER BY e.pc_eventDate, e.pc_startTime";
1056 $res = sqlStatement($query, array($pid) );
1058 if ( (acl_check('patients', 'med')) && ($GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_crw']) ) {
1059 // clinical summary expand collapse widget
1060 $widgetTitle = xl("Clinical Reminders");
1061 $widgetLabel = "clinical_reminders";
1062 $widgetButtonLabel = xl("Edit");
1063 $widgetButtonLink = "../reminder/clinical_reminders.php?patient_id=".$pid;;
1064 $widgetButtonClass = "";
1065 $linkMethod = "html";
1066 $bodyClass = "summary_item small";
1067 $widgetAuth = true;
1068 $fixedWidth = false;
1069 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1070 echo "<br/>";
1071 echo "<div style='margin-left:10px' class='text'><image src='../../pic/ajax-loader.gif'/></div><br/>";
1072 echo "</div>";
1073 } // end if crw
1075 // appointments expand collapse widget
1076 $widgetTitle = xl("Appointments");
1077 $widgetLabel = "appointments";
1078 $widgetButtonLabel = xl("Add");
1079 $widgetButtonLink = "return newEvt();";
1080 $widgetButtonClass = "";
1081 $linkMethod = "javascript";
1082 $bodyClass = "summary_item small";
1083 $widgetAuth = (isset($res) && $res != null);
1084 $fixedWidth = false;
1085 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1087 $count = 0;
1088 while($row = sqlFetchArray($res)) {
1089 $count++;
1090 $dayname = date("l", strtotime($row['pc_eventDate']));
1091 $dispampm = "am";
1092 $disphour = substr($row['pc_startTime'], 0, 2) + 0;
1093 $dispmin = substr($row['pc_startTime'], 3, 2);
1094 if ($disphour >= 12) {
1095 $dispampm = "pm";
1096 if ($disphour > 12) $disphour -= 12;
1098 $etitle = xl('(Click to edit)');
1099 if ($row['pc_hometext'] != "") {
1100 $etitle = xl('Comments').": ".($row['pc_hometext'])."\r\n".$etitle;
1102 echo "<a href='javascript:oldEvt(" . htmlspecialchars($row['pc_eid'],ENT_QUOTES) .
1103 ")' title='" . htmlspecialchars($etitle,ENT_QUOTES) . "'>";
1104 echo "<b>" . htmlspecialchars(xl($dayname) . ", " . $row['pc_eventDate'],ENT_NOQUOTES) . "</b><br>";
1105 echo htmlspecialchars("$disphour:$dispmin " . xl($dispampm) . " " . xl_appt_category($row['pc_catname']),ENT_NOQUOTES) . "<br>\n";
1106 echo htmlspecialchars($row['fname'] . " " . $row['lname'],ENT_NOQUOTES) . "</a><br>\n";
1108 if (isset($res) && $res != null) {
1109 if ( $count < 1 ) { echo "&nbsp;&nbsp;" . htmlspecialchars(xl('None'),ENT_NOQUOTES); }
1110 echo "</div>";
1114 </div>
1116 <div id='stats_div'>
1117 <br/>
1118 <div style='margin-left:10px' class='text'><img src='../../pic/ajax-loader.gif'/></div><br/>
1119 </div>
1120 </td>
1121 </tr>
1122 </table>
1124 </div> <!-- end right column div -->
1126 </td>
1128 </tr>
1129 </table>
1131 </div> <!-- end main content div -->
1133 <?php if ($GLOBALS['concurrent_layout'] && $_GET['set_pid']) { ?>
1134 <script language='JavaScript'>
1135 top.window.parent.left_nav.setPatient(<?php echo "'" . htmlspecialchars(($result['fname']) . " " . ($result['lname']),ENT_QUOTES) .
1136 "'," . htmlspecialchars($pid,ENT_QUOTES) . ",'" . htmlspecialchars(($result['pubpid']),ENT_QUOTES) .
1137 "','', ' " . htmlspecialchars(xl('DOB') . ": " . oeFormatShortDate($result['DOB_YMD']) . " " . xl('Age') . ": " . getPatientAge($result['DOB_YMD']), ENT_QUOTES) . "'"; ?>);
1138 EncounterDateArray=new Array;
1139 CalendarCategoryArray=new Array;
1140 EncounterIdArray=new Array;
1141 Count=0;
1142 <?php
1143 //Encounter details are stored to javacript as array.
1144 $result4 = sqlStatement("SELECT fe.encounter,fe.date,openemr_postcalendar_categories.pc_catname FROM form_encounter AS fe ".
1145 " left join openemr_postcalendar_categories on fe.pc_catid=openemr_postcalendar_categories.pc_catid WHERE fe.pid = ? order by fe.date desc", array($pid));
1146 if(sqlNumRows($result4)>0)
1147 while($rowresult4 = sqlFetchArray($result4))
1150 EncounterIdArray[Count]='<?php echo htmlspecialchars($rowresult4['encounter'], ENT_QUOTES); ?>';
1151 EncounterDateArray[Count]='<?php echo htmlspecialchars(oeFormatShortDate(date("Y-m-d", strtotime($rowresult4['date']))), ENT_QUOTES); ?>';
1152 CalendarCategoryArray[Count]='<?php echo htmlspecialchars( xl_appt_category($rowresult4['pc_catname']), ENT_QUOTES); ?>';
1153 Count++;
1154 <?php
1157 top.window.parent.left_nav.setPatientEncounter(EncounterIdArray,EncounterDateArray,CalendarCategoryArray);
1158 parent.left_nav.setRadio(window.name, 'dem');
1159 </script>
1160 <?php } ?>
1162 <?php if (false && $GLOBALS['athletic_team']) { ?>
1163 <script language='JavaScript'>
1164 Calendar.setup({inputField:"form_userdate1", ifFormat:"%Y-%m-%d", button:"img_userdate1"});
1165 </script>
1166 <?php } ?>
1168 </body>
1169 </html>