Patient Summary Screen Modifications:
[openemr.git] / interface / patient_file / summary / demographics.php
blobeccc310cb4706ea7593e132e4dd688456eca2fcf
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("./patient_picture.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/user.inc");
25 if ($GLOBALS['concurrent_layout'] && $_GET['set_pid']) {
26 include_once("$srcdir/pid.inc");
27 setpid($_GET['set_pid']);
30 // COLLECT the user settings
31 // currently collects flags to keep track of
32 // which sections to persistently expand/collapse
33 $user_settings = getUserSettings($_SESSION['authUserID']);
35 function print_as_money($money) {
36 preg_match("/(\d*)\.?(\d*)/",$money,$moneymatches);
37 $tmp = wordwrap(strrev($moneymatches[1]),3,",",1);
38 $ccheck = strrev($tmp);
39 if ($ccheck[0] == ",") {
40 $tmp = substr($ccheck,1,strlen($ccheck)-1);
42 if ($moneymatches[2] != "") {
43 return "$ " . strrev($tmp) . "." . $moneymatches[2];
44 } else {
45 return "$ " . strrev($tmp);
49 <html>
51 <head>
52 <?php html_header_show();?>
53 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
54 <link rel="stylesheet" type="text/css" href="../../../library/js/fancybox/jquery.fancybox-1.2.6.css" media="screen" />
55 <style type="text/css">@import url(../../../library/dynarch_calendar.css);</style>
56 <script type="text/javascript" src="../../../library/textformat.js"></script>
57 <script type="text/javascript" src="../../../library/dynarch_calendar.js"></script>
58 <?php include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?>
59 <script type="text/javascript" src="../../../library/dynarch_calendar_setup.js"></script>
60 <script type="text/javascript" src="../../../library/dialog.js"></script>
61 <script type="text/javascript" src="../../../library/js/jquery.1.3.2.js"></script>
62 <script type="text/javascript" src="../../../library/js/common.js"></script>
63 <script type="text/javascript" src="../../../library/js/fancybox/jquery.fancybox-1.2.6.js"></script>
64 <script language="JavaScript">
65 //Visolve - sync the radio buttons - Start
66 if((top.window.parent) && (parent.window)){
67 var wname = top.window.parent.left_nav;
68 wname.syncRadios();
69 wname.setRadio(parent.window.name, "dem");
71 //Visolve - sync the radio buttons - End
73 var mypcc = '<?php echo htmlspecialchars($GLOBALS['phone_country_code'],ENT_QUOTES); ?>';
75 function oldEvt(eventid) {
76 dlgopen('../../main/calendar/add_edit_event.php?eid=' + eventid, '_blank', 550, 270);
79 function advdirconfigure() {
80 dlgopen('advancedirectives.php', '_blank', 500, 450);
83 function refreshme() {
84 top.restoreSession();
85 location.reload();
88 // Process click on Delete link.
89 function deleteme() {
90 dlgopen('../deleter.php?patient=<?php echo htmlspecialchars($pid,ENT_QUOTES); ?>', '_blank', 500, 450);
91 return false;
94 // Called by the deleteme.php window on a successful delete.
95 function imdeleted() {
96 <?php if ($GLOBALS['concurrent_layout']) { ?>
97 parent.left_nav.clearPatient();
98 <?php } else { ?>
99 top.restoreSession();
100 top.location.href = '../main/main_screen.php';
101 <?php } ?>
104 function validate() {
105 var f = document.forms[0];
106 <?php
107 if ($GLOBALS['athletic_team']) {
108 echo " if (f.form_userdate1.value != f.form_original_userdate1.value) {\n";
109 $irow = sqlQuery("SELECT id, title FROM lists WHERE " .
110 "pid = ? AND enddate IS NULL ORDER BY begdate DESC LIMIT 1", array($pid));
111 if (!empty($irow)) {
113 if (confirm('Do you wish to also set this new return date in the issue titled "<?php echo htmlspecialchars($irow['title'],ENT_QUOTES); ?>"?')) {
114 f.form_issue_id.value = '<?php echo htmlspecialchars($irow['id'],ENT_QUOTES); ?>';
115 } else {
116 alert('OK, you will need to manually update the return date in any affected issue(s).');
118 <?php } else { ?>
119 alert('You have changed the return date but there are no open issues. You probably need to create or modify one.');
120 <?php
121 } // end empty $irow
122 echo " }\n";
123 } // end athletic team
125 return true;
128 function newEvt() {
129 dlgopen('../../main/calendar/add_edit_event.php?patientid=<?php echo htmlspecialchars($pid,ENT_QUOTES); ?>', '_blank', 550, 270);
130 return false;
133 function sendimage(pid, what) {
134 // alert('Not yet implemented.'); return false;
135 dlgopen('../upload_dialog.php?patientid=' + pid + '&file=' + what,
136 '_blank', 500, 400);
137 return false;
140 </script>
142 <script type="text/javascript">
144 function toggle( target, div ) {
146 $mode = $(target).find(".indicator").text();
147 if ( $mode == "<?php echo htmlspecialchars(xl('collapse'),ENT_QUOTES); ?>" ) {
148 $(target).find(".indicator").text( "<?php echo htmlspecialchars(xl('expand'),ENT_QUOTES); ?>" );
149 $(div).hide();
150 $.post( "../../../library/ajax/user_settings.php", { target: div, mode: 0 });
151 } else {
152 $(target).find(".indicator").text( "<?php echo htmlspecialchars(xl('collapse'),ENT_QUOTES); ?>" );
153 $(div).show();
154 $.post( "../../../library/ajax/user_settings.php", { target: div, mode: 1 });
159 $(document).ready(function(){
161 $("#dem_view").click( function() {
162 toggle( $(this), "#DEM" );
165 $("#his_view").click( function() {
166 toggle( $(this), "#HIS" );
169 $("#ins_view").click( function() {
170 toggle( $(this), "#INSURANCE" );
173 $("#notes_view").click( function() {
174 toggle( $(this), "#notes_div" );
177 $("#disc_view").click( function() {
178 toggle( $(this), "#disc_div" );
181 // load divs
182 $("#stats_div").load("stats.php", { 'embeddedScreen' : true }, function() {
183 // special size for (note need to place here to get the dynamic link to work
184 $(".rx_modal").fancybox( {
185 'overlayOpacity' : 0.0,
186 'showCloseButton' : true,
187 'frameHeight' : 500,
188 'frameWidth' : 800,
189 'centerOnScroll' : false,
190 'callbackOnClose' : function() {
191 refreshme();
195 $("#notes_div").load("pnotes_fragment.php");
196 $("#disc_div").load("disc_fragment.php");
198 // fancy box
199 enable_modals();
201 tabbify();
203 // special size for
204 $(".large_modal").fancybox( {
205 'overlayOpacity' : 0.0,
206 'showCloseButton' : true,
207 'frameHeight' : 600,
208 'frameWidth' : 1000,
209 'centerOnScroll' : false
212 // special size for
213 $(".medium_modal").fancybox( {
214 'overlayOpacity' : 0.0,
215 'showCloseButton' : true,
216 'frameHeight' : 500,
217 'frameWidth' : 800,
218 'centerOnScroll' : false
222 </script>
224 <style type="css/text">
225 #notes_div {
226 height:auto;
227 width:100%;
229 </style>
231 </head>
233 <body class="body_top">
234 <table cellspacing='0' cellpadding='0' border='0'>
235 <tr>
236 <?php
237 $result = getPatientData($pid, "*, DATE_FORMAT(DOB,'%Y-%m-%d') as DOB_YMD");
238 $result2 = getEmployerData($pid);
240 $thisauth = acl_check('patients', 'demo');
241 if ($thisauth) {
242 if ($result['squad'] && ! acl_check('squads', $result['squad']))
243 $thisauth = 0;
246 if (!$thisauth) {
247 echo "<p>(" . htmlspecialchars(xl('Demographics not authorized'),ENT_NOQUOTES) . ")</p>\n";
248 echo "</body>\n</html>\n";
249 exit();
252 if ($thisauth == 'write') {
253 foreach (pic_array() as $var) {print $var;}
254 echo "<td><span class='title'>" .
255 htmlspecialchars(getPatientName($pid),ENT_NOQUOTES) .
256 "</span>&nbsp;&nbsp;</td>";
258 if (acl_check('admin', 'super')) {
259 echo "<td><a class='css_button iframe' href='../deleter.php?patient=" .
260 htmlspecialchars($pid,ENT_QUOTES) . "'>" .
261 "<span>".htmlspecialchars(xl('Delete'),ENT_NOQUOTES).
262 "</span></a></td>";
264 if ($GLOBALS['oer_config']['ws_accounting']['enabled']) {
265 // Show current balance and billing note, if any.
266 echo "<td>&nbsp;&nbsp;&nbsp;<span class='bold'><font color='#ee6600'>" .
267 htmlspecialchars(xl('Balance Due'),ENT_NOQUOTES) .
268 ": " . htmlspecialchars(oeFormatMoney(get_patient_balance($pid)),ENT_NOQUOTES) .
269 "</font><br />";
270 if ($result['genericname2'] == 'Billing') {
271 htmlspecialchars(xl('Billing Note'),ENT_NOQUOTES) . ":";
272 echo "<span class='bold'><font color='red'>" .
273 htmlspecialchars($result['genericval2'],ENT_NOQUOTES) .
274 "</font></span>";
276 echo "</span></td>";
281 // Get the document ID of the patient ID card if access to it is wanted here.
282 $document_id = 0;
283 if ($GLOBALS['patient_id_category_name']) {
284 $tmp = sqlQuery("SELECT d.id, d.date, d.url FROM " .
285 "documents AS d, categories_to_documents AS cd, categories AS c " .
286 "WHERE d.foreign_id = ? " .
287 "AND cd.document_id = d.id " .
288 "AND c.id = cd.category_id " .
289 "AND c.name LIKE ? " .
290 "ORDER BY d.date DESC LIMIT 1", array($pid, $GLOBALS['patient_id_category_name']) );
291 if ($tmp) $document_id = $tmp['id'];
294 </tr>
296 <tr>
297 <td class="small" colspan='4'>
298 <a href="../history/history.php" onclick='top.restoreSession()'>
299 <?php echo htmlspecialchars(xl('History'),ENT_NOQUOTES); ?></a>
301 <a href="../report/patient_report.php" class='iframe medium_modal' onclick='top.restoreSession()'>
302 <?php echo htmlspecialchars(xl('Report'),ENT_NOQUOTES); ?></a>
304 <?php //note that we have temporarily removed document screen from the modul view ?>
305 <a href="../../../controller.php?document&list&patient_id=<?php echo $pid;?>" onclick='top.restoreSession()'>
306 <?php echo htmlspecialchars(xl('Documents'),ENT_NOQUOTES); ?></a>
308 <a href="../transaction/transactions.php" class='iframe large_modal' onclick='top.restoreSession()'>
309 <?php echo htmlspecialchars(xl('Transactions'),ENT_NOQUOTES); ?></a>
310 </td>
311 </tr>
312 </table> <!-- end header -->
314 <div style='margin-top:10px'> <!-- start main content div -->
315 <table border="0" cellspacing="0" cellpadding="0" width="100%">
316 <tr>
317 <td align="left" valign="top">
318 <!-- start left column div -->
319 <div style='float:left; margin-right:20px'>
320 <table cellspacing=0 cellpadding=0>
321 <tr>
322 <td>
323 <div class="section-header">
324 <table><tr>
325 <?php if ($thisauth == 'write') {
326 echo "<td><a class='css_button_small' href='demographics_full.php'";
327 if (! $GLOBALS['concurrent_layout']) echo " target='Main'";
328 echo " onclick='top.restoreSession()'><span>" .
329 htmlspecialchars(xl("Edit" ),ENT_NOQUOTES). "</span></a></td>";
330 } ?>
331 <td><a href='javascript:;' class='small' id='dem_view'><span class='text'><b>
332 <?php echo htmlspecialchars(xl("Demographics"),ENT_NOQUOTES); ?></b></span>
333 <?php if ($user_settings['dem_expand']) {
334 $label = xl('collapse');
336 else {
337 $label = xl('expand');
338 } ?>
339 (<span class="indicator"><?php echo htmlspecialchars($label, ENT_QUOTES); ?></span>)</a></td>
340 </tr></table>
341 </div>
343 <!-- Demographics -->
344 <?php if ($user_settings['dem_expand']) {
345 $styling = "";
347 else {
348 $styling = "style='display:none'";
349 } ?>
350 <div id="DEM" <?php echo $styling; ?>>
351 <ul class="tabNav">
352 <?php display_layout_tabs('DEM', $result, $result2); ?>
353 </ul>
354 <div class="tabContainer">
355 <?php display_layout_tabs_data('DEM', $result, $result2); ?>
356 </div>
357 </div>
358 </td>
359 </tr>
361 <tr>
362 <td>
363 <?php
365 $insurance_count = 0;
366 foreach (array('primary','secondary','tertiary') as $instype) {
367 $enddate = 'Present';
369 $query = "SELECT * FROM insurance_data WHERE " .
370 "pid = ? AND type = ? " .
371 "ORDER BY date DESC";
372 $res = sqlStatement($query, array($pid, $instype) );
373 while( $row = sqlFetchArray($res) ) {
374 if ($row['provider'] ) $insurance_count++;
378 if ( $insurance_count > 0 ) {
381 <div class="section-header">
382 <table><tr>
383 <?php if ($thisauth == 'write') {
384 echo "<td><a class='css_button_small' href='demographics_full.php'";
385 if (! $GLOBALS['concurrent_layout']) echo " target='Main'";
386 echo " onclick='top.restoreSession()'><span>" .
387 htmlspecialchars(xl("Edit" ),ENT_NOQUOTES). "</span></a></td>";
388 } ?>
389 <td><a href='javascript:;' class='small' id='ins_view'><span class='text'><b>
390 <?php echo htmlspecialchars(xl("Insurance"),ENT_NOQUOTES); ?></b></span>
391 <?php if ($user_settings['ins_expand']) {
392 $label = xl('collapse');
394 else {
395 $label = xl('expand');
396 } ?>
397 (<span class="indicator"><?php echo htmlspecialchars($label, ENT_QUOTES); ?></span>)</a></td>
398 </tr></table>
399 </div>
401 <?php if ($user_settings['ins_expand']) {
402 $styling = "";
404 else {
405 $styling = "style='display:none'";
406 } ?>
407 <div id="INSURANCE" <?php echo $styling; ?>>
409 <?php
410 if ( $insurance_count > 1 ) {
412 ?><ul class="tabNav"><?php
414 ///////////////////////////////// INSURANCE SECTION
415 $first = true;
416 foreach (array('primary','secondary','tertiary') as $instype) {
418 $query = "SELECT * FROM insurance_data WHERE " .
419 "pid = ? AND type = ? " .
420 "ORDER BY date DESC";
421 $res = sqlStatement($query, array($pid, $instype) );
423 $enddate = 'Present';
425 while( $row = sqlFetchArray($res) ) {
426 if ($row['provider'] ) {
428 $ins_description = ucfirst($instype);
429 $ins_description = xl($ins_description);
430 $ins_description .= strcmp($enddate, 'Present') != 0 ? " (".xl('Old').")" : "";
432 <li <?php echo $first ? 'class="current"' : '' ?>><a href="/play/javascript-tabbed-navigation/">
433 <?php echo htmlspecialchars($ins_description,ENT_NOQUOTES); ?></a></li>
434 <?php
435 $first = false;
437 $enddate = $row['date'];
441 ?></ul><?php
443 } ?>
445 <div class="tabContainer">
446 <?php
447 $first = true;
448 foreach (array('primary','secondary','tertiary') as $instype) {
449 $enddate = 'Present';
451 $query = "SELECT * FROM insurance_data WHERE " .
452 "pid = ? AND type = ? " .
453 "ORDER BY date DESC";
454 $res = sqlStatement($query, array($pid, $instype) );
455 while( $row = sqlFetchArray($res) ) {
456 if ($row['provider'] ) {
458 <div class="tab <?php echo $first ? 'current' : '' ?>">
459 <table border='0' cellpadding='0' width='100%'>
460 <?php
461 $icobj = new InsuranceCompany($row['provider']);
462 $adobj = $icobj->get_address();
463 $insco_name = trim($icobj->get_name());
465 <tr>
466 <td valign='top' colspan='3'>
467 <span class='text'>
468 <?php if (strcmp($enddate, 'Present') != 0) echo htmlspecialchars(xl("Old"),ENT_NOQUOTES)." "; ?>
469 <?php $tempinstype=ucfirst($instype); echo htmlspecialchars(xl($tempinstype.' Insurance'),ENT_NOQUOTES); ?>
470 <?php if (strcmp($row['date'], '0000-00-00') != 0) { ?>
471 <?php echo htmlspecialchars(xl('from','',' ',' ').$row['date'],ENT_NOQUOTES); ?>
472 <?php } ?>
473 <?php echo htmlspecialchars(xl('until','',' ',' '),ENT_NOQUOTES);
474 echo (strcmp($enddate, 'Present') != 0) ? $enddate : htmlspecialchars(xl('Present'),ENT_NOQUOTES); ?>:</span>
475 </td>
476 </tr>
477 <tr>
478 <td valign='top'>
479 <span class='text'>
480 <?php
481 if ($insco_name) {
482 echo htmlspecialchars($insco_name,ENT_NOQUOTES) . '<br>';
483 if (trim($adobj->get_line1())) {
484 echo htmlspecialchars($adobj->get_line1(),ENT_NOQUOTES) . '<br>';
485 echo htmlspecialchars($adobj->get_city() . ', ' . $adobj->get_state() . ' ' . $adobj->get_zip(),ENT_NOQUOTES);
487 } else {
488 echo "<font color='red'><b>".htmlspecialchars(xl('Unassigned'),ENT_NOQUOTES)."</b></font>";
491 <br>
492 <?php echo htmlspecialchars(xl('Policy Number'),ENT_NOQUOTES); ?>:
493 <?php echo htmlspecialchars($row['policy_number'],ENT_NOQUOTES) ?><br>
494 <?php echo htmlspecialchars(xl('Plan Name'),ENT_NOQUOTES); ?>:
495 <?php echo htmlspecialchars($row['plan_name'],ENT_NOQUOTES); ?><br>
496 <?php echo htmlspecialchars(xl('Group Number'),ENT_NOQUOTES); ?>:
497 <?php echo htmlspecialchars($row['group_number'],ENT_NOQUOTES); ?></span>
498 </td>
499 <td valign='top'>
500 <span class='bold'><?php echo htmlspecialchars(xl('Subscriber'),ENT_NOQUOTES); ?>: </span><br>
501 <span class='text'><?php echo htmlspecialchars($row['subscriber_fname'] . ' ' . $row['subscriber_mname'] . ' ' . $row['subscriber_lname'],ENT_NOQUOTES); ?>
502 <?php
503 if ($row['subscriber_relationship'] != "") {
504 echo "(" . htmlspecialchars($row['subscriber_relationship'],ENT_NOQUOTES) . ")";
507 <br>
508 <?php echo htmlspecialchars(xl('S.S.'),ENT_NOQUOTES); ?>:
509 <?php echo htmlspecialchars($row['subscriber_ss'],ENT_NOQUOTES); ?><br>
510 <?php echo htmlspecialchars(xl('D.O.B.'),ENT_NOQUOTES); ?>:
511 <?php if ($row['subscriber_DOB'] != "0000-00-00 00:00:00") echo htmlspecialchars($row['subscriber_DOB'],ENT_NOQUOTES); ?><br>
512 <?php echo htmlspecialchars(xl('Phone'),ENT_NOQUOTES); ?>:
513 <?php echo htmlspecialchars($row['subscriber_phone'],ENT_NOQUOTES); ?>
514 </span>
515 </td>
516 <td valign='top'>
517 <span class='bold'><?php echo htmlspecialchars(xl('Subscriber Address'),ENT_NOQUOTES); ?>: </span><br>
518 <span class='text'><?php echo htmlspecialchars($row['subscriber_street'],ENT_NOQUOTES); ?><br>
519 <?php echo htmlspecialchars($row['subscriber_city'],ENT_NOQUOTES); ?>
520 <?php if($row['subscriber_state'] != "") echo ", "; echo htmlspecialchars($row['subscriber_state'],ENT_NOQUOTES); ?>
521 <?php if($row['subscriber_country'] != "") echo ", "; echo htmlspecialchars($row['subscriber_country'],ENT_NOQUOTES); ?>
522 <?php echo " " . htmlspecialchars($row['subscriber_postal_code'],ENT_NOQUOTES); ?></span>
524 <?php if (trim($row['subscriber_employer'])) { ?>
525 <br><span class='bold'><?php echo htmlspecialchars(xl('Subscriber Employer'),ENT_NOQUOTES); ?>: </span><br>
526 <span class='text'><?php echo htmlspecialchars($row['subscriber_employer'],ENT_NOQUOTES); ?><br>
527 <?php echo htmlspecialchars($row['subscriber_employer_street'],ENT_NOQUOTES); ?><br>
528 <?php echo htmlspecialchars($row['subscriber_employer_city'],ENT_NOQUOTES); ?>
529 <?php if($row['subscriber_employer_city'] != "") echo ", "; echo htmlspecialchars($row['subscriber_employer_state'],ENT_NOQUOTES); ?>
530 <?php if($row['subscriber_employer_country'] != "") echo ", "; echo htmlspecialchars($row['subscriber_employer_country'],ENT_NOQUOTES); ?>
531 <?php echo " " . htmlspecialchars($row['subscriber_employer_postal_code'],ENT_NOQUOTES); ?>
532 </span>
533 <?php } ?>
535 </td>
536 </tr>
537 <tr>
538 <td>
539 <?php if ($row['copay'] != "") { ?>
540 <span class='bold'><?php echo htmlspecialchars(xl('CoPay'),ENT_NOQUOTES); ?>: </span>
541 <span class='text'><?php echo htmlspecialchars($row['copay'],ENT_NOQUOTES); ?></span>
542 <?php } ?>
543 <br>
544 <span class='bold'><?php echo htmlspecialchars(xl('Accept Assignment'),ENT_NOQUOTES); ?>:</span>
545 <span class='text'><?php if($row['accept_assignment'] == "TRUE") echo xl("YES"); ?>
546 <?php if($row['accept_assignment'] == "FALSE") echo xl("NO"); ?></span>
547 </td>
548 <td valign='top'></td>
549 <td valign='top'></td>
550 </tr>
552 </table>
553 </div>
554 <?php
556 } // end if ($row['provider'])
557 $enddate = $row['date'];
558 $first = false;
559 } // end while
560 } // end foreach
562 ///////////////////////////////// END INSURANCE SECTION
564 </div>
566 <?php } // ?>
568 </td>
569 </tr>
571 <tr>
572 <td width='650px'>
573 <div class="section-header">
574 <table><tr>
575 <?php echo "<td><a class='css_button_small' href='pnotes_full.php'";
576 if (! $GLOBALS['concurrent_layout']) echo " target='Main'";
577 echo " onclick='top.restoreSession()'><span>" .
578 htmlspecialchars(xl("Edit" ),ENT_NOQUOTES). "</span></a></td>";
580 <td><a href='javascript:;' class='small' id='notes_view'><span class='text'><b><?php echo htmlspecialchars(xl("Notes"),ENT_NOQUOTES);?></b></span>
581 <?php if ($user_settings['not_expand']) {
582 $label = xl('collapse');
584 else {
585 $label = xl('expand');
586 } ?>
587 (<span class="indicator"><?php echo htmlspecialchars($label, ENT_QUOTES); ?></span>)</a></td>
588 </tr></table>
589 </div>
590 <?php if ($user_settings['not_expand']) {
591 $styling = "style='height:auto; width:100%;'";
593 else {
594 $styling = "style='height:auto; width:100%; display:none;'";
595 } ?>
596 <div id='notes_div' class='tab current' <?php echo $styling; ?>>
598 <br/>
599 <div style='margin-left:10px' class='text'><image src='../../pic/ajax-loader.gif'/></div><br/>
600 </div>
601 </td>
602 </tr>
603 <tr>
604 <td width='650px'>
605 <div class="section-header">
606 <table><tr>
607 <?php echo "<td><a class='css_button_small' href='disclosure_full.php'";
608 if (! $GLOBALS['concurrent_layout']) echo " target='Main'";
609 echo " onclick='top.restoreSession()'><span>" .
610 htmlspecialchars(xl("Edit" ),ENT_NOQUOTES). "</span></a></td>";
612 <td><a href='javascript:;' class='small' id='disc_view'><span class='text'><b><?php echo htmlspecialchars(xl("Disclosures"),ENT_NOQUOTES);?></b></span>
613 <?php if ($user_settings['dis_expand']) {
614 $label = xl('collapse');
616 else {
617 $label = xl('expand');
618 } ?>
619 (<span class="indicator"><?php echo htmlspecialchars($label, ENT_QUOTES); ?></span>)</a></td>
620 </tr></table>
621 </div>
622 <?php if ($user_settings['dis_expand']) {
623 $styling = "style='height:auto; width:100%;'";
625 else {
626 $styling = "style='height:auto; width:100%; display:none;'";
627 } ?>
628 <div id='disc_div' class='tab current' <?php echo $styling; ?>>
630 <br/>
631 <div style='margin-left:10px' class='text'><image src='../../pic/ajax-loader.gif'/></div><br/>
632 </div>
633 </td>
634 </tr>
636 </table>
638 </div>
641 </div>
642 <!-- end left column div -->
644 <!-- start right column div -->
645 <div class='text'>
646 <table>
647 <tr>
648 <td>
649 <?php
650 if ($GLOBALS['advance_directives_warning']) { ?>
651 <div>
652 <span class="text"><b><?php echo htmlspecialchars(xl('Advance Directives'),ENT_NOQUOTES); ?></b></span>
653 <a href="#" class="small" onclick="return advdirconfigure();">
654 (<b><?php echo htmlspecialchars(xl('Manage'),ENT_NOQUOTES); ?></b>)
655 </a>
656 </div>
657 <div class='small'>
658 <?php
659 $counterFlag = false; //flag to record whether any categories contain ad records
660 $query = "SELECT id FROM categories WHERE name='Advance Directive'";
661 $myrow2 = sqlQuery($query);
662 if ($myrow2) {
663 $parentId = $myrow2['id'];
664 $query = "SELECT id, name FROM categories WHERE parent=?";
665 $resNew1 = sqlStatement($query, array($parentId) );
666 while ($myrows3 = sqlFetchArray($resNew1)) {
667 $categoryId = $myrows3['id'];
668 $nameDoc = $myrows3['name'];
669 $query = "SELECT documents.date, documents.id " .
670 "FROM documents " .
671 "INNER JOIN categories_to_documents " .
672 "ON categories_to_documents.document_id=documents.id " .
673 "WHERE categories_to_documents.category_id=? " .
674 "AND documents.foreign_id=? " .
675 "ORDER BY documents.date DESC";
676 $resNew2 = sqlStatement($query, array($categoryId, $pid) );
677 $limitCounter = 0; // limit to one entry per category
678 while (($myrows4 = sqlFetchArray($resNew2)) && ($limitCounter == 0)) {
679 $dateTimeDoc = $myrows4['date'];
680 // remove time from datetime stamp
681 $tempParse = explode(" ",$dateTimeDoc);
682 $dateDoc = $tempParse[0];
683 $idDoc = $myrows4['id'];
684 echo "<a href='$web_root/controller.php?document&retrieve&patient_id=" .
685 htmlspecialchars($pid,ENT_QUOTES) . "&document_id=" .
686 htmlspecialchars($idDoc,ENT_QUOTES) . "&as_file=true'>" .
687 htmlspecialchars(xl_document_category($nameDoc),ENT_NOQUOTES) . "</a> " .
688 htmlspecialchars($dateDoc,ENT_NOQUOTES);
689 echo "<br>";
690 $limitCounter = $limitCounter + 1;
691 $counterFlag = true;
695 if (!$counterFlag) {
696 echo htmlspecialchars(xl('None'),ENT_NOQUOTES);
697 } ?>
698 </div>
699 <? } ?>
700 <?php
701 // This is a feature for a specific client. -- Rod
702 if ($GLOBALS['cene_specific']) {
703 echo " <br />\n";
705 $imagedir = "$webserver_root/documents/$pid/demographics";
706 $imagepath = "$web_root/documents/$pid/demographics";
708 echo " <a href='' onclick=\"return sendimage($pid, 'photo');\" " .
709 "title='Click to attach patient image'>\n";
710 if (is_file("$imagedir/photo.jpg")) {
711 echo " <img src='$imagepath/photo.jpg' /></a>\n";
712 } else {
713 echo " Attach Patient Image</a><br />\n";
715 echo " <br />&nbsp;<br />\n";
717 echo " <a href='' onclick=\"return sendimage($pid, 'fingerprint');\" " .
718 "title='Click to attach fingerprint'>\n";
719 if (is_file("$imagedir/fingerprint.jpg")) {
720 echo " <img src='$imagepath/fingerprint.jpg' /></a>\n";
721 } else {
722 echo " Attach Biometric Fingerprint</a><br />\n";
724 echo " <br />&nbsp;<br />\n";
727 // This stuff only applies to athletic team use of OpenEMR. The client
728 // insisted on being able to quickly change fitness and return date here:
730 if (false && $GLOBALS['athletic_team']) {
731 // blue green yellow red orange
732 $fitcolors = array('#6677ff','#00cc00','#ffff00','#ff3333','#ff8800','#ffeecc','#ffccaa');
733 if (!empty($GLOBALS['fitness_colors'])) $fitcolors = $GLOBALS['fitness_colors'];
734 $fitcolor = $fitcolors[0];
735 $form_fitness = $_POST['form_fitness'];
736 $form_userdate1 = fixDate($_POST['form_userdate1'], '');
737 $form_issue_id = $_POST['form_issue_id'];
738 if ($form_submit) {
739 $returndate = $form_userdate1 ? "'$form_userdate1'" : "NULL";
740 sqlStatement("UPDATE patient_data SET fitness = ?, " .
741 "userdate1 = ? WHERE pid = ?", array($form_fitness, $returndate, $pid) );
742 // Update return date in the designated issue, if requested.
743 if ($form_issue_id) {
744 sqlStatement("UPDATE lists SET returndate = ? WHERE " .
745 "id = ?", array($returndate, $form_issue_id) );
747 } else {
748 $form_fitness = $result['fitness'];
749 if (! $form_fitness) $form_fitness = 1;
750 $form_userdate1 = $result['userdate1'];
752 $fitcolor = $fitcolors[$form_fitness - 1];
753 echo " <form method='post' action='demographics.php' onsubmit='return validate()'>\n";
754 echo " <span class='bold'>Fitness to Play:</span><br />\n";
755 echo " <select name='form_fitness' style='background-color:$fitcolor'>\n";
756 $res = sqlStatement("SELECT * FROM list_options WHERE " .
757 "list_id = 'fitness' ORDER BY seq");
758 while ($row = sqlFetchArray($res)) {
759 $key = $row['option_id'];
760 echo " <option value='" . htmlspecialchars($key,ENT_QUOTES) . "'";
761 if ($key == $form_fitness) echo " selected";
762 echo ">" . htmlspecialchars($row['title'],ENT_NOQUOTES) . "</option>\n";
764 echo " </select>\n";
765 echo " <br /><span class='bold'>Return to Play:</span><br>\n";
766 echo " <input type='text' size='10' name='form_userdate1' id='form_userdate1' " .
767 "value='$form_userdate1' " .
768 "title='" . htmlspecialchars(xl('yyyy-mm-dd Date of return to play'),ENT_QUOTES) . "' " .
769 "onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)' />\n" .
770 " <img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22' " .
771 "id='img_userdate1' border='0' alt='[?]' style='cursor:pointer' " .
772 "title='" . htmlspecialchars(xl('Click here to choose a date'),ENT_QUOTES) . "'>\n";
773 echo " <input type='hidden' name='form_original_userdate1' value='" . htmlspecialchars($form_userdate1,ENT_QUOTES) . "' />\n";
774 echo " <input type='hidden' name='form_issue_id' value='' />\n";
775 echo "<p><input type='submit' name='form_submit' value='Change' /></p>\n";
776 echo " </form>\n";
779 // If there is a patient ID card, then show a link to it.
780 if ($document_id) {
781 echo "<a href='" . $web_root . "/controller.php?document&retrieve" .
782 "&patient_id=$pid&document_id=$document_id' style='color:#00cc00' " .
783 "onclick='top.restoreSession()'>Click for ID card</a><br />";
786 // Show current and upcoming appointments.
787 if (isset($pid) && !$GLOBALS['disable_calendar']) {
788 $query = "SELECT e.pc_eid, e.pc_aid, e.pc_title, e.pc_eventDate, " .
789 "e.pc_startTime, e.pc_hometext, u.fname, u.lname, u.mname, " .
790 "c.pc_catname " .
791 "FROM openemr_postcalendar_events AS e, users AS u, " .
792 "openemr_postcalendar_categories AS c WHERE " .
793 "e.pc_pid = ? AND e.pc_eventDate >= CURRENT_DATE AND " .
794 "u.id = e.pc_aid AND e.pc_catid = c.pc_catid " .
795 "ORDER BY e.pc_eventDate, e.pc_startTime";
796 $res = sqlStatement($query, array($pid) );
798 if (isset($res) && $res != null) { ?>
799 <div>
800 <span class="text"><b><?php echo htmlspecialchars(xl('Appointments'),ENT_NOQUOTES); ?></b></span>
801 <a href="#" class="small" onclick="return newEvt();" >
802 (<b><?php echo htmlspecialchars(xl('Add'),ENT_NOQUOTES); ?></b>)
803 </a>
804 </div>
805 <?php } ?>
806 <div class='small'>
807 <?php
808 $count = 0;
809 while($row = sqlFetchArray($res)) {
810 $count++;
811 $dayname = date("l", strtotime($row['pc_eventDate']));
812 $dispampm = "am";
813 $disphour = substr($row['pc_startTime'], 0, 2) + 0;
814 $dispmin = substr($row['pc_startTime'], 3, 2);
815 if ($disphour >= 12) {
816 $dispampm = "pm";
817 if ($disphour > 12) $disphour -= 12;
819 $etitle = xl('(Click to edit)');
820 if ($row['pc_hometext'] != "") {
821 $etitle = xl('Comments').": ".($row['pc_hometext'])."\r\n".$etitle;
823 echo "<a href='javascript:oldEvt(" . htmlspecialchars($row['pc_eid'],ENT_QUOTES) .
824 ")' title='" . htmlspecialchars($etitle,ENT_QUOTES) . "'>";
825 echo "<b>" . htmlspecialchars(xl($dayname) . ", " . $row['pc_eventDate'],ENT_NOQUOTES) . "</b><br>";
826 echo htmlspecialchars("$disphour:$dispmin " . xl($dispampm) . " " . xl_appt_category($row['pc_catname']),ENT_NOQUOTES) . "<br>\n";
827 echo htmlspecialchars($row['fname'] . " " . $row['lname'],ENT_NOQUOTES) . "</a><br>\n";
829 if (isset($res) && $res != null) {
830 if ( $count < 1 ) { echo htmlspecialchars(xl('None'),ENT_NOQUOTES); }
831 echo "</div>";
835 </div>
837 <div id='stats_div' style='float:left'>
838 <br/>
839 <div style='margin-left:10px' class='text'><image src='../../pic/ajax-loader.gif'/></div><br/>
840 </div>
842 </td>
843 </tr>
844 </table>
846 </div> <!-- end right column div -->
848 </td>
850 </tr>
851 </table>
853 </div> <!-- end main content div -->
855 <?php if ($GLOBALS['concurrent_layout'] && $_GET['set_pid']) { ?>
856 <script language='JavaScript'>
857 top.window.parent.left_nav.setPatient(<?php echo "'" . htmlspecialchars(($result['fname']) . " " . ($result['lname']),ENT_QUOTES) .
858 "'," . htmlspecialchars($pid,ENT_QUOTES) . ",'" . htmlspecialchars(($result['pubpid']),ENT_QUOTES) .
859 "','', ' " . htmlspecialchars(xl('DOB') . ": " . oeFormatShortDate($result['DOB_YMD']) . " " . xl('Age') . ": " . getPatientAge($result['DOB_YMD']), ENT_QUOTES) . "'"; ?>);
860 parent.left_nav.setRadio(window.name, 'dem');
861 </script>
862 <?php } ?>
864 <?php if (false && $GLOBALS['athletic_team']) { ?>
865 <script language='JavaScript'>
866 Calendar.setup({inputField:"form_userdate1", ifFormat:"%Y-%m-%d", button:"img_userdate1"});
867 </script>
868 <?php } ?>
870 </body>
871 </html>