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.
8 $sanitize_all_escapes=true;
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");
25 require_once("$srcdir/invoice_summary.inc.php");
26 require_once("$srcdir/clinical_rules.php");
28 if ($GLOBALS['concurrent_layout'] && isset($_GET['set_pid'])) {
29 include_once("$srcdir/pid.inc");
30 setpid($_GET['set_pid']);
33 $active_reminders = false;
34 if ((!isset($_SESSION['alert_notify_pid']) ||
($_SESSION['alert_notify_pid'] != $pid)) && isset($_GET['set_pid']) && acl_check('patients', 'med') && $GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_crp']) {
35 // showing a new patient, so check for active reminders
36 $active_reminders = active_alert_summary($pid,"reminders-due");
39 function print_as_money($money) {
40 preg_match("/(\d*)\.?(\d*)/",$money,$moneymatches);
41 $tmp = wordwrap(strrev($moneymatches[1]),3,",",1);
42 $ccheck = strrev($tmp);
43 if ($ccheck[0] == ",") {
44 $tmp = substr($ccheck,1,strlen($ccheck)-1);
46 if ($moneymatches[2] != "") {
47 return "$ " . strrev($tmp) . "." . $moneymatches[2];
49 return "$ " . strrev($tmp);
53 // get an array from Photos category
54 function pic_array($pid,$picture_directory) {
56 $sql_query = "select documents.id from documents join categories_to_documents " .
57 "on documents.id = categories_to_documents.document_id " .
58 "join categories on categories.id = categories_to_documents.category_id " .
59 "where categories.name like ? and documents.foreign_id = ?";
60 if ($query = sqlStatement($sql_query, array($picture_directory,$pid))) {
61 while( $results = sqlFetchArray($query) ) {
62 array_push($pics,$results['id']);
67 // Get the document ID of the first document in a specific catg.
68 function get_document_by_catg($pid,$doc_catg) {
72 if ($pid and $doc_catg) {
73 $result = sqlQuery("SELECT d.id, d.date, d.url FROM " .
74 "documents AS d, categories_to_documents AS cd, categories AS c " .
75 "WHERE d.foreign_id = ? " .
76 "AND cd.document_id = d.id " .
77 "AND c.id = cd.category_id " .
78 "AND c.name LIKE ? " .
79 "ORDER BY d.date DESC LIMIT 1", array($pid, $doc_catg) );
82 return($result['id']);
85 // Display image in 'widget style'
86 function image_widget($doc_id,$doc_catg)
88 global $pid, $web_root;
89 $docobj = new Document($doc_id);
90 $image_file = $docobj->get_url_file();
91 $extension = substr($image_file, strrpos($image_file,"."));
92 $viewable_types = array('.png','.jpg','.jpeg','.png','.bmp','.PNG','.JPG','.JPEG','.PNG','.BMP'); // image ext supported by fancybox viewer
93 if ( in_array($extension,$viewable_types) ) { // extention matches list
94 $to_url = "<td> <a href = $web_root" .
95 "/controller.php?document&retrieve&patient_id=$pid&document_id=$doc_id" .
96 "/tmp$extension" . // Force image type URL for fancybox
97 " onclick=top.restoreSession(); class='image_modal'>" .
98 " <img src = $web_root" .
99 "/controller.php?document&retrieve&patient_id=$pid&document_id=$doc_id" .
100 " width=100 alt='$doc_catg:$image_file'> </a> </td> <td valign='center'>".
101 htmlspecialchars($doc_catg) . '<br /> ' . htmlspecialchars($image_file) .
105 $to_url = "<td> <a href='" . $web_root . "/controller.php?document&retrieve" .
106 "&patient_id=$pid&document_id=$doc_id'" .
107 " onclick='top.restoreSession()' class='css_button_small'>" .
109 htmlspecialchars( xl("View"), ENT_QUOTES
)."</a> " .
110 htmlspecialchars( "$doc_catg - $image_file", ENT_QUOTES
) .
115 echo "</tr></table>";
118 // Determine if the Vitals form is in use for this site.
119 $tmp = sqlQuery("SELECT count(*) AS count FROM registry WHERE " .
120 "directory = 'vitals' AND state = 1");
121 $vitals_is_registered = $tmp['count'];
123 // Get patient/employer/insurance information.
125 $result = getPatientData($pid, "*, DATE_FORMAT(DOB,'%Y-%m-%d') as DOB_YMD");
126 $result2 = getEmployerData($pid);
127 $result3 = getInsuranceData($pid, "primary", "copay, provider, DATE_FORMAT(`date`,'%Y-%m-%d') as effdate");
129 if ($result3['provider']) { // Use provider in case there is an ins record w/ unassigned insco
130 $insco_name = getInsuranceProvider($result3['provider']);
136 <?php
html_header_show();?
>
137 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
138 <link rel
="stylesheet" type
="text/css" href
="../../../library/js/fancybox/jquery.fancybox-1.2.6.css" media
="screen" />
139 <style type
="text/css">@import
url(../../../library
/dynarch_calendar
.css
);</style
>
140 <script type
="text/javascript" src
="../../../library/textformat.js"></script
>
141 <script type
="text/javascript" src
="../../../library/dynarch_calendar.js"></script
>
142 <?php
include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?
>
143 <script type
="text/javascript" src
="../../../library/dynarch_calendar_setup.js"></script
>
144 <script type
="text/javascript" src
="../../../library/dialog.js"></script
>
145 <script type
="text/javascript" src
="../../../library/js/jquery-1.6.4.min.js"></script
>
146 <script type
="text/javascript" src
="../../../library/js/common.js"></script
>
147 <script type
="text/javascript" src
="../../../library/js/fancybox/jquery.fancybox-1.2.6.js"></script
>
148 <script type
="text/javascript" language
="JavaScript">
150 var mypcc
= '<?php echo htmlspecialchars($GLOBALS['phone_country_code
'],ENT_QUOTES); ?>';
152 function oldEvt(eventid
) {
153 dlgopen('../../main/calendar/add_edit_event.php?eid=' + eventid
, '_blank', 550, 350);
156 function advdirconfigure() {
157 dlgopen('advancedirectives.php', '_blank', 500, 450);
160 function refreshme() {
161 top
.restoreSession();
165 // Process click on Delete link.
166 function deleteme() {
167 dlgopen('../deleter.php?patient=<?php echo htmlspecialchars($pid,ENT_QUOTES); ?>', '_blank', 500, 450);
171 // Called by the deleteme.php window on a successful delete.
172 function imdeleted() {
173 <?php
if ($GLOBALS['concurrent_layout']) { ?
>
174 parent
.left_nav
.clearPatient();
176 top
.restoreSession();
177 top
.location
.href
= '../main/main_screen.php';
181 function validate() {
182 var f
= document
.forms
[0];
184 if ($GLOBALS['athletic_team']) {
185 echo " if (f.form_userdate1.value != f.form_original_userdate1.value) {\n";
186 $irow = sqlQuery("SELECT id, title FROM lists WHERE " .
187 "pid = ? AND enddate IS NULL ORDER BY begdate DESC LIMIT 1", array($pid));
190 if (confirm('Do you wish to also set this new return date in the issue titled "<?php echo htmlspecialchars($irow['title
'],ENT_QUOTES); ?>"?')) {
191 f
.form_issue_id
.value
= '<?php echo htmlspecialchars($irow['id
'],ENT_QUOTES); ?>';
193 alert('OK, you will need to manually update the return date in any affected issue(s).');
196 alert('You have changed the return date but there are no open issues. You probably need to create or modify one.');
200 } // end athletic team
206 dlgopen('../../main/calendar/add_edit_event.php?patientid=<?php echo htmlspecialchars($pid,ENT_QUOTES); ?>', '_blank', 550, 350);
210 function sendimage(pid
, what
) {
211 // alert('Not yet implemented.'); return false;
212 dlgopen('../upload_dialog.php?patientid=' + pid +
'&file=' + what
,
219 <script type
="text/javascript">
221 function toggleIndicator(target
,div
) {
223 $mode = $
(target
).find(".indicator").text();
224 if ( $mode == "<?php echo htmlspecialchars(xl('collapse'),ENT_QUOTES); ?>" ) {
225 $
(target
).find(".indicator").text( "<?php echo htmlspecialchars(xl('expand'),ENT_QUOTES); ?>" );
227 $
.post( "../../../library/ajax/user_settings.php", { target
: div
, mode
: 0 });
229 $
(target
).find(".indicator").text( "<?php echo htmlspecialchars(xl('collapse'),ENT_QUOTES); ?>" );
231 $
.post( "../../../library/ajax/user_settings.php", { target
: div
, mode
: 1 });
235 $
(document
).ready(function(){
238 if($GLOBALS['erx_enable']){
239 //$soap_status=sqlQuery("select soap_import_status from patient_data where pid=?",array($pid));
240 $soap_status=sqlStatement("select soap_import_status,pid from patient_data where pid=? and soap_import_status in ('1','3')",array($pid));
241 while($row_soapstatus=sqlFetchArray($soap_status)){
242 //if($soap_status['soap_import_status']=='1' || $soap_status['soap_import_status']=='3'){ ?>
243 top
.restoreSession();
246 url
: "../../soap_functions/soap_patientfullmedication.php",
249 patient
:<?php
echo $row_soapstatus['pid']; ?
>,
252 success
: function(thedata
){
254 msg_updation+
=thedata
;
262 //elseif($soap_status['soap_import_status']=='3'){ ?>
263 top
.restoreSession();
266 url
: "../../soap_functions/soap_allergy.php",
269 patient
:<?php
echo $row_soapstatus['pid']; ?
>,
272 success
: function(thedata
){
274 msg_updation+
=thedata
;
281 if($GLOBALS['erx_import_status_message']){ ?
>
291 $
("#stats_div").load("stats.php", { 'embeddedScreen' : true }, function() {
292 // (note need to place javascript code here also to get the dynamic link to work)
293 $
(".rx_modal").fancybox( {
294 'overlayOpacity' : 0.0,
295 'showCloseButton' : true,
298 'centerOnScroll' : false,
299 'callbackOnClose' : function() {
304 $
("#pnotes_ps_expand").load("pnotes_fragment.php");
305 $
("#disclosures_ps_expand").load("disc_fragment.php");
307 <?php
if ($GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_crw']) { ?
>
308 top
.restoreSession();
309 $
("#clinical_reminders_ps_expand").load("clinical_reminders_fragment.php", { 'embeddedScreen' : true }, function() {
310 // (note need to place javascript code here also to get the dynamic link to work)
311 $
(".medium_modal").fancybox( {
312 'overlayOpacity' : 0.0,
313 'showCloseButton' : true,
316 'centerOnScroll' : false,
317 'callbackOnClose' : function() {
324 <?php
if ($GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_prw']) { ?
>
325 top
.restoreSession();
326 $
("#patient_reminders_ps_expand").load("patient_reminders_fragment.php");
329 <?php
if ($vitals_is_registered && acl_check('patients', 'med')) { ?
>
330 // Initialize the Vitals form if it is registered and user is authorized.
331 $
("#vitals_ps_expand").load("vitals_fragment.php");
335 // Initialize for each applicable LBF form.
336 $gfres = sqlStatement("SELECT option_id FROM list_options WHERE " .
337 "list_id = 'lbfnames' AND option_value > 0 ORDER BY seq, title");
338 while($gfrow = sqlFetchArray($gfres)) {
340 $
("#<?php echo $gfrow['option_id']; ?>_ps_expand").load("lbf_fragment.php?formname=<?php echo $gfrow['option_id']; ?>");
350 // modal for dialog boxes
351 $
(".large_modal").fancybox( {
352 'overlayOpacity' : 0.0,
353 'showCloseButton' : true,
356 'centerOnScroll' : false
359 // modal for image viewer
360 $
(".image_modal").fancybox( {
361 'overlayOpacity' : 0.0,
362 'showCloseButton' : true,
363 'centerOnScroll' : false,
367 $
(".iframe1").fancybox( {
369 'overlayOpacity' : 0.0,
370 'showCloseButton' : true,
374 // special size for patient portal
375 $
(".small_modal").fancybox( {
376 'overlayOpacity' : 0.0,
377 'showCloseButton' : true,
380 'centerOnScroll' : false
383 <?php
if ($active_reminders) { ?
>
384 // show the active reminder modal
385 $
("#reminder_popup_link").fancybox({
386 'overlayOpacity' : 0.0,
387 'showCloseButton' : true,
390 'centerOnScroll' : false
396 // JavaScript stuff to do when a new patient is set.
398 function setMyPatient() {
399 <?php
if ($GLOBALS['concurrent_layout']) { ?
>
400 // Avoid race conditions with loading of the left_nav or Title frame.
401 if (!parent
.allFramesLoaded()) {
402 setTimeout("setMyPatient()", 500);
405 <?php
if (isset($_GET['set_pid'])) { ?
>
406 parent
.left_nav
.setPatient(<?php
echo "'" . htmlspecialchars(($result['fname']) . " " . ($result['lname']),ENT_QUOTES
) .
407 "'," . htmlspecialchars($pid,ENT_QUOTES
) . ",'" . htmlspecialchars(($result['pubpid']),ENT_QUOTES
) .
408 "','', ' " . htmlspecialchars(xl('DOB') . ": " . oeFormatShortDate($result['DOB_YMD']) . " " . xl('Age') . ": " . getPatientAgeDisplay($result['DOB_YMD']), ENT_QUOTES
) . "'"; ?
>);
409 var EncounterDateArray
= new Array;
410 var CalendarCategoryArray
= new Array;
411 var EncounterIdArray
= new Array;
414 //Encounter details are stored to javacript as array.
415 $result4 = sqlStatement("SELECT fe.encounter,fe.date,openemr_postcalendar_categories.pc_catname FROM form_encounter AS fe ".
416 " left join openemr_postcalendar_categories on fe.pc_catid=openemr_postcalendar_categories.pc_catid WHERE fe.pid = ? order by fe.date desc", array($pid));
417 if(sqlNumRows($result4)>0) {
418 while($rowresult4 = sqlFetchArray($result4)) {
420 EncounterIdArray
[Count
] = '<?php echo htmlspecialchars($rowresult4['encounter
'], ENT_QUOTES); ?>';
421 EncounterDateArray
[Count
] = '<?php echo htmlspecialchars(oeFormatShortDate(date("Y-m-d", strtotime($rowresult4['date
']))), ENT_QUOTES); ?>';
422 CalendarCategoryArray
[Count
] = '<?php echo htmlspecialchars(xl_appt_category($rowresult4['pc_catname
']), ENT_QUOTES); ?>';
428 parent
.left_nav
.setPatientEncounter(EncounterIdArray
,EncounterDateArray
,CalendarCategoryArray
);
429 <?php
} // end setting new pid ?>
430 parent
.left_nav
.setRadio(window
.name
, 'dem');
431 parent
.left_nav
.syncRadios();
432 <?php
} // end concurrent layout ?>
435 $
(window
).load(function() {
441 <style type
="css/text">
450 <body
class="body_top">
452 <a href
='../reminder/active_reminder_popup.php' id
='reminder_popup_link' style
='visibility: false;' class='iframe' onclick
='top.restoreSession()'></a
>
455 $thisauth = acl_check('patients', 'demo');
457 if ($result['squad'] && ! acl_check('squads', $result['squad']))
461 echo "<p>(" . htmlspecialchars(xl('Demographics not authorized'),ENT_NOQUOTES
) . ")</p>\n";
462 echo "</body>\n</html>\n";
466 echo "<table><tr><td><span class='title'>" .
467 htmlspecialchars(getPatientName($pid),ENT_NOQUOTES
) .
470 if (acl_check('admin', 'super')) {
471 echo "<td style='padding-left:1em;'><a class='css_button iframe' href='../deleter.php?patient=" .
472 htmlspecialchars($pid,ENT_QUOTES
) . "'>" .
473 "<span>".htmlspecialchars(xl('Delete'),ENT_NOQUOTES
).
476 if($GLOBALS['erx_enable']){
477 echo '<td style="padding-left:1em;"><a class="css_button" href="../../eRx.php?page=medentry" onclick="top.restoreSession()">';
478 echo "<span>".htmlspecialchars(xl('NewCrop MedEntry'),ENT_NOQUOTES
)."</span></a></td>";
479 echo '<td style="padding-left:1em;"><a class="css_button iframe1" href="../../soap_functions/soap_accountStatusDetails.php" onclick="top.restoreSession()">';
480 echo "<span>".htmlspecialchars(xl('NewCrop Account Status'),ENT_NOQUOTES
)."</span></a></td><td id='accountstatus'></td>";
483 $portalUserSetting = true; //flag to see if patient has authorized access to portal
484 if($GLOBALS['portal_onsite_enable'] && $GLOBALS['portal_onsite_address']){
485 $portalStatus = sqlQuery("SELECT allow_patient_portal FROM patient_data WHERE pid=?",array($pid));
486 if ($portalStatus['allow_patient_portal']=='YES') {
487 $portalLogin = sqlQuery("SELECT pid FROM `patient_access_onsite` WHERE `pid`=?", array($pid));
488 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()'>";
489 if (empty($portalLogin)) {
490 echo "<span>".htmlspecialchars(xl('Create Onsite Portal Credentials'),ENT_NOQUOTES
)."</span></a></td>";
493 echo "<span>".htmlspecialchars(xl('Reset Onsite Portal Credentials'),ENT_NOQUOTES
)."</span></a></td>";
497 $portalUserSetting = false;
500 if($GLOBALS['portal_offsite_enable'] && $GLOBALS['portal_offsite_address']){
501 $portalStatus = sqlQuery("SELECT allow_patient_portal FROM patient_data WHERE pid=?",array($pid));
502 if ($portalStatus['allow_patient_portal']=='YES') {
503 $portalLogin = sqlQuery("SELECT pid FROM `patient_access_offsite` WHERE `pid`=?", array($pid));
504 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()'>";
505 if (empty($portalLogin)) {
506 echo "<span>".htmlspecialchars(xl('Create Offsite Portal Credentials'),ENT_NOQUOTES
)."</span></a></td>";
509 echo "<span>".htmlspecialchars(xl('Reset Offsite Portal Credentials'),ENT_NOQUOTES
)."</span></a></td>";
513 $portalUserSetting = false;
516 if (!($portalUserSetting)) {
517 // Show that the patient has not authorized portal access
518 echo "<td style='padding-left:1em;'>" . htmlspecialchars( xl('Patient has not authorized the Patient Portal.'), ENT_NOQUOTES
) . "</td>";
522 // If patient is deceased, then show this (along with the number of days patient has been deceased for)
523 $days_deceased = is_patient_deceased($pid);
524 if ($days_deceased) {
525 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>";
528 echo "</tr></table>";
531 // Get the document ID of the patient ID card if access to it is wanted here.
532 $idcard_doc_id = false;
533 if ($GLOBALS['patient_id_category_name']) {
534 $idcard_doc_id = get_document_by_catg($pid, $GLOBALS['patient_id_category_name']);
538 <table cellspacing
='0' cellpadding
='0' border
='0'>
540 <td
class="small" colspan
='4'>
541 <a href
="../history/history.php" onclick
='top.restoreSession()'>
542 <?php
echo htmlspecialchars(xl('History'),ENT_NOQUOTES
); ?
></a
>
544 <?php
//note that we have temporarily removed report screen from the modal view ?>
545 <a href
="../report/patient_report.php" onclick
='top.restoreSession()'>
546 <?php
echo htmlspecialchars(xl('Report'),ENT_NOQUOTES
); ?
></a
>
548 <?php
//note that we have temporarily removed document screen from the modal view ?>
549 <a href
="../../../controller.php?document&list&patient_id=<?php echo $pid;?>" onclick
='top.restoreSession()'>
550 <?php
echo htmlspecialchars(xl('Documents'),ENT_NOQUOTES
); ?
></a
>
552 <a href
="../transaction/transactions.php" class='iframe large_modal' onclick
='top.restoreSession()'>
553 <?php
echo htmlspecialchars(xl('Transactions'),ENT_NOQUOTES
); ?
></a
>
555 <a href
="stats_full.php?active=all" onclick
='top.restoreSession()'>
556 <?php
echo htmlspecialchars(xl('Issues'),ENT_NOQUOTES
); ?
></a
>
559 </table
> <!-- end header
-->
561 <div style
='margin-top:10px'> <!-- start main content div
-->
562 <table border
="0" cellspacing
="0" cellpadding
="0" width
="100%">
564 <td align
="left" valign
="top">
565 <!-- start left column div
-->
566 <div style
='float:left; margin-right:20px'>
567 <table cellspacing
=0 cellpadding
=0>
568 <tr
<?php
if ($GLOBALS['athletic_team']) echo " style='display:none;'"; ?
>>
571 // Billing expand collapse widget
572 $widgetTitle = xl("Billing");
573 $widgetLabel = "billing";
574 $widgetButtonLabel = xl("Edit");
575 $widgetButtonLink = "return newEvt();";
576 $widgetButtonClass = "";
577 $linkMethod = "javascript";
578 $bodyClass = "notab";
581 if ($GLOBALS['force_billing_widget_open']) {
582 $forceExpandAlways = true;
585 $forceExpandAlways = false;
587 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
588 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
589 $widgetAuth, $fixedWidth, $forceExpandAlways);
593 //PATIENT BALANCE,INS BALANCE naina@capminds.com
594 $patientbalance = get_patient_balance($pid, false);
595 //Debit the patient balance from insurance balance
596 $insurancebalance = get_patient_balance($pid, true) - $patientbalance;
597 $totalbalance=$patientbalance +
$insurancebalance;
598 if ($GLOBALS['oer_config']['ws_accounting']['enabled']) {
599 // Show current balance and billing note, if any.
600 echo "<table border='0'><tr><td>" .
601 "<table ><tr><td><span class='bold'><font color='red' size='3pt'>" .
602 xlt('Patient Balance Due') .
603 " : " . text(oeFormatMoney($patientbalance)) .
604 "</font></span></td></tr>".
605 "<tr><td><span class='bold'><font color='red' size='3pt'>" .
606 xlt('Insurance Balance Due') .
607 " : " . text(oeFormatMoney($insurancebalance)) .
608 "</font></span></td></tr>".
609 "<tr><td><span class='bold'><font color='red' size='3pt'>" .
610 xlt('Total Balance Due').
611 " : " . text(oeFormatMoney($totalbalance)) .
612 "</font></span></td></td></tr>";
613 if ($result['genericname2'] == 'Billing') {
614 echo "<tr><td><span class='bold'><font color='red'>" .
615 xlt('Billing Note') . ":" .
616 text($result['genericval2']) .
617 "</font></span></td></tr>";
619 if ($result3['provider']) { // Use provider in case there is an ins record w/ unassigned insco
620 echo "<tr><td><span class='bold'>" .
621 xlt('Primary Insurance') . ': ' . text($insco_name) .
622 "</span> ";
623 if ($result3['copay'] > 0) {
624 echo "<span class='bold'>" .
625 xlt('Copay') . ': ' . text($result3['copay']) .
626 "</span> ";
628 echo "<span class='bold'>" .
629 xlt('Effective Date') . ': ' . text(oeFormatShortDate($result3['effdate'])) .
632 echo "</table></td></tr></td></tr></table><br>";
635 </div
> <!-- required
for expand_collapse_widget
-->
641 // Demographics expand collapse widget
642 $widgetTitle = xl("Demographics");
643 $widgetLabel = "demographics";
644 $widgetButtonLabel = xl("Edit");
645 $widgetButtonLink = "demographics_full.php";
646 $widgetButtonClass = "";
647 $linkMethod = "html";
649 $widgetAuth = acl_check('patients', 'demo', '', 'write');
651 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
652 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
653 $widgetAuth, $fixedWidth);
657 <?php
display_layout_tabs('DEM', $result, $result2); ?
>
659 <div
class="tabContainer">
660 <?php
display_layout_tabs_data('DEM', $result, $result2); ?
>
663 </div
> <!-- required
for expand_collapse_widget
-->
670 $insurance_count = 0;
671 foreach (array('primary','secondary','tertiary') as $instype) {
672 $enddate = 'Present';
673 $query = "SELECT * FROM insurance_data WHERE " .
674 "pid = ? AND type = ? " .
675 "ORDER BY date DESC";
676 $res = sqlStatement($query, array($pid, $instype) );
677 while( $row = sqlFetchArray($res) ) {
678 if ($row['provider'] ) $insurance_count++
;
682 if ( $insurance_count > 0 ) {
683 // Insurance expand collapse widget
684 $widgetTitle = xl("Insurance");
685 $widgetLabel = "insurance";
686 $widgetButtonLabel = xl("Edit");
687 $widgetButtonLink = "demographics_full.php";
688 $widgetButtonClass = "";
689 $linkMethod = "html";
691 $widgetAuth = acl_check('patients', 'demo', '', 'write');
693 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
694 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
695 $widgetAuth, $fixedWidth);
697 if ( $insurance_count > 0 ) {
700 <ul
class="tabNav"><?php
701 ///////////////////////////////// INSURANCE SECTION
703 foreach (array('primary','secondary','tertiary') as $instype) {
705 $query = "SELECT * FROM insurance_data WHERE " .
706 "pid = ? AND type = ? " .
707 "ORDER BY date DESC";
708 $res = sqlStatement($query, array($pid, $instype) );
710 $enddate = 'Present';
712 while( $row = sqlFetchArray($res) ) {
713 if ($row['provider'] ) {
715 $ins_description = ucfirst($instype);
716 $ins_description = xl($ins_description);
717 $ins_description .= strcmp($enddate, 'Present') != 0 ?
" (".xl('Old').")" : "";
719 <li
<?php
echo $first ?
'class="current"' : '' ?
>><a href
="/play/javascript-tabbed-navigation/">
720 <?php
echo htmlspecialchars($ins_description,ENT_NOQUOTES
); ?
></a
></li
>
724 $enddate = $row['date'];
727 // Display the eligibility tab
728 echo "<li><a href='/play/javascript-tabbed-navigation/'>" .
729 htmlspecialchars( xl('Eligibility'), ENT_NOQUOTES
) . "</a></li>";
735 <div
class="tabContainer">
738 foreach (array('primary','secondary','tertiary') as $instype) {
739 $enddate = 'Present';
741 $query = "SELECT * FROM insurance_data WHERE " .
742 "pid = ? AND type = ? " .
743 "ORDER BY date DESC";
744 $res = sqlStatement($query, array($pid, $instype) );
745 while( $row = sqlFetchArray($res) ) {
746 if ($row['provider'] ) {
748 <div
class="tab <?php echo $first ? 'current' : '' ?>">
749 <table border
='0' cellpadding
='0' width
='100%'>
751 $icobj = new InsuranceCompany($row['provider']);
752 $adobj = $icobj->get_address();
753 $insco_name = trim($icobj->get_name());
756 <td valign
='top' colspan
='3'>
758 <?php
if (strcmp($enddate, 'Present') != 0) echo htmlspecialchars(xl("Old"),ENT_NOQUOTES
)." "; ?
>
759 <?php
$tempinstype=ucfirst($instype); echo htmlspecialchars(xl($tempinstype.' Insurance'),ENT_NOQUOTES
); ?
>
760 <?php
if (strcmp($row['date'], '0000-00-00') != 0) { ?
>
761 <?php
echo htmlspecialchars(xl('from','',' ',' ').$row['date'],ENT_NOQUOTES
); ?
>
763 <?php
echo htmlspecialchars(xl('until','',' ',' '),ENT_NOQUOTES
);
764 echo (strcmp($enddate, 'Present') != 0) ?
$enddate : htmlspecialchars(xl('Present'),ENT_NOQUOTES
); ?
>:</span
>
772 echo htmlspecialchars($insco_name,ENT_NOQUOTES
) . '<br>';
773 if (trim($adobj->get_line1())) {
774 echo htmlspecialchars($adobj->get_line1(),ENT_NOQUOTES
) . '<br>';
775 echo htmlspecialchars($adobj->get_city() . ', ' . $adobj->get_state() . ' ' . $adobj->get_zip(),ENT_NOQUOTES
);
778 echo "<font color='red'><b>".htmlspecialchars(xl('Unassigned'),ENT_NOQUOTES
)."</b></font>";
782 <?php
echo htmlspecialchars(xl('Policy Number'),ENT_NOQUOTES
); ?
>:
783 <?php
echo htmlspecialchars($row['policy_number'],ENT_NOQUOTES
) ?
><br
>
784 <?php
echo htmlspecialchars(xl('Plan Name'),ENT_NOQUOTES
); ?
>:
785 <?php
echo htmlspecialchars($row['plan_name'],ENT_NOQUOTES
); ?
><br
>
786 <?php
echo htmlspecialchars(xl('Group Number'),ENT_NOQUOTES
); ?
>:
787 <?php
echo htmlspecialchars($row['group_number'],ENT_NOQUOTES
); ?
></span
>
790 <span
class='bold'><?php
echo htmlspecialchars(xl('Subscriber'),ENT_NOQUOTES
); ?
>: </span
><br
>
791 <span
class='text'><?php
echo htmlspecialchars($row['subscriber_fname'] . ' ' . $row['subscriber_mname'] . ' ' . $row['subscriber_lname'],ENT_NOQUOTES
); ?
>
793 if ($row['subscriber_relationship'] != "") {
794 echo "(" . htmlspecialchars($row['subscriber_relationship'],ENT_NOQUOTES
) . ")";
798 <?php
echo htmlspecialchars(xl('S.S.'),ENT_NOQUOTES
); ?
>:
799 <?php
echo htmlspecialchars($row['subscriber_ss'],ENT_NOQUOTES
); ?
><br
>
800 <?php
echo htmlspecialchars(xl('D.O.B.'),ENT_NOQUOTES
); ?
>:
801 <?php
if ($row['subscriber_DOB'] != "0000-00-00 00:00:00") echo htmlspecialchars($row['subscriber_DOB'],ENT_NOQUOTES
); ?
><br
>
802 <?php
echo htmlspecialchars(xl('Phone'),ENT_NOQUOTES
); ?
>:
803 <?php
echo htmlspecialchars($row['subscriber_phone'],ENT_NOQUOTES
); ?
>
807 <span
class='bold'><?php
echo htmlspecialchars(xl('Subscriber Address'),ENT_NOQUOTES
); ?
>: </span
><br
>
808 <span
class='text'><?php
echo htmlspecialchars($row['subscriber_street'],ENT_NOQUOTES
); ?
><br
>
809 <?php
echo htmlspecialchars($row['subscriber_city'],ENT_NOQUOTES
); ?
>
810 <?php
if($row['subscriber_state'] != "") echo ", "; echo htmlspecialchars($row['subscriber_state'],ENT_NOQUOTES
); ?
>
811 <?php
if($row['subscriber_country'] != "") echo ", "; echo htmlspecialchars($row['subscriber_country'],ENT_NOQUOTES
); ?
>
812 <?php
echo " " . htmlspecialchars($row['subscriber_postal_code'],ENT_NOQUOTES
); ?
></span
>
814 <?php
if (trim($row['subscriber_employer'])) { ?
>
815 <br
><span
class='bold'><?php
echo htmlspecialchars(xl('Subscriber Employer'),ENT_NOQUOTES
); ?
>: </span
><br
>
816 <span
class='text'><?php
echo htmlspecialchars($row['subscriber_employer'],ENT_NOQUOTES
); ?
><br
>
817 <?php
echo htmlspecialchars($row['subscriber_employer_street'],ENT_NOQUOTES
); ?
><br
>
818 <?php
echo htmlspecialchars($row['subscriber_employer_city'],ENT_NOQUOTES
); ?
>
819 <?php
if($row['subscriber_employer_city'] != "") echo ", "; echo htmlspecialchars($row['subscriber_employer_state'],ENT_NOQUOTES
); ?
>
820 <?php
if($row['subscriber_employer_country'] != "") echo ", "; echo htmlspecialchars($row['subscriber_employer_country'],ENT_NOQUOTES
); ?
>
821 <?php
echo " " . htmlspecialchars($row['subscriber_employer_postal_code'],ENT_NOQUOTES
); ?
>
829 <?php
if ($row['copay'] != "") { ?
>
830 <span
class='bold'><?php
echo htmlspecialchars(xl('CoPay'),ENT_NOQUOTES
); ?
>: </span
>
831 <span
class='text'><?php
echo htmlspecialchars($row['copay'],ENT_NOQUOTES
); ?
></span
>
834 <span
class='bold'><?php
echo htmlspecialchars(xl('Accept Assignment'),ENT_NOQUOTES
); ?
>:</span
>
835 <span
class='text'><?php
if($row['accept_assignment'] == "TRUE") echo xl("YES"); ?
>
836 <?php
if($row['accept_assignment'] == "FALSE") echo xl("NO"); ?
></span
>
837 <?php
if (!empty($row['policy_type'])) { ?
>
839 <span
class='bold'><?php
echo htmlspecialchars(xl('Secondary Medicare Type'),ENT_NOQUOTES
); ?
>: </span
>
840 <span
class='text'><?php
echo htmlspecialchars($policy_types[$row['policy_type']],ENT_NOQUOTES
); ?
></span
>
843 <td valign
='top'></td
>
844 <td valign
='top'></td
>
851 } // end if ($row['provider'])
852 $enddate = $row['date'];
857 // Display the eligibility information
858 echo "<div class='tab'>";
859 show_eligibility_information($pid,true);
862 ///////////////////////////////// END INSURANCE SECTION
875 // Notes expand collapse widget
876 $widgetTitle = xl("Notes");
877 $widgetLabel = "pnotes";
878 $widgetButtonLabel = xl("Edit");
879 $widgetButtonLink = "pnotes_full.php?form_active=1";
880 $widgetButtonClass = "";
881 $linkMethod = "html";
882 $bodyClass = "notab";
885 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
886 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
887 $widgetAuth, $fixedWidth);
891 <div style
='margin-left:10px' class='text'><img src
='../../pic/ajax-loader.gif'/></div
><br
/>
895 <?php
if ( (acl_check('patients', 'med')) && ($GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_prw']) ) {
896 echo "<tr><td width='650px'>";
897 // patient reminders collapse widget
898 $widgetTitle = xl("Patient Reminders");
899 $widgetLabel = "patient_reminders";
900 $widgetButtonLabel = xl("Edit");
901 $widgetButtonLink = "../reminder/patient_reminders.php?mode=simple&patient_id=".$pid;
902 $widgetButtonClass = "";
903 $linkMethod = "html";
904 $bodyClass = "notab";
907 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth); ?
>
909 <div style
='margin-left:10px' class='text'><image src
='../../pic/ajax-loader.gif'/></div
><br
/>
913 <?php
} //end if prw is activated ?>
918 // disclosures expand collapse widget
919 $widgetTitle = xl("Disclosures");
920 $widgetLabel = "disclosures";
921 $widgetButtonLabel = xl("Edit");
922 $widgetButtonLink = "disclosure_full.php";
923 $widgetButtonClass = "";
924 $linkMethod = "html";
925 $bodyClass = "notab";
928 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
929 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
930 $widgetAuth, $fixedWidth);
933 <div style
='margin-left:10px' class='text'><img src
='../../pic/ajax-loader.gif'/></div
><br
/>
938 <?php
if ($vitals_is_registered && acl_check('patients', 'med')) { ?
>
941 <?php
// vitals expand collapse widget
942 $widgetTitle = xl("Vitals");
943 $widgetLabel = "vitals";
944 $widgetButtonLabel = xl("Trend");
945 $widgetButtonLink = "../encounter/trend_form.php?formname=vitals";
946 $widgetButtonClass = "";
947 $linkMethod = "html";
948 $bodyClass = "notab";
949 // check to see if any vitals exist
950 $existVitals = sqlQuery("SELECT * FROM form_vitals WHERE pid=?", array($pid) );
958 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
959 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
960 $widgetAuth, $fixedWidth);
963 <div style
='margin-left:10px' class='text'><img src
='../../pic/ajax-loader.gif'/></div
><br
/>
967 <?php
} // end if ($vitals_is_registered && acl_check('patients', 'med')) ?>
970 // This generates a section similar to Vitals for each LBF form that
971 // supports charting. The form ID is used as the "widget label".
973 $gfres = sqlStatement("SELECT option_id, title FROM list_options WHERE " .
974 "list_id = 'lbfnames' AND option_value > 0 ORDER BY seq, title");
975 while($gfrow = sqlFetchArray($gfres)) {
979 <?php
// vitals expand collapse widget
980 $vitals_form_id = $gfrow['option_id'];
981 $widgetTitle = $gfrow['title'];
982 $widgetLabel = $vitals_form_id;
983 $widgetButtonLabel = xl("Trend");
984 $widgetButtonLink = "../encounter/trend_form.php?formname=$vitals_form_id";
985 $widgetButtonClass = "";
986 $linkMethod = "html";
987 $bodyClass = "notab";
988 // check to see if any instances exist for this patient
989 $existVitals = sqlQuery(
990 "SELECT * FROM forms WHERE pid = ? AND formdir = ? AND deleted = 0",
991 array($pid, $vitals_form_id));
992 $widgetAuth = $existVitals ?
true : false;
994 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
995 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
996 $widgetAuth, $fixedWidth);
999 <div style
='margin-left:10px' class='text'>
1000 <image src
='../../pic/ajax-loader.gif'/>
1003 </div
> <!-- This is required by
expand_collapse_widget(). -->
1013 <!-- end left column div
-->
1015 <!-- start right column div
-->
1024 // If there is an ID Card or any Photos show the widget
1025 $photos = pic_array($pid, $GLOBALS['patient_photo_category_name']);
1026 if ($photos or $idcard_doc_id )
1028 $widgetTitle = xl("ID Card") . '/' . xl("Photos");
1029 $widgetLabel = "photos";
1030 $linkMethod = "javascript";
1031 $bodyClass = "notab-right";
1032 $widgetAuth = false;
1033 $fixedWidth = false;
1034 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel ,
1035 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
1036 $widgetAuth, $fixedWidth);
1040 if ($idcard_doc_id) {
1041 image_widget($idcard_doc_id, $GLOBALS['patient_id_category_name']);
1044 foreach ($photos as $photo_doc_id) {
1045 image_widget($photo_doc_id, $GLOBALS['patient_photo_category_name']);
1054 // Advance Directives
1055 if ($GLOBALS['advance_directives_warning']) {
1056 // advance directives expand collapse widget
1057 $widgetTitle = xl("Advance Directives");
1058 $widgetLabel = "directives";
1059 $widgetButtonLabel = xl("Edit");
1060 $widgetButtonLink = "return advdirconfigure();";
1061 $widgetButtonClass = "";
1062 $linkMethod = "javascript";
1063 $bodyClass = "summary_item small";
1065 $fixedWidth = false;
1066 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1067 $counterFlag = false; //flag to record whether any categories contain ad records
1068 $query = "SELECT id FROM categories WHERE name='Advance Directive'";
1069 $myrow2 = sqlQuery($query);
1071 $parentId = $myrow2['id'];
1072 $query = "SELECT id, name FROM categories WHERE parent=?";
1073 $resNew1 = sqlStatement($query, array($parentId) );
1074 while ($myrows3 = sqlFetchArray($resNew1)) {
1075 $categoryId = $myrows3['id'];
1076 $nameDoc = $myrows3['name'];
1077 $query = "SELECT documents.date, documents.id " .
1079 "INNER JOIN categories_to_documents " .
1080 "ON categories_to_documents.document_id=documents.id " .
1081 "WHERE categories_to_documents.category_id=? " .
1082 "AND documents.foreign_id=? " .
1083 "ORDER BY documents.date DESC";
1084 $resNew2 = sqlStatement($query, array($categoryId, $pid) );
1085 $limitCounter = 0; // limit to one entry per category
1086 while (($myrows4 = sqlFetchArray($resNew2)) && ($limitCounter == 0)) {
1087 $dateTimeDoc = $myrows4['date'];
1088 // remove time from datetime stamp
1089 $tempParse = explode(" ",$dateTimeDoc);
1090 $dateDoc = $tempParse[0];
1091 $idDoc = $myrows4['id'];
1092 echo "<a href='$web_root/controller.php?document&retrieve&patient_id=" .
1093 htmlspecialchars($pid,ENT_QUOTES
) . "&document_id=" .
1094 htmlspecialchars($idDoc,ENT_QUOTES
) . "&as_file=true'>" .
1095 htmlspecialchars(xl_document_category($nameDoc),ENT_NOQUOTES
) . "</a> " .
1096 htmlspecialchars($dateDoc,ENT_NOQUOTES
);
1098 $limitCounter = $limitCounter +
1;
1099 $counterFlag = true;
1103 if (!$counterFlag) {
1104 echo " " . htmlspecialchars(xl('None'),ENT_NOQUOTES
);
1107 <?php
} // close advanced dir block
1109 // This is a feature for a specific client. -- Rod
1110 if ($GLOBALS['cene_specific']) {
1113 $imagedir = $GLOBALS['OE_SITE_DIR'] . "/documents/$pid/demographics";
1114 $imagepath = "$web_root/sites/" . $_SESSION['site_id'] . "/documents/$pid/demographics";
1116 echo " <a href='' onclick=\"return sendimage($pid, 'photo');\" " .
1117 "title='Click to attach patient image'>\n";
1118 if (is_file("$imagedir/photo.jpg")) {
1119 echo " <img src='$imagepath/photo.jpg' /></a>\n";
1121 echo " Attach Patient Image</a><br />\n";
1123 echo " <br /> <br />\n";
1125 echo " <a href='' onclick=\"return sendimage($pid, 'fingerprint');\" " .
1126 "title='Click to attach fingerprint'>\n";
1127 if (is_file("$imagedir/fingerprint.jpg")) {
1128 echo " <img src='$imagepath/fingerprint.jpg' /></a>\n";
1130 echo " Attach Biometric Fingerprint</a><br />\n";
1132 echo " <br /> <br />\n";
1135 // This stuff only applies to athletic team use of OpenEMR. The client
1136 // insisted on being able to quickly change fitness and return date here:
1138 if (false && $GLOBALS['athletic_team']) {
1139 // blue green yellow red orange
1140 $fitcolors = array('#6677ff','#00cc00','#ffff00','#ff3333','#ff8800','#ffeecc','#ffccaa');
1141 if (!empty($GLOBALS['fitness_colors'])) $fitcolors = $GLOBALS['fitness_colors'];
1142 $fitcolor = $fitcolors[0];
1143 $form_fitness = $_POST['form_fitness'];
1144 $form_userdate1 = fixDate($_POST['form_userdate1'], '');
1145 $form_issue_id = $_POST['form_issue_id'];
1147 $returndate = $form_userdate1 ?
"'$form_userdate1'" : "NULL";
1148 sqlStatement("UPDATE patient_data SET fitness = ?, " .
1149 "userdate1 = ? WHERE pid = ?", array($form_fitness, $returndate, $pid) );
1150 // Update return date in the designated issue, if requested.
1151 if ($form_issue_id) {
1152 sqlStatement("UPDATE lists SET returndate = ? WHERE " .
1153 "id = ?", array($returndate, $form_issue_id) );
1156 $form_fitness = $result['fitness'];
1157 if (! $form_fitness) $form_fitness = 1;
1158 $form_userdate1 = $result['userdate1'];
1160 $fitcolor = $fitcolors[$form_fitness - 1];
1161 echo " <form method='post' action='demographics.php' onsubmit='return validate()'>\n";
1162 echo " <span class='bold'>Fitness to Play:</span><br />\n";
1163 echo " <select name='form_fitness' style='background-color:$fitcolor'>\n";
1164 $res = sqlStatement("SELECT * FROM list_options WHERE " .
1165 "list_id = 'fitness' ORDER BY seq");
1166 while ($row = sqlFetchArray($res)) {
1167 $key = $row['option_id'];
1168 echo " <option value='" . htmlspecialchars($key,ENT_QUOTES
) . "'";
1169 if ($key == $form_fitness) echo " selected";
1170 echo ">" . htmlspecialchars($row['title'],ENT_NOQUOTES
) . "</option>\n";
1172 echo " </select>\n";
1173 echo " <br /><span class='bold'>Return to Play:</span><br>\n";
1174 echo " <input type='text' size='10' name='form_userdate1' id='form_userdate1' " .
1175 "value='$form_userdate1' " .
1176 "title='" . htmlspecialchars(xl('yyyy-mm-dd Date of return to play'),ENT_QUOTES
) . "' " .
1177 "onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)' />\n" .
1178 " <img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22' " .
1179 "id='img_userdate1' border='0' alt='[?]' style='cursor:pointer' " .
1180 "title='" . htmlspecialchars(xl('Click here to choose a date'),ENT_QUOTES
) . "'>\n";
1181 echo " <input type='hidden' name='form_original_userdate1' value='" . htmlspecialchars($form_userdate1,ENT_QUOTES
) . "' />\n";
1182 echo " <input type='hidden' name='form_issue_id' value='' />\n";
1183 echo "<p><input type='submit' name='form_submit' value='Change' /></p>\n";
1187 // Show current and upcoming appointments.
1188 if (isset($pid) && !$GLOBALS['disable_calendar']) {
1189 $query = "SELECT e.pc_eid, e.pc_aid, e.pc_title, e.pc_eventDate, " .
1190 "e.pc_startTime, e.pc_hometext, u.fname, u.lname, u.mname, " .
1191 "c.pc_catname, e.pc_apptstatus " .
1192 "FROM openemr_postcalendar_events AS e, users AS u, " .
1193 "openemr_postcalendar_categories AS c WHERE " .
1194 "e.pc_pid = ? AND e.pc_eventDate >= CURRENT_DATE AND " .
1195 "u.id = e.pc_aid AND e.pc_catid = c.pc_catid " .
1196 "ORDER BY e.pc_eventDate, e.pc_startTime";
1197 $res = sqlStatement($query, array($pid) );
1199 if ( (acl_check('patients', 'med')) && ($GLOBALS['enable_cdr'] && $GLOBALS['enable_cdr_crw']) ) {
1200 // clinical summary expand collapse widget
1201 $widgetTitle = xl("Clinical Reminders");
1202 $widgetLabel = "clinical_reminders";
1203 $widgetButtonLabel = xl("Edit");
1204 $widgetButtonLink = "../reminder/clinical_reminders.php?patient_id=".$pid;;
1205 $widgetButtonClass = "";
1206 $linkMethod = "html";
1207 $bodyClass = "summary_item small";
1209 $fixedWidth = false;
1210 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1212 echo "<div style='margin-left:10px' class='text'><image src='../../pic/ajax-loader.gif'/></div><br/>";
1216 // appointments expand collapse widget
1217 $widgetTitle = xl("Appointments");
1218 $widgetLabel = "appointments";
1219 $widgetButtonLabel = xl("Add");
1220 $widgetButtonLink = "return newEvt();";
1221 $widgetButtonClass = "";
1222 $linkMethod = "javascript";
1223 $bodyClass = "summary_item small";
1224 $widgetAuth = (isset($res) && $res != null);
1225 $fixedWidth = false;
1226 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1228 while($row = sqlFetchArray($res)) {
1230 $dayname = date("l", strtotime($row['pc_eventDate']));
1232 $disphour = substr($row['pc_startTime'], 0, 2) +
0;
1233 $dispmin = substr($row['pc_startTime'], 3, 2);
1234 if ($disphour >= 12) {
1236 if ($disphour > 12) $disphour -= 12;
1238 $etitle = xl('(Click to edit)');
1239 if ($row['pc_hometext'] != "") {
1240 $etitle = xl('Comments').": ".($row['pc_hometext'])."\r\n".$etitle;
1242 echo "<a href='javascript:oldEvt(" . htmlspecialchars($row['pc_eid'],ENT_QUOTES
) . ")' title='" . htmlspecialchars($etitle,ENT_QUOTES
) . "'>";
1243 echo "<b>" . htmlspecialchars(xl($dayname) . ", " . $row['pc_eventDate'],ENT_NOQUOTES
) . "</b>" . xlt("Status") . "(";
1244 echo " " . generate_display_field(array('data_type'=>'1','list_id'=>'apptstat'),$row['pc_apptstatus']) . ")<br>"; // can't use special char parser on this
1245 echo htmlspecialchars("$disphour:$dispmin " . xl($dispampm) . " " . xl_appt_category($row['pc_catname']),ENT_NOQUOTES
) . "<br>\n";
1246 echo htmlspecialchars($row['fname'] . " " . $row['lname'],ENT_NOQUOTES
) . "</a><br>\n";
1248 if (isset($res) && $res != null) {
1250 echo " " . htmlspecialchars(xl('None'),ENT_NOQUOTES
);
1256 // Show PAST appointments.
1257 if (isset($pid) && !$GLOBALS['disable_calendar'] && $GLOBALS['num_past_appointments_to_show'] > 0) {
1258 $query = "SELECT e.pc_eid, e.pc_aid, e.pc_title, e.pc_eventDate, " .
1259 "e.pc_startTime, e.pc_hometext, u.fname, u.lname, u.mname, " .
1260 "c.pc_catname, e.pc_apptstatus " .
1261 "FROM openemr_postcalendar_events AS e, users AS u, " .
1262 "openemr_postcalendar_categories AS c WHERE " .
1263 "e.pc_pid = ? AND e.pc_eventDate < CURRENT_DATE AND " .
1264 "u.id = e.pc_aid AND e.pc_catid = c.pc_catid " .
1265 "ORDER BY e.pc_eventDate, e.pc_startTime DESC " .
1266 "LIMIT " . $GLOBALS['num_past_appointments_to_show'];
1268 $pres = sqlStatement($query, array($pid) );
1270 // appointments expand collapse widget
1271 $widgetTitle = xl("Past Appoinments");
1272 $widgetLabel = "past_appointments";
1273 $widgetButtonLabel = '';
1274 $widgetButtonLink = '';
1275 $widgetButtonClass = '';
1276 $linkMethod = "javascript";
1277 $bodyClass = "summary_item small";
1278 $widgetAuth = false; //no button
1279 $fixedWidth = false;
1280 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
1282 while($row = sqlFetchArray($pres)) {
1284 $dayname = date("l", strtotime($row['pc_eventDate']));
1286 $disphour = substr($row['pc_startTime'], 0, 2) +
0;
1287 $dispmin = substr($row['pc_startTime'], 3, 2);
1288 if ($disphour >= 12) {
1290 if ($disphour > 12) $disphour -= 12;
1292 if ($row['pc_hometext'] != "") {
1293 $etitle = xl('Comments').": ".($row['pc_hometext'])."\r\n".$etitle;
1295 echo "<a href='javascript:oldEvt(" . htmlspecialchars($row['pc_eid'],ENT_QUOTES
) . ")' title='" . htmlspecialchars($etitle,ENT_QUOTES
) . "'>";
1296 echo "<b>" . htmlspecialchars(xl($dayname) . ", " . $row['pc_eventDate'],ENT_NOQUOTES
) . "</b>" . xlt("Status") . "(";
1297 echo " " . generate_display_field(array('data_type'=>'1','list_id'=>'apptstat'),$row['pc_apptstatus']) . ")<br>"; // can't use special char parser on this
1298 echo htmlspecialchars("$disphour:$dispmin ") . xl($dispampm) . " ";
1299 echo htmlspecialchars($row['fname'] . " " . $row['lname'],ENT_NOQUOTES
) . "</a><br>\n";
1301 if (isset($pres) && $res != null) {
1303 echo " " . htmlspecialchars(xl('None'),ENT_NOQUOTES
);
1308 // END of past appointments
1313 <div id
='stats_div'>
1315 <div style
='margin-left:10px' class='text'><img src
='../../pic/ajax-loader.gif'/></div
><br
/>
1321 </div
> <!-- end right column div
-->
1328 </div
> <!-- end main content div
-->
1330 <?php
if (false && $GLOBALS['athletic_team']) { ?
>
1331 <script language
='JavaScript'>
1332 Calendar
.setup({inputField
:"form_userdate1", ifFormat
:"%Y-%m-%d", button
:"img_userdate1"});