internationalization of the date widget, see feature request tracker item 2967294
[openemr.git] / interface / patient_file / summary / demographics.php
blobf6289a811ac9b8c1689ac01b52c05a55fc6f6d4a
1 <?php
2 require_once("../../globals.php");
3 require_once("$srcdir/patient.inc");
4 require_once("$srcdir/acl.inc");
5 require_once("$srcdir/classes/Address.class.php");
6 require_once("$srcdir/classes/InsuranceCompany.class.php");
7 require_once("./patient_picture.php");
8 require_once("$srcdir/options.inc.php");
9 require_once("../history/history.inc.php");
10 if ($GLOBALS['concurrent_layout'] && $_GET['set_pid']) {
11 include_once("$srcdir/pid.inc");
12 setpid($_GET['set_pid']);
15 function print_as_money($money) {
16 preg_match("/(\d*)\.?(\d*)/",$money,$moneymatches);
17 $tmp = wordwrap(strrev($moneymatches[1]),3,",",1);
18 $ccheck = strrev($tmp);
19 if ($ccheck[0] == ",") {
20 $tmp = substr($ccheck,1,strlen($ccheck)-1);
22 if ($moneymatches[2] != "") {
23 return "$ " . strrev($tmp) . "." . $moneymatches[2];
24 } else {
25 return "$ " . strrev($tmp);
29 <html>
31 <head>
32 <?php html_header_show();?>
33 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
34 <link rel="stylesheet" type="text/css" href="../../../library/js/fancybox/jquery.fancybox-1.2.6.css" media="screen" />
35 <style type="text/css">@import url(../../../library/dynarch_calendar.css);</style>
36 <script type="text/javascript" src="../../../library/textformat.js"></script>
37 <script type="text/javascript" src="../../../library/dynarch_calendar.js"></script>
38 <?php include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?>
39 <script type="text/javascript" src="../../../library/dynarch_calendar_setup.js"></script>
40 <script type="text/javascript" src="../../../library/dialog.js"></script>
41 <script type="text/javascript" src="../../../library/js/jquery.1.3.2.js"></script>
42 <script type="text/javascript" src="../../../library/js/common.js"></script>
43 <script type="text/javascript" src="../../../library/js/fancybox/jquery.fancybox-1.2.6.js"></script>
44 <script language="JavaScript">
46 var mypcc = '<?php echo $GLOBALS['phone_country_code'] ?>';
48 function oldEvt(eventid) {
49 dlgopen('../../main/calendar/add_edit_event.php?eid=' + eventid, '_blank', 550, 270);
52 function advdirconfigure() {
53 dlgopen('advancedirectives.php', '_blank', 500, 450);
56 function refreshme() {
57 top.restoreSession();
58 location.reload();
61 // Process click on Delete link.
62 function deleteme() {
63 dlgopen('../deleter.php?patient=<?php echo $pid ?>', '_blank', 500, 450);
64 return false;
67 // Called by the deleteme.php window on a successful delete.
68 function imdeleted() {
69 <?php if ($GLOBALS['concurrent_layout']) { ?>
70 parent.left_nav.clearPatient();
71 <?php } else { ?>
72 top.restoreSession();
73 top.location.href = '../main/main_screen.php';
74 <?php } ?>
77 function validate() {
78 var f = document.forms[0];
79 <?php
80 if ($GLOBALS['athletic_team']) {
81 echo " if (f.form_userdate1.value != f.form_original_userdate1.value) {\n";
82 $irow = sqlQuery("SELECT id, title FROM lists WHERE " .
83 "pid = '$pid' AND enddate IS NULL ORDER BY begdate DESC LIMIT 1");
84 if (!empty($irow)) {
86 if (confirm('Do you wish to also set this new return date in the issue titled "<?php echo addslashes($irow['title']) ?>"?')) {
87 f.form_issue_id.value = '<?php echo $irow['id'] ?>';
88 } else {
89 alert('OK, you will need to manually update the return date in any affected issue(s).');
91 <?php } else { ?>
92 alert('You have changed the return date but there are no open issues. You probably need to create or modify one.');
93 <?php
94 } // end empty $irow
95 echo " }\n";
96 } // end athletic team
98 return true;
101 function newEvt() {
102 dlgopen('../../main/calendar/add_edit_event.php?patientid=<?php echo $pid ?>', '_blank', 550, 270);
103 return false;
106 function sendimage(pid, what) {
107 // alert('Not yet implemented.'); return false;
108 dlgopen('../upload_dialog.php?patientid=' + pid + '&file=' + what,
109 '_blank', 500, 400);
110 return false;
113 </script>
115 <script type="text/javascript">
117 function toggle( target, div ) {
119 $mode = $(target).find(".indicator").text();
120 if ( $mode == "<?php xl('collapse','e'); ?>" ) {
121 $(target).find(".indicator").text( "<?php xl('expand','e'); ?>" );
122 $(div).hide();
123 } else {
124 $(target).find(".indicator").text( "<?php xl('collapse','e'); ?>" );
125 $(div).show();
130 $(document).ready(function(){
132 $("#dem_view").click( function() {
133 toggle( $(this), "#DEM" );
136 $("#his_view").click( function() {
137 toggle( $(this), "#HIS" );
140 $("#ins_view").click( function() {
141 toggle( $(this), "#INSURANCE" );
144 $("#notes_view").click( function() {
145 toggle( $(this), "#notes_div" );
148 // load divs
149 $("#stats_div").load("stats.php");
150 $("#notes_div").load("pnotes_fragment.php");
152 // fancy box
153 enable_modals();
155 tabbify();
157 // special size for
158 $(".large_modal").fancybox( {
159 'overlayOpacity' : 0.0,
160 'showCloseButton' : true,
161 'frameHeight' : 600,
162 'frameWidth' : 1000,
163 'centerOnScroll' : false
166 // special size for
167 $(".medium_modal").fancybox( {
168 'overlayOpacity' : 0.0,
169 'showCloseButton' : true,
170 'frameHeight' : 500,
171 'frameWidth' : 800,
172 'centerOnScroll' : false
176 // special size for
177 $(".rx_modal").fancybox( {
178 'overlayOpacity' : 0.0,
179 'showCloseButton' : true,
180 'frameHeight' : 500,
181 'frameWidth' : 800,
182 'centerOnScroll' : false,
183 'callbackOnClose' : function() {
184 refreshme();
190 </script>
192 <style type="css/text">
193 #notes_div {
194 height:auto;
195 width:100%;
197 </style>
199 </head>
201 <body class="body_top">
202 <table cellspacing='0' cellpadding='0' border='0'>
203 <tr>
204 <?php
205 $result = getPatientData($pid, "*, DATE_FORMAT(DOB,'%Y-%m-%d') as DOB_YMD");
206 $result2 = getEmployerData($pid);
208 $thisauth = acl_check('patients', 'demo');
209 if ($thisauth) {
210 if ($result['squad'] && ! acl_check('squads', $result['squad']))
211 $thisauth = 0;
214 if (!$thisauth) {
215 echo "<p>(" . xl('Demographics not authorized') . ")</p>\n";
216 echo "</body>\n</html>\n";
217 exit();
220 if ($thisauth == 'write') {
221 foreach (pic_array() as $var) {print $var;}
222 echo "<td><a href='demographics_full.php'";
223 if (! $GLOBALS['concurrent_layout']) echo " target='Main'";
224 echo " onclick='top.restoreSession()'><span class='title'>" .
225 getPatientName($pid) . "</span></a>&nbsp;&nbsp;</td>";
227 echo "<td><a class='css_button' href='demographics_full.php'";
228 if (! $GLOBALS['concurrent_layout']) echo " target='Main'";
229 echo " onclick='top.restoreSession()'><span>" . xl("Edit" ). "</span></a></td>";
231 if (acl_check('admin', 'super')) {
232 echo "<td><a class='css_button iframe' href='../deleter.php?patient=" . $pid . "'>" .
233 "<span>".xl('Delete')."</span></a></td>";
235 if ($GLOBALS['oer_config']['ws_accounting']['enabled']) {
236 // Show current balance and billing note, if any.
237 echo "<td>&nbsp;&nbsp;&nbsp;<span class='bold'><font color='#ee6600'>" . xl('Balance Due') . ": " . xl('$') .
238 get_patient_balance($pid) . "</font><br />";
239 if ($result['genericname2'] == 'Billing') {
240 xl('Billing Note') . ":";
241 echo "<span class='bold'><font color='red'>" .
242 $result['genericval2'] . "</font></span>";
244 echo "</span></td>";
249 // Get the document ID of the patient ID card if access to it is wanted here.
250 $document_id = 0;
251 if ($GLOBALS['patient_id_category_name']) {
252 $tmp = sqlQuery("SELECT d.id, d.date, d.url FROM " .
253 "documents AS d, categories_to_documents AS cd, categories AS c " .
254 "WHERE d.foreign_id = $pid " .
255 "AND cd.document_id = d.id " .
256 "AND c.id = cd.category_id " .
257 "AND c.name LIKE '" . $GLOBALS['patient_id_category_name'] . "' " .
258 "ORDER BY d.date DESC LIMIT 1");
259 if ($tmp) $document_id = $tmp['id'];
262 </tr>
264 <tr>
265 <td class="small" colspan='4'>
266 <a href="rx_frameset.php" class='iframe rx_modal' onclick='top.restoreSession()'><?php xl('Rx', 'e'); ?></a>
268 <a href="../history/history.php" onclick='top.restoreSession()'><?php xl('History', 'e'); ?></a>
270 <a href="../report/patient_report.php" class='iframe medium_modal' onclick='top.restoreSession()'><?php xl('Report', 'e'); ?></a>
272 <a href="../../../controller.php?document&list&patient_id=<?php echo $pid;?>" class='iframe medium_modal' onclick='top.restoreSession()'><?php xl('Documents', 'e'); ?></a>
274 <a href="../transaction/transactions.php" class='iframe large_modal' onclick='top.restoreSession()'><?php xl('Transactions', 'e'); ?></a>
275 </td>
276 </tr>
277 </table> <!-- end header -->
279 <div style='margin-top:10px'> <!-- start main content div -->
280 <table border="0" cellspacing="0" cellpadding="0" width="100%">
281 <tr>
282 <td align="left" valign="top">
283 <!-- start left column div -->
284 <div style='float:left; margin-right:20px'>
285 <table cellspacing=0 cellpadding=0>
286 <tr>
287 <td>
288 <div class="section-header">
289 <a href='javascript:;' class='small' id='dem_view'><span class='text'><b><?php xl("Demographics", "e" )?></b></span> (<span class="indicator"><?php xl('collapse','e'); ?></span>)</a>
290 </div>
292 <!-- Demographics -->
293 <div id="DEM">
294 <ul class="tabNav">
295 <?php display_layout_tabs('DEM', $result, $result2); ?>
296 </ul>
297 <div class="tabContainer">
298 <?php display_layout_tabs_data('DEM', $result, $result2); ?>
299 </div>
300 </div>
301 </td>
302 </tr>
304 <tr>
305 <td>
306 <?php
308 $insurance_count = 0;
309 foreach (array('primary','secondary','tertiary') as $instype) {
310 $enddate = 'Present';
312 $query = "SELECT * FROM insurance_data WHERE " .
313 "pid = '$pid' AND type = '$instype' " .
314 "ORDER BY date DESC";
315 $res = sqlStatement($query);
316 while( $row = sqlFetchArray($res) ) {
317 if ($row['provider'] ) $insurance_count++;
321 if ( $insurance_count > 0 ) {
324 <div class="section-header">
325 <a href='javascript:;' class='small' id='ins_view'><span class='text'><b><?php xl("Insurance", "e" )?></b></span> (<span class="indicator"><?php xl('collapse','e'); ?></span>)</a>
326 </div>
328 <div id="INSURANCE">
330 <?php
331 if ( $insurance_count > 1 ) {
333 ?><ul class="tabNav"><?php
335 ///////////////////////////////// INSURANCE SECTION
336 $first = true;
337 foreach (array('primary','secondary','tertiary') as $instype) {
339 $query = "SELECT * FROM insurance_data WHERE " .
340 "pid = '$pid' AND type = '$instype' " .
341 "ORDER BY date DESC";
342 $res = sqlStatement($query);
344 $enddate = 'Present';
346 while( $row = sqlFetchArray($res) ) {
347 if ($row['provider'] ) {
349 $ins_description = ucfirst($instype);
350 $ins_description .= strcmp($enddate, 'Present') != 0 ? " (Old)" : "";
352 <li <?php echo $first ? 'class="current"' : '' ?>><a href="/play/javascript-tabbed-navigation/"><?php xl(ucfirst($ins_description),'e'); ?></a></li>
353 <?php
354 $first = false;
356 $enddate = $row['date'];
360 ?></ul><?php
362 } ?>
364 <div class="tabContainer">
365 <?php
366 $first = true;
367 foreach (array('primary','secondary','tertiary') as $instype) {
368 $enddate = 'Present';
370 $query = "SELECT * FROM insurance_data WHERE " .
371 "pid = '$pid' AND type = '$instype' " .
372 "ORDER BY date DESC";
373 $res = sqlStatement($query);
374 while( $row = sqlFetchArray($res) ) {
375 if ($row['provider'] ) {
377 <div class="tab <?php echo $first ? 'current' : '' ?>">
378 <table border='0' cellpadding='0' width='100%'>
379 <?php
380 $icobj = new InsuranceCompany($row['provider']);
381 $adobj = $icobj->get_address();
382 $insco_name = trim($icobj->get_name());
384 <tr>
385 <td valign='top' colspan='3'>
386 <span class='text'>
387 <?php if (strcmp($enddate, 'Present') != 0) echo "Old "; ?>
388 <?php xl(ucfirst($instype) . ' Insurance','e'); ?>
389 <?php if (strcmp($row['date'], '0000-00-00') != 0) { ?>
390 <?php xl(' from','e'); echo ' ' . $row['date']; ?>
391 <?php } ?>
392 <?php xl(' until ','e'); echo $enddate; ?>:</span>
393 </td>
394 </tr>
395 <tr>
396 <td valign='top'>
397 <span class='text'>
398 <?php
399 if ($insco_name) {
400 echo $insco_name . '<br>';
401 if (trim($adobj->get_line1())) {
402 echo $adobj->get_line1() . '<br>';
403 echo $adobj->get_city() . ', ' . $adobj->get_state() . ' ' . $adobj->get_zip();
405 } else {
406 echo "<font color='red'><b>Unassigned</b></font>";
409 <br>
410 <?php xl('Policy Number','e'); ?>: <?php echo $row['policy_number'] ?><br>
411 Plan Name: <?php echo $row['plan_name']; ?><br>
412 Group Number: <?php echo $row['group_number']; ?></span>
413 </td>
414 <td valign='top'>
415 <span class='bold'><?php xl('Subscriber','e'); ?>: </span><br>
416 <span class='text'><?php echo $row['subscriber_fname'] . ' ' . $row['subscriber_mname'] . ' ' . $row['subscriber_lname'] ?>
417 <?php
418 if ($row['subscriber_relationship'] != "") {
419 echo "(" . $row['subscriber_relationship'] . ")";
422 <br>
423 S.S.: <?php echo $row['subscriber_ss']; ?><br>
424 <?php xl('D.O.B.','e'); ?>:
425 <?php if ($row['subscriber_DOB'] != "0000-00-00 00:00:00") echo $row['subscriber_DOB']; ?><br>
426 Phone: <?php echo $row['subscriber_phone'] ?>
427 </span>
428 </td>
429 <td valign='top'>
430 <span class='bold'><?php xl('Subscriber Address','e'); ?>: </span><br>
431 <span class='text'><?php echo $row['subscriber_street']; ?><br>
432 <?php echo $row['subscriber_city']; ?>
433 <?php if($row['subscriber_state'] != "") echo ", "; echo $row['subscriber_state']; ?>
434 <?php if($row['subscriber_country'] != "") echo ", "; echo $row['subscriber_country']; ?>
435 <?php echo " " . $row['subscriber_postal_code']; ?></span>
437 <?php if (trim($row['subscriber_employer'])) { ?>
438 <br><span class='bold'><?php xl('Subscriber Employer','e'); ?>: </span><br>
439 <span class='text'><?php echo $row['subscriber_employer']; ?><br>
440 <?php echo $row['subscriber_employer_street']; ?><br>
441 <?php echo $row['subscriber_employer_city']; ?>
442 <?php if($row['subscriber_employer_city'] != "") echo ", "; echo $row['subscriber_employer_state']; ?>
443 <?php if($row['subscriber_employer_country'] != "") echo ", "; echo $row['subscriber_employer_country']; ?>
444 <?php echo " " . $row['subscriber_employer_postal_code']; ?>
445 </span>
446 <?php } ?>
448 </td>
449 </tr>
450 <tr>
451 <td>
452 <?php if ($row['copay'] != "") { ?>
453 <span class='bold'><?php xl('CoPay','e'); ?>: </span>
454 <span class='text'><?php echo $row['copay']; ?></span>
455 <?php } ?>
456 <br>
457 <span class='bold'><?php xl('Accept Assignment','e'); ?>:</span>
458 <span class='text'><?php if($row['accept_assignment'] == "TRUE") echo "YES"; ?>
459 <?php if($row['accept_assignment'] == "FALSE") echo "NO"; ?></span>
460 </td>
461 <td valign='top'></td>
462 <td valign='top'></td>
463 </tr>
465 </table>
466 </div>
467 <?php
469 } // end if ($row['provider'])
470 $enddate = $row['date'];
471 $first = false;
472 } // end while
473 } // end foreach
475 ///////////////////////////////// END INSURANCE SECTION
477 </div>
479 <?php } // ?>
481 </td>
482 </tr>
484 <tr>
485 <td width='650px'>
486 <div class="section-header">
487 <a href='javascript:;' class='small' id='notes_view'><span class='text'><b><?php xl("Notes", "e" )?></b></span> (<span class="indicator"><?php xl('collapse','e'); ?></span>)</a>
488 </div>
489 <!-- Demographics -->
490 <div id='notes_div' class='tab current' style='height:auto; width:100%' >
491 <br/>
492 <div style='margin-left:10px' class='text'><image src='../../pic/ajax-loader.gif'/></div><br/>
493 </div>
494 </td>
495 </tr>
497 </table>
499 </div>
502 </div>
503 <!-- end left column div -->
505 <!-- start right column div -->
506 <div class='text'>
507 <table>
508 <tr>
509 <td>
510 <?php
511 if ($GLOBALS['advance_directives_warning']) { ?>
512 <div>
513 <span class="text"><b><?php echo xl('Advance Directives') ?></b></span>
514 <a href="#" class="small" onclick="return advdirconfigure();">
515 (<b><?php echo xl('Manage') ?></b>)
516 </a>
517 </div>
518 <div class='small'>
519 <?php
520 $counterFlag = false; //flag to record whether any categories contain ad records
521 $query = "SELECT id FROM categories WHERE name='Advance Directive'";
522 $myrow2 = sqlQuery($query);
523 if ($myrow2) {
524 $parentId = $myrow2['id'];
525 $query = "SELECT id, name FROM categories WHERE parent='$parentId'";
526 $resNew1 = sqlStatement($query);
527 while ($myrows3 = sqlFetchArray($resNew1)) {
528 $categoryId = $myrows3['id'];
529 $nameDoc = $myrows3['name'];
530 $query = "SELECT documents.date, documents.id " .
531 "FROM documents " .
532 "INNER JOIN categories_to_documents " .
533 "ON categories_to_documents.document_id=documents.id " .
534 "WHERE categories_to_documents.category_id='$categoryId' " .
535 "AND documents.foreign_id='$pid' " .
536 "ORDER BY documents.date DESC";
537 $resNew2 = sqlStatement($query);
538 $limitCounter = 0; // limit to one entry per category
539 while (($myrows4 = sqlFetchArray($resNew2)) && ($limitCounter == 0)) {
540 $dateTimeDoc = $myrows4['date'];
541 // remove time from datetime stamp
542 $tempParse = explode(" ",$dateTimeDoc);
543 $dateDoc = $tempParse[0];
544 $idDoc = $myrows4['id'];
545 echo "<a href='$web_root/controller.php?document&retrieve&patient_id=$pid&document_id=" .
546 $idDoc . "&as_file=true'>" . xl_document_category($nameDoc) . "</a> " . $dateDoc;
547 echo "<br>";
548 $limitCounter = $limitCounter + 1;
549 $counterFlag = true;
553 if (!$counterFlag) {
554 echo xl('None.', 'e');
555 } ?>
556 </div>
557 <? } ?>
558 <?php
559 // This is a feature for a specific client. -- Rod
560 if ($GLOBALS['cene_specific']) {
561 echo " <br />\n";
563 $imagedir = "$webserver_root/documents/$pid/demographics";
564 $imagepath = "$web_root/documents/$pid/demographics";
566 echo " <a href='' onclick=\"return sendimage($pid, 'photo');\" " .
567 "title='Click to attach patient image'>\n";
568 if (is_file("$imagedir/photo.jpg")) {
569 echo " <img src='$imagepath/photo.jpg' /></a>\n";
570 } else {
571 echo " Attach Patient Image</a><br />\n";
573 echo " <br />&nbsp;<br />\n";
575 echo " <a href='' onclick=\"return sendimage($pid, 'fingerprint');\" " .
576 "title='Click to attach fingerprint'>\n";
577 if (is_file("$imagedir/fingerprint.jpg")) {
578 echo " <img src='$imagepath/fingerprint.jpg' /></a>\n";
579 } else {
580 echo " Attach Biometric Fingerprint</a><br />\n";
582 echo " <br />&nbsp;<br />\n";
585 // This stuff only applies to athletic team use of OpenEMR. The client
586 // insisted on being able to quickly change fitness and return date here:
588 if (false && $GLOBALS['athletic_team']) {
589 // blue green yellow red orange
590 $fitcolors = array('#6677ff','#00cc00','#ffff00','#ff3333','#ff8800','#ffeecc','#ffccaa');
591 if (!empty($GLOBALS['fitness_colors'])) $fitcolors = $GLOBALS['fitness_colors'];
592 $fitcolor = $fitcolors[0];
593 $form_fitness = $_POST['form_fitness'];
594 $form_userdate1 = fixDate($_POST['form_userdate1'], '');
595 $form_issue_id = $_POST['form_issue_id'];
596 if ($form_submit) {
597 $returndate = $form_userdate1 ? "'$form_userdate1'" : "NULL";
598 sqlStatement("UPDATE patient_data SET fitness = '$form_fitness', " .
599 "userdate1 = $returndate WHERE pid = '$pid'");
600 // Update return date in the designated issue, if requested.
601 if ($form_issue_id) {
602 sqlStatement("UPDATE lists SET returndate = $returndate WHERE " .
603 "id = '$form_issue_id'");
605 } else {
606 $form_fitness = $result['fitness'];
607 if (! $form_fitness) $form_fitness = 1;
608 $form_userdate1 = $result['userdate1'];
610 $fitcolor = $fitcolors[$form_fitness - 1];
611 echo " <form method='post' action='demographics.php' onsubmit='return validate()'>\n";
612 echo " <span class='bold'>Fitness to Play:</span><br />\n";
613 echo " <select name='form_fitness' style='background-color:$fitcolor'>\n";
614 $res = sqlStatement("SELECT * FROM list_options WHERE " .
615 "list_id = 'fitness' ORDER BY seq");
616 while ($row = sqlFetchArray($res)) {
617 $key = $row['option_id'];
618 echo " <option value='$key'";
619 if ($key == $form_fitness) echo " selected";
620 echo ">" . $row['title'] . "</option>\n";
622 echo " </select>\n";
623 echo " <br /><span class='bold'>Return to Play:</span><br>\n";
624 echo " <input type='text' size='10' name='form_userdate1' id='form_userdate1' " .
625 "value='$form_userdate1' " .
626 "title='" . xl('yyyy-mm-dd Date of return to play') . "' " .
627 "onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)' />\n" .
628 " <img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22' " .
629 "id='img_userdate1' border='0' alt='[?]' style='cursor:pointer' " .
630 "title='" . xl('Click here to choose a date') . "'>\n";
631 echo " <input type='hidden' name='form_original_userdate1' value='$form_userdate1' />\n";
632 echo " <input type='hidden' name='form_issue_id' value='' />\n";
633 echo "<p><input type='submit' name='form_submit' value='Change' /></p>\n";
634 echo " </form>\n";
637 // If there is a patient ID card, then show a link to it.
638 if ($document_id) {
639 echo "<a href='" . $web_root . "/controller.php?document&retrieve" .
640 "&patient_id=$pid&document_id=$document_id' style='color:#00cc00' " .
641 "onclick='top.restoreSession()'>Click for ID card</a><br />";
644 // Show current and upcoming appointments.
645 if (isset($pid) && !$GLOBALS['disable_calendar']) {
646 $query = "SELECT e.pc_eid, e.pc_aid, e.pc_title, e.pc_eventDate, " .
647 "e.pc_startTime, e.pc_hometext, u.fname, u.lname, u.mname, " .
648 "c.pc_catname " .
649 "FROM openemr_postcalendar_events AS e, users AS u, " .
650 "openemr_postcalendar_categories AS c WHERE " .
651 "e.pc_pid = '$pid' AND e.pc_eventDate >= CURRENT_DATE AND " .
652 "u.id = e.pc_aid AND e.pc_catid = c.pc_catid " .
653 "ORDER BY e.pc_eventDate, e.pc_startTime";
654 $res = sqlStatement($query);
656 if (isset($res) && $res != null) { ?>
657 <div>
658 <span class="text"><b><?php echo xl('Appointments') ?></b></span>
659 <a href="#" class="small" onclick="return newEvt();" >
660 (<b><?php echo xl('Add') ?></b>)
661 </a>
662 </div>
663 <?php } ?>
664 <div class='small'>
665 <?php
666 $count = 0;
667 while($row = sqlFetchArray($res)) {
668 $count++;
669 $dayname = date("l", strtotime($row['pc_eventDate']));
670 $dispampm = "am";
671 $disphour = substr($row['pc_startTime'], 0, 2) + 0;
672 $dispmin = substr($row['pc_startTime'], 3, 2);
673 if ($disphour >= 12) {
674 $dispampm = "pm";
675 if ($disphour > 12) $disphour -= 12;
677 $etitle = xl('(Click to edit)');
678 if ($row['pc_hometext'] != "") {
679 $etitle = xl('Comments').": ".addslashes($row['pc_hometext'])."\r\n".$etitle;
681 echo "<a href='javascript:oldEvt(" . $row['pc_eid'] . ")' title='$etitle'>";
682 echo "<b>" . xl($dayname) . ", " . $row['pc_eventDate'] . "</b><br>";
683 echo "$disphour:$dispmin " . xl($dispampm) . " " . xl_appt_category($row['pc_catname']) . "<br>\n";
684 echo $row['fname'] . " " . $row['lname'] . "</a><br>\n";
686 if (isset($res) && $res != null) {
687 if ( $count < 1 ) { echo xl('None.', 'e'); }
688 echo "</div>";
692 </div>
694 <div id='stats_div' style='float:left'>
695 <br/>
696 <div style='margin-left:10px' class='text'><image src='../../pic/ajax-loader.gif'/></div><br/>
697 </div>
699 </td>
700 </tr>
701 </table>
703 </div> <!-- end right column div -->
705 </td>
707 </tr>
708 </table>
710 </div> <!-- end main content div -->
712 <?php if ($GLOBALS['concurrent_layout'] && $_GET['set_pid']) { ?>
713 <script language='JavaScript'>
714 parent.left_nav.setPatient(<?php echo "'" . addslashes($result['fname']) . " " . addslashes($result['lname']) . "',$pid,'" . addslashes($result['pubpid']) . "','', ' ".xl('DOB').": ".$result['DOB_YMD'] ." ".xl('Age').": ".getPatientAge($result['DOB_YMD'])."'"; ?>);
715 parent.left_nav.setRadio(window.name, 'dem');
716 </script>
717 <?php } ?>
719 <?php if (false && $GLOBALS['athletic_team']) { ?>
720 <script language='JavaScript'>
721 Calendar.setup({inputField:"form_userdate1", ifFormat:"%Y-%m-%d", button:"img_userdate1"});
722 </script>
723 <?php } ?>
725 </body>
726 </html>