3 * This the first of two pages to support posting of EOBs.
4 * The second is sl_eob_invoice.php.
7 * @link http://www.open-emr.org
8 * @author Rod Roark <rod@sunsetsystems.com>
9 * @author Bill Cernansky
10 * @author Tony McCormick
11 * @author Roberto Vasquez <robertogagliotta@gmail.com>
12 * @author Jerry Padgett <sjpadgett@gmail.com>
13 * @author Brady Miller <brady.g.miller@gmail.com>
14 * @copyright Copyright (c) 2005-2010 Rod Roark <rod@sunsetsystems.com>
15 * @copyright Copyright (c) 2018 Brady Miller <brady.g.miller@gmail.com>
16 * @copyright Copyright (c) 2018 Jerry Padgett <sjpadgett@gmail.com>
17 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
20 // Updated by Growlingflea Software. now generates correct service and billing facility on statement.
21 // any questions contact Daniel Pflieger at daniel@growlingflea.com
23 require_once("../globals.php");
24 require_once("$srcdir/patient.inc");
25 require_once("$srcdir/invoice_summary.inc.php");
26 require_once("$srcdir/appointments.inc.php");
27 require_once($GLOBALS['OE_SITE_DIR'] . "/statement.inc.php");
28 require_once("$srcdir/api.inc");
29 require_once("$srcdir/forms.inc");
30 require_once("$srcdir/../controllers/C_Document.class.php");
31 require_once("$srcdir/documents.php");
32 require_once("$srcdir/options.inc.php");
33 require_once("$srcdir/acl.inc");
34 require_once "$srcdir/user.inc";
36 use OpenEMR\Billing\ParseERA
;
37 use OpenEMR\Billing\SLEOB
;
38 use OpenEMR\Core\Header
;
39 use OpenEMR\OeUI\OemrUI
;
41 $DEBUG = 0; // set to 0 for production, 1 to test
43 $posting_adj_disable = prevSetting('sl_eob_search.', 'posting_adj_disable', 'posting_adj_disable', '');
49 /* Load dependencies only if we need them */
50 if (!empty($GLOBALS['portal_onsite_two_enable'])) {
51 /* Addition of onsite portal patient notify of invoice and reformated invoice - sjpadgett 01/2017 */
52 require_once("../../portal/lib/portal_mail.inc");
53 require_once("../../portal/lib/appsql.class.php");
55 function is_auth_portal($pid = 0)
57 if ($pData = sqlQuery("SELECT * FROM `patient_data` WHERE `pid` = ?", array($pid))) {
58 if ($pData['allow_patient_portal'] != "YES") {
61 $_SESSION['portalUser'] = strtolower($pData['fname']) . $pData['id'];
69 function notify_portal($thispid, array $invoices, $template, $invid)
71 $builddir = $GLOBALS['OE_SITE_DIR'] . '/documents/onsite_portal_documents/templates/' . $thispid;
72 if (!is_dir($builddir)) {
73 mkdir($builddir, 0755, true);
76 if (fixup_invoice($template, $builddir . '/invoice' . $invid . '.tpl') != true) {
80 if (SavePatientAudit($thispid, $invoices) != true) {
82 } // this is all the invoice data for portal auditing
83 $note = xl('You have an invoice due for payment in your Patient Documents. There you may pay, download or print the invoice. Thank you.');
84 if (sendMail($_SESSION['authUser'], $note, xlt('Bill/Collect'), '', '0', $_SESSION['authUser'], $_SESSION['authUser'], $_SESSION['portalUser'], $invoices[0]['patient'], "New", '0') == 1) { // remind admin this was sent
85 sendMail($_SESSION['portalUser'], $note, xlt('Bill/Collect'), '', '0', $_SESSION['authUser'], $_SESSION['authUser'], $_SESSION['portalUser'], $invoices[0]['patient'], "New", '0'); // notify patient
93 function fixup_invoice($template, $ifile)
95 $data = file_get_contents($template);
100 if (!file_put_contents($ifile, $data)) {
107 function SavePatientAudit($pid, $invs)
109 $appsql = new ApplicationTable();
112 $audit['patient_id'] = $pid;
113 $audit['activity'] = "invoice";
114 $audit['require_audit'] = "0";
115 $audit['pending_action'] = "payment";
116 $audit['action_taken'] = "";
117 $audit['status'] = "waiting transaction";
118 $audit['narrative'] = "Request patient online payment.";
119 $audit['table_action'] = '';
120 $audit['table_args'] = json_encode($invs);
121 $audit['action_user'] = $pid;
122 $audit['action_taken_time'] = "";
123 $audit['checksum'] = "";
124 $edata = $appsql->getPortalAudit($pid, 'payment', 'invoice', "waiting transaction", 0);
125 if ($edata['id'] > 0) {
126 $appsql->portalAudit('update', $edata['id'], $audit);
128 $appsql->portalAudit('insert', '', $audit);
130 } catch (Exception
$ex) {
138 // This is called back by ParseERA::parse_era() if we are processing X12 835's.
139 function era_callback(&$out)
141 global $where, $eracount, $eraname;
142 // print_r($out); // debugging
144 // $eraname = $out['isa_control_number'];
145 $eraname = $out['gs_date'] . '_' . ltrim($out['isa_control_number'], '0') .
146 '_' . ltrim($out['payer_id'], '0');
147 list($pid, $encounter, $invnumber) = SLEOB
::slInvoiceNumber($out);
149 if ($pid && $encounter) {
154 $where .= "( f.pid = '" . add_escape_custom($pid) . "' AND f.encounter = '" . add_escape_custom($encounter) . "' )";
158 function bucks($amount)
161 return oeFormatMoney($amount);
165 function validEmail($email)
167 if (preg_match("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$^", $email)) {
174 function emailLogin($patient_id, $message)
176 $patientData = sqlQuery("SELECT * FROM `patient_data` WHERE `pid`=?", array($patient_id));
177 if ($patientData['hipaa_allowemail'] != "YES" ||
empty($patientData['email']) ||
empty($GLOBALS['patient_reminder_sender_email'])) {
181 if (!(validEmail($patientData['email']))) {
185 if (!(validEmail($GLOBALS['patient_reminder_sender_email']))) {
189 if ($_SESSION['pc_facility']) {
190 $sql = "select * from facility where id=?";
191 $facility = sqlQuery($sql, array($_SESSION['pc_facility']));
193 $sql = "SELECT * FROM facility ORDER BY billing_location DESC LIMIT 1";
194 $facility = sqlQuery($sql);
197 $mail = new MyMailer();
198 $pt_name = $patientData['fname'] . ' ' . $patientData['lname'];
199 $pt_email = $patientData['email'];
200 $email_subject = ($facility['name'] . ' ' . xl('Patient Statement Bill'));
201 $email_sender = $GLOBALS['patient_reminder_sender_email'];
202 $mail->AddReplyTo($email_sender, $email_sender);
203 $mail->SetFrom($email_sender, $email_sender);
204 $mail->AddAddress($pt_email, $pt_name);
205 $mail->Subject
= $email_subject;
206 $mail->MsgHTML("<html><body><div class='wrapper'>" . $message . "</div></body></html>");
208 $mail->AltBody
= $message;
213 $email_status = $mail->ErrorInfo
;
214 error_log("EMAIL ERROR: " . $email_status, 0);
219 // Upload a file to the client's browser
221 function upload_file_to_client($file_to_send)
223 header("Pragma: public");
224 header("Expires: 0");
225 header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
226 header("Content-Type: application/force-download");
227 header("Content-Length: " . filesize($file_to_send));
228 header("Content-Disposition: attachment; filename=" . basename($file_to_send));
229 header("Content-Description: File Transfer");
230 readfile($file_to_send);
231 // flush the content to the browser. If you don't do this, the text from the subsequent
232 // output from this script will be in the file instead of sent to the browser.
234 exit(); //added to exit from process properly in order to stop bad html code -ehrlive
235 // sleep one second to ensure there's no follow-on.
239 function upload_file_to_client_email($ppid, $file_to_send)
242 global $STMT_TEMP_FILE_PDF;
243 $file = fopen($file_to_send, "r");//this file contains the text to be converted to pdf.
244 while (!feof($file)) {
245 $OneLine = fgets($file);//one line is read
247 $message = $message . $OneLine . '<br>';
252 emailLogin($ppid, $message);
255 function upload_file_to_client_pdf($file_to_send, $aPatFirstName = '', $aPatID = null, $flagCFN = false)
257 //modified for statement title name
258 //Function reads a HTML file and converts to pdf.
260 $aPatFName = convert_safe_file_dir_name($aPatFirstName); //modified for statement title name
262 $STMT_TEMP_FILE_PDF = $GLOBALS['temporary_files_dir'] . "/Stmt_{$aPatFName}_{$aPatID}.pdf";
264 global $STMT_TEMP_FILE_PDF;
269 if ($GLOBALS['statement_appearance'] == '1') {
270 require_once("$srcdir/html2pdf/vendor/autoload.php");
271 $pdf2 = new HTML2PDF(
272 $GLOBALS['pdf_layout'],
273 $GLOBALS['pdf_size'],
274 $GLOBALS['pdf_language'],
275 true, // default unicode setting is true
276 'UTF-8', // default encoding setting is UTF-8
277 array($GLOBALS['pdf_left_margin'], $GLOBALS['pdf_top_margin'], $GLOBALS['pdf_right_margin'], $GLOBALS['pdf_bottom_margin']),
278 $_SESSION['language_direction'] == 'rtl' ?
true : false
281 readfile($file_to_send, "r");//this file contains the HTML to be converted to pdf.
283 $content = ob_get_clean();
285 // Fix a nasty html2pdf bug - it ignores document root!
286 global $web_root, $webserver_root;
288 $wrlen = strlen($web_root);
289 $wsrlen = strlen($webserver_root);
291 $i = stripos($content, " src='/", $i +
1);
296 if (substr($content, $i +
6, $wrlen) === $web_root &&
297 substr($content, $i +
6, $wsrlen) !== $webserver_root) {
298 $content = substr($content, 0, $i +
6) . $webserver_root . substr($content, $i +
6 +
$wrlen);
302 $pdf2->WriteHTML($content);
303 $temp_filename = $STMT_TEMP_FILE_PDF;
304 $content_pdf = $pdf2->Output($STMT_TEMP_FILE_PDF, 'F');
306 $pdf = new Cezpdf('LETTER');//pdf creation starts
307 $pdf->ezSetMargins(45, 9, 36, 10);
308 $pdf->selectFont('Courier');
309 $pdf->ezSetY($pdf->ez
['pageHeight'] - $pdf->ez
['topMargin']);
311 $file = fopen($file_to_send, "r");//this file contains the text to be converted to pdf.
312 while (!feof($file)) {
313 $OneLine = fgets($file);//one line is read
314 if (stristr($OneLine, "\014") == true && !feof($file)) {//form feed means we should start a new page.
316 $pdf->ezSetY($pdf->ez
['pageHeight'] - $pdf->ez
['topMargin']);
317 str_replace("\014", "", $OneLine);
320 if (stristr($OneLine, 'REMIT TO') == true ||
stristr($OneLine, 'Visit Date') == true ||
stristr($OneLine, 'Future Appointments') == true ||
stristr($OneLine, 'Current') == true) { //lines are made bold when 'REMIT TO' or 'Visit Date' is there.
321 $pdf->ezText('<b>' . $OneLine . '</b>', 12, array('justification' => 'left', 'leading' => 6));
323 $pdf->ezText($OneLine, 12, array('justification' => 'left', 'leading' => 6));
329 $fh = @fopen
($STMT_TEMP_FILE_PDF, 'w');//stored to a pdf file
331 fwrite($fh, $pdf->ezOutput());
336 header("Pragma: public");//this section outputs the pdf file to browser
337 header("Expires: 0");
338 header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
339 header("Content-Type: application/force-download");
340 header("Content-Length: " . filesize($STMT_TEMP_FILE_PDF));
341 header("Content-Disposition: attachment; filename=" . basename($STMT_TEMP_FILE_PDF));
342 header("Content-Description: File Transfer");
343 readfile($STMT_TEMP_FILE_PDF);
344 // flush the content to the browser. If you don't do this, the text from the subsequent
345 // output from this script will be in the file instead of sent to the browser.
347 exit(); //added to exit from process properly in order to stop bad html code -ehrlive
348 // sleep one second to ensure there's no follow-on.
353 $today = date("Y-m-d");
354 // Print or download statements if requested.
356 if (($_REQUEST['form_print'] ||
$_REQUEST['form_download'] ||
$_REQUEST['form_email'] ||
$_REQUEST['form_pdf']) ||
$_REQUEST['form_portalnotify'] && $_REQUEST['form_cb']) {
357 if (!verifyCsrfToken($_REQUEST["csrf_token_form"])) {
361 $fhprint = fopen($STMT_TEMP_FILE, 'w');
363 $sqlBindArray = array();
365 foreach ($_REQUEST['form_cb'] as $key => $value) {
366 $where .= " OR f.id = ?";
367 array_push($sqlBindArray, $key);
370 if (!empty($where)) {
371 $where = substr($where, 4);
372 $where = '( ' . $where . ' ) AND';
375 $res = sqlStatement("SELECT " .
376 "f.id, f.date, f.pid, f.encounter, f.stmt_count, f.last_stmt_date, f.last_level_closed, f.last_level_billed, f.billing_note as enc_billing_note, " .
377 "p.fname, p.mname, p.lname, p.street, p.city, p.state, p.postal_code, p.billing_note as pat_billing_note, f.provider_id " .
378 "FROM form_encounter AS f, patient_data AS p " .
381 "ORDER BY p.lname, p.fname, f.pid, f.date, f.encounter", $sqlBindArray);
387 $aPatientFirstName = '';
389 $multiplePatients = false;
390 $usePatientNamePdf = false;
392 // get pids for delimits
393 // need to only use summary invoice for multi visits
396 if ($_REQUEST['form_portalnotify']) {
397 foreach ($_REQUEST['form_invpids'] as $key => $v) {
398 if ($_REQUEST['form_cb'][$key]) {
399 array_push($inv_pid, key($v));
404 while ($row = sqlFetchArray($res)) {
406 if (!$inv_pid[$rcnt]) {
407 array_push($inv_pid, $row['pid']);
411 // This loops once for each invoice/encounter.
414 while ($row = $rows[$rcnt++
]) {
415 $svcdate = substr($row['date'], 0, 10);
416 $duedate = $svcdate; // TBD?
417 $duncount = $row['stmt_count'];
418 $enc_note = $row['enc_billing_note'];
422 $aPatientFirstName = $row['fname'];
423 $aPatientID = $row['pid'];
424 $usePatientNamePdf = true;
425 } elseif (!$multiplePatients) {
426 if ($aPatientID != $row['pid']) {
427 $multiplePatients = true;
428 $aPatientFirstName = '';
430 $usePatientNamePdf = false;
434 // If this is a new patient then print the pending statement
435 // and start a new one. This is an associative array:
438 // pid = OpenEMR patient ID
439 // patient = patient name
440 // amount = total amount due
441 // adjust = adjustments (already applied to amount)
442 // duedate = due date of the oldest included invoice
443 // age = number of days from duedate to today
444 // to = array of addressee name/address lines
446 // dos = date of service "yyyy-mm-dd"
447 // desc = description
448 // amount = charge less adjustments
449 // paid = amount paid
450 // notice = 1 for first notice, 2 for second, etc.
451 // detail = array of details, see invoice_summary.inc.php
453 if ($stmt['cid'] != $row['pid']) {
457 $stmt['fid'] = $row['id'];
458 $stmt['cid'] = $row['pid'];
459 $stmt['pid'] = $row['pid'];
460 $stmt['dun_count'] = $row['stmt_count'];
461 $stmt['bill_note'] = $row['pat_billing_note'];
462 $stmt['enc_bill_note'] = $row['enc_billing_note'];
463 $stmt['bill_level'] = $row['last_level_billed'];
464 $stmt['level_closed'] = $row['last_level_closed'];
465 $stmt['patient'] = $row['fname'] . ' ' . $row['lname'];
466 $stmt['encounter'] = $row['encounter'];
467 $stmt['provider_id'] = $row['provider_id'];
468 #If you use the field in demographics layout called
469 #guardiansname this will allow you to send statements to the parent
470 #of a child or a guardian etc
471 if (strlen($row['guardiansname']) == 0) {
472 $stmt['to'] = array($row['fname'] . ' ' . $row['lname']);
474 $stmt['to'] = array($row['guardiansname']);
477 if ($row['street']) {
478 $stmt['to'][] = $row['street'];
481 $stmt['to'][] = $row['city'] . ", " . $row['state'] . " " . $row['postal_code'];
482 $stmt['lines'] = array();
483 $stmt['amount'] = '0.00';
484 $stmt['ins_paid'] = 0;
485 $stmt['today'] = $today;
486 $stmt['duedate'] = $duedate;
488 // Report the oldest due date.
489 if ($duedate < $stmt['duedate']) {
490 $stmt['duedate'] = $duedate;
494 // Recompute age at each invoice.
495 $stmt['age'] = round((strtotime($today) - strtotime($stmt['duedate'])) / (24 * 60 * 60));
497 $invlines = ar_get_invoice_summary($row['pid'], $row['encounter'], true);
498 foreach ($invlines as $key => $value) {
500 $line['dos'] = $svcdate;
501 if ($GLOBALS['use_custom_statement']) {
502 $line['desc'] = ($key == 'CO-PAY') ?
"Patient Payment" : $value['code_text'];
504 $line['desc'] = ($key == 'CO-PAY') ?
"Patient Payment" : "Procedure $key";
507 $line['amount'] = sprintf("%.2f", $value['chg']);
508 $line['adjust'] = sprintf("%.2f", $value['adj']);
509 $line['paid'] = sprintf("%.2f", $value['chg'] - $value['bal']);
510 $line['notice'] = $duncount +
1;
511 $line['detail'] = $value['dtl'];
512 $stmt['lines'][] = $line;
513 $stmt['amount'] = sprintf("%.2f", $stmt['amount'] +
$value['bal']);
514 $stmt['ins_paid'] = $stmt['ins_paid'] +
$value['ins'];
517 // Record that this statement was run.
518 if (!$DEBUG && !$_REQUEST['form_without']) {
519 sqlStatement("UPDATE form_encounter SET " .
520 "last_stmt_date = ?, stmt_count = stmt_count + 1 " .
521 "WHERE id = ?", array($today, $row['id']));
524 if ($_REQUEST['form_portalnotify']) {
525 if (!is_auth_portal($stmt['pid'])) {
526 $alertmsg = xlt('Notification FAILED: Not Portal Authorized');
530 // we don't want to send the portal multiple invoices, thus this. Last invoice for pid is summary.
531 if ($inv_pid[$inv_count] != $inv_pid[$inv_count +
1]) {
532 fwrite($fhprint, make_statement($stmt));
533 if (!notify_portal($stmt['pid'], $pvoice, $STMT_TEMP_FILE, $stmt['pid'] . "-" . $stmt['encounter'])) {
534 $alertmsg = xlt('Notification FAILED');
540 ftruncate($fhprint, 0);
545 if ($inv_pid[$inv_count] != $inv_pid[$inv_count +
1]) {
546 $tmp = make_statement($stmt);
548 $tmp = xlt("This EOB item does not meet minimum print requirements setup in Globals or there is an unknown error.") . " " . xlt("EOB Id") . ":" . text($inv_pid[$inv_count]) . " " . xlt("Encounter") . ":" . text($stmt[encounter
]) . "\n";
549 $tmp .= "<br />\n\014<br /><br />";
551 fwrite($fhprint, $tmp);
562 // Download or print the file, as selected
563 if ($_REQUEST['form_download']) {
564 upload_file_to_client($STMT_TEMP_FILE);
565 } elseif ($_REQUEST['form_pdf']) {
566 upload_file_to_client_pdf($STMT_TEMP_FILE, $aPatientFirstName, $aPatientID, $usePatientNamePdf);
567 } elseif ($_REQUEST['form_email']) {
568 upload_file_to_client_email($stmt['pid'], $STMT_TEMP_FILE);
569 } elseif ($_REQUEST['form_portalnotify']) {
570 if ($alertmsg == "") {
571 $alertmsg = xl('Sending Invoice to Patient Portal Completed');
573 } else { // Must be print!
575 $alertmsg = xl("Printing skipped; see test output in") . ' ' . $STMT_TEMP_FILE;
577 exec(escapeshellcmd($STMT_PRINT_CMD) . " " . escapeshellarg($STMT_TEMP_FILE));
578 if ($_REQUEST['form_without']) {
579 $alertmsg = xl('Now printing') . ' ' . $stmt_count . ' ' . xl('statements; invoices will not be updated.');
581 $alertmsg = xl('Now printing') . ' ' . $stmt_count . ' ' . xl('statements and updating invoices.');
584 } // end not form_download
585 } // end statements requested
589 <?php Header
::setupHeader(['datetime-picker']); ?
>
590 <title
><?php
echo xlt('EOB Posting - Search'); ?
></title
>
591 <script language
="JavaScript">
594 function checkAll(checked
) {
595 var f
= document
.forms
[0];
596 for (var i
= 0; i
< f
.elements
.length
; ++i
) {
597 var ename
= f
.elements
[i
].name
;
598 if (ename
.indexOf('form_cb[') == 0)
599 f
.elements
[i
].checked
= checked
;
603 function persistCriteria(el
, e
) {
605 let target
= "sl_eob_search.posting_adj_disable";
606 let val
= el
.checked ?
'checked' : '';
607 $
.post("./../../library/ajax/user_settings.php",
611 csrf_token_form
: "<?php echo attr(collectCsrfToken()); ?>"
616 function npopup(pid
) {
617 window
.open('sl_eob_patient_note.php?patient_id=' + pid
, '_blank', 'width=500,height=250,resizable=1');
621 function toEncSummary(pid
) {
623 top
.restoreSession();
624 let encurl
= 'patient_file/history/encounters.php?billing=1&issue=0&pagesize=20&pagestart=0';
625 let paturl
= "patient_file/summary/demographics.php?set_pid=" + pid
;
626 parent
.left_nav
.loadFrame('pat2', 'pat', paturl
);
627 // need a little time so can force a billing view
628 setTimeout(function(){parent
.left_nav
.loadFrame('enc2', 'enc', encurl
);}, 3000);
631 $
(document
).ready(function () {
632 $
('.datepicker').datetimepicker({
633 <?php
$datetimepicker_timepicker = false; ?
>
634 <?php
$datetimepicker_showseconds = false; ?
>
635 <?php
$datetimepicker_formatInput = false; ?
>
636 <?php
require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?
>
637 <?php
// can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
643 @media only screen
and (max
-width
: 768px
) {
646 text
-align
: left
!Important
;
650 @media only screen
and (max
-width
: 1004px
) and (min
-width
: 641px
) {
656 display
: inline
-block
;
665 .modal
-body
, .modal
-body
* {
679 $arrOeUiSettings = array(
680 'heading_title' => xl('EOB Posting - Search'),
681 'include_patient_name' => false,
682 'expandable' => true,
683 'expandable_files' => array('sl_eob_search_xpd'),//all file names need suffix _xpd
685 'action_title' => "",
686 'action_href' => "sl_eob_search.php",//only for actions - reset, link or back
687 'show_help_icon' => true,
688 'help_file_name' => "sl_eob_help.php"
690 $oemr_ui = new OemrUI($arrOeUiSettings);
696 <div id
="container_div" class="<?php echo $oemr_ui->oeContainer();?>">
698 <div
class="col-sm-12">
699 <div
class="page-header">
700 <?php
echo $oemr_ui->pageHeading() . "\r\n"; ?
>
705 <div
class="col-sm-12">
706 <form id
="formSearch" action
="" enctype
='multipart/form-data' method
='post'>
707 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(collectCsrfToken()); ?>"/>
708 <fieldset id
="payment-allocate" class="oe-show-hide">
710  
;<?php
echo xlt('Post Item'); ?
><i id
="payment-info-do-not-remove"> </i
>
712 <div
class="col-xs-12 oe-custom-line">
713 <div
class="col-xs-3">
714 <label
class="control-label" for="form_payer_id"> <?php
echo xlt('Payer'); ?
>:</label
>
716 $insurancei = getInsuranceProviders();
717 echo " <select name='form_payer_id'id='form_payer_id' class='form-control'>\n";
718 echo " <option value='0'>-- " . xlt('Patient') . " --</option>\n";
719 foreach ($insurancei as $iid => $iname) {
720 echo "<option value='" . attr($iid) . "'";
721 if ($iid == $_REQUEST['form_payer_id']) {
724 echo ">" . text($iname) . "</option>\n";
729 <div
class="col-xs-2">
730 <label
class="control-label" for="form_source"><?php
echo xlt('Source'); ?
>:</label
>
731 <input type
='text' name
='form_source' id
='form_source' class='form-control'
732 value
='<?php echo attr($_REQUEST['form_source
']); ?>'
733 title
='<?php echo xla("A check number or claim number to identify the payment"); ?>'>
735 <div
class="col-xs-2">
736 <label
class="control-label" for="form_paydate"><?php
echo xlt('Pay Date'); ?
>:</label
>
737 <input type
='text' name
='form_paydate' id
='form_paydate' class='form-control datepicker'
738 value
='<?php echo attr($_REQUEST['form_paydate
']); ?>'
739 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)'
740 title
='<?php echo xla("Date of payment yyyy-mm-dd"); ?>'>
742 <div
class="col-xs-2">
743 <label
class="control-label oe-large"
744 for="form_deposit_date"><?php
echo xlt('Deposit Date'); ?
>:</label
>
745 <label
class="control-label oe-small" for="form_deposit_date"><?php
echo xlt('Dep Date'); ?
>
747 <input type
='text' name
='form_deposit_date' id
='form_deposit_date'
748 class='form-control datepicker'
749 value
='<?php echo attr($_REQUEST['form_deposit_date
']); ?>'
750 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)'
751 title
='<?php echo xla("Date of bank deposit yyyy-mm-dd"); ?>'>
753 <div
class="col-xs-2">
754 <label
class="control-label" for="form_amount"><?php
echo xlt('Amount'); ?
>:</label
>
755 <input type
='text' name
='form_amount' id
='form_amount' class='form-control'
756 value
='<?php echo attr($_REQUEST['form_amount
']); ?>'
757 title
='<?php echo xla("Paid amount that you will allocate"); ?>'>
759 <div
class="col-xs-1">
760 <label
class="control-label oe-large" for="only_with_debt"><?php
echo xlt('Pt Debt'); ?
>:</label
>
762 <label
class="control-label oe-small" for="only_with_debt"><?php
echo xlt('Debt'); ?
>:</label
>
764 <div
class="text-center">
765 <input
<?php
echo $_REQUEST['only_with_debt'] ?
'checked=checked' : ''; ?
>
766 type
="checkbox" name
="only_with_debt" id
="only_with_debt"/>
771 <fieldset id
="search-upload">
773  
;<span
><?php
echo xlt('Select Method'); ?
></span
> 
;<i id
='select-method-tooltip'
774 class="fa fa-info-circle oe-superscript"
775 aria
-hidden
="true"></i
>
776 <div id
="radio-div" class="pull-right oe-legend-radio">
777 <label
class="radio-inline">
778 <input type
="radio" id
="invoice_search" name
="radio-search" onclick
=""
779 value
="inv-search"><?php
echo xlt('Invoice Search'); ?
>
781 <label
class="radio-inline">
782 <input type
="radio" id
="era_upload" name
="radio-search" onclick
=""
783 value
="era-upld"><?php
echo xlt('ERA Upload'); ?
>
787 <input type
="hidden" id
="hid1" value
="<?php echo xla('Invoice Search'); ?>">
788 <input type
="hidden" id
="hid2" value
="<?php echo xla('ERA Upload'); ?>">
789 <input type
="hidden" id
="hid3" value
="<?php echo xla('Select Method'); ?>">
791 <div
class="col-xs-12 .oe-custom-line oe-show-hide" id
='inv-search'>
792 <div
class="col-xs-3">
793 <label
class="control-label" for="form_name"><?php
echo xlt('Name'); ?
>:</label
>
794 <input type
='text' name
='form_name' id
='form_name' class='form-control'
795 value
='<?php echo attr($_REQUEST['form_name
']); ?>'
796 title
='<?php echo xla("Any part of the patient name, or \"last,first\", or \"X-Y\""); ?>'
797 placeholder
='<?php echo xla('Last name
, First name
'); ?>'>
799 <div
class="col-xs-2">
800 <label
class="control-label" for="form_pid"><?php
echo xlt('Chart ID'); ?
>:</label
>
801 <input type
='text' name
='form_pid' id
='form_pid' class='form-control'
802 value
='<?php echo attr($_REQUEST['form_pid
']); ?>'
803 title
='<?php echo xla("Patient chart ID"); ?>'>
805 <div
class="col-xs-2">
806 <label
class="control-label" for="form_encounter"><?php
echo xlt('Encounter'); ?
>:</label
>
807 <input type
='text' name
='form_encounter' id
='form_encounter' class='form-control'
808 value
='<?php echo attr($_REQUEST['form_encounter
']); ?>'
809 title
='<?php echo xla("Encounter number"); ?>'>
811 <div
class="col-xs-2">
812 <label
class="control-label oe-large"
813 for="form_date"><?php
echo xlt('Service Date From'); ?
>:</label
>
814 <label
class="control-label oe-small" for="form_date"><?php
echo xlt('Svc Date'); ?
>
816 <input type
='text' name
='form_date' id
='form_date' class='form-control datepicker'
817 value
='<?php echo attr($_REQUEST['form_date
']); ?>'
818 title
='<?php echo xla("Date of service mm/dd/yyyy"); ?>'>
820 <div
class="col-xs-2">
821 <label
class="control-label" for="form_to_date"><?php
echo xlt('Service Date To'); ?
>
823 <input type
='text' name
='form_to_date' id
='form_to_date' class='form-control datepicker'
824 value
='<?php echo attr($_REQUEST['form_to_date
']); ?>'
825 title
='<?php echo xla("Ending DOS mm/dd/yyyy if you wish to enter a range"); ?>'>
827 <div
class="col-xs-1" style
="padding-right:0px">
828 <label
class="control-label" for="type_name"><?php
echo xlt('Type'); ?
>:</label
>
829 <select name
='form_category' id
='form_category' class='form-control'>
831 foreach (array(xl('Open'), xl('All'), xl('Due Pt'), xl('Due Ins')) as $value) {
832 echo " <option value='" . attr($value) . "'";
833 if ($_REQUEST['form_category'] == $value) {
836 echo ">" . text($value) . "</option>\n";
842 <div
class="col-xs-12 .oe-custom-line oe-show-hide" id
='era-upld'>
843 <div
class="form-group col-xs9 oe-file-div">
844 <div
class="input-group">
845 <label
class="input-group-btn">
846 <span
class="btn btn-default">Browse
&hellip
;<input type
="file" id
="uploadedfile" name
="form_erafile" style
="display: none;">
847 <input name
="MAX_FILE_SIZE" type
="hidden" value
="5000000">
850 <input type
="text" class="form-control"
851 placeholder
="<?php echo xla('Click Browse and select one Electronic Remittance Advice (ERA) file...'); ?>"
857 <?php
//can change position of buttons by creating a class 'position-override' and adding rule text-alig:center or right as the case may be in individual stylesheets ?>
858 <div
class="form-group clearfix">
859 <div
class="col-sm-12 position-override oe-show-hide" id
="search-btn">
860 <div
class="btn-group" role
="group">
861 <button type
='submit' class="btn btn-default btn-search oe-show-hide" name
='form_search'
863 value
='<?php echo xla("Search"); ?>'><?php
echo xlt("Search"); ?
></button
>
864 <button type
='submit' class="btn btn-default btn-save oe-show-hide" name
='form_search'
866 value
='<?php echo xla("Upload"); ?>'><?php
echo xlt("Upload"); ?
></button
>
870 <fieldset id
="search-results" class="oe-show-hide">
871 <legend
><span
><?php
echo xlt('Search Results'); ?
></span
>
872 <div
class="pull-right oe-legend-radio">
873 <label
class="checkbox-inline">
874 <input type
="checkbox" id
="posting_adj_disable" name
="posting_adj_disable"
875 onchange
='persistCriteria(this, event)'
876 title
="<?php echo xlt("Disable automatically calculating balance adjustments
for invoice posting
") ?>"
877 value
="<?php echo attr($posting_adj_disable); ?>"
878 <?php
echo ' ' . attr($posting_adj_disable); ?
> /><?php
echo xlt('Disable Auto Adjustments'); ?
>
882 <div
class="table-responsive">
884 if ($_REQUEST['form_search'] ||
$_REQUEST['form_print']) {
885 if (!verifyCsrfToken($_REQUEST["csrf_token_form"])) {
889 $form_name = trim($_REQUEST['form_name']);
890 $form_pid = trim($_REQUEST['form_pid']);
891 $form_encounter = trim($_REQUEST['form_encounter']);
892 $form_date = fixDate($_REQUEST['form_date'], "");
893 $form_to_date = fixDate($_REQUEST['form_to_date'], "");
897 // Handle X12 835 file upload.
899 if ($_FILES['form_erafile']['size']) {
900 $tmp_name = $_FILES['form_erafile']['tmp_name'];
902 // Handle .zip extension if present. Probably won't work on Windows.
903 if (strtolower(substr($_FILES['form_erafile']['name'], -4)) == '.zip') {
904 rename($tmp_name, "$tmp_name.zip");
905 exec("unzip -p " . escapeshellarg($tmp_name . ".zip") . " > " . escapeshellarg($tmp_name));
906 unlink("$tmp_name.zip");
909 echo "<!-- Notes from ERA upload processing:\n";
910 $alertmsg .= ParseERA
::parse_era($tmp_name, 'era_callback');
912 $erafullname = $GLOBALS['OE_SITE_DIR'] . "/era/$eraname.edi";
914 if (is_file($erafullname)) {
915 $alertmsg .= "Warning: Set $eraname was already uploaded ";
916 if (is_file($GLOBALS['OE_SITE_DIR'] . "/era/$eraname.html")) {
917 $alertmsg .= "and processed. ";
919 $alertmsg .= "but not yet processed. ";
922 rename($tmp_name, $erafullname);
926 // Note that ParseERA::parse_era() modified $eracount and $where.
935 // Allow the last name to be followed by a comma and some part of a first name.
936 if (preg_match('/^(.*\S)\s*,\s*(.*)/', $form_name, $matches)) {
937 $where .= "p.lname LIKE '" . add_escape_custom($matches[1]) . "%' AND p.fname LIKE '" . add_escape_custom($matches[2]) . "%'";
938 // Allow a filter like "A-C" on the first character of the last name.
939 } elseif (preg_match('/^(\S)\s*-\s*(\S)$/', $form_name, $matches)) {
941 while (ord($matches[1]) <= ord($matches[2])) {
942 $tmp .= " OR p.lname LIKE '" . add_escape_custom($matches[1]) . "%'";
943 $matches[1] = chr(ord($matches[1]) +
1);
945 $where .= "( $tmp ) ";
947 $where .= "p.lname LIKE '%" . add_escape_custom($form_name) . "%'";
954 $where .= "f.pid = '" . add_escape_custom($form_pid) . "'";
956 if ($form_encounter) {
960 $where .= "f.encounter = '" . add_escape_custom($form_encounter) . "'";
967 $where .= "f.date >= '" . add_escape_custom($form_date) . "' AND f.date <= '" . add_escape_custom($form_to_date) . "'";
969 $where .= "f.date = '" . add_escape_custom($form_date) . "'";
973 if ($_REQUEST['form_category'] == 'All') {
974 $alertmsg .= xlt("At least one search parameter is required if you select All.");
981 // Notes that as of release 4.1.1 the copays are stored
982 // in the ar_activity table marked with a PCP in the account_code column.
983 $query = "SELECT f.id, f.pid, f.encounter, f.date, " .
984 "f.last_level_billed, f.last_level_closed, f.last_stmt_date, f.stmt_count, " .
985 "p.fname, p.mname, p.lname, p.pubpid, p.billing_note, " .
986 "( SELECT SUM(b.fee) FROM billing AS b WHERE " .
987 "b.pid = f.pid AND b.encounter = f.encounter AND " .
988 "b.activity = 1 AND b.code_type != 'COPAY' ) AS charges, " .
989 "( SELECT SUM(a.pay_amount) FROM ar_activity AS a WHERE " .
990 "a.pid = f.pid AND a.encounter = f.encounter AND a.payer_type = 0 AND a.account_code = 'PCP')*-1 AS copays, " .
991 "( SELECT SUM(a.pay_amount) FROM ar_activity AS a WHERE " .
992 "a.pid = f.pid AND a.encounter = f.encounter AND a.account_code != 'PCP') AS payments, " .
993 "( SELECT SUM(a.adj_amount) FROM ar_activity AS a WHERE " .
994 "a.pid = f.pid AND a.encounter = f.encounter ) AS adjustments " .
995 "FROM form_encounter AS f " .
996 "JOIN patient_data AS p ON p.pid = f.pid " .
998 "ORDER BY p.lname, p.fname, p.mname, f.pid, f.encounter";
1000 // Note that unlike the SQL-Ledger case, this query does not weed
1001 // out encounters that are paid up. Also the use of sub-selects
1002 // will require MySQL 4.1 or greater.
1004 // echo "<!-- $query -->\n"; // debugging
1007 $t_res = sqlStatement($query);
1008 $num_invoices = sqlNumRows($t_res);
1011 if ($eracount && $num_invoices != $eracount) {
1012 $alertmsg .= "Of $eracount remittances, there are $num_invoices " .
1013 "matching encounters in OpenEMR. ";
1016 <table
class="table table-striped table-condensed">
1019 <th
class="id dehead"><?php
echo xlt('id'); ?
></th
>
1020 <th
class="dehead"> 
;<?php
echo xlt('Patient'); ?
></th
>
1021 <th
class="dehead"> 
;<?php
echo xlt('Invoice'); ?
></th
>
1022 <th
class="dehead"> 
;<?php
echo xlt('Svc Date'); ?
></th
>
1023 <th
class="dehead"> 
;<?php
echo xlt('Last Stmt'); ?
></th
>
1024 <th align
="right" class="dehead"><?php
echo xlt('Charge'); ?
> 
;</th
>
1025 <th align
="right" class="dehead"><?php
echo xlt('Adjust'); ?
> 
;</th
>
1026 <th align
="right" class="dehead"><?php
echo xlt('Paid'); ?
> 
;</th
>
1027 <th align
="right" class="dehead"><?php
echo xlt('Balance'); ?
> 
;</th
>
1028 <th align
="center" class="dehead"><?php
echo xlt('Prv'); ?
></th
>
1030 if (!$eracount) { ?
>
1031 <th align
="left" class="dehead"><?php
echo xlt('Sel'); ?
></th
>
1032 <th align
="center" class="dehead"><?php
echo xlt('Email'); ?
></th
>
1040 while ($row = sqlFetchArray($t_res)) {
1041 $balance = sprintf("%.2f", $row['charges'] +
$row['copays'] - $row['payments'] - $row['adjustments']);
1042 //new filter only patients with debt.
1043 if ($_REQUEST['only_with_debt'] && $balance <= 0) {
1048 if ($_REQUEST['form_category'] != 'All' && $eracount == 0 && $balance == 0) {
1052 // $duncount was originally supposed to be the number of times that
1053 // the patient was sent a statement for this invoice.
1055 $duncount = $row['stmt_count'];
1057 // But if we have not yet billed the patient, then compute $duncount as a
1058 // negative count of the number of insurance plans for which we have not
1059 // yet closed out insurance.
1062 for ($i = 1; $i <= 3 && SLEOB
::arGetPayerID($row['pid'], $row['date'], $i);
1065 $duncount = $row['last_level_closed'] +
1 - $i;
1068 $isdueany = ($balance > 0);
1070 // An invoice is now due from the patient if money is owed and we are
1071 // not waiting for insurance to pay.
1073 $isduept = ($duncount >= 0 && $isdueany) ?
" checked" : "";
1075 // Skip invoices not in the desired "Due..." category.
1077 if (substr($_REQUEST['form_category'], 0, 3) == 'Due' && !$isdueany) {
1080 if ($_REQUEST['form_category'] == 'Due Ins' && ($duncount >= 0 ||
!$isdueany)) {
1083 if ($_REQUEST['form_category'] == 'Due Pt' && ($duncount < 0 ||
!$isdueany)) {
1087 $bgcolor = ((++
$orow & 1) ?
"#ffdddd" : "#ddddff");
1089 $svcdate = substr($row['date'], 0, 10);
1090 $last_stmt_date = empty($row['last_stmt_date']) ?
'' : $row['last_stmt_date'];
1092 // Determine if customer is in collections.
1094 $billnote = $row['billing_note'];
1095 $in_collections = stristr($billnote, 'IN COLLECTIONS') !== false;
1100 onclick
="return npopup(<?php echo attr(addslashes($row['pid'])) ?>)"><?php
echo text($row['pid']); ?
></a
>
1102 <td
class="detail"> 
;
1104 onclick
="return npopup(<?php echo attr(addslashes($row['pid'])) ?>)"><?php
echo text($row['lname']) . ', ' . text($row['fname']); ?
></a
>
1106 <td
class="detail"> 
;
1107 <a href
="sl_eob_invoice.php?isPosting=1&id=<?php echo attr_url($row['id']); ?>"
1108 target
="_blank"><?php
echo text($row['pid']) . '.' . text($row['encounter']); ?
></a
>
1110 <td
class="detail"> 
;<?php
echo text(oeFormatShortDate($svcdate)); ?
></td
>
1112  
;<?php
echo text(oeFormatShortDate($last_stmt_date)); ?
></td
>
1113 <td align
="right" class="detail"><?php
echo text(bucks($row['charges'])); ?
> 
;
1115 <td align
="right" class="detail"><?php
echo text(bucks($row['adjustments'])); ?
>
1119 class="detail"><?php
echo text(bucks($row['payments'] - $row['copays'])); ?
>
1122 <td align
="right" class="detail"><?php
echo text(bucks($balance)); ?
> 
;</td
>
1124 class="detail"><?php
echo $duncount ?
text($duncount) : " " ?
></td
>
1125 <?php
if (!$eracount) { ?
>
1126 <td
class="detail" align
="left">
1127 <input type
='checkbox'
1128 name
='form_cb[<?php echo attr($row['id
']) ?>]'<?php
echo text($isduept); ?
> />
1130 if ($in_collections) {
1131 echo "<b><font color='red'>IC</font></b>";
1134 if (function_exists('is_auth_portal') ?
is_auth_portal($row['pid']) : false) {
1136 echo("<input type='hidden' name='form_invpids[" . attr($row['id']) . "][" . attr($row['pid']) . "]' />");
1141 <td align
="left" class="detail">
1143 $patientData = sqlQuery("SELECT * FROM `patient_data` WHERE `pid`=?", array($row['pid']));
1144 if ($patientData['hipaa_allowemail'] == "YES" && $patientData['allow_patient_portal'] == "YES" && $patientData['hipaa_notice'] == "YES" && validEmail($patientData['email'])) {
1154 } // end search/print logic
1157 </div
><!--End of table
-responsive div
-->
1159 <?php
//can change position of buttons by creating a class 'position-override' and adding rule text-alig:center or right as the case may be in individual stylesheets ?>
1160 <div
class="form-group clearfix">
1161 <div
class="col-sm-12 text-left position-override oe-show-hide" id
="statement-download">
1162 <div
class="btn-group" role
="group">
1165 <button type
="button" class="btn btn-default btn-save" name
="Submit"
1166 onclick
='processERA()' value
="<?php echo xla('Process ERA File'); ?>">
1167 <?php
echo xlt('Process ERA File'); ?
></button
>
1170 <button type
="button" class="btn btn-default btn-save" name
="Submit1"
1171 onclick
='checkAll(true)'><?php
echo xlt('Select All'); ?
></button
>
1172 <button type
="button" class="btn btn-default btn-undo" name
="Submit2"
1173 onclick
='checkAll(false)'><?php
echo xlt('Clear All'); ?
></button
>
1174 <?php
if ($GLOBALS['statement_appearance'] != '1') { ?
>
1175 <button type
="submit" class="btn btn-default btn-print" name
='form_print'
1176 value
="<?php echo xla('Print Selected Statements'); ?>">
1177 <?php
echo xlt('Print Selected Statements'); ?
></button
>
1178 <button type
="submit" class="btn btn-default btn-download" name
='form_download'
1179 value
="<?php echo xla('Download Selected Statements'); ?>">
1180 <?php
echo xlt('Download Selected Statements'); ?
></button
>
1182 <button type
="submit" class="btn btn-default btn-download" name
='form_pdf'
1183 value
="<?php echo xla('PDF Download Selected Statements'); ?>">
1184 <?php
echo xlt('PDF Download Selected Statements'); ?
></button
>
1185 <button type
="submit" class="btn btn-default btn-mail" name
='form_download'
1186 value
="<?php echo xla('Email Selected Statements'); ?>">
1187 <?php
echo xlt('Email Selected Statements'); ?
></button
>
1189 if ($is_portal) { ?
>
1190 <button type
="submit" class="btn btn-default btn-save" name
='form_portalnotify'
1191 value
="<?php echo xla('Notify via Patient Portal'); ?>">
1192 <?php
echo xlt('Notify via Patient Portal'); ?
></button
>
1197 <input type
='checkbox' class="btn-separate-left" name
='form_without'
1198 value
='1'/><?php
echo xlt('Without Update'); ?
>
1205 </div
> <!--End of Container div
-->
1206 <?php
$oemr_ui->oeBelowContainerDiv();?
>
1208 <script language
="JavaScript">
1209 function processERA() {
1210 var f
= document
.forms
[0];
1211 var debug
= f
.form_without
.checked ?
'1' : '0';
1212 var paydate
= f
.form_paydate
.value
;
1213 window
.open('sl_eob_process.php?eraname=' +
<?php
echo js_url($eraname); ?
> +
'&debug=' +
encodeURIComponent(debug
) +
'&paydate=' +
encodeURIComponent(paydate
) +
'&original=original' +
'&csrf_token_form=' +
<?php
echo js_url(collectCsrfToken()); ?
>, '_blank');
1218 //https://www.abeautifulsite.net/whipping-file-inputs-into-shape-with-bootstrap-3
1219 // We can attach the `fileselect` event to all file inputs on the page
1220 $
(document
).on('change', ':file', function () {
1221 var input
= $
(this
),
1222 numFiles
= input
.get(0).files ? input
.get(0).files
.length
: 1,
1223 label
= input
.val().replace(/\\/g
, '/').replace(/.*\
//, '');
1224 input
.trigger('fileselect', [numFiles
, label
]);
1227 // We can watch for our custom `fileselect` event like this
1228 $
(document
).ready(function () {
1229 $
(':file').on('fileselect', function (event
, numFiles
, label
) {
1230 var input
= $
(this
).parents('.input-group').find(':text'),
1231 log
= numFiles
> 1 ? numFiles +
' files selected' : label
;
1237 if (log
) alert(log
);
1243 //to dynamically show /hide relevant divs and change Fieldset legends
1244 $
(document
).ready(function () {
1245 $
("input[name=radio-search]").on("change", function () {
1247 let flip
= $
(this
).val();
1248 $
(".oe-show-hide").hide();
1249 $
("#" + flip
).show();
1250 if (flip
== 'inv-search') {
1251 $
("#search-upload").insertAfter("#payment-allocate");
1252 $
('#payment-allocate').show();
1253 $
('#search-btn').show();
1254 $
('#btn-inv-search').show();
1255 var legend_text
= $
('#hid1').val();
1256 $
('#search-upload').find('legend').find('span').text(legend_text
);
1257 $
('#search-upload').find('#form_name').focus();
1258 $
('#select-method-tooltip').hide();
1260 else if (flip
== 'era-upld') {
1261 $
('#payment-allocate').hide();
1262 $
('#search-btn').show();
1263 $
('#btn-era-upld').show();
1264 var legend_text
= $
('#hid2').val();
1265 $
('#search-upload').find('legend').find('span').text(legend_text
);
1266 $
('#select-method-tooltip').hide();
1269 $
('#payment-allocate').hide();
1270 $
('#search-btn').hide();
1271 var legend_text
= $
('#hid3').val();
1272 $
('#search-upload').find('legend').find('span').text(legend_text
);
1273 $
('#select-method-tooltip').show();
1279 echo "alert('" . addslashes($alertmsg) . "');\n";
1283 $
(document
).ready(function () {
1284 //using jquery-ui-1-12-1 tooltip instead of bootstrap tooltip
1285 $
('#select-method-tooltip').attr("title", "<?php echo xla('Click on either the Invoice Search button on the far right, for manual entry or ERA Upload button for uploading an entire electronic remittance advice ERA file'); ?>").tooltip();
1289 $tr_str = xl('Search');
1290 if ($_REQUEST['form_search'] == "$tr_str") { ?
>
1292 $
("#payment-allocate").insertAfter("#search-upload");
1293 $
('#payment-allocate').show();
1294 $
("#search-results").show();
1295 $
("#statement-download").show();
1301 $tr_str = xl('Upload');
1302 if ($_REQUEST['form_search'] == "$tr_str") { ?
>
1304 $
('#era-upld').show();
1305 $
('#search-results').show();
1306 $
("#statement-download").show();