Fixes #5182 set correct patient language system (#5189)
[openemr.git] / portal / report / pat_ledger.php
blob89554c8c9ca2c7d20796c7e03d46058149836a4b
1 <?php
3 /**
4 * This is a report to create a patient ledger of charges with payments
5 * applied.
7 * @package OpenEMR
8 * @link https://www.open-emr.org
9 * @author WMT
10 * @author Terry Hill <terry@lillysystems.com>
11 * @author Brady Miller <brady.g.miller@gmail.com>
12 * @copyright Copyright (c) 2015 Rich Genandt <rgenandt@gmail.com>
13 * @copyright Copyright (c) 2019 Brady Miller <brady.g.miller@gmail.com>
14 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
17 require_once("./../verify_session.php");
18 $ignoreAuth_onsite_portal = true;
19 global $ignoreAuth_onsite_portal;
22 require_once('../../interface/globals.php');
23 require_once($GLOBALS['srcdir'] . '/patient.inc');
24 require_once($GLOBALS['srcdir'] . '/options.inc.php');
25 require_once($GLOBALS['srcdir'] . '/appointments.inc.php');
27 use OpenEMR\Core\Header;
29 $enc_units = $total_units = 0;
30 $enc_chg = $total_chg = 0;
31 $enc_pmt = $total_pmt = 0;
32 $enc_adj = $total_adj = 0;
33 $enc_bal = $total_bal = 0;
34 $bgcolor = "#FFFFDD";
35 $orow = 0;
37 function GetAllUnapplied($pat = '', $from_dt = '', $to_dt = '')
39 $all = array();
40 if (!$pat) {
41 return($all);
44 $sql = "SELECT ar_session.*, ins.name, " .
45 "pat.lname, pat.fname, pat.mname, " .
46 "(SELECT SUM(ar_activity.pay_amount) FROM ar_activity WHERE " .
47 "ar_activity.deleted IS NULL AND ar_activity.session_id = ar_session.session_id) AS applied " .
48 "FROM ar_session " .
49 "LEFT JOIN insurance_companies AS ins on ar_session.payer_id = ins.id " .
50 "LEFT JOIN patient_data AS pat on ar_session.patient_id = pat.pid " .
51 "WHERE " .
52 "ar_session.created_time >= ? AND ar_session.created_time <= ? " .
53 "AND ar_session.patient_id=?";
54 $result = sqlStatement($sql, array($from_dt, $to_dt, $pat));
55 $iter = 0;
56 while ($row = sqlFetchArray($result)) {
57 $all[$iter] = $row;
58 $iter++;
61 return($all);
64 function User_Id_Look($thisField)
66 if (!$thisField) {
67 return '';
70 $ret = '';
71 $rlist = sqlStatement("SELECT lname, fname, mname FROM users WHERE id=?", array($thisField));
72 $rrow = sqlFetchArray($rlist);
73 if ($rrow) {
74 $ret = $rrow['lname'] . ', ' . $rrow['fname'] . ' ' . $rrow['mname'];
77 return $ret;
80 function List_Look($thisData, $thisList)
82 if ($thisList == 'occurrence') {
83 if (!$thisData || $thisData == '') {
84 return xl('Unknown or N/A');
88 if ($thisData == '') {
89 return '';
92 $fres = sqlStatement("SELECT title FROM list_options WHERE list_id=? " .
93 "AND option_id=?", array($thisList, $thisData));
94 if ($fres) {
95 $rret = sqlFetchArray($fres);
96 $dispValue = xl_list_label($rret['title']);
97 if ($thisList == 'occurrence' && $dispValue == '') {
98 $dispValue = xl('Unknown or N/A');
100 } else {
101 $dispValue = xl('Not Found');
104 return $dispValue;
107 function GetAllCredits($enc = '', $pat = '')
109 $all = array();
110 if (!$enc || !$pat) {
111 return($all);
114 $sql = "SELECT activity.*, session.*, ins.name FROM ar_activity AS " .
115 "activity LEFT JOIN ar_session AS session USING (session_id) " .
116 "LEFT JOIN insurance_companies AS ins ON session.payer_id = " .
117 "ins.id WHERE deleted IS NULL AND encounter = ? AND pid = ? " .
118 "ORDER BY sequence_no";
119 $result = sqlStatement($sql, array($enc, $pat));
120 $iter = 0;
121 while ($row = sqlFetchArray($result)) {
122 $all[$iter] = $row;
123 $iter++;
126 return($all);
128 function PrintEncHeader($dt, $rsn, $dr)
130 global $bgcolor, $orow;
131 $bgcolor = (($bgcolor == "#FFFFDD") ? "#FFDDDD" : "#FFFFDD");
132 echo "<tr class='bg-white'>";
133 if (strlen($rsn) > 50) {
134 $rsn = substr($rsn, 0, 50) . '...';
137 echo "<td colspan='4'><span class='font-weight-bold'>" . xlt('Encounter Dt / Rsn') . ": </span><span class='detail'>" . text(substr($dt, 0, 10)) . " / " . text($rsn) . "</span></td>";
138 echo "<td colspan='5'><span class='font-weight-bold'>" . xlt('Provider') . ": </span><span class='detail'>" . text(User_Id_Look($dr)) . "</span></td>";
139 echo "</tr>\n";
140 $orow++;
142 function PrintEncFooter()
144 global $enc_units, $enc_chg, $enc_pmt, $enc_adj, $enc_bal;
145 echo "<tr bgcolor='#DDFFFF'>";
146 echo "<td colspan='3'>&nbsp;</td>";
147 echo "<td class='detail'>" . xlt('Encounter Balance') . ":</td>";
148 echo "<td class='detail text-right'>" . text($enc_units) . "</td>";
149 echo "<td class='detail text-right'>" . text(oeFormatMoney($enc_chg)) . "</td>";
150 echo "<td class='detail text-right'>" . text(oeFormatMoney($enc_pmt)) . "</td>";
151 echo "<td class='detail text-right'>" . text(oeFormatMoney($enc_adj)) . "</td>";
152 echo "<td class='detail text-right'>" . text(oeFormatMoney($enc_bal)) . "</td>";
153 echo "</tr>\n";
155 function PrintCreditDetail($detail, $pat, $unassigned = false)
157 global $enc_pmt, $total_pmt, $enc_adj, $total_adj, $enc_bal, $total_bal;
158 global $bgcolor, $orow, $enc_units, $enc_chg;
159 foreach ($detail as $pmt) {
160 if ($unassigned) {
161 if (($pmt['pay_total'] - $pmt['applied']) == 0) {
162 continue;
166 $bgcolor = (($bgcolor == "#FFFFDD") ? "#FFDDDD" : "#FFFFDD");
167 $print = "<tr bgcolor='" . attr($bgcolor) . "'>";
168 $print .= "<td class='detail'>&nbsp;</td>";
169 $method = List_Look($pmt['payment_method'], 'payment_method');
170 $desc = $pmt['description'];
171 $ref = $pmt['reference'];
172 if ($unassigned) {
173 $memo = List_Look($pmt['adjustment_code'], 'payment_adjustment_code');
174 } else {
175 $memo = $pmt['memo'];
178 $description = $method;
179 if ($ref) {
180 if ($description) {
181 $description .= ' - ';
184 $description .= $ref;
187 if ($desc) {
188 if ($description) {
189 $description .= ': ';
192 $description .= $desc;
195 if ($memo) {
196 if ($description) {
197 $description .= ' ';
200 $description .= '[' . $memo . ']';
203 $print .= "<td class='detail' colspan='2'>" .
204 text($description) . "&nbsp;</td>";
205 $payer = ($pmt['name'] == '') ? xl('Patient') : $pmt['name'];
206 if ($unassigned) {
207 $pmt_date = substr($pmt['post_to_date'], 0, 10);
208 } else {
209 $pmt_date = substr($pmt['post_time'], 0, 10);
212 $print .= "<td class='detail'>" .
213 text($pmt_date) . "&nbsp;/&nbsp;" . text($payer) . "</td>";
214 $type = List_Look($pmt['payment_type'], 'payment_type');
215 $print .= "<td class='detail'>" . text($type) . "&nbsp;</td>";
216 if ($unassigned) {
217 $pmt_amt = $pmt['pay_total'] - $pmt['applied'];
218 $uac_bal = oeFormatMoney($pmt_amt * -1);
219 $uac_appl = oeFormatMoney($pmt['applied']);
220 $uac_total = oeFormatMoney($pmt['pay_total']);
221 $pmt_amt = $pmt['pay_total'];
222 $total_pmt = $total_pmt - $uac_bal;
223 } else {
224 $uac_total = '';
225 $uac_bal = '';
226 $uac_appl = '';
227 $pmt_amt = $pmt['pay_amount'];
228 $adj_amt = $pmt['adj_amount'];
229 $enc_pmt = $enc_pmt + $pmt['pay_amount'];
230 $total_pmt = $total_pmt + $pmt['pay_amount'];
231 $enc_adj = $enc_adj + $pmt['adj_amount'];
232 $total_adj = $total_adj + $pmt['adj_amount'];
235 $print_pmt = '';
236 if ($pmt_amt != 0) {
237 $print_pmt = oeFormatMoney($pmt_amt);
240 $print_adj = '';
241 if ($adj_amt != 0) {
242 $print_adj = oeFormatMoney($adj_amt);
245 $print .= "<td class='detail text-right'>" . text($uac_appl) . "&nbsp;</td>";
246 $print .= "<td class='detail text-right'>" . text($print_pmt) . "&nbsp;</td>";
247 $print .= "<td class='detail text-right'>" . text($print_adj) . "&nbsp;</td>";
248 $print .= "<td class='detail text-right'>" . text($uac_bal) . "&nbsp;</td>";
249 $print .= "</tr>\n";
250 echo $print;
251 if ($pmt['follow_up_note'] != '') {
252 $bgcolor = (($bgcolor == "#FFFFDD") ? "#FFDDDD" : "#FFFFDD");
253 $print = "<tr bgcolor='" . attr($bgcolor) . "'>";
254 $print .= "<td class='detail' colspan='2'>&nbsp;</td>";
255 $print .= "<td colspan='7'>" . xlt('Follow Up Note') . ": ";
256 $print .= text($pmt['follow_up_note']);
257 $print .= "</td></tr>\n";
258 echo $print;
261 if ($unassigned) {
262 $total_bal = $total_bal + $uac_bal;
263 } else {
264 $enc_bal = $enc_bal - $pmt_amt - $adj_amt;
265 $total_bal = $total_bal - $pmt_amt - $adj_amt;
268 $orow++;
271 $bgcolor = (($bgcolor == "#FFFFDD") ? "#FFDDDD" : "#FFFFDD");
273 if (!isset($_REQUEST['form_from_date'])) {
274 $_REQUEST['form_from_date'] = '';
277 if (!isset($_REQUEST['form_to_date'])) {
278 $_REQUEST['form_to_date'] = '';
281 if (!isset($_REQUEST['form_refresh'])) {
282 $_REQUEST['form_refresh'] = '';
285 if (substr($GLOBALS['ledger_begin_date'], 0, 1) == 'Y') {
286 $ledger_time = substr($GLOBALS['ledger_begin_date'], 1, 1);
287 $last_year = mktime(0, 0, 0, date('m'), date('d'), date('Y') - $ledger_time);
288 } elseif (substr($GLOBALS['ledger_begin_date'], 0, 1) == 'M') {
289 $ledger_time = substr($GLOBALS['ledger_begin_date'], 1, 1);
290 $last_year = mktime(0, 0, 0, date('m') - $ledger_time, date('d'), date('Y'));
291 } elseif (substr($GLOBALS['ledger_begin_date'], 0, 1) == 'D') {
292 $ledger_time = substr($GLOBALS['ledger_begin_date'], 1, 1);
293 $last_year = mktime(0, 0, 0, date('m'), date('d') - $ledger_time, date('Y'));
296 $form_from_date = date('Y-m-d', $last_year);
297 if ($_REQUEST['form_from_date']) {
298 $form_from_date = fixDate($_REQUEST['form_from_date'], $last_year);
301 $form_to_date = fixDate($_REQUEST['form_to_date'], date('Y-m-d')); ?>
302 <html>
303 <head>
305 <?php Header::setupHeader(['no_main-theme', 'datetime-picker', 'patientportal-style']); ?>
306 <script src="<?php echo $GLOBALS['webroot'] ?>/library/js/common.js?v=<?php echo $v_js_includes; ?>"></script>
308 <script>
309 function checkSubmit() {
310 document.forms[0].elements['form_refresh'].value = true;
311 document.forms[0].submit();
314 </script>
316 <style>
318 /* specifically include & exclude from printing */
319 @media print {
320 #report_parameters {
321 visibility: hidden;
322 display: none;
324 #report_parameters_daterange {
325 visibility: visible;
326 display: inline;
328 #report_results {
329 margin-top: 30px;
331 #report_header {
332 visibility: visible;
333 display: inline;
335 #title {
336 visibility: hidden;
337 display: none;
340 /* specifically exclude some from the screen */
341 @media screen {
342 #report_parameters_daterange {
343 visibility: hidden;
344 display: none;
346 #report_header {
347 visibility: hidden;
348 display: none;
350 #title {
351 visibility: visible;
352 display: inline;
355 </style>
357 <title><?php echo xlt('Patient Ledger by Date') ?></title>
359 <script>
360 $(function () {
361 $('.datepicker').datetimepicker({
362 <?php $datetimepicker_timepicker = false; ?>
363 <?php $datetimepicker_formatInput = false; ?>
364 <?php require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?>
365 <?php // can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
368 </script>
370 </head>
371 <body class="skin-blue">
372 <h2><?php echo xlt('Patient Ledger'); ?></h2>
373 <form method='post' action='./pat_ledger.php' id='theform'>
374 <div id="report_parameters">
375 <input type='hidden' name='form_refresh' id='form_refresh' value=''/>
376 <table>
377 <tr>
378 <td width='35%'>
379 <div class="float-left">
380 <table class='text'>
381 <tr>
382 <td class='col-form-label'>
383 <?php echo xlt('From'); ?>:
384 </td>
385 <td>
386 <input type='text' class='datepicker form-control' name='form_from_date' id="form_from_date" size='10' value='<?php echo attr($form_from_date) ?>' title='yyyy-mm-dd'>
387 </td>
388 <td class='col-form-label'>
389 &nbsp;&nbsp;&nbsp;&nbsp;<?php echo xlt('To{{Range}}'); ?>:
390 </td>
391 <td>
392 <input type='text' class='datepicker form-control' name='form_to_date' id="form_to_date" size='10' value='<?php echo attr($form_to_date) ?>' title='yyyy-mm-dd'>
393 </td>
394 </td>
395 </tr>
396 </table>
397 </div>
398 </td>
399 <td align='left' class='align-middle h-100'>
400 <table class="w-100 h-100">
401 <tr>
402 <td>
403 <div style='margin-left: 15px'>
404 <a href='#' class='btn btn-primary' onclick="checkSubmit();" ><?php echo xlt('Submit'); ?></a>
405 </div>
406 </td>
407 </tr>
408 </table>
409 </td>
410 </tr>
411 </table>
412 </div> <!-- end of parameters -->
414 <?php
415 $from_date = $form_from_date . ' 00:00:00';
416 $to_date = $form_to_date . ' 23:59:59';
417 if ($_REQUEST['form_refresh']) {
418 $rows = array();
419 $sqlBindArray = array();
420 $query = "select b.code_type, b.code, b.code_text, b.pid, b.provider_id, " .
421 "b.billed, b.payer_id, b.units, b.fee, b.bill_date, b.id, " .
422 "ins.name, " .
423 "fe.encounter, fe.date, fe.reason, fe.provider_id " .
424 "FROM form_encounter AS fe " .
425 "LEFT JOIN billing AS b ON b.pid=fe.pid AND b.encounter=fe.encounter " .
426 "LEFT JOIN insurance_companies AS ins ON b.payer_id = ins.id " .
427 "LEFT OUTER JOIN code_types AS c ON c.ct_key = b.code_type " .
428 "WHERE fe.date >= ? AND fe.date <= ? AND fe.pid = ? ";
429 array_push($sqlBindArray, $from_date, $to_date, $pid);
431 $query .= "AND c.ct_proc = '1' ";
432 $query .= "AND activity > 0 ORDER BY fe.date, fe.id ";
433 $res = sqlStatement($query, $sqlBindArray);
435 $patient = sqlQuery("SELECT * from patient_data WHERE pid=?", array($pid));
436 $pat_dob = $patient['DOB'];
437 $pat_name = $patient['fname'] . ' ' . $patient['lname'];
439 <div id="report_header">
440 <table width="98%" class="border-0" cellspacing="0" cellpadding="0">
441 <tr>
442 <td class="title"><?php echo xlt('Patient Ledger'); ?></td>
443 </tr>
444 <tr>
445 <?php
446 $title = xl('All Providers');
448 <td class="title" ><?php echo text($title); ?></td>
449 </tr>
450 <tr>
451 <?php
452 $title = xl('For Dates') . ': ' . $form_from_date . ' - ' . $form_to_date;
454 <td class="title"><?php echo text($title); ?></td>
455 </tr>
456 </table>
457 <br/>
458 <table class="w-100 border-0" cellspacing="0" cellpadding="0">
459 <tr>
460 <td class='font-weight-bold'><?php echo xlt('Date')?>: <?php echo text(date('Y-m-d')); ?></td>
461 <td class='font-weight-bold'><?php echo xlt('Patient')?>: <?php echo text($pat_name); ?></td>
462 <td class='font-weight-bold'><?php echo xlt('DOB')?>: <?php echo text($pat_dob);?></td>
463 <td class='font-weight-bold'> <?php echo xlt('ID')?>: <?php echo text($pid);?></td>
464 </tr>
465 </table>
466 </div>
467 <div id="report_results">
468 <table class="table">
469 <tr>
470 <td class='font-weight-bold'><?php echo xlt('Code'); ?></td>
471 <td colspan="2" class='font-weight-bold'><?php echo xlt('Description'); ?></td>
472 <td class='font-weight-bold'><?php echo xlt('Billed Date'); ?> / <?php echo xlt('Payor'); ?></td>
473 <td class='font-weight-bold'><?php echo xlt('Type'); ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
474 <?php echo xlt('Units'); ?></td>
475 <td class='font-weight-bold'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo xlt('Charge'); ?></td>
476 <td class='text-right font-weight-bold'>&nbsp;&nbsp;<?php echo xlt('Payment'); ?></td>
477 <td class='text-right font-weight-bold'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo xlt('Adjustment'); ?></td>
478 <td class='text-right font-weight-bold'>&nbsp;&nbsp;&nbsp;<?php echo xlt('Balance'); ?></td>
479 </tr>
480 <tr>
481 <td>&nbsp;&nbsp;&nbsp;</td>
482 <td colspan="2">&nbsp;&nbsp;&nbsp;</td>
483 <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
484 <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
485 <td class='font-weight-bold'>&nbsp;&nbsp;&nbsp;<?php echo xlt('UAC Appl'); ?></td>
486 <td class='text-right font-weight-bold'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo xlt('UAC Tot'); ?></td>
487 <td>&nbsp;</td>
488 <td>&nbsp;</td>
489 </tr>
490 <?php
491 $orow = 0;
492 $prev_encounter_id = -1;
493 $hdr_printed = false;
494 $prev_row = array();
495 while ($erow = sqlFetchArray($res)) {
496 $print = '';
497 $csv = '';
498 if ($erow['encounter'] != $prev_encounter_id) {
499 if ($prev_encounter_id != -1) {
500 $credits = GetAllCredits($prev_encounter_id, $pid);
501 if (count($credits) > 0) {
502 if (!$hdr_printed) {
503 PrintEncHeader(
504 $prev_row['date'],
505 $prev_row['reason'],
506 $prev_row['provider_id']
510 PrintCreditDetail($credits, $pid);
513 if ($hdr_printed) {
514 PrintEncFooter();
517 $hdr_printed = false;
520 $enc_units = $enc_chg = $enc_pmt = $enc_adj = $enc_bal = 0;
523 if ($erow['id']) {
524 // Now print an encounter heading line -
525 if (!$hdr_printed) {
526 PrintEncHeader(
527 $erow['date'],
528 $erow['reason'],
529 $erow['provider_id']
531 $hdr_printed = true;
534 $code_desc = $erow['code_text'];
535 if (strlen($code_desc) > 50) {
536 $code_desc = substr($code_desc, 0, 50) . '...';
539 $bgcolor = (($bgcolor == "#FFFFDD") ? "#FFDDDD" : "#FFFFDD");
540 $print = "<tr bgcolor='" . attr($bgcolor) . "'>";
541 $print .= "<td class='detail'>" . text($erow['code']) . "</td>";
542 $print .= "<td class='detail' colspan='2'>" . text($code_desc) . "</td>";
543 $who = ($erow['name'] == '') ? xl('Self') : $erow['name'];
544 $bill = substr($erow['bill_date'], 0, 10);
545 if ($bill == '') {
546 $bill = 'unbilled';
549 $print .= "<td class='detail'>" . text($bill) . "&nbsp;/&nbsp;" . text($who) . "</td>";
550 $print .= "<td class='detail text-right'>" . text($erow['units']) . "</td>";
551 $print .= "<td class='detail text-right'>" . text(oeFormatMoney($erow['fee'])) . "</td>";
552 $print .= "<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>";
553 $print .= "</tr>\n";
555 $total_units += $erow['units'];
556 $total_chg += $erow['fee'];
557 $total_bal += $erow['fee'];
558 $enc_units += $erow['units'];
559 $enc_chg += $erow['fee'];
560 $enc_bal += $erow['fee'];
561 $orow++;
563 echo $print;
566 $prev_encounter_id = $erow['encounter'];
567 $prev_row = $erow;
570 if ($prev_encounter_id != -1) {
571 $credits = GetAllCredits($prev_encounter_id, $pid);
572 if (count($credits) > 0) {
573 if (!$hdr_printed) {
574 PrintEncHeader(
575 $prev_row['date'],
576 $prev_row['reason'],
577 $prev_row['provider_id']
581 PrintCreditDetail($credits, $pid);
584 if ($hdr_printed) {
585 PrintEncFooter();
589 // This is the end of the encounter/charge loop -
590 $uac = GetAllUnapplied($pid, $from_date, $to_date);
591 if (count($uac) > 0) {
592 if ($orow) {
593 $bgcolor = (($bgcolor == "#FFFFDD") ? "#FFDDDD" : "#FFFFDD");
594 echo "<tr class='bg-white'><td colspan='9'>&nbsp;</td></tr>\n";
597 PrintCreditDetail($uac, $pid, true);
600 if ($orow) {
601 echo "<tr bgcolor='#DDFFFF'>\n";
602 echo " <td colspan='2'>&nbsp;</td>";
603 echo " <td class='font-weight-bold' colspan='2'>" . xlt("Grand Total") . "</td>\n";
604 echo " <td class='font-weight-bold text-right'>" . text($total_units) . "</td>\n";
605 echo " <td class='font-weight-bold text-right'>" . text(oeFormatMoney($total_chg)) . "</td>\n";
606 echo " <td class='font-weight-bold text-right'>" . text(oeFormatMoney($total_pmt)) . "</td>\n";
607 echo " <td class='font-weight-bold text-right'>" . text(oeFormatMoney($total_adj)) . "</td>\n";
608 echo " <td class='font-weight-bold text-right'>" . text(oeFormatMoney($total_bal)) . "</td>\n";
609 echo " </tr>\n";
611 </table>
612 <tr><td>&nbsp;</td></tr><br /><br />
613 <?php if ($GLOBALS['print_next_appointment_on_ledger'] == 1) {
614 $next_day = mktime(0, 0, 0, date('m'), date('d') + 1, date('Y'));
615 # add one day to date so it will not get todays appointment
616 $current_date2 = date('Y-m-d', $next_day);
617 $events = fetchNextXAppts($current_date2, $pid);
618 $next_appoint_date = oeFormatShortDate($events[0]['pc_eventDate']);
619 $next_appoint_time = substr($events[0]['pc_startTime'], 0, 5);
620 if (strlen($events[0]['umname']) != 0) {
621 $next_appoint_provider = $events[0]['ufname'] . ' ' . $events[0]['umname'] . ' ' . $events[0]['ulname'];
622 } else {
623 $next_appoint_provider = $events[0]['ufname'] . ' ' . $events[0]['ulname'];
626 if (strlen($next_appoint_time) != 0) {
628 <tr>
629 <td class="title"><?php echo xlt('Next Appointment Date') . ': ' . text($next_appoint_date) . ' ' . xlt('Time') . ' ' . text($next_appoint_time) . ' ' . xlt('Provider') . ' ' . text($next_appoint_provider); ?></td>
630 </tr>
632 <?php
634 } // end ($GLOBALS['print_next_appointment_on_ledger'] == 1)
635 } // end ($orow)
636 echo "</div>\n";
640 if ($_REQUEST['form_refresh'] && $orow <= 0) {
641 echo "<span style='font-size: 0.8125rem;'>";
642 echo xlt('No matches found. Try search again.');
643 echo "</span>";
644 echo '<script>document.getElementById("report_results").style.display="none";</script>';
645 echo '<script>document.getElementById("controls").style.display="none";</script>';
648 if (!$_REQUEST['form_refresh']) { ?>
649 <div class='text'>
650 <?php echo xlt('Please input search criteria above, and click Submit to view results.'); ?>
651 </div>
652 <?php
655 </form>
656 </body>
658 </html>