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");
26 if ($GLOBALS['concurrent_layout'] && $_GET['set_pid']) {
27 include_once("$srcdir/pid.inc");
28 setpid($_GET['set_pid']);
31 function print_as_money($money) {
32 preg_match("/(\d*)\.?(\d*)/",$money,$moneymatches);
33 $tmp = wordwrap(strrev($moneymatches[1]),3,",",1);
34 $ccheck = strrev($tmp);
35 if ($ccheck[0] == ",") {
36 $tmp = substr($ccheck,1,strlen($ccheck)-1);
38 if ($moneymatches[2] != "") {
39 return "$ " . strrev($tmp) . "." . $moneymatches[2];
41 return "$ " . strrev($tmp);
45 // get an array from Photos category
46 function pic_array($pid,$picture_directory) {
48 $sql_query = "select documents.id from documents join categories_to_documents " .
49 "on documents.id = categories_to_documents.document_id " .
50 "join categories on categories.id = categories_to_documents.category_id " .
51 "where categories.name like ? and documents.foreign_id = ?";
52 if ($query = sqlStatement($sql_query, array($picture_directory,$pid))) {
53 while( $results = sqlFetchArray($query) ) {
54 array_push($pics,$results['id']);
59 // Get the document ID of the first document in a specific catg.
60 function get_document_by_catg($pid,$doc_catg) {
64 if ($pid and $doc_catg) {
65 $result = sqlQuery("SELECT d.id, d.date, d.url FROM " .
66 "documents AS d, categories_to_documents AS cd, categories AS c " .
67 "WHERE d.foreign_id = ? " .
68 "AND cd.document_id = d.id " .
69 "AND c.id = cd.category_id " .
70 "AND c.name LIKE ? " .
71 "ORDER BY d.date DESC LIMIT 1", array($pid, $doc_catg) );
74 return($result['id']);
77 // Display image in 'widget style'
78 function image_widget($doc_id,$doc_catg)
80 global $pid, $web_root;
81 $docobj = new Document($doc_id);
82 $image_file = $docobj->get_url_file();
83 $extension = substr($image_file, strrpos($image_file,"."));
84 $viewable_types = array('.png','.jpg','.jpeg','.png','.bmp'); // image ext supported by fancybox viewer
85 if ( in_array($extention,$viewable_types) == 0 ) { // extention matches list
86 $to_url = "<a href = $web_root" .
87 "/controller.php?document&retrieve&patient_id=$pid&document_id=$doc_id" .
88 "/tmp.$extension" . // Force image type inot URL for fancybox
89 " onclick=top.restoreSession(); class='image_modal'>" .
90 " <img src = $web_root" .
91 "/controller.php?document&retrieve&patient_id=$pid&document_id=$doc_id" .
92 " width=100 alt='$doc_catg:$image_file' align='center'>" .
93 htmlspecialchars(" $doc_catg: $image_file") .
97 $to_url = "<a href='" . $web_root . "/controller.php?document&retrieve" .
98 "&patient_id=$pid&document_id=$doc_id'" .
99 " onclick='top.restoreSession()' class='css_button_small'>" .
101 htmlspecialchars( xl("View"), ENT_QUOTES
)."</a> " .
102 htmlspecialchars( "$doc_catg - $image_file", ENT_QUOTES
) .
103 "</span> <br /><br />";
108 // Determine if the Vitals form is in use for this site.
109 $tmp = sqlQuery("SELECT count(*) AS count FROM registry WHERE " .
110 "directory = 'vitals' AND state = 1");
111 $vitals_is_registered = $tmp['count'];
116 <?php
html_header_show();?
>
117 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
118 <link rel
="stylesheet" type
="text/css" href
="../../../library/js/fancybox/jquery.fancybox-1.2.6.css" media
="screen" />
119 <style type
="text/css">@import
url(../../../library
/dynarch_calendar
.css
);</style
>
120 <script type
="text/javascript" src
="../../../library/textformat.js"></script
>
121 <script type
="text/javascript" src
="../../../library/dynarch_calendar.js"></script
>
122 <?php
include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?
>
123 <script type
="text/javascript" src
="../../../library/dynarch_calendar_setup.js"></script
>
124 <script type
="text/javascript" src
="../../../library/dialog.js"></script
>
125 <script type
="text/javascript" src
="../../../library/js/jquery.1.3.2.js"></script
>
126 <script type
="text/javascript" src
="../../../library/js/common.js"></script
>
127 <script type
="text/javascript" src
="../../../library/js/fancybox/jquery.fancybox-1.2.6.js"></script
>
128 <script type
="text/javascript" language
="JavaScript">
129 //Visolve - sync the radio buttons - Start
130 if((top
.window
.parent
) && (parent
.window
)){
131 var wname
= top
.window
.parent
.left_nav
;
133 wname
.setRadio(parent
.window
.name
, "dem");
135 //Visolve - sync the radio buttons - End
137 var mypcc
= '<?php echo htmlspecialchars($GLOBALS['phone_country_code
'],ENT_QUOTES); ?>';
139 function oldEvt(eventid
) {
140 dlgopen('../../main/calendar/add_edit_event.php?eid=' + eventid
, '_blank', 550, 270);
143 function advdirconfigure() {
144 dlgopen('advancedirectives.php', '_blank', 500, 450);
147 function refreshme() {
148 top
.restoreSession();
152 // Process click on Delete link.
153 function deleteme() {
154 dlgopen('../deleter.php?patient=<?php echo htmlspecialchars($pid,ENT_QUOTES); ?>', '_blank', 500, 450);
158 // Called by the deleteme.php window on a successful delete.
159 function imdeleted() {
160 <?php
if ($GLOBALS['concurrent_layout']) { ?
>
161 parent
.left_nav
.clearPatient();
163 top
.restoreSession();
164 top
.location
.href
= '../main/main_screen.php';
168 function validate() {
169 var f
= document
.forms
[0];
171 if ($GLOBALS['athletic_team']) {
172 echo " if (f.form_userdate1.value != f.form_original_userdate1.value) {\n";
173 $irow = sqlQuery("SELECT id, title FROM lists WHERE " .
174 "pid = ? AND enddate IS NULL ORDER BY begdate DESC LIMIT 1", array($pid));
177 if (confirm('Do you wish to also set this new return date in the issue titled "<?php echo htmlspecialchars($irow['title
'],ENT_QUOTES); ?>"?')) {
178 f
.form_issue_id
.value
= '<?php echo htmlspecialchars($irow['id
'],ENT_QUOTES); ?>';
180 alert('OK, you will need to manually update the return date in any affected issue(s).');
183 alert('You have changed the return date but there are no open issues. You probably need to create or modify one.');
187 } // end athletic team
193 dlgopen('../../main/calendar/add_edit_event.php?patientid=<?php echo htmlspecialchars($pid,ENT_QUOTES); ?>', '_blank', 550, 270);
197 function sendimage(pid
, what
) {
198 // alert('Not yet implemented.'); return false;
199 dlgopen('../upload_dialog.php?patientid=' + pid +
'&file=' + what
,
206 <script type
="text/javascript">
208 function toggleIndicator(target
,div
) {
210 $mode = $
(target
).find(".indicator").text();
211 if ( $mode == "<?php echo htmlspecialchars(xl('collapse'),ENT_QUOTES); ?>" ) {
212 $
(target
).find(".indicator").text( "<?php echo htmlspecialchars(xl('expand'),ENT_QUOTES); ?>" );
214 $
.post( "../../../library/ajax/user_settings.php", { target
: div
, mode
: 0 });
216 $
(target
).find(".indicator").text( "<?php echo htmlspecialchars(xl('collapse'),ENT_QUOTES); ?>" );
218 $
.post( "../../../library/ajax/user_settings.php", { target
: div
, mode
: 1 });
222 $
(document
).ready(function(){
225 $
("#stats_div").load("stats.php", { 'embeddedScreen' : true }, function() {
226 // (note need to place javascript code here also to get the dynamic link to work)
227 $
(".rx_modal").fancybox( {
228 'overlayOpacity' : 0.0,
229 'showCloseButton' : true,
232 'centerOnScroll' : false,
233 'callbackOnClose' : function() {
238 $
("#pnotes_ps_expand").load("pnotes_fragment.php");
239 $
("#disclosures_ps_expand").load("disc_fragment.php");
241 <?php
if ($vitals_is_registered) { ?
>
242 // Initialize the Vitals form if it is registered.
243 $
("#vitals_ps_expand").load("vitals_fragment.php");
247 // Initialize for each applicable LBF form.
248 $gfres = sqlStatement("SELECT option_id FROM list_options WHERE " .
249 "list_id = 'lbfnames' AND option_value > 0 ORDER BY seq, title");
250 while($gfrow = sqlFetchArray($gfres)) {
252 $
("#<?php echo $gfrow['option_id']; ?>_ps_expand").load("lbf_fragment.php?formname=<?php echo $gfrow['option_id']; ?>");
262 // modal for dialog boxes
263 $
(".large_modal").fancybox( {
264 'overlayOpacity' : 0.0,
265 'showCloseButton' : true,
268 'centerOnScroll' : false
271 // modal for image viewer
272 $
(".image_modal").fancybox( {
273 'overlayOpacity' : 0.0,
274 'showCloseButton' : true,
275 'centerOnScroll' : false,
283 <style type
="css/text">
292 <body
class="body_top">
295 $result = getPatientData($pid, "*, DATE_FORMAT(DOB,'%Y-%m-%d') as DOB_YMD");
296 $result2 = getEmployerData($pid);
297 $result3 = getInsuranceData($pid, "primary", "copay, provider, DATE_FORMAT(`date`,'%Y-%m-%d') as effdate");
300 if ($result3['provider']) { // Use provider in case there is an ins record w/ unassigned insco
301 $insco_name = getInsuranceProvider($result3['provider']);
304 $thisauth = acl_check('patients', 'demo');
306 if ($result['squad'] && ! acl_check('squads', $result['squad']))
311 echo "<p>(" . htmlspecialchars(xl('Demographics not authorized'),ENT_NOQUOTES
) . ")</p>\n";
312 echo "</body>\n</html>\n";
316 if ($thisauth == 'write') {
317 echo "<table><tr><td><span class='title'>" .
318 htmlspecialchars(getPatientName($pid),ENT_NOQUOTES
) .
321 if (acl_check('admin', 'super')) {
322 echo "<td style='padding-left:1em;'><a class='css_button iframe' href='../deleter.php?patient=" .
323 htmlspecialchars($pid,ENT_QUOTES
) . "'>" .
324 "<span>".htmlspecialchars(xl('Delete'),ENT_NOQUOTES
).
327 echo "</tr></table>";
330 // Get the document ID of the patient ID card if access to it is wanted here.
331 $idcard_doc_id = false;
332 if ($GLOBALS['patient_id_category_name']) {
333 $idcard_doc_id = get_document_by_catg($pid, $GLOBALS['patient_id_category_name']);
337 <table cellspacing
='0' cellpadding
='0' border
='0'>
339 <td
class="small" colspan
='4'>
340 <a href
="../history/history.php" onclick
='top.restoreSession()'>
341 <?php
echo htmlspecialchars(xl('History'),ENT_NOQUOTES
); ?
></a
>
343 <?php
//note that we have temporarily removed report screen from the modal view ?>
344 <a href
="../report/patient_report.php" onclick
='top.restoreSession()'>
345 <?php
echo htmlspecialchars(xl('Report'),ENT_NOQUOTES
); ?
></a
>
347 <?php
//note that we have temporarily removed document screen from the modal view ?>
348 <a href
="../../../controller.php?document&list&patient_id=<?php echo $pid;?>" onclick
='top.restoreSession()'>
349 <?php
echo htmlspecialchars(xl('Documents'),ENT_NOQUOTES
); ?
></a
>
351 <a href
="../transaction/transactions.php" class='iframe large_modal' onclick
='top.restoreSession()'>
352 <?php
echo htmlspecialchars(xl('Transactions'),ENT_NOQUOTES
); ?
></a
>
355 </table
> <!-- end header
-->
357 <div style
='margin-top:10px'> <!-- start main content div
-->
358 <table border
="0" cellspacing
="0" cellpadding
="0" width
="100%">
360 <td align
="left" valign
="top">
361 <!-- start left column div
-->
362 <div style
='float:left; margin-right:20px'>
363 <table cellspacing
=0 cellpadding
=0>
367 // Billing expand collapse widget
368 $widgetTitle = xl("Billing");
369 $widgetLabel = "billing";
370 $widgetButtonLabel = xl("Edit");
371 $widgetButtonLink = "return newEvt();";
372 $widgetButtonClass = "";
373 $linkMethod = "javascript";
374 $bodyClass = "notab";
377 if ($GLOBALS['force_billing_widget_open']) {
378 $forceExpandAlways = true;
381 $forceExpandAlways = false;
383 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
384 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
385 $widgetAuth, $fixedWidth, $forceExpandAlways);
389 if ($GLOBALS['oer_config']['ws_accounting']['enabled']) {
390 // Show current balance and billing note, if any.
391 echo " <div style='margin-left: 10px; margin-right: 10px'>" .
392 "<span class='bold'><font color='#ee6600'>" .
393 htmlspecialchars(xl('Balance Due'),ENT_NOQUOTES
) .
394 ": " . htmlspecialchars(oeFormatMoney(get_patient_balance($pid)),ENT_NOQUOTES
) .
395 "</font></span><br>";
396 if ($result['genericname2'] == 'Billing') {
397 echo "<span class='bold'><font color='red'>" .
398 htmlspecialchars(xl('Billing Note'),ENT_NOQUOTES
) . ":" .
399 htmlspecialchars($result['genericval2'],ENT_NOQUOTES
) .
400 "</font></span><br>";
402 if ($result3['provider']) { // Use provider in case there is an ins record w/ unassigned insco
403 echo "<span class='bold'>" .
404 htmlspecialchars(xl('Primary Insurance'),ENT_NOQUOTES
) . ': ' . htmlspecialchars($insco_name,ENT_NOQUOTES
) .
405 "</span> ";
406 if ($result3['copay'] > 0) {
407 echo "<span class='bold'>" .
408 htmlspecialchars(xl('Copay'),ENT_NOQUOTES
) . ': ' . htmlspecialchars($result3['copay'],ENT_NOQUOTES
) .
409 "</span> ";
411 echo "<span class='bold'>" .
412 htmlspecialchars(xl('Effective Date'),ENT_NOQUOTES
) . ': ' . htmlspecialchars(oeFormatShortDate($result3['effdate'],ENT_NOQUOTES
)) .
418 </div
> <!-- required
for expand_collapse_widget
-->
424 // Demographics expand collapse widget
425 $widgetTitle = xl("Demographics");
426 $widgetLabel = "demographics";
427 $widgetButtonLabel = xl("Edit");
428 $widgetButtonLink = "demographics_full.php";
429 $widgetButtonClass = "";
430 $linkMethod = "html";
432 $widgetAuth = ($thisauth == "write");
434 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
435 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
436 $widgetAuth, $fixedWidth);
440 <?php
display_layout_tabs('DEM', $result, $result2); ?
>
442 <div
class="tabContainer">
443 <?php
display_layout_tabs_data('DEM', $result, $result2); ?
>
446 </div
> <!-- required
for expand_collapse_widget
-->
453 $insurance_count = 0;
454 foreach (array('primary','secondary','tertiary') as $instype) {
455 $enddate = 'Present';
456 $query = "SELECT * FROM insurance_data WHERE " .
457 "pid = ? AND type = ? " .
458 "ORDER BY date DESC";
459 $res = sqlStatement($query, array($pid, $instype) );
460 while( $row = sqlFetchArray($res) ) {
461 if ($row['provider'] ) $insurance_count++
;
465 if ( $insurance_count > 0 ) {
466 // Insurance expand collapse widget
467 $widgetTitle = xl("Insurance");
468 $widgetLabel = "insurance";
469 $widgetButtonLabel = xl("Edit");
470 $widgetButtonLink = "demographics_full.php";
471 $widgetButtonClass = "";
472 $linkMethod = "html";
474 $widgetAuth = ($thisauth == "write");
476 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
477 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
478 $widgetAuth, $fixedWidth);
480 if ( $insurance_count > 0 ) {
483 <ul
class="tabNav"><?php
484 ///////////////////////////////// INSURANCE SECTION
486 foreach (array('primary','secondary','tertiary') as $instype) {
488 $query = "SELECT * FROM insurance_data WHERE " .
489 "pid = ? AND type = ? " .
490 "ORDER BY date DESC";
491 $res = sqlStatement($query, array($pid, $instype) );
493 $enddate = 'Present';
495 while( $row = sqlFetchArray($res) ) {
496 if ($row['provider'] ) {
498 $ins_description = ucfirst($instype);
499 $ins_description = xl($ins_description);
500 $ins_description .= strcmp($enddate, 'Present') != 0 ?
" (".xl('Old').")" : "";
502 <li
<?php
echo $first ?
'class="current"' : '' ?
>><a href
="/play/javascript-tabbed-navigation/">
503 <?php
echo htmlspecialchars($ins_description,ENT_NOQUOTES
); ?
></a
></li
>
507 $enddate = $row['date'];
510 // Display the eligibility tab
511 echo "<li><a href='/play/javascript-tabbed-navigation/'>" .
512 htmlspecialchars( xl('Eligibility'), ENT_NOQUOTES
) . "</a></li>";
518 <div
class="tabContainer">
521 foreach (array('primary','secondary','tertiary') as $instype) {
522 $enddate = 'Present';
524 $query = "SELECT * FROM insurance_data WHERE " .
525 "pid = ? AND type = ? " .
526 "ORDER BY date DESC";
527 $res = sqlStatement($query, array($pid, $instype) );
528 while( $row = sqlFetchArray($res) ) {
529 if ($row['provider'] ) {
531 <div
class="tab <?php echo $first ? 'current' : '' ?>">
532 <table border
='0' cellpadding
='0' width
='100%'>
534 $icobj = new InsuranceCompany($row['provider']);
535 $adobj = $icobj->get_address();
536 $insco_name = trim($icobj->get_name());
539 <td valign
='top' colspan
='3'>
541 <?php
if (strcmp($enddate, 'Present') != 0) echo htmlspecialchars(xl("Old"),ENT_NOQUOTES
)." "; ?
>
542 <?php
$tempinstype=ucfirst($instype); echo htmlspecialchars(xl($tempinstype.' Insurance'),ENT_NOQUOTES
); ?
>
543 <?php
if (strcmp($row['date'], '0000-00-00') != 0) { ?
>
544 <?php
echo htmlspecialchars(xl('from','',' ',' ').$row['date'],ENT_NOQUOTES
); ?
>
546 <?php
echo htmlspecialchars(xl('until','',' ',' '),ENT_NOQUOTES
);
547 echo (strcmp($enddate, 'Present') != 0) ?
$enddate : htmlspecialchars(xl('Present'),ENT_NOQUOTES
); ?
>:</span
>
555 echo htmlspecialchars($insco_name,ENT_NOQUOTES
) . '<br>';
556 if (trim($adobj->get_line1())) {
557 echo htmlspecialchars($adobj->get_line1(),ENT_NOQUOTES
) . '<br>';
558 echo htmlspecialchars($adobj->get_city() . ', ' . $adobj->get_state() . ' ' . $adobj->get_zip(),ENT_NOQUOTES
);
561 echo "<font color='red'><b>".htmlspecialchars(xl('Unassigned'),ENT_NOQUOTES
)."</b></font>";
565 <?php
echo htmlspecialchars(xl('Policy Number'),ENT_NOQUOTES
); ?
>:
566 <?php
echo htmlspecialchars($row['policy_number'],ENT_NOQUOTES
) ?
><br
>
567 <?php
echo htmlspecialchars(xl('Plan Name'),ENT_NOQUOTES
); ?
>:
568 <?php
echo htmlspecialchars($row['plan_name'],ENT_NOQUOTES
); ?
><br
>
569 <?php
echo htmlspecialchars(xl('Group Number'),ENT_NOQUOTES
); ?
>:
570 <?php
echo htmlspecialchars($row['group_number'],ENT_NOQUOTES
); ?
></span
>
573 <span
class='bold'><?php
echo htmlspecialchars(xl('Subscriber'),ENT_NOQUOTES
); ?
>: </span
><br
>
574 <span
class='text'><?php
echo htmlspecialchars($row['subscriber_fname'] . ' ' . $row['subscriber_mname'] . ' ' . $row['subscriber_lname'],ENT_NOQUOTES
); ?
>
576 if ($row['subscriber_relationship'] != "") {
577 echo "(" . htmlspecialchars($row['subscriber_relationship'],ENT_NOQUOTES
) . ")";
581 <?php
echo htmlspecialchars(xl('S.S.'),ENT_NOQUOTES
); ?
>:
582 <?php
echo htmlspecialchars($row['subscriber_ss'],ENT_NOQUOTES
); ?
><br
>
583 <?php
echo htmlspecialchars(xl('D.O.B.'),ENT_NOQUOTES
); ?
>:
584 <?php
if ($row['subscriber_DOB'] != "0000-00-00 00:00:00") echo htmlspecialchars($row['subscriber_DOB'],ENT_NOQUOTES
); ?
><br
>
585 <?php
echo htmlspecialchars(xl('Phone'),ENT_NOQUOTES
); ?
>:
586 <?php
echo htmlspecialchars($row['subscriber_phone'],ENT_NOQUOTES
); ?
>
590 <span
class='bold'><?php
echo htmlspecialchars(xl('Subscriber Address'),ENT_NOQUOTES
); ?
>: </span
><br
>
591 <span
class='text'><?php
echo htmlspecialchars($row['subscriber_street'],ENT_NOQUOTES
); ?
><br
>
592 <?php
echo htmlspecialchars($row['subscriber_city'],ENT_NOQUOTES
); ?
>
593 <?php
if($row['subscriber_state'] != "") echo ", "; echo htmlspecialchars($row['subscriber_state'],ENT_NOQUOTES
); ?
>
594 <?php
if($row['subscriber_country'] != "") echo ", "; echo htmlspecialchars($row['subscriber_country'],ENT_NOQUOTES
); ?
>
595 <?php
echo " " . htmlspecialchars($row['subscriber_postal_code'],ENT_NOQUOTES
); ?
></span
>
597 <?php
if (trim($row['subscriber_employer'])) { ?
>
598 <br
><span
class='bold'><?php
echo htmlspecialchars(xl('Subscriber Employer'),ENT_NOQUOTES
); ?
>: </span
><br
>
599 <span
class='text'><?php
echo htmlspecialchars($row['subscriber_employer'],ENT_NOQUOTES
); ?
><br
>
600 <?php
echo htmlspecialchars($row['subscriber_employer_street'],ENT_NOQUOTES
); ?
><br
>
601 <?php
echo htmlspecialchars($row['subscriber_employer_city'],ENT_NOQUOTES
); ?
>
602 <?php
if($row['subscriber_employer_city'] != "") echo ", "; echo htmlspecialchars($row['subscriber_employer_state'],ENT_NOQUOTES
); ?
>
603 <?php
if($row['subscriber_employer_country'] != "") echo ", "; echo htmlspecialchars($row['subscriber_employer_country'],ENT_NOQUOTES
); ?
>
604 <?php
echo " " . htmlspecialchars($row['subscriber_employer_postal_code'],ENT_NOQUOTES
); ?
>
612 <?php
if ($row['copay'] != "") { ?
>
613 <span
class='bold'><?php
echo htmlspecialchars(xl('CoPay'),ENT_NOQUOTES
); ?
>: </span
>
614 <span
class='text'><?php
echo htmlspecialchars($row['copay'],ENT_NOQUOTES
); ?
></span
>
617 <span
class='bold'><?php
echo htmlspecialchars(xl('Accept Assignment'),ENT_NOQUOTES
); ?
>:</span
>
618 <span
class='text'><?php
if($row['accept_assignment'] == "TRUE") echo xl("YES"); ?
>
619 <?php
if($row['accept_assignment'] == "FALSE") echo xl("NO"); ?
></span
>
621 <td valign
='top'></td
>
622 <td valign
='top'></td
>
629 } // end if ($row['provider'])
630 $enddate = $row['date'];
635 // Display the eligibility information
636 echo "<div class='tab'>";
637 show_eligibility_information($pid,true);
640 ///////////////////////////////// END INSURANCE SECTION
653 // Notes expand collapse widget
654 $widgetTitle = xl("Notes");
655 $widgetLabel = "pnotes";
656 $widgetButtonLabel = xl("Edit");
657 $widgetButtonLink = "pnotes_full.php";
658 $widgetButtonClass = "";
659 $linkMethod = "html";
660 $bodyClass = "notab";
663 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
664 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
665 $widgetAuth, $fixedWidth);
669 <div style
='margin-left:10px' class='text'><img src
='../../pic/ajax-loader.gif'/></div
><br
/>
676 // disclosures expand collapse widget
677 $widgetTitle = xl("Disclosures");
678 $widgetLabel = "disclosures";
679 $widgetButtonLabel = xl("Edit");
680 $widgetButtonLink = "disclosure_full.php";
681 $widgetButtonClass = "";
682 $linkMethod = "html";
683 $bodyClass = "notab";
686 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
687 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
688 $widgetAuth, $fixedWidth);
692 <div style
='margin-left:10px' class='text'><image src
='../../pic/ajax-loader.gif'/></div
><br
/>
699 <?php
if ($vitals_is_registered) { ?
>
702 <?php
// vitals expand collapse widget
703 $widgetTitle = xl("Vitals");
704 $widgetLabel = "vitals";
705 $widgetButtonLabel = xl("Trend");
706 $widgetButtonLink = "../encounter/trend_form.php?formname=vitals";
707 $widgetButtonClass = "";
708 $linkMethod = "html";
709 $bodyClass = "notab";
710 // check to see if any vitals exist
711 $existVitals = sqlQuery("SELECT * FROM form_vitals WHERE pid=?", array($pid) );
719 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
720 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
721 $widgetAuth, $fixedWidth);
724 <div style
='margin-left:10px' class='text'><image src
='../../pic/ajax-loader.gif'/></div
><br
/>
728 <?php
} // end if ($vitals_is_registered) ?>
731 // This generates a section similar to Vitals for each LBF form that
732 // supports charting. The form ID is used as the "widget label".
734 $gfres = sqlStatement("SELECT option_id, title FROM list_options WHERE " .
735 "list_id = 'lbfnames' AND option_value > 0 ORDER BY seq, title");
736 while($gfrow = sqlFetchArray($gfres)) {
740 <?php
// vitals expand collapse widget
741 $vitals_form_id = $gfrow['option_id'];
742 $widgetTitle = $gfrow['title'];
743 $widgetLabel = $vitals_form_id;
744 $widgetButtonLabel = xl("Trend");
745 $widgetButtonLink = "../encounter/trend_form.php?formname=$vitals_form_id";
746 $widgetButtonClass = "";
747 $linkMethod = "html";
748 $bodyClass = "notab";
749 // check to see if any instances exist for this patient
750 $existVitals = sqlQuery(
751 "SELECT * FROM forms WHERE pid = ? AND formdir = ? AND deleted = 0",
752 array($pid, $vitals_form_id));
753 $widgetAuth = $existVitals ?
true : false;
755 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel,
756 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
757 $widgetAuth, $fixedWidth);
760 <div style
='margin-left:10px' class='text'>
761 <image src
='../../pic/ajax-loader.gif'/>
764 </div
> <!-- This is required by
expand_collapse_widget(). -->
776 <!-- end left column div
-->
778 <!-- start right column div
-->
786 // If there is an ID Card or any Photos show the widget
787 $photos = pic_array($pid, $GLOBALS['patient_photo_category_name']);
788 if ($photos or $idcard_doc_id )
790 $widgetTitle = xl("ID Card") . '/' . xl("Photos");
791 $widgetLabel = "photos";
792 $linkMethod = "javascript";
793 $bodyClass = "notab";
796 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel ,
797 $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass,
798 $widgetAuth, $fixedWidth);
802 if ($idcard_doc_id) {
803 image_widget($idcard_doc_id, $GLOBALS['patient_id_category_name']);
806 foreach ($photos as $photo_doc_id) {
807 image_widget($photo_doc_id, $GLOBALS['patient_photo_category_name']);
816 // Advance Directives
817 if ($GLOBALS['advance_directives_warning']) {
818 // advance directives expand collapse widget
819 $widgetTitle = xl("Advance Directives");
820 $widgetLabel = "directives";
821 $widgetButtonLabel = xl("Edit");
822 $widgetButtonLink = "return advdirconfigure();";
823 $widgetButtonClass = "";
824 $linkMethod = "javascript";
825 $bodyClass = "summary_item small";
828 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
829 $counterFlag = false; //flag to record whether any categories contain ad records
830 $query = "SELECT id FROM categories WHERE name='Advance Directive'";
831 $myrow2 = sqlQuery($query);
833 $parentId = $myrow2['id'];
834 $query = "SELECT id, name FROM categories WHERE parent=?";
835 $resNew1 = sqlStatement($query, array($parentId) );
836 while ($myrows3 = sqlFetchArray($resNew1)) {
837 $categoryId = $myrows3['id'];
838 $nameDoc = $myrows3['name'];
839 $query = "SELECT documents.date, documents.id " .
841 "INNER JOIN categories_to_documents " .
842 "ON categories_to_documents.document_id=documents.id " .
843 "WHERE categories_to_documents.category_id=? " .
844 "AND documents.foreign_id=? " .
845 "ORDER BY documents.date DESC";
846 $resNew2 = sqlStatement($query, array($categoryId, $pid) );
847 $limitCounter = 0; // limit to one entry per category
848 while (($myrows4 = sqlFetchArray($resNew2)) && ($limitCounter == 0)) {
849 $dateTimeDoc = $myrows4['date'];
850 // remove time from datetime stamp
851 $tempParse = explode(" ",$dateTimeDoc);
852 $dateDoc = $tempParse[0];
853 $idDoc = $myrows4['id'];
854 echo "<a href='$web_root/controller.php?document&retrieve&patient_id=" .
855 htmlspecialchars($pid,ENT_QUOTES
) . "&document_id=" .
856 htmlspecialchars($idDoc,ENT_QUOTES
) . "&as_file=true'>" .
857 htmlspecialchars(xl_document_category($nameDoc),ENT_NOQUOTES
) . "</a> " .
858 htmlspecialchars($dateDoc,ENT_NOQUOTES
);
860 $limitCounter = $limitCounter +
1;
866 echo " " . htmlspecialchars(xl('None'),ENT_NOQUOTES
);
869 <?php
} // close advanced dir block
871 // This is a feature for a specific client. -- Rod
872 if ($GLOBALS['cene_specific']) {
875 $imagedir = $GLOBALS['OE_SITE_DIR'] . "/documents/$pid/demographics";
876 $imagepath = "$web_root/sites/" . $_SESSION['site_id'] . "/documents/$pid/demographics";
878 echo " <a href='' onclick=\"return sendimage($pid, 'photo');\" " .
879 "title='Click to attach patient image'>\n";
880 if (is_file("$imagedir/photo.jpg")) {
881 echo " <img src='$imagepath/photo.jpg' /></a>\n";
883 echo " Attach Patient Image</a><br />\n";
885 echo " <br /> <br />\n";
887 echo " <a href='' onclick=\"return sendimage($pid, 'fingerprint');\" " .
888 "title='Click to attach fingerprint'>\n";
889 if (is_file("$imagedir/fingerprint.jpg")) {
890 echo " <img src='$imagepath/fingerprint.jpg' /></a>\n";
892 echo " Attach Biometric Fingerprint</a><br />\n";
894 echo " <br /> <br />\n";
897 // This stuff only applies to athletic team use of OpenEMR. The client
898 // insisted on being able to quickly change fitness and return date here:
900 if (false && $GLOBALS['athletic_team']) {
901 // blue green yellow red orange
902 $fitcolors = array('#6677ff','#00cc00','#ffff00','#ff3333','#ff8800','#ffeecc','#ffccaa');
903 if (!empty($GLOBALS['fitness_colors'])) $fitcolors = $GLOBALS['fitness_colors'];
904 $fitcolor = $fitcolors[0];
905 $form_fitness = $_POST['form_fitness'];
906 $form_userdate1 = fixDate($_POST['form_userdate1'], '');
907 $form_issue_id = $_POST['form_issue_id'];
909 $returndate = $form_userdate1 ?
"'$form_userdate1'" : "NULL";
910 sqlStatement("UPDATE patient_data SET fitness = ?, " .
911 "userdate1 = ? WHERE pid = ?", array($form_fitness, $returndate, $pid) );
912 // Update return date in the designated issue, if requested.
913 if ($form_issue_id) {
914 sqlStatement("UPDATE lists SET returndate = ? WHERE " .
915 "id = ?", array($returndate, $form_issue_id) );
918 $form_fitness = $result['fitness'];
919 if (! $form_fitness) $form_fitness = 1;
920 $form_userdate1 = $result['userdate1'];
922 $fitcolor = $fitcolors[$form_fitness - 1];
923 echo " <form method='post' action='demographics.php' onsubmit='return validate()'>\n";
924 echo " <span class='bold'>Fitness to Play:</span><br />\n";
925 echo " <select name='form_fitness' style='background-color:$fitcolor'>\n";
926 $res = sqlStatement("SELECT * FROM list_options WHERE " .
927 "list_id = 'fitness' ORDER BY seq");
928 while ($row = sqlFetchArray($res)) {
929 $key = $row['option_id'];
930 echo " <option value='" . htmlspecialchars($key,ENT_QUOTES
) . "'";
931 if ($key == $form_fitness) echo " selected";
932 echo ">" . htmlspecialchars($row['title'],ENT_NOQUOTES
) . "</option>\n";
935 echo " <br /><span class='bold'>Return to Play:</span><br>\n";
936 echo " <input type='text' size='10' name='form_userdate1' id='form_userdate1' " .
937 "value='$form_userdate1' " .
938 "title='" . htmlspecialchars(xl('yyyy-mm-dd Date of return to play'),ENT_QUOTES
) . "' " .
939 "onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)' />\n" .
940 " <img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22' " .
941 "id='img_userdate1' border='0' alt='[?]' style='cursor:pointer' " .
942 "title='" . htmlspecialchars(xl('Click here to choose a date'),ENT_QUOTES
) . "'>\n";
943 echo " <input type='hidden' name='form_original_userdate1' value='" . htmlspecialchars($form_userdate1,ENT_QUOTES
) . "' />\n";
944 echo " <input type='hidden' name='form_issue_id' value='' />\n";
945 echo "<p><input type='submit' name='form_submit' value='Change' /></p>\n";
949 // Show current and upcoming appointments.
950 if (isset($pid) && !$GLOBALS['disable_calendar']) {
951 $query = "SELECT e.pc_eid, e.pc_aid, e.pc_title, e.pc_eventDate, " .
952 "e.pc_startTime, e.pc_hometext, u.fname, u.lname, u.mname, " .
954 "FROM openemr_postcalendar_events AS e, users AS u, " .
955 "openemr_postcalendar_categories AS c WHERE " .
956 "e.pc_pid = ? AND e.pc_eventDate >= CURRENT_DATE AND " .
957 "u.id = e.pc_aid AND e.pc_catid = c.pc_catid " .
958 "ORDER BY e.pc_eventDate, e.pc_startTime";
959 $res = sqlStatement($query, array($pid) );
961 // appointments expand collapse widget
962 $widgetTitle = xl("Appointments");
963 $widgetLabel = "appointments";
964 $widgetButtonLabel = xl("Add");
965 $widgetButtonLink = "return newEvt();";
966 $widgetButtonClass = "";
967 $linkMethod = "javascript";
968 $bodyClass = "summary_item small";
969 $widgetAuth = (isset($res) && $res != null);
971 expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel , $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth);
974 while($row = sqlFetchArray($res)) {
976 $dayname = date("l", strtotime($row['pc_eventDate']));
978 $disphour = substr($row['pc_startTime'], 0, 2) +
0;
979 $dispmin = substr($row['pc_startTime'], 3, 2);
980 if ($disphour >= 12) {
982 if ($disphour > 12) $disphour -= 12;
984 $etitle = xl('(Click to edit)');
985 if ($row['pc_hometext'] != "") {
986 $etitle = xl('Comments').": ".($row['pc_hometext'])."\r\n".$etitle;
988 echo "<a href='javascript:oldEvt(" . htmlspecialchars($row['pc_eid'],ENT_QUOTES
) .
989 ")' title='" . htmlspecialchars($etitle,ENT_QUOTES
) . "'>";
990 echo "<b>" . htmlspecialchars(xl($dayname) . ", " . $row['pc_eventDate'],ENT_NOQUOTES
) . "</b><br>";
991 echo htmlspecialchars("$disphour:$dispmin " . xl($dispampm) . " " . xl_appt_category($row['pc_catname']),ENT_NOQUOTES
) . "<br>\n";
992 echo htmlspecialchars($row['fname'] . " " . $row['lname'],ENT_NOQUOTES
) . "</a><br>\n";
994 if (isset($res) && $res != null) {
995 if ( $count < 1 ) { echo " " . htmlspecialchars(xl('None'),ENT_NOQUOTES
); }
1002 <div id
='stats_div'>
1004 <div style
='margin-left:10px' class='text'><image src
='../../pic/ajax-loader.gif'/></div
><br
/>
1010 </div
> <!-- end right column div
-->
1017 </div
> <!-- end main content div
-->
1019 <?php
if ($GLOBALS['concurrent_layout'] && $_GET['set_pid']) { ?
>
1020 <script language
='JavaScript'>
1021 top
.window
.parent
.left_nav
.setPatient(<?php
echo "'" . htmlspecialchars(($result['fname']) . " " . ($result['lname']),ENT_QUOTES
) .
1022 "'," . htmlspecialchars($pid,ENT_QUOTES
) . ",'" . htmlspecialchars(($result['pubpid']),ENT_QUOTES
) .
1023 "','', ' " . htmlspecialchars(xl('DOB') . ": " . oeFormatShortDate($result['DOB_YMD']) . " " . xl('Age') . ": " . getPatientAge($result['DOB_YMD']), ENT_QUOTES
) . "'"; ?
>);
1024 EncounterDateArray
=new Array;
1025 CalendarCategoryArray
=new Array;
1026 EncounterIdArray
=new Array;
1029 //Encounter details are stored to javacript as array.
1030 $result4 = sqlStatement("SELECT fe.encounter,fe.date,openemr_postcalendar_categories.pc_catname FROM form_encounter AS fe ".
1031 " left join openemr_postcalendar_categories on fe.pc_catid=openemr_postcalendar_categories.pc_catid WHERE fe.pid = ? order by fe.date desc", array($pid));
1032 if(sqlNumRows($result4)>0)
1033 while($rowresult4 = sqlFetchArray($result4))
1036 EncounterIdArray
[Count
]='<?php echo htmlspecialchars($rowresult4['encounter
'], ENT_QUOTES); ?>';
1037 EncounterDateArray
[Count
]='<?php echo htmlspecialchars(oeFormatShortDate(date("Y-m-d", strtotime($rowresult4['date
']))), ENT_QUOTES); ?>';
1038 CalendarCategoryArray
[Count
]='<?php echo htmlspecialchars( xl_appt_category($rowresult4['pc_catname
']), ENT_QUOTES); ?>';
1043 top
.window
.parent
.left_nav
.setPatientEncounter(EncounterIdArray
,EncounterDateArray
,CalendarCategoryArray
);
1044 parent
.left_nav
.setRadio(window
.name
, 'dem');
1048 <?php
if (false && $GLOBALS['athletic_team']) { ?
>
1049 <script language
='JavaScript'>
1050 Calendar
.setup({inputField
:"form_userdate1", ifFormat
:"%Y-%m-%d", button
:"img_userdate1"});