Add New FMC code from Intesync
[openemr.git] / interface / patient_file / summary / demographics2.php
blobc866d7e2787d54b6dd15b07cf1191ef656d43548
1 <?php
2 // Copyright (C) 2010 OpenEMR Support LLC
3 // This program is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU General Public License
5 // as published by the Free Software Foundation; either version 2
6 // of the License, or (at your option) any later version.
8 //SANITIZE ALL ESCAPES
9 $sanitize_all_escapes=true;
11 //STOP FAKE REGISTER GLOBALS
12 $fake_register_globals=false;
14 require_once("../../globals.php");
15 require_once("$srcdir/patient.inc");
16 require_once("$srcdir/acl.inc");
17 require_once("$srcdir/classes/Address.class.php");
18 require_once("$srcdir/classes/InsuranceCompany.class.php");
19 require_once("./patient_picture.php");
20 require_once("$srcdir/options.inc.php");
21 require_once("../history/history.inc.php");
24 if ($GLOBALS['concurrent_layout'] && $_GET['set_pid']) {
25 include_once("$srcdir/pid.inc");
26 setpid($_GET['set_pid']);
29 $pid = htmlspecialchars($_GET['pid'], ENT_QUOTES);
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 <html>
47 <head>
48 <?php html_header_show();?>
49 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
50 <link rel="stylesheet" type="text/css" href="../../../library/js/fancybox/jquery.fancybox-1.2.6.css" media="screen" />
51 <style type="text/css">@import url(../../../library/dynarch_calendar.css);</style>
52 <script type="text/javascript" src="../../../library/textformat.js"></script>
53 <script type="text/javascript" src="../../../library/dynarch_calendar.js"></script>
54 <?php include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?>
55 <script type="text/javascript" src="../../../library/dynarch_calendar_setup.js"></script>
56 <script type="text/javascript" src="../../../library/dialog.js"></script>
57 <script type="text/javascript" src="../../../library/js/jquery.1.3.2.js"></script>
58 <script type="text/javascript" src="../../../library/js/common.js"></script>
59 <script type="text/javascript" src="../../../library/js/fancybox/jquery.fancybox-1.2.6.js"></script>
60 <script language="JavaScript">
62 var mypcc = '<?php echo htmlspecialchars($GLOBALS['phone_country_code'], ENT_QUOTES) ?>';
64 function oldEvt(eventid) {
65 dlgopen('../../main/calendar/add_edit_event.php?eid=' + eventid, '_blank', 550, 270);
68 function advdirconfigure() {
69 dlgopen('advancedirectives.php', '_blank', 500, 450);
72 function refreshme() {
73 top.restoreSession();
74 location.reload();
77 // Process click on Delete link.
78 function deleteme() {
79 dlgopen('../deleter.php?patient=<?php echo $pid ?>', '_blank', 500, 450);
80 return false;
83 // Called by the deleteme.php window on a successful delete.
84 function imdeleted() {
85 <?php if ($GLOBALS['concurrent_layout']) { ?>
86 parent.left_nav.clearPatient();
87 <?php } else { ?>
88 top.restoreSession();
89 top.location.href = '../main/main_screen.php';
90 <?php } ?>
93 function validate() {
94 var f = document.forms[0];
95 <?php
96 if ($GLOBALS['athletic_team']) {
97 echo " if (f.form_userdate1.value != f.form_original_userdate1.value) {\n";
98 $irow = sqlQuery("SELECT id, title FROM lists WHERE " .
99 "pid = ? AND enddate IS NULL ORDER BY begdate DESC LIMIT 1", array($pid));
100 if (!empty($irow)) {
102 if (confirm('Do you wish to also set this new return date in the issue titled "<?php echo addslashes(htmlspecialchars($irow['title'], ENT_QUOTES)) ?>"?')) {
103 f.form_issue_id.value = '<?php echo htmlspecialchars($irow['id'], ENT_QUOTES) ?>';
104 } else {
105 alert('OK, you will need to manually update the return date in any affected issue(s).');
107 <?php } else { ?>
108 alert('You have changed the return date but there are no open issues. You probably need to create or modify one.');
109 <?php
110 } // end empty $irow
111 echo " }\n";
112 } // end athletic team
114 return true;
117 function newEvt() {
118 dlgopen('../../main/calendar/add_edit_event.php?patientid=<?php echo $pid ?>', '_blank', 550, 270);
119 return false;
122 function sendimage(pid, what) {
123 // alert('Not yet implemented.'); return false;
124 dlgopen('../upload_dialog.php?patientid=' + pid + '&file=' + what,
125 '_blank', 500, 400);
126 return false;
129 </script>
131 <script type="text/javascript">
133 function toggle( target, div ) {
135 $mode = $(target).find(".indicator").text();
136 if ( $mode == "<?php echo htmlspecialchars(xl('collapse'), ENT_QUOTES); ?>" ) {
137 $(target).find(".indicator").text( "<?php echo htmlspecialchars(xl('expand'), ENT_QUOTES); ?>" );
138 $(div).hide();
139 } else {
140 $(target).find(".indicator").text( "<?php echo htmlspecialchars(xl('collapse'), ENT_QUOTES); ?>" );
141 $(div).show();
146 $(document).ready(function(){
148 $("#dem_view").click( function() {
149 toggle( $(this), "#DEM" );
152 $("#his_view").click( function() {
153 toggle( $(this), "#HIS" );
156 $("#ins_view").click( function() {
157 toggle( $(this), "#INSURANCE" );
160 $("#notes_view").click( function() {
161 toggle( $(this), "#notes_div" );
164 // load divs
165 $("#stats_div").load("stats.php");
166 $("#notes_div").load("pnotes_fragment.php");
168 // fancy box
169 enable_modals();
171 tabbify();
173 // special size for
174 $(".large_modal").fancybox( {
175 'overlayOpacity' : 0.0,
176 'showCloseButton' : true,
177 'frameHeight' : 600,
178 'frameWidth' : 1000,
179 'centerOnScroll' : false
182 // special size for
183 $(".medium_modal").fancybox( {
184 'overlayOpacity' : 0.0,
185 'showCloseButton' : true,
186 'frameHeight' : 500,
187 'frameWidth' : 800,
188 'centerOnScroll' : false
192 // special size for
193 $(".rx_modal").fancybox( {
194 'overlayOpacity' : 0.0,
195 'showCloseButton' : true,
196 'frameHeight' : 500,
197 'frameWidth' : 800,
198 'centerOnScroll' : false,
199 'callbackOnClose' : function() {
200 refreshme();
206 </script>
208 <style type="css/text">
209 #notes_div {
210 height:auto;
211 width:100%;
213 </style>
215 </head>
217 <body class="body_top">
218 <table cellspacing='0' cellpadding='0' border='0'>
219 <tr>
220 <?php
221 $result = getPatientData($pid, "*, DATE_FORMAT(DOB,'%Y-%m-%d') as DOB_YMD");
222 $result2 = getEmployerData($pid);
224 $thisauth = acl_check('patients', 'demo');
225 if ($thisauth) {
226 if ($result['squad'] && ! acl_check('squads', $result['squad']))
227 $thisauth = 0;
230 if (!$thisauth) {
231 echo "<p>(" . htmlspecialchars(xl('Demographics not authorized'), ENT_QUOTES) . ")</p>\n";
232 echo "</body>\n</html>\n";
233 exit();
236 if ($thisauth == 'write') {
237 foreach (pic_array() as $var) {print $var;}
238 echo "<td><a href='demographics_full.php'";
239 if (! $GLOBALS['concurrent_layout']) echo " target='Main'";
240 echo " onclick='top.restoreSession()'><span class='title'>" .
241 htmlspecialchars(getPatientName($pid), ENT_QUOTES) . "</span></a>&nbsp;&nbsp;</td>";
243 echo "<td><a class='css_button' href='demographics_full.php'";
244 if (! $GLOBALS['concurrent_layout']) echo " target='Main'";
245 echo " onclick='top.restoreSession()'><span>" . htmlspecialchars(xl("Edit" ), ENT_QUOTES). "</span></a></td>";
247 if (acl_check('admin', 'super')) {
248 echo "<td><a class='css_button iframe' href='../deleter.php?patient=" . $pid . "'>" .
249 "<span>".htmlspecialchars(xl('Delete'), ENT_QUOTES)."</span></a></td>";
251 if ($GLOBALS['oer_config']['ws_accounting']['enabled']) {
252 // Show current balance and billing note, if any.
253 echo "<td>&nbsp;&nbsp;&nbsp;<span class='bold'><font color='#ee6600'>" . htmlspecialchars(xl('Balance Due'), ENT_QUOTES) . ": " . htmlspecialchars(xl('$'), ENT_QUOTES) .
254 htmlspecialchars(get_patient_balance($pid), ENT_QUOTES) . "</font><br />";
255 if ($result['genericname2'] == 'Billing') {
256 htmlspecialchars(xl('Billing Note'), ENT_QUOTES) . ":";
257 echo "<span class='bold'><font color='red'>" .
258 htmlspecialchars($result['genericval2'], ENT_QUOTES) . "</font></span>";
260 echo "</span></td>";
265 // Get the document ID of the patient ID card if access to it is wanted here.
266 $document_id = 0;
267 if ($GLOBALS['patient_id_category_name']) {
268 $tmp = sqlQuery("SELECT d.id, d.date, d.url FROM " .
269 "documents AS d, categories_to_documents AS cd, categories AS c " .
270 "WHERE d.foreign_id = ? " .
271 "AND cd.document_id = d.id " .
272 "AND c.id = cd.category_id " .
273 "AND c.name LIKE ? " .
274 "ORDER BY d.date DESC LIMIT 1", array($pid, $GLOBALS['patient_id_category_name']));
275 if ($tmp) $document_id = htmlspecialchars($tmp['id'], ENT_QUOTES);
278 </tr>
280 <tr>
281 <td class="small" colspan='4'>
282 <a href="rx_frameset.php" class='iframe rx_modal' onclick='top.restoreSession()'><?php echo htmlspecialchars(xl('Rx'), ENT_QUOTES); ?></a>
284 <a href="../history/history.php" onclick='top.restoreSession()'><?php echo htmlspecialchars(xl('History'), ENT_QUOTES); ?></a>
286 <a href="../report/patient_report.php" class='iframe medium_modal' onclick='top.restoreSession()'><?php echo htmlspecialchars(xl('Report'), ENT_QUOTES); ?></a>
288 <a href="../../../controller.php?document&list&patient_id=<?php echo $pid;?>" class='iframe medium_modal' onclick='top.restoreSession()'><?php echo htmlspecialchars(xl('Documents'), ENT_QUOTES); ?></a>
290 <a href="../transaction/transactions.php" class='iframe large_modal' onclick='top.restoreSession()'><?php echo htmlspecialchars(xl('Transactions'), ENT_QUOTES); ?></a>
291 </td>
292 </tr>
293 </table> <!-- end header -->
295 <div style='margin-top:10px'> <!-- start main content div -->
296 <table border="0" cellspacing="0" cellpadding="0" width="100%">
297 <tr>
298 <td align="left" valign="top">
299 <!-- start left column div -->
300 <div style='float:left; margin-right:20px'>
301 <table cellspacing=0 cellpadding=0>
302 <tr>
303 <td>
304 <div class="section-header">
305 <a href='javascript:;' class='small' id='dem_view'><span class='text'><b><?php echo htmlspecialchars(xl("Demographics"), ENT_QUOTES)?></b></span> (<span class="indicator"><?php echo htmlspecialchars(xl('collapse'), ENT_QUOTES); ?></span>)</a>
306 </div>
308 <!-- Demographics -->
309 <div id="DEM">
310 <ul class="tabNav">
311 <?php display_layout_tabs('DEM', $result, $result2); ?>
312 </ul>
313 <div class="tabContainer">
314 <?php display_layout_tabs_data('DEM', $result, $result2); ?>
315 </div>
316 </div>
317 </td>
318 </tr>
320 <tr>
321 <td>
322 <?php
324 $insurance_count = 0;
325 foreach (array('primary','secondary','tertiary') as $instype) {
326 $enddate = 'Present';
328 $query = "SELECT * FROM insurance_data WHERE " .
329 "pid = ? AND type = ? " .
330 "ORDER BY date DESC";
331 $res = sqlStatement($query, array($pid, $instype));
332 while( $row = sqlFetchArray($res) ) {
333 if ($row['provider'] ) $insurance_count++;
337 if ( $insurance_count > 0 ) {
340 <div class="section-header">
341 <a href='javascript:;' class='small' id='ins_view'><span class='text'><b><?php echo htmlspecialchars(xl("Insurance"), ENT_QUOTES)?></b></span> (<span class="indicator"><?php echo htmlspecialchars(xl('collapse'), ENT_QUOTES); ?></span>)</a>
342 </div>
344 <div id="INSURANCE">
346 <?php
347 if ( $insurance_count > 1 ) {
349 ?><ul class="tabNav"><?php
351 ///////////////////////////////// INSURANCE SECTION
352 $first = true;
353 foreach (array('primary','secondary','tertiary') as $instype) {
355 $query = "SELECT * FROM insurance_data WHERE " .
356 "pid = ? AND type = ? " .
357 "ORDER BY date DESC";
358 $res = sqlStatement($query, array($pid, $instype));
360 $enddate = 'Present';
362 while( $row = sqlFetchArray($res) ) {
363 if ($row['provider'] ) {
365 $ins_description = ucfirst($instype);
366 $ins_description .= strcmp($enddate, 'Present') != 0 ? " (Old)" : "";
368 <li <?php echo $first ? 'class="current"' : '' ?>><a href="/play/javascript-tabbed-navigation/"><?php echo htmlspecialchars(ucfirst($ins_description), ENT_QUOTES); ?></a></li>
369 <?php
370 $first = false;
372 $enddate = $row['date'];
376 ?></ul><?php
378 } ?>
380 <div class="tabContainer">
381 <?php
382 $first = true;
383 foreach (array('primary','secondary','tertiary') as $instype) {
384 $enddate = 'Present';
386 $query = "SELECT * FROM insurance_data WHERE " .
387 "pid = ? AND type = ? " .
388 "ORDER BY date DESC";
389 $res = sqlStatement($query, array($pid, $instype));
390 while( $row = sqlFetchArray($res) ) {
391 if ($row['provider'] ) {
393 <div class="tab <?php echo $first ? 'current' : '' ?>">
394 <table border='0' cellpadding='0' width='100%'>
395 <?php
396 $icobj = new InsuranceCompany($row['provider']);
397 $adobj = $icobj->get_address();
398 $insco_name = trim($icobj->get_name());
400 <tr>
401 <td valign='top' colspan='3'>
402 <span class='text'>
403 <?php if (strcmp($enddate, 'Present') != 0) echo "Old "; ?>
404 <?php echo htmlspecialchars(ucfirst($instype)." ". xl('Insurance'), ENT_QUOTES); ?>
405 <?php if (strcmp($row['date'], '0000-00-00') != 0) { ?>
406 <?php echo htmlspecialchars(" ".xl('from','e')." ". $row['date'], ENT_QUOTES); ?>
407 <?php } ?>
408 <?php ; echo " ".htmlspecialchars(xl('until')." ".$enddate, ENT_QUOTES); ?>:</span>
409 </td>
410 </tr>
411 <tr>
412 <td valign='top'>
413 <span class='text'>
414 <?php
415 if ($insco_name) {
416 echo htmlspecialchars($insco_name, ENT_QUOTES) . '<br>';
417 if (trim($adobj->get_line1())) {
418 echo htmlspecialchars($adobj->get_line1(), ENT_QUOTES) . '<br>';
419 echo htmlspecialchars($adobj->get_city() . ', ' . $adobj->get_state() . ' ' . $adobj->get_zip(), ENT_QUOTES);
421 } else {
422 echo "<font color='red'><b>Unassigned</b></font>";
425 <br>
426 <?php echo htmlspecialchars(xl('Policy Number'), ENT_QUOTES); ?>: <?php echo htmlspecialchars($row['policy_number'], ENT_QUOTES) ?><br>
427 <?php echo htmlspecialchars(xl('Plan Name').": ".$row['plan_name'], ENT_QUOTES); ?><br>
428 <?php echo htmlspecialchars(xl('Group Number').": ".$row['group_number'], ENT_QUOTES); ?></span>
429 </td>
430 <td valign='top'>
431 <span class='bold'><?php echo htmlspecialchars(xl('Subscriber'), ENT_QUOTES); ?>: </span><br>
432 <span class='text'><?php echo htmlspecialchars($row['subscriber_fname'] . ' ' . $row['subscriber_mname'] . ' ' . $row['subscriber_lname'], ENT_QUOTES); ?>
433 <?php
434 if ($row['subscriber_relationship'] != "") {
435 echo "(" . htmlspecialchars($row['subscriber_relationship'], ENT_QUOTES) . ")";
438 <br>
439 <?php echo htmlspecialchars(xl('S.S.').": ".$row['subscriber_ss'], ENT_QUOTES); ?><br>
440 <?php echo htmlspecialchars(xl('D.O.B.'), ENT_QUOTES); ?>:
441 <?php if ($row['subscriber_DOB'] != "0000-00-00 00:00:00") echo htmlspecialchars($row['subscriber_DOB'], ENT_QUOTES); ?><br>
442 <?php echo htmlspecialchars(xl('Phone').": ".$row['subscriber_phone'], ENT_QUOTES); ?>
443 </span>
444 </td>
445 <td valign='top'>
446 <span class='bold'><?php echo htmlspecialchars(xl('Subscriber Address'), ENT_QUOTES); ?>: </span><br>
447 <span class='text'><?php echo htmlspecialchars($row['subscriber_street'], ENT_QUOTES); ?><br>
448 <?php echo htmlspecialchars($row['subscriber_city'], ENT_QUOTES); ?>
449 <?php if($row['subscriber_state'] != "") echo ", "; echo htmlspecialchars($row['subscriber_state'], ENT_QUOTES); ?>
450 <?php if($row['subscriber_country'] != "") echo ", "; echo htmlspecialchars($row['subscriber_country'], ENT_QUOTES); ?>
451 <?php echo " " . htmlspecialchars($row['subscriber_postal_code'], ENT_QUOTES); ?></span>
453 <?php if (trim($row['subscriber_employer'])) { ?>
454 <br><span class='bold'><?php echo htmlspecialchars(xl('Subscriber Employer'), ENT_QUOTES); ?>: </span><br>
455 <span class='text'><?php echo htmlspecialchars($row['subscriber_employer'], ENT_QUOTES); ?><br>
456 <?php echo htmlspecialchars($row['subscriber_employer_street'], ENT_QUOTES); ?><br>
457 <?php echo htmlspecialchars($row['subscriber_employer_city'], ENT_QUOTES); ?>
458 <?php if($row['subscriber_employer_city'] != "") echo ", "; echo htmlspecialchars($row['subscriber_employer_state'], ENT_QUOTES); ?>
459 <?php if($row['subscriber_employer_country'] != "") echo ", "; echo htmlspecialchars($row['subscriber_employer_country'], ENT_QUOTES); ?>
460 <?php echo " " . htmlspecialchars($row['subscriber_employer_postal_code'], ENT_QUOTES); ?>
461 </span>
462 <?php } ?>
464 </td>
465 </tr>
466 <tr>
467 <td>
468 <?php if ($row['copay'] != "") { ?>
469 <span class='bold'><?php echo htmlspecialchars(xl('CoPay'), ENT_QUOTES); ?>: </span>
470 <span class='text'><?php echo htmlspecialchars($row['copay'], ENT_QUOTES); ?></span>
471 <?php } ?>
472 <br>
473 <span class='bold'><?php echo htmlspecialchars(xl('Accept Assignment'), ENT_QUOTES); ?>:</span>
474 <span class='text'><?php if($row['accept_assignment'] == "TRUE") echo "YES"; ?>
475 <?php if($row['accept_assignment'] == "FALSE") echo "NO"; ?></span>
476 </td>
477 <td valign='top'></td>
478 <td valign='top'></td>
479 </tr>
481 </table>
482 </div>
483 <?php
485 } // end if ($row['provider'])
486 $enddate = $row['date'];
487 $first = false;
488 } // end while
489 } // end foreach
491 ///////////////////////////////// END INSURANCE SECTION
493 </div>
495 <?php } // ?>
497 </td>
498 </tr>
500 <tr>
501 <td width='650px'>
502 <div class="section-header">
503 <a href='javascript:;' class='small' id='notes_view'><span class='text'><b><?php echo htmlspecialchars(xl("Notes"), ENT_QUOTES);?></b></span> (<span class="indicator"><?php echo htmlspecialchars(xl('collapse'), ENT_QUOTES); ?></span>)</a>
504 </div>
505 <!-- Demographics -->
506 <div id='notes_div' class='tab current' style='height:auto; width:100%' >
507 <br/>
508 <div style='margin-left:10px' class='text'><image src='../../pic/ajax-loader.gif'/></div><br/>
509 </div>
510 </td>
511 </tr>
513 </table>
515 </div>
518 </div>
519 <!-- end left column div -->
521 <!-- start right column div -->
522 <div class='text'>
523 <table>
524 <tr>
525 <td>
526 <?php
527 if ($GLOBALS['advance_directives_warning']) { ?>
528 <div>
529 <span class="text"><b><?php echo htmlspecialchars(xl('Advance Directives'), ENT_QUOTES) ?></b></span>
530 <a href="#" class="small" onClick="return advdirconfigure();">
531 (<b><?php echo htmlspecialchars(xl('Manage'), ENT_QUOTES) ?></b>)
532 </a>
533 </div>
534 <div class='small'>
535 <?php
536 $counterFlag = false; //flag to record whether any categories contain ad records
537 $query = "SELECT id FROM categories WHERE name='Advance Directive'";
538 $myrow2 = sqlQuery($query);
539 if ($myrow2) {
540 $parentId = $myrow2['id'];
541 $query = "SELECT id, name FROM categories WHERE parent=?";
542 $resNew1 = sqlStatement($query, array($parentId));
543 while ($myrows3 = sqlFetchArray($resNew1)) {
544 $categoryId = $myrows3['id'];
545 $nameDoc = $myrows3['name'];
546 $query = "SELECT documents.date, documents.id " .
547 "FROM documents " .
548 "INNER JOIN categories_to_documents " .
549 "ON categories_to_documents.document_id=documents.id " .
550 "WHERE categories_to_documents.category_id=? " .
551 "AND documents.foreign_id=? " .
552 "ORDER BY documents.date DESC";
553 $resNew2 = sqlStatement($query, array($categoryId, $pid));
554 $limitCounter = 0; // limit to one entry per category
555 while (($myrows4 = sqlFetchArray($resNew2)) && ($limitCounter == 0)) {
556 $dateTimeDoc = $myrows4['date'];
557 // remove time from datetime stamp
558 $tempParse = explode(" ",$dateTimeDoc);
559 $dateDoc = htmlspecialchars($tempParse[0], ENT_QUOTES);
560 $idDoc = htmlspecialchars($myrows4['id'], ENT_QUOTES);
561 echo "<a href='$web_root/controller.php?document&retrieve&patient_id=$pid&document_id=" .
562 $idDoc . "&as_file=true'>" . htmlspecialchars(xl_document_category($nameDoc), ENT_QUOTES) . "</a> " . $dateDoc;
563 echo "<br>";
564 $limitCounter = $limitCounter + 1;
565 $counterFlag = true;
569 if (!$counterFlag) {
570 echo htmlspecialchars(xl('None.'), ENT_QUOTES);
571 } ?>
572 </div>
573 <? } ?>
574 <?php
575 // This is a feature for a specific client. -- Rod
576 if ($GLOBALS['cene_specific']) {
577 echo " <br />\n";
579 $imagedir = "$webserver_root/documents/$pid/demographics";
580 $imagepath = "$web_root/documents/$pid/demographics";
582 echo " <a href='' onclick=\"return sendimage($pid, 'photo');\" " .
583 "title='".htmlspecialchars(xl('Click to attach patient image'), ENT_QUOTES)."'>\n";
584 if (is_file("$imagedir/photo.jpg")) {
585 echo " <img src='$imagepath/photo.jpg' /></a>\n";
586 } else {
587 echo " ".htmlspecialchars(xl('Attach Patient Image'), ENT_QUOTES)."</a><br />\n";
589 echo " <br />&nbsp;<br />\n";
591 echo " <a href='' onclick=\"return sendimage($pid, 'fingerprint');\" " .
592 "title='".htmlspecialchars(xl('Click to attach fingerprint'), ENT_QUOTES)."'>\n";
593 if (is_file("$imagedir/fingerprint.jpg")) {
594 echo " <img src='$imagepath/fingerprint.jpg' /></a>\n";
595 } else {
596 echo " ".htmlspecialchars(xl('Attach Biometric Fingerprint'), ENT_QUOTES)."</a><br />\n";
598 echo " <br />&nbsp;<br />\n";
601 // This stuff only applies to athletic team use of OpenEMR. The client
602 // insisted on being able to quickly change fitness and return date here:
604 if (false && $GLOBALS['athletic_team']) {
605 // blue green yellow red orange
606 $fitcolors = array('#6677ff','#00cc00','#ffff00','#ff3333','#ff8800','#ffeecc','#ffccaa');
607 if (!empty($GLOBALS['fitness_colors'])) $fitcolors = $GLOBALS['fitness_colors'];
608 $fitcolor = $fitcolors[0];
609 $form_fitness = $_POST['form_fitness'];
610 $form_userdate1 = fixDate($_POST['form_userdate1'], '');
611 $form_issue_id = $_POST['form_issue_id'];
612 if ($form_submit) {
613 $returndate = $form_userdate1 ? "'$form_userdate1'" : "NULL";
614 sqlStatement("UPDATE patient_data SET fitness = '$form_fitness', " .
615 "userdate1 = $returndate WHERE pid = ?", array($pid));
616 // Update return date in the designated issue, if requested.
617 if ($form_issue_id) {
618 sqlStatement("UPDATE lists SET returndate = $returndate WHERE " .
619 "id = ?", array($form_issue_id));
621 } else {
622 $form_fitness = $result['fitness'];
623 if (! $form_fitness) $form_fitness = 1;
624 $form_userdate1 = $result['userdate1'];
626 $fitcolor = $fitcolors[$form_fitness - 1];
627 echo " <form method='post' action='demographics.php' onsubmit='return validate()'>\n";
628 echo " <span class='bold'>.".htmlspecialchars(xl('Fitness to Play'), ENT_QUOTES).":</span><br />\n";
629 echo " <select name='form_fitness' style='background-color:$fitcolor'>\n";
630 $res = sqlStatement("SELECT * FROM list_options WHERE " .
631 "list_id = 'fitness' ORDER BY seq");
632 while ($row = sqlFetchArray($res)) {
633 $key = htmlspecialchars($row['option_id'], ENT_QUOTES);
634 echo " <option value='$key'";
635 if ($key == $form_fitness) echo " selected";
636 echo ">" . htmlspecialchars($row['title'], ENT_QUOTES) . "</option>\n";
638 echo " </select>\n";
639 echo " <br /><span class='bold'>".htmlspecialchars(xl('Return to Play'), ENT_QUOTES).":</span><br>\n";
640 echo " <input type='text' size='10' name='form_userdate1' id='form_userdate1' " .
641 "value='".htmlspecialchars($form_userdate1, ENT_QUOTES)."' " .
642 "title='" . htmlspecialchars(xl('yyyy-mm-dd Date of return to play'), ENT_QUOTES) . "' " .
643 "onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)' />\n" .
644 " <img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22' " .
645 "id='img_userdate1' border='0' alt='[?]' style='cursor:pointer' " .
646 "title='" . htmlspecialchars(xl('Click here to choose a date'), ENT_QUOTES) . "'>\n";
647 echo " <input type='hidden' name='form_original_userdate1' value='".htmlspecialchars($form_userdate1, ENT_QUOTES)."' />\n";
648 echo " <input type='hidden' name='form_issue_id' value='' />\n";
649 echo "<p><input type='submit' name='form_submit' value='Change' /></p>\n";
650 echo " </form>\n";
653 // If there is a patient ID card, then show a link to it.
654 if ($document_id) {
655 echo "<a href='" . $web_root . "/controller.php?document&retrieve" .
656 "&patient_id=$pid&document_id=$document_id' style='color:#00cc00' " .
657 "onclick='top.restoreSession()'>Click for ID card</a><br />";
660 // Show current and upcoming appointments.
661 if (isset($pid) && !$GLOBALS['disable_calendar']) {
662 $query = "SELECT e.pc_eid, e.pc_aid, e.pc_title, e.pc_eventDate, " .
663 "e.pc_startTime, e.pc_hometext, u.fname, u.lname, u.mname, " .
664 "c.pc_catname " .
665 "FROM openemr_postcalendar_events AS e, users AS u, " .
666 "openemr_postcalendar_categories AS c WHERE " .
667 "e.pc_pid = ? AND e.pc_eventDate >= CURRENT_DATE AND " .
668 "u.id = e.pc_aid AND e.pc_catid = c.pc_catid " .
669 "ORDER BY e.pc_eventDate, e.pc_startTime";
670 $res = sqlStatement($query, array($pid));
672 if (isset($res) && $res != null) { ?>
673 <div>
674 <span class="text"><b><?php echo htmlspecialchars(xl('Appointments'), ENT_QUOTES) ?></b></span>
675 <a href="#" class="small" onClick="return newEvt();" >
676 (<b><?php echo htmlspecialchars(xl('Add'), ENT_QUOTES) ?></b>)
677 </a>
678 </div>
679 <?php } ?>
680 <div class='small'>
681 <?php
682 $count = 0;
683 while($row = sqlFetchArray($res)) {
684 $count++;
685 $dayname = date("l", strtotime($row['pc_eventDate']));
686 $dispampm = "am";
687 $disphour = substr($row['pc_startTime'], 0, 2) + 0;
688 $dispmin = substr($row['pc_startTime'], 3, 2);
689 if ($disphour >= 12) {
690 $dispampm = "pm";
691 if ($disphour > 12) $disphour -= 12;
693 $etitle = xl('(Click to edit)');
694 if ($row['pc_hometext'] != "") {
695 $etitle = xl('Comments').": ".addslashes($row['pc_hometext'])."\r\n".$etitle;
697 echo "<a href='javascript:oldEvt(" . htmlspecialchars($row['pc_eid'], ENT_QUOTES) . ")' title='".htmlspecialchars($etitle, ENT_QUOTES)."'>";
698 echo "<b>" . htmlspecialchars(xl($dayname), ENT_QUOTES) . ", " . htmlspecialchars($row['pc_eventDate'], ENT_QUOTES) . "</b><br>";
699 echo htmlspecialchars("$disphour:$dispmin " . xl($dispampm) . " " . xl_appt_category($row['pc_catname']), ENT_QUOTES) . "<br>\n";
700 echo htmlspecialchars($row['fname'] . " " . $row['lname'], ENT_QUOTES) . "</a><br>\n";
702 if (isset($res) && $res != null) {
703 if ( $count < 1 ) { echo htmlspecialchars(xl('None.'), ENT_QUOTES); }
704 echo "</div>";
708 </div>
710 <div id='stats_div' style='float:left'>
711 <br/>
712 <div style='margin-left:10px' class='text'><image src='../../pic/ajax-loader.gif'/></div><br/>
713 </div>
715 </td>
716 </tr>
717 </table>
719 </div> <!-- end right column div -->
721 </td>
723 </tr>
724 </table>
726 </div> <!-- end main content div -->
728 <?php if ($GLOBALS['concurrent_layout'] && $_GET['set_pid']) { ?>
729 <script language='JavaScript'>
730 parent.left_nav.setPatient(<?php echo "'" . addslashes(htmlspecialchars($result['fname'], ENT_QUOTES)) . " " . addslashes(htmlspecialchars($result['lname'], ENT_QUOTES)) . "',$pid,'" . addslashes(htmlspecialchars($result['pubpid'], ENT_QUOTES)) . "','', ' ".htmlspecialchars(xl('DOB'), ENT_QUOTES).": ".htmlspecialchars($result['DOB_YMD'], ENT_QUOTES) ." ".htmlspecialchars(xl('Age'), ENT_QUOTES).": ".htmlspecialchars(getPatientAge($result['DOB_YMD']), ENT_QUOTES)."'"; ?>);
731 parent.left_nav.setRadio(window.name, 'dem');
732 </script>
733 <?php } ?>
735 <?php if (false && $GLOBALS['athletic_team']) { ?>
736 <script language='JavaScript'>
737 Calendar.setup({inputField:"form_userdate1", ifFormat:"%Y-%m-%d", button:"img_userdate1"});
738 </script>
739 <?php } ?>
741 </body>
742 </html>