NewCrop E-Prescription Module.
[openemr.git] / interface / patient_file / summary / demographics.php
blob84c45e27523680f6df61b0343e359b7c8d30dab8
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(){
225 <?php
226 if($GLOBALS['erx_enable']){
227 //$soap_status=sqlQuery("select soap_import_status from patient_data where pid=?",array($pid));
228 $soap_status=sqlStatement("select soap_import_status,pid from patient_data where soap_import_status in ('1','3')");
229 while($row_soapstatus=sqlFetchArray($soap_status)){
230 //if($soap_status['soap_import_status']=='1' || $soap_status['soap_import_status']=='3'){ ?>
231 top.restoreSession();
232 $.ajax({
233 type: "POST",
234 url: "../../soap_functions/soap_patientfullmedication.php",
235 dataType: "html",
236 data: {
237 patient:<?php echo $row_soapstatus['pid']; ?>,
239 async: false,
240 success: function(thedata){
241 alert(thedata);
243 error:function(){
244 alert('ajax error');
247 <?php
248 //}
249 //elseif($soap_status['soap_import_status']=='3'){ ?>
250 top.restoreSession();
251 $.ajax({
252 type: "POST",
253 url: "../../soap_functions/soap_allergy.php",
254 dataType: "html",
255 data: {
256 patient:<?php echo $row_soapstatus['pid']; ?>,
258 async: false,
259 success: function(thedata){
260 alert(thedata);
262 error:function(){
263 alert('ajax error');
266 <?php
267 //}
271 // load divs
272 $("#stats_div").load("stats.php", { 'embeddedScreen' : true }, function() {
273 // (note need to place javascript code here also to get the dynamic link to work)
274 $(".rx_modal").fancybox( {
275 'overlayOpacity' : 0.0,
276 'showCloseButton' : true,
277 'frameHeight' : 500,
278 'frameWidth' : 800,
279 'centerOnScroll' : false,
280 'callbackOnClose' : function() {
281 refreshme();
285 $("#pnotes_ps_expand").load("pnotes_fragment.php");
286 $("#disclosures_ps_expand").load("disc_fragment.php");
288 <?php if ($GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_crw']) { ?>
289 top.restoreSession();
290 $("#clinical_reminders_ps_expand").load("clinical_reminders_fragment.php", { 'embeddedScreen' : true }, function() {
291 // (note need to place javascript code here also to get the dynamic link to work)
292 $(".medium_modal").fancybox( {
293 'overlayOpacity' : 0.0,
294 'showCloseButton' : true,
295 'frameHeight' : 500,
296 'frameWidth' : 800,
297 'centerOnScroll' : false,
298 'callbackOnClose' : function() {
299 refreshme();
303 <?php } // end crw?>
305 <?php if ($GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_prw']) { ?>
306 top.restoreSession();
307 $("#patient_reminders_ps_expand").load("patient_reminders_fragment.php");
308 <?php } // end prw?>
310 <?php if ($vitals_is_registered) { ?>
311 // Initialize the Vitals form if it is registered.
312 $("#vitals_ps_expand").load("vitals_fragment.php");
313 <?php } ?>
315 <?php
316 // Initialize for each applicable LBF form.
317 $gfres = sqlStatement("SELECT option_id FROM list_options WHERE " .
318 "list_id = 'lbfnames' AND option_value > 0 ORDER BY seq, title");
319 while($gfrow = sqlFetchArray($gfres)) {
321 $("#<?php echo $gfrow['option_id']; ?>_ps_expand").load("lbf_fragment.php?formname=<?php echo $gfrow['option_id']; ?>");
322 <?php
326 // fancy box
327 enable_modals();
329 tabbify();
331 // modal for dialog boxes
332 $(".large_modal").fancybox( {
333 'overlayOpacity' : 0.0,
334 'showCloseButton' : true,
335 'frameHeight' : 600,
336 'frameWidth' : 1000,
337 'centerOnScroll' : false
340 // modal for image viewer
341 $(".image_modal").fancybox( {
342 'overlayOpacity' : 0.0,
343 'showCloseButton' : true,
344 'centerOnScroll' : false,
345 'autoscale' : true
348 $(".iframe1").fancybox( {
349 'left':10,
350 'overlayOpacity' : 0.0,
351 'showCloseButton' : true,
352 'frameHeight' : 300,
353 'frameWidth' : 350
355 // special size for patient portal
356 $(".small_modal").fancybox( {
357 'overlayOpacity' : 0.0,
358 'showCloseButton' : true,
359 'frameHeight' : 180,
360 'frameWidth' : 380,
361 'centerOnScroll' : false
366 </script>
368 <style type="css/text">
369 #pnotes_ps_expand {
370 height:auto;
371 width:100%;
373 </style>
375 </head>
377 <body class="body_top">
379 <?php
380 $result = getPatientData($pid, "*, DATE_FORMAT(DOB,'%Y-%m-%d') as DOB_YMD");
381 $result2 = getEmployerData($pid);
382 $result3 = getInsuranceData($pid, "primary", "copay, provider, DATE_FORMAT(`date`,'%Y-%m-%d') as effdate");
383 $insco_name = "";
385 if ($result3['provider']) { // Use provider in case there is an ins record w/ unassigned insco
386 $insco_name = getInsuranceProvider($result3['provider']);
389 $thisauth = acl_check('patients', 'demo');
390 if ($thisauth) {
391 if ($result['squad'] && ! acl_check('squads', $result['squad']))
392 $thisauth = 0;
395 if (!$thisauth) {
396 echo "<p>(" . htmlspecialchars(xl('Demographics not authorized'),ENT_NOQUOTES) . ")</p>\n";
397 echo "</body>\n</html>\n";
398 exit();
401 if ($thisauth == 'write') {
402 echo "<table><tr><td><span class='title'>" .
403 htmlspecialchars(getPatientName($pid),ENT_NOQUOTES) .
404 "</span></td>";
406 if (acl_check('admin', 'super')) {
407 echo "<td style='padding-left:1em;'><a class='css_button iframe' href='../deleter.php?patient=" .
408 htmlspecialchars($pid,ENT_QUOTES) . "'>" .
409 "<span>".htmlspecialchars(xl('Delete'),ENT_NOQUOTES).
410 "</span></a></td>";
412 if($GLOBALS['erx_enable']){
413 echo '<td style="padding-left:1em;"><a class="css_button" href="../../eRx.php?page=medentry" onclick="top.restoreSession()">';
414 echo "<span>".htmlspecialchars(xl('NewCrop MedEntry'),ENT_NOQUOTES)."</span></a></td>";
415 echo '<td style="padding-left:1em;"><a class="css_button iframe1" href="../../soap_functions/soap_accountStatusDetails.php" onclick="top.restoreSession()">';
416 echo "<span>".htmlspecialchars(xl('NewCrop Account Status'),ENT_NOQUOTES)."</span></a></td><td id='accountstatus'></td>";
418 //Patient Portal
419 $portalUserSetting = true; //flag to see if patient has authorized access to portal
420 if($GLOBALS['portal_onsite_enable'] && $GLOBALS['portal_onsite_address']){
421 $portalStatus = sqlQuery("SELECT allow_patient_portal FROM patient_data WHERE pid=?",array($pid));
422 if ($portalStatus['allow_patient_portal']=='YES') {
423 $portalLogin = sqlQuery("SELECT pid FROM `patient_access_onsite` WHERE `pid`=?", array($pid));
424 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()'>";
425 if (empty($portalLogin)) {
426 echo "<span>".htmlspecialchars(xl('Create Onsite Portal Credentials'),ENT_NOQUOTES)."</span></a></td>";
428 else {
429 echo "<span>".htmlspecialchars(xl('Reset Onsite Portal Credentials'),ENT_NOQUOTES)."</span></a></td>";
432 else {
433 $portalUserSetting = false;
436 if($GLOBALS['portal_offsite_enable'] && $GLOBALS['portal_offsite_address']){
437 $portalStatus = sqlQuery("SELECT allow_patient_portal FROM patient_data WHERE pid=?",array($pid));
438 if ($portalStatus['allow_patient_portal']=='YES') {
439 $portalLogin = sqlQuery("SELECT pid FROM `patient_access_offsite` WHERE `pid`=?", array($pid));
440 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()'>";
441 if (empty($portalLogin)) {
442 "<span>".htmlspecialchars(xl('Create Offsite Portal Credentials'),ENT_NOQUOTES)."</span></a></td>";
444 else {
445 "<span>".htmlspecialchars(xl('Reset Offsite Portal Credentials'),ENT_NOQUOTES)."</span></a></td>";
448 else {
449 $portalUserSetting = false;
452 if (!($portalUserSetting)) {
453 // Show that the patient has not authorized portal access
454 echo "<td style='padding-left:1em;'>" . htmlspecialchars( xl('Patient has not authorized the Patient Portal.'), ENT_NOQUOTES) . "</td>";
456 //Patient Portal
458 // If patient is deceased, then show this (along with the number of days patient has been deceased for)
459 $days_deceased = is_patient_deceased($pid);
460 if ($days_deceased) {
461 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>";
464 echo "</tr></table>";
467 // Get the document ID of the patient ID card if access to it is wanted here.
468 $idcard_doc_id = false;
469 if ($GLOBALS['patient_id_category_name']) {
470 $idcard_doc_id = get_document_by_catg($pid, $GLOBALS['patient_id_category_name']);
474 <table cellspacing='0' cellpadding='0' border='0'>
475 <tr>
476 <td class="small" colspan='4'>
477 <a href="../history/history.php" onclick='top.restoreSession()'>
478 <?php echo htmlspecialchars(xl('History'),ENT_NOQUOTES); ?></a>
480 <?php //note that we have temporarily removed report screen from the modal view ?>
481 <a href="../report/patient_report.php" onclick='top.restoreSession()'>
482 <?php echo htmlspecialchars(xl('Report'),ENT_NOQUOTES); ?></a>
484 <?php //note that we have temporarily removed document screen from the modal view ?>
485 <a href="../../../controller.php?document&list&patient_id=<?php echo $pid;?>" onclick='top.restoreSession()'>
486 <?php echo htmlspecialchars(xl('Documents'),ENT_NOQUOTES); ?></a>
488 <a href="../transaction/transactions.php" class='iframe large_modal' onclick='top.restoreSession()'>
489 <?php echo htmlspecialchars(xl('Transactions'),ENT_NOQUOTES); ?></a>
491 <a href="stats_full.php?active=all" onclick='top.restoreSession()'>
492 <?php echo htmlspecialchars(xl('Issues'),ENT_NOQUOTES); ?></a>
493 </td>
494 </tr>
495 </table> <!-- end header -->
497 <div style='margin-top:10px'> <!-- start main content div -->
498 <table border="0" cellspacing="0" cellpadding="0" width="100%">
499 <tr>
500 <td align="left" valign="top">
501 <!-- start left column div -->
502 <div style='float:left; margin-right:20px'>
503 <table cellspacing=0 cellpadding=0>
504 <tr>
505 <td>
506 <?php
507 // Billing expand collapse widget
508 $widgetTitle = xl("Billing");
509 $widgetLabel = "billing";
510 $widgetButtonLabel = xl("Edit");
511 $widgetButtonLink = "return newEvt();";
512 $widgetButtonClass = "";
513 $linkMethod = "javascript";
514 $bodyClass = "notab";
515 $widgetAuth = false;
516 $fixedWidth = true;
517 if ($GLOBALS['force_billing_widget_open']) {
518 $forceExpandAlways = true;
520 else {
521 $forceExpandAlways = false;
523 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
524 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
525 $widgetAuth, $fixedWidth, $forceExpandAlways);
527 <br>
528 <?php
529 if ($GLOBALS['oer_config']['ws_accounting']['enabled']) {
530 // Show current balance and billing note, if any.
531 echo " <div style='margin-left: 10px; margin-right: 10px'>" .
532 "<span class='bold'><font color='#ee6600'>" .
533 htmlspecialchars(xl('Balance Due'),ENT_NOQUOTES) .
534 ": " . htmlspecialchars(oeFormatMoney(get_patient_balance($pid)),ENT_NOQUOTES) .
535 "</font></span><br>";
536 if ($result['genericname2'] == 'Billing') {
537 echo "<span class='bold'><font color='red'>" .
538 htmlspecialchars(xl('Billing Note'),ENT_NOQUOTES) . ":" .
539 htmlspecialchars($result['genericval2'],ENT_NOQUOTES) .
540 "</font></span><br>";
542 if ($result3['provider']) { // Use provider in case there is an ins record w/ unassigned insco
543 echo "<span class='bold'>" .
544 htmlspecialchars(xl('Primary Insurance'),ENT_NOQUOTES) . ': ' . htmlspecialchars($insco_name,ENT_NOQUOTES) .
545 "</span>&nbsp;&nbsp;&nbsp;";
546 if ($result3['copay'] > 0) {
547 echo "<span class='bold'>" .
548 htmlspecialchars(xl('Copay'),ENT_NOQUOTES) . ': ' . htmlspecialchars($result3['copay'],ENT_NOQUOTES) .
549 "</span>&nbsp;&nbsp;&nbsp;";
551 echo "<span class='bold'>" .
552 htmlspecialchars(xl('Effective Date'),ENT_NOQUOTES) . ': ' . htmlspecialchars(oeFormatShortDate($result3['effdate'],ENT_NOQUOTES)) .
553 "</span>";
555 echo "</div><br>";
558 </div> <!-- required for expand_collapse_widget -->
559 </td>
560 </tr>
561 <tr>
562 <td>
563 <?php
564 // Demographics expand collapse widget
565 $widgetTitle = xl("Demographics");
566 $widgetLabel = "demographics";
567 $widgetButtonLabel = xl("Edit");
568 $widgetButtonLink = "demographics_full.php";
569 $widgetButtonClass = "";
570 $linkMethod = "html";
571 $bodyClass = "";
572 $widgetAuth = ($thisauth == "write");
573 $fixedWidth = true;
574 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
575 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
576 $widgetAuth, $fixedWidth);
578 <div id="DEM" >
579 <ul class="tabNav">
580 <?php display_layout_tabs('DEM', $result, $result2); ?>
581 </ul>
582 <div class="tabContainer">
583 <?php display_layout_tabs_data('DEM', $result, $result2); ?>
584 </div>
585 </div>
586 </div> <!-- required for expand_collapse_widget -->
587 </td>
588 </tr>
590 <tr>
591 <td>
592 <?php
593 $insurance_count = 0;
594 foreach (array('primary','secondary','tertiary') as $instype) {
595 $enddate = 'Present';
596 $query = "SELECT * FROM insurance_data WHERE " .
597 "pid = ? AND type = ? " .
598 "ORDER BY date DESC";
599 $res = sqlStatement($query, array($pid, $instype) );
600 while( $row = sqlFetchArray($res) ) {
601 if ($row['provider'] ) $insurance_count++;
605 if ( $insurance_count > 0 ) {
606 // Insurance expand collapse widget
607 $widgetTitle = xl("Insurance");
608 $widgetLabel = "insurance";
609 $widgetButtonLabel = xl("Edit");
610 $widgetButtonLink = "demographics_full.php";
611 $widgetButtonClass = "";
612 $linkMethod = "html";
613 $bodyClass = "";
614 $widgetAuth = ($thisauth == "write");
615 $fixedWidth = true;
616 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
617 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
618 $widgetAuth, $fixedWidth);
620 if ( $insurance_count > 0 ) {
623 <ul class="tabNav"><?php
624 ///////////////////////////////// INSURANCE SECTION
625 $first = true;
626 foreach (array('primary','secondary','tertiary') as $instype) {
628 $query = "SELECT * FROM insurance_data WHERE " .
629 "pid = ? AND type = ? " .
630 "ORDER BY date DESC";
631 $res = sqlStatement($query, array($pid, $instype) );
633 $enddate = 'Present';
635 while( $row = sqlFetchArray($res) ) {
636 if ($row['provider'] ) {
638 $ins_description = ucfirst($instype);
639 $ins_description = xl($ins_description);
640 $ins_description .= strcmp($enddate, 'Present') != 0 ? " (".xl('Old').")" : "";
642 <li <?php echo $first ? 'class="current"' : '' ?>><a href="/play/javascript-tabbed-navigation/">
643 <?php echo htmlspecialchars($ins_description,ENT_NOQUOTES); ?></a></li>
644 <?php
645 $first = false;
647 $enddate = $row['date'];
650 // Display the eligibility tab
651 echo "<li><a href='/play/javascript-tabbed-navigation/'>" .
652 htmlspecialchars( xl('Eligibility'), ENT_NOQUOTES) . "</a></li>";
654 ?></ul><?php
656 } ?>
658 <div class="tabContainer">
659 <?php
660 $first = true;
661 foreach (array('primary','secondary','tertiary') as $instype) {
662 $enddate = 'Present';
664 $query = "SELECT * FROM insurance_data WHERE " .
665 "pid = ? AND type = ? " .
666 "ORDER BY date DESC";
667 $res = sqlStatement($query, array($pid, $instype) );
668 while( $row = sqlFetchArray($res) ) {
669 if ($row['provider'] ) {
671 <div class="tab <?php echo $first ? 'current' : '' ?>">
672 <table border='0' cellpadding='0' width='100%'>
673 <?php
674 $icobj = new InsuranceCompany($row['provider']);
675 $adobj = $icobj->get_address();
676 $insco_name = trim($icobj->get_name());
678 <tr>
679 <td valign='top' colspan='3'>
680 <span class='text'>
681 <?php if (strcmp($enddate, 'Present') != 0) echo htmlspecialchars(xl("Old"),ENT_NOQUOTES)." "; ?>
682 <?php $tempinstype=ucfirst($instype); echo htmlspecialchars(xl($tempinstype.' Insurance'),ENT_NOQUOTES); ?>
683 <?php if (strcmp($row['date'], '0000-00-00') != 0) { ?>
684 <?php echo htmlspecialchars(xl('from','',' ',' ').$row['date'],ENT_NOQUOTES); ?>
685 <?php } ?>
686 <?php echo htmlspecialchars(xl('until','',' ',' '),ENT_NOQUOTES);
687 echo (strcmp($enddate, 'Present') != 0) ? $enddate : htmlspecialchars(xl('Present'),ENT_NOQUOTES); ?>:</span>
688 </td>
689 </tr>
690 <tr>
691 <td valign='top'>
692 <span class='text'>
693 <?php
694 if ($insco_name) {
695 echo htmlspecialchars($insco_name,ENT_NOQUOTES) . '<br>';
696 if (trim($adobj->get_line1())) {
697 echo htmlspecialchars($adobj->get_line1(),ENT_NOQUOTES) . '<br>';
698 echo htmlspecialchars($adobj->get_city() . ', ' . $adobj->get_state() . ' ' . $adobj->get_zip(),ENT_NOQUOTES);
700 } else {
701 echo "<font color='red'><b>".htmlspecialchars(xl('Unassigned'),ENT_NOQUOTES)."</b></font>";
704 <br>
705 <?php echo htmlspecialchars(xl('Policy Number'),ENT_NOQUOTES); ?>:
706 <?php echo htmlspecialchars($row['policy_number'],ENT_NOQUOTES) ?><br>
707 <?php echo htmlspecialchars(xl('Plan Name'),ENT_NOQUOTES); ?>:
708 <?php echo htmlspecialchars($row['plan_name'],ENT_NOQUOTES); ?><br>
709 <?php echo htmlspecialchars(xl('Group Number'),ENT_NOQUOTES); ?>:
710 <?php echo htmlspecialchars($row['group_number'],ENT_NOQUOTES); ?></span>
711 </td>
712 <td valign='top'>
713 <span class='bold'><?php echo htmlspecialchars(xl('Subscriber'),ENT_NOQUOTES); ?>: </span><br>
714 <span class='text'><?php echo htmlspecialchars($row['subscriber_fname'] . ' ' . $row['subscriber_mname'] . ' ' . $row['subscriber_lname'],ENT_NOQUOTES); ?>
715 <?php
716 if ($row['subscriber_relationship'] != "") {
717 echo "(" . htmlspecialchars($row['subscriber_relationship'],ENT_NOQUOTES) . ")";
720 <br>
721 <?php echo htmlspecialchars(xl('S.S.'),ENT_NOQUOTES); ?>:
722 <?php echo htmlspecialchars($row['subscriber_ss'],ENT_NOQUOTES); ?><br>
723 <?php echo htmlspecialchars(xl('D.O.B.'),ENT_NOQUOTES); ?>:
724 <?php if ($row['subscriber_DOB'] != "0000-00-00 00:00:00") echo htmlspecialchars($row['subscriber_DOB'],ENT_NOQUOTES); ?><br>
725 <?php echo htmlspecialchars(xl('Phone'),ENT_NOQUOTES); ?>:
726 <?php echo htmlspecialchars($row['subscriber_phone'],ENT_NOQUOTES); ?>
727 </span>
728 </td>
729 <td valign='top'>
730 <span class='bold'><?php echo htmlspecialchars(xl('Subscriber Address'),ENT_NOQUOTES); ?>: </span><br>
731 <span class='text'><?php echo htmlspecialchars($row['subscriber_street'],ENT_NOQUOTES); ?><br>
732 <?php echo htmlspecialchars($row['subscriber_city'],ENT_NOQUOTES); ?>
733 <?php if($row['subscriber_state'] != "") echo ", "; echo htmlspecialchars($row['subscriber_state'],ENT_NOQUOTES); ?>
734 <?php if($row['subscriber_country'] != "") echo ", "; echo htmlspecialchars($row['subscriber_country'],ENT_NOQUOTES); ?>
735 <?php echo " " . htmlspecialchars($row['subscriber_postal_code'],ENT_NOQUOTES); ?></span>
737 <?php if (trim($row['subscriber_employer'])) { ?>
738 <br><span class='bold'><?php echo htmlspecialchars(xl('Subscriber Employer'),ENT_NOQUOTES); ?>: </span><br>
739 <span class='text'><?php echo htmlspecialchars($row['subscriber_employer'],ENT_NOQUOTES); ?><br>
740 <?php echo htmlspecialchars($row['subscriber_employer_street'],ENT_NOQUOTES); ?><br>
741 <?php echo htmlspecialchars($row['subscriber_employer_city'],ENT_NOQUOTES); ?>
742 <?php if($row['subscriber_employer_city'] != "") echo ", "; echo htmlspecialchars($row['subscriber_employer_state'],ENT_NOQUOTES); ?>
743 <?php if($row['subscriber_employer_country'] != "") echo ", "; echo htmlspecialchars($row['subscriber_employer_country'],ENT_NOQUOTES); ?>
744 <?php echo " " . htmlspecialchars($row['subscriber_employer_postal_code'],ENT_NOQUOTES); ?>
745 </span>
746 <?php } ?>
748 </td>
749 </tr>
750 <tr>
751 <td>
752 <?php if ($row['copay'] != "") { ?>
753 <span class='bold'><?php echo htmlspecialchars(xl('CoPay'),ENT_NOQUOTES); ?>: </span>
754 <span class='text'><?php echo htmlspecialchars($row['copay'],ENT_NOQUOTES); ?></span>
755 <?php } ?>
756 <br>
757 <span class='bold'><?php echo htmlspecialchars(xl('Accept Assignment'),ENT_NOQUOTES); ?>:</span>
758 <span class='text'><?php if($row['accept_assignment'] == "TRUE") echo xl("YES"); ?>
759 <?php if($row['accept_assignment'] == "FALSE") echo xl("NO"); ?></span>
760 </td>
761 <td valign='top'></td>
762 <td valign='top'></td>
763 </tr>
765 </table>
766 </div>
767 <?php
769 } // end if ($row['provider'])
770 $enddate = $row['date'];
771 $first = false;
772 } // end while
773 } // end foreach
775 // Display the eligibility information
776 echo "<div class='tab'>";
777 show_eligibility_information($pid,true);
778 echo "</div>";
780 ///////////////////////////////// END INSURANCE SECTION
782 </div>
784 <?php } // ?>
786 </td>
787 </tr>
789 <tr>
790 <td width='650px'>
792 <?php
793 // Notes expand collapse widget
794 $widgetTitle = xl("Notes");
795 $widgetLabel = "pnotes";
796 $widgetButtonLabel = xl("Edit");
797 $widgetButtonLink = "pnotes_full.php";
798 $widgetButtonClass = "";
799 $linkMethod = "html";
800 $bodyClass = "notab";
801 $widgetAuth = true;
802 $fixedWidth = true;
803 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
804 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
805 $widgetAuth, $fixedWidth);
808 <br/>
809 <div style='margin-left:10px' class='text'><img src='../../pic/ajax-loader.gif'/></div><br/>
810 </div>
811 </td>
812 </tr>
813 <?php if ( (acl_check('patients', 'med')) && ($GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_prw']) ) {
814 echo "<tr><td width='650px'>";
815 // patient reminders collapse widget
816 $widgetTitle = xl("Patient Reminders");
817 $widgetLabel = "patient_reminders";
818 $widgetButtonLabel = xl("Edit");
819 $widgetButtonLink = "../reminder/patient_reminders.php?mode=simple&patient_id=".$pid;
820 $widgetButtonClass = "";
821 $linkMethod = "html";
822 $bodyClass = "notab";
823 $widgetAuth = true;
824 $fixedWidth = true;
825 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth); ?>
826 <br/>
827 <div style='margin-left:10px' class='text'><image src='../../pic/ajax-loader.gif'/></div><br/>
828 </div>
829 </td>
830 </tr>
831 <?php } //end if prw is activated ?>
833 <tr>
834 <td width='650px'>
835 <?php
836 // disclosures expand collapse widget
837 $widgetTitle = xl("Disclosures");
838 $widgetLabel = "disclosures";
839 $widgetButtonLabel = xl("Edit");
840 $widgetButtonLink = "disclosure_full.php";
841 $widgetButtonClass = "";
842 $linkMethod = "html";
843 $bodyClass = "notab";
844 $widgetAuth = true;
845 $fixedWidth = true;
846 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
847 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
848 $widgetAuth, $fixedWidth);
850 <br/>
851 <div style='margin-left:10px' class='text'><img src='../../pic/ajax-loader.gif'/></div><br/>
852 </div>
853 </td>
854 </tr>
856 <?php if ($vitals_is_registered) { ?>
857 <tr>
858 <td width='650px'>
859 <?php // vitals expand collapse widget
860 $widgetTitle = xl("Vitals");
861 $widgetLabel = "vitals";
862 $widgetButtonLabel = xl("Trend");
863 $widgetButtonLink = "../encounter/trend_form.php?formname=vitals";
864 $widgetButtonClass = "";
865 $linkMethod = "html";
866 $bodyClass = "notab";
867 // check to see if any vitals exist
868 $existVitals = sqlQuery("SELECT * FROM form_vitals WHERE pid=?", array($pid) );
869 if ($existVitals) {
870 $widgetAuth = true;
872 else {
873 $widgetAuth = false;
875 $fixedWidth = true;
876 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
877 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
878 $widgetAuth, $fixedWidth);
880 <br/>
881 <div style='margin-left:10px' class='text'><img src='../../pic/ajax-loader.gif'/></div><br/>
882 </div>
883 </td>
884 </tr>
885 <?php } // end if ($vitals_is_registered) ?>
887 <?php
888 // This generates a section similar to Vitals for each LBF form that
889 // supports charting. The form ID is used as the "widget label".
891 $gfres = sqlStatement("SELECT option_id, title FROM list_options WHERE " .
892 "list_id = 'lbfnames' AND option_value > 0 ORDER BY seq, title");
893 while($gfrow = sqlFetchArray($gfres)) {
895 <tr>
896 <td width='650px'>
897 <?php // vitals expand collapse widget
898 $vitals_form_id = $gfrow['option_id'];
899 $widgetTitle = $gfrow['title'];
900 $widgetLabel = $vitals_form_id;
901 $widgetButtonLabel = xl("Trend");
902 $widgetButtonLink = "../encounter/trend_form.php?formname=$vitals_form_id";
903 $widgetButtonClass = "";
904 $linkMethod = "html";
905 $bodyClass = "notab";
906 // check to see if any instances exist for this patient
907 $existVitals = sqlQuery(
908 "SELECT * FROM forms WHERE pid = ? AND formdir = ? AND deleted = 0",
909 array($pid, $vitals_form_id));
910 $widgetAuth = $existVitals ? true : false;
911 $fixedWidth = true;
912 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
913 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
914 $widgetAuth, $fixedWidth);
916 <br/>
917 <div style='margin-left:10px' class='text'>
918 <image src='../../pic/ajax-loader.gif'/>
919 </div>
920 <br/>
921 </div> <!-- This is required by expand_collapse_widget(). -->
922 </td>
923 </tr>
924 <?php
925 } // end while
928 </table>
930 </div>
931 <!-- end left column div -->
933 <!-- start right column div -->
934 <div>
935 <table>
936 <tr>
937 <td>
939 <div>
940 <?php
942 // If there is an ID Card or any Photos show the widget
943 $photos = pic_array($pid, $GLOBALS['patient_photo_category_name']);
944 if ($photos or $idcard_doc_id )
946 $widgetTitle = xl("ID Card") . '/' . xl("Photos");
947 $widgetLabel = "photos";
948 $linkMethod = "javascript";
949 $bodyClass = "notab-right";
950 $widgetAuth = false;
951 $fixedWidth = false;
952 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel ,
953 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
954 $widgetAuth, $fixedWidth);
956 <br />
957 <?php
958 if ($idcard_doc_id) {
959 image_widget($idcard_doc_id, $GLOBALS['patient_id_category_name']);
962 foreach ($photos as $photo_doc_id) {
963 image_widget($photo_doc_id, $GLOBALS['patient_photo_category_name']);
968 <br />
969 </div>
970 <div>
971 <?php
972 // Advance Directives
973 if ($GLOBALS['advance_directives_warning']) {
974 // advance directives expand collapse widget
975 $widgetTitle = xl("Advance Directives");
976 $widgetLabel = "directives";
977 $widgetButtonLabel = xl("Edit");
978 $widgetButtonLink = "return advdirconfigure();";
979 $widgetButtonClass = "";
980 $linkMethod = "javascript";
981 $bodyClass = "summary_item small";
982 $widgetAuth = true;
983 $fixedWidth = false;
984 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
985 $counterFlag = false; //flag to record whether any categories contain ad records
986 $query = "SELECT id FROM categories WHERE name='Advance Directive'";
987 $myrow2 = sqlQuery($query);
988 if ($myrow2) {
989 $parentId = $myrow2['id'];
990 $query = "SELECT id, name FROM categories WHERE parent=?";
991 $resNew1 = sqlStatement($query, array($parentId) );
992 while ($myrows3 = sqlFetchArray($resNew1)) {
993 $categoryId = $myrows3['id'];
994 $nameDoc = $myrows3['name'];
995 $query = "SELECT documents.date, documents.id " .
996 "FROM documents " .
997 "INNER JOIN categories_to_documents " .
998 "ON categories_to_documents.document_id=documents.id " .
999 "WHERE categories_to_documents.category_id=? " .
1000 "AND documents.foreign_id=? " .
1001 "ORDER BY documents.date DESC";
1002 $resNew2 = sqlStatement($query, array($categoryId, $pid) );
1003 $limitCounter = 0; // limit to one entry per category
1004 while (($myrows4 = sqlFetchArray($resNew2)) && ($limitCounter == 0)) {
1005 $dateTimeDoc = $myrows4['date'];
1006 // remove time from datetime stamp
1007 $tempParse = explode(" ",$dateTimeDoc);
1008 $dateDoc = $tempParse[0];
1009 $idDoc = $myrows4['id'];
1010 echo "<a href='$web_root/controller.php?document&retrieve&patient_id=" .
1011 htmlspecialchars($pid,ENT_QUOTES) . "&document_id=" .
1012 htmlspecialchars($idDoc,ENT_QUOTES) . "&as_file=true'>" .
1013 htmlspecialchars(xl_document_category($nameDoc),ENT_NOQUOTES) . "</a> " .
1014 htmlspecialchars($dateDoc,ENT_NOQUOTES);
1015 echo "<br>";
1016 $limitCounter = $limitCounter + 1;
1017 $counterFlag = true;
1021 if (!$counterFlag) {
1022 echo "&nbsp;&nbsp;" . htmlspecialchars(xl('None'),ENT_NOQUOTES);
1023 } ?>
1024 </div>
1025 <?php } // close advanced dir block
1027 // This is a feature for a specific client. -- Rod
1028 if ($GLOBALS['cene_specific']) {
1029 echo " <br />\n";
1031 $imagedir = $GLOBALS['OE_SITE_DIR'] . "/documents/$pid/demographics";
1032 $imagepath = "$web_root/sites/" . $_SESSION['site_id'] . "/documents/$pid/demographics";
1034 echo " <a href='' onclick=\"return sendimage($pid, 'photo');\" " .
1035 "title='Click to attach patient image'>\n";
1036 if (is_file("$imagedir/photo.jpg")) {
1037 echo " <img src='$imagepath/photo.jpg' /></a>\n";
1038 } else {
1039 echo " Attach Patient Image</a><br />\n";
1041 echo " <br />&nbsp;<br />\n";
1043 echo " <a href='' onclick=\"return sendimage($pid, 'fingerprint');\" " .
1044 "title='Click to attach fingerprint'>\n";
1045 if (is_file("$imagedir/fingerprint.jpg")) {
1046 echo " <img src='$imagepath/fingerprint.jpg' /></a>\n";
1047 } else {
1048 echo " Attach Biometric Fingerprint</a><br />\n";
1050 echo " <br />&nbsp;<br />\n";
1053 // This stuff only applies to athletic team use of OpenEMR. The client
1054 // insisted on being able to quickly change fitness and return date here:
1056 if (false && $GLOBALS['athletic_team']) {
1057 // blue green yellow red orange
1058 $fitcolors = array('#6677ff','#00cc00','#ffff00','#ff3333','#ff8800','#ffeecc','#ffccaa');
1059 if (!empty($GLOBALS['fitness_colors'])) $fitcolors = $GLOBALS['fitness_colors'];
1060 $fitcolor = $fitcolors[0];
1061 $form_fitness = $_POST['form_fitness'];
1062 $form_userdate1 = fixDate($_POST['form_userdate1'], '');
1063 $form_issue_id = $_POST['form_issue_id'];
1064 if ($form_submit) {
1065 $returndate = $form_userdate1 ? "'$form_userdate1'" : "NULL";
1066 sqlStatement("UPDATE patient_data SET fitness = ?, " .
1067 "userdate1 = ? WHERE pid = ?", array($form_fitness, $returndate, $pid) );
1068 // Update return date in the designated issue, if requested.
1069 if ($form_issue_id) {
1070 sqlStatement("UPDATE lists SET returndate = ? WHERE " .
1071 "id = ?", array($returndate, $form_issue_id) );
1073 } else {
1074 $form_fitness = $result['fitness'];
1075 if (! $form_fitness) $form_fitness = 1;
1076 $form_userdate1 = $result['userdate1'];
1078 $fitcolor = $fitcolors[$form_fitness - 1];
1079 echo " <form method='post' action='demographics.php' onsubmit='return validate()'>\n";
1080 echo " <span class='bold'>Fitness to Play:</span><br />\n";
1081 echo " <select name='form_fitness' style='background-color:$fitcolor'>\n";
1082 $res = sqlStatement("SELECT * FROM list_options WHERE " .
1083 "list_id = 'fitness' ORDER BY seq");
1084 while ($row = sqlFetchArray($res)) {
1085 $key = $row['option_id'];
1086 echo " <option value='" . htmlspecialchars($key,ENT_QUOTES) . "'";
1087 if ($key == $form_fitness) echo " selected";
1088 echo ">" . htmlspecialchars($row['title'],ENT_NOQUOTES) . "</option>\n";
1090 echo " </select>\n";
1091 echo " <br /><span class='bold'>Return to Play:</span><br>\n";
1092 echo " <input type='text' size='10' name='form_userdate1' id='form_userdate1' " .
1093 "value='$form_userdate1' " .
1094 "title='" . htmlspecialchars(xl('yyyy-mm-dd Date of return to play'),ENT_QUOTES) . "' " .
1095 "onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)' />\n" .
1096 " <img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22' " .
1097 "id='img_userdate1' border='0' alt='[?]' style='cursor:pointer' " .
1098 "title='" . htmlspecialchars(xl('Click here to choose a date'),ENT_QUOTES) . "'>\n";
1099 echo " <input type='hidden' name='form_original_userdate1' value='" . htmlspecialchars($form_userdate1,ENT_QUOTES) . "' />\n";
1100 echo " <input type='hidden' name='form_issue_id' value='' />\n";
1101 echo "<p><input type='submit' name='form_submit' value='Change' /></p>\n";
1102 echo " </form>\n";
1105 // Show current and upcoming appointments.
1106 if (isset($pid) && !$GLOBALS['disable_calendar']) {
1107 $query = "SELECT e.pc_eid, e.pc_aid, e.pc_title, e.pc_eventDate, " .
1108 "e.pc_startTime, e.pc_hometext, u.fname, u.lname, u.mname, " .
1109 "c.pc_catname " .
1110 "FROM openemr_postcalendar_events AS e, users AS u, " .
1111 "openemr_postcalendar_categories AS c WHERE " .
1112 "e.pc_pid = ? AND e.pc_eventDate >= CURRENT_DATE AND " .
1113 "u.id = e.pc_aid AND e.pc_catid = c.pc_catid " .
1114 "ORDER BY e.pc_eventDate, e.pc_startTime";
1115 $res = sqlStatement($query, array($pid) );
1117 if ( (acl_check('patients', 'med')) && ($GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_crw']) ) {
1118 // clinical summary expand collapse widget
1119 $widgetTitle = xl("Clinical Reminders");
1120 $widgetLabel = "clinical_reminders";
1121 $widgetButtonLabel = xl("Edit");
1122 $widgetButtonLink = "../reminder/clinical_reminders.php?patient_id=".$pid;;
1123 $widgetButtonClass = "";
1124 $linkMethod = "html";
1125 $bodyClass = "summary_item small";
1126 $widgetAuth = true;
1127 $fixedWidth = false;
1128 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1129 echo "<br/>";
1130 echo "<div style='margin-left:10px' class='text'><image src='../../pic/ajax-loader.gif'/></div><br/>";
1131 echo "</div>";
1132 } // end if crw
1134 // appointments expand collapse widget
1135 $widgetTitle = xl("Appointments");
1136 $widgetLabel = "appointments";
1137 $widgetButtonLabel = xl("Add");
1138 $widgetButtonLink = "return newEvt();";
1139 $widgetButtonClass = "";
1140 $linkMethod = "javascript";
1141 $bodyClass = "summary_item small";
1142 $widgetAuth = (isset($res) && $res != null);
1143 $fixedWidth = false;
1144 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1146 $count = 0;
1147 while($row = sqlFetchArray($res)) {
1148 $count++;
1149 $dayname = date("l", strtotime($row['pc_eventDate']));
1150 $dispampm = "am";
1151 $disphour = substr($row['pc_startTime'], 0, 2) + 0;
1152 $dispmin = substr($row['pc_startTime'], 3, 2);
1153 if ($disphour >= 12) {
1154 $dispampm = "pm";
1155 if ($disphour > 12) $disphour -= 12;
1157 $etitle = xl('(Click to edit)');
1158 if ($row['pc_hometext'] != "") {
1159 $etitle = xl('Comments').": ".($row['pc_hometext'])."\r\n".$etitle;
1161 echo "<a href='javascript:oldEvt(" . htmlspecialchars($row['pc_eid'],ENT_QUOTES) .
1162 ")' title='" . htmlspecialchars($etitle,ENT_QUOTES) . "'>";
1163 echo "<b>" . htmlspecialchars(xl($dayname) . ", " . $row['pc_eventDate'],ENT_NOQUOTES) . "</b><br>";
1164 echo htmlspecialchars("$disphour:$dispmin " . xl($dispampm) . " " . xl_appt_category($row['pc_catname']),ENT_NOQUOTES) . "<br>\n";
1165 echo htmlspecialchars($row['fname'] . " " . $row['lname'],ENT_NOQUOTES) . "</a><br>\n";
1167 if (isset($res) && $res != null) {
1168 if ( $count < 1 ) { echo "&nbsp;&nbsp;" . htmlspecialchars(xl('None'),ENT_NOQUOTES); }
1169 echo "</div>";
1173 </div>
1175 <div id='stats_div'>
1176 <br/>
1177 <div style='margin-left:10px' class='text'><img src='../../pic/ajax-loader.gif'/></div><br/>
1178 </div>
1179 </td>
1180 </tr>
1181 </table>
1183 </div> <!-- end right column div -->
1185 </td>
1187 </tr>
1188 </table>
1190 </div> <!-- end main content div -->
1192 <?php if ($GLOBALS['concurrent_layout'] && $_GET['set_pid']) { ?>
1193 <script language='JavaScript'>
1194 top.window.parent.left_nav.setPatient(<?php echo "'" . htmlspecialchars(($result['fname']) . " " . ($result['lname']),ENT_QUOTES) .
1195 "'," . htmlspecialchars($pid,ENT_QUOTES) . ",'" . htmlspecialchars(($result['pubpid']),ENT_QUOTES) .
1196 "','', ' " . htmlspecialchars(xl('DOB') . ": " . oeFormatShortDate($result['DOB_YMD']) . " " . xl('Age') . ": " . getPatientAge($result['DOB_YMD']), ENT_QUOTES) . "'"; ?>);
1197 EncounterDateArray=new Array;
1198 CalendarCategoryArray=new Array;
1199 EncounterIdArray=new Array;
1200 Count=0;
1201 <?php
1202 //Encounter details are stored to javacript as array.
1203 $result4 = sqlStatement("SELECT fe.encounter,fe.date,openemr_postcalendar_categories.pc_catname FROM form_encounter AS fe ".
1204 " left join openemr_postcalendar_categories on fe.pc_catid=openemr_postcalendar_categories.pc_catid WHERE fe.pid = ? order by fe.date desc", array($pid));
1205 if(sqlNumRows($result4)>0)
1206 while($rowresult4 = sqlFetchArray($result4))
1209 EncounterIdArray[Count]='<?php echo htmlspecialchars($rowresult4['encounter'], ENT_QUOTES); ?>';
1210 EncounterDateArray[Count]='<?php echo htmlspecialchars(oeFormatShortDate(date("Y-m-d", strtotime($rowresult4['date']))), ENT_QUOTES); ?>';
1211 CalendarCategoryArray[Count]='<?php echo htmlspecialchars( xl_appt_category($rowresult4['pc_catname']), ENT_QUOTES); ?>';
1212 Count++;
1213 <?php
1216 top.window.parent.left_nav.setPatientEncounter(EncounterIdArray,EncounterDateArray,CalendarCategoryArray);
1217 parent.left_nav.setRadio(window.name, 'dem');
1218 </script>
1219 <?php } ?>
1221 <?php if (false && $GLOBALS['athletic_team']) { ?>
1222 <script language='JavaScript'>
1223 Calendar.setup({inputField:"form_userdate1", ifFormat:"%Y-%m-%d", button:"img_userdate1"});
1224 </script>
1225 <?php } ?>
1227 </body>
1228 </html>