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/parse_era.inc.php");
29 require_once("$srcdir/sl_eob.inc.php");
30 require_once("$srcdir/api.inc");
31 require_once("$srcdir/forms.inc");
32 require_once("$srcdir/../controllers/C_Document.class.php");
33 require_once("$srcdir/documents.php");
34 require_once("$srcdir/options.inc.php");
35 require_once("$srcdir/acl.inc");
36 require_once "$srcdir/user.inc";
38 use OpenEMR\Core\Header
;
40 $DEBUG = 0; // set to 0 for production, 1 to test
42 $posting_adj_disable = prevSetting('sl_eob_search.', 'posting_adj_disable', 'posting_adj_disable', '');
48 /* Load dependencies only if we need them */
49 if (!empty($GLOBALS['portal_onsite_two_enable'])) {
50 /* Addition of onsite portal patient notify of invoice and reformated invoice - sjpadgett 01/2017 */
51 require_once("../../portal/lib/portal_mail.inc");
52 require_once("../../portal/lib/appsql.class.php");
54 function is_auth_portal($pid = 0)
56 if ($pData = sqlQuery("SELECT * FROM `patient_data` WHERE `pid` = ?", array($pid))) {
57 if ($pData['allow_patient_portal'] != "YES") {
60 $_SESSION['portalUser'] = strtolower($pData['fname']) . $pData['id'];
68 function notify_portal($thispid, array $invoices, $template, $invid)
70 $builddir = $GLOBALS['OE_SITE_DIR'] . '/documents/onsite_portal_documents/templates/' . $thispid;
71 if (!is_dir($builddir)) {
72 mkdir($builddir, 0755, true);
75 if (fixup_invoice($template, $builddir . '/invoice' . $invid . '.tpl') != true) {
79 if (SavePatientAudit($thispid, $invoices) != true) {
81 } // this is all the invoice data for portal auditing
82 $note = xl('You have an invoice due for payment in your Patient Documents. There you may pay, download or print the invoice. Thank you.');
83 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
84 sendMail($_SESSION['portalUser'], $note, xlt('Bill/Collect'), '', '0', $_SESSION['authUser'], $_SESSION['authUser'], $_SESSION['portalUser'], $invoices[0]['patient'], "New", '0'); // notify patient
92 function fixup_invoice($template, $ifile)
94 $data = file_get_contents($template);
99 if (!file_put_contents($ifile, $data)) {
106 function SavePatientAudit($pid, $invs)
108 $appsql = new ApplicationTable();
111 $audit['patient_id'] = $pid;
112 $audit['activity'] = "invoice";
113 $audit['require_audit'] = "0";
114 $audit['pending_action'] = "payment";
115 $audit['action_taken'] = "";
116 $audit['status'] = "waiting transaction";
117 $audit['narrative'] = "Request patient online payment.";
118 $audit['table_action'] = '';
119 $audit['table_args'] = json_encode($invs);
120 $audit['action_user'] = $pid;
121 $audit['action_taken_time'] = "";
122 $audit['checksum'] = "";
123 $edata = $appsql->getPortalAudit($pid, 'payment', 'invoice', "waiting transaction", 0);
124 if ($edata['id'] > 0) {
125 $appsql->portalAudit('update', $edata['id'], $audit);
127 $appsql->portalAudit('insert', '', $audit);
129 } catch (Exception
$ex) {
137 // This is called back by parse_era() if we are processing X12 835's.
138 function era_callback(&$out)
140 global $where, $eracount, $eraname;
141 // print_r($out); // debugging
143 // $eraname = $out['isa_control_number'];
144 $eraname = $out['gs_date'] . '_' . ltrim($out['isa_control_number'], '0') .
145 '_' . ltrim($out['payer_id'], '0');
146 list($pid, $encounter, $invnumber) = slInvoiceNumber($out);
148 if ($pid && $encounter) {
153 $where .= "( f.pid = '" . add_escape_custom($pid) . "' AND f.encounter = '" . add_escape_custom($encounter) . "' )";
157 function bucks($amount)
160 return oeFormatMoney($amount);
164 function validEmail($email)
166 if (preg_match("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$^", $email)) {
173 function emailLogin($patient_id, $message)
175 $patientData = sqlQuery("SELECT * FROM `patient_data` WHERE `pid`=?", array($patient_id));
176 if ($patientData['hipaa_allowemail'] != "YES" ||
empty($patientData['email']) ||
empty($GLOBALS['patient_reminder_sender_email'])) {
180 if (!(validEmail($patientData['email']))) {
184 if (!(validEmail($GLOBALS['patient_reminder_sender_email']))) {
188 if ($_SESSION['pc_facility']) {
189 $sql = "select * from facility where id=?";
190 $facility = sqlQuery($sql, array($_SESSION['pc_facility']));
192 $sql = "SELECT * FROM facility ORDER BY billing_location DESC LIMIT 1";
193 $facility = sqlQuery($sql);
196 $mail = new MyMailer();
197 $pt_name = $patientData['fname'] . ' ' . $patientData['lname'];
198 $pt_email = $patientData['email'];
199 $email_subject = ($facility['name'] . ' ' . xl('Patient Statement Bill'));
200 $email_sender = $GLOBALS['patient_reminder_sender_email'];
201 $mail->AddReplyTo($email_sender, $email_sender);
202 $mail->SetFrom($email_sender, $email_sender);
203 $mail->AddAddress($pt_email, $pt_name);
204 $mail->Subject
= $email_subject;
205 $mail->MsgHTML("<html><body><div class='wrapper'>" . $message . "</div></body></html>");
207 $mail->AltBody
= $message;
212 $email_status = $mail->ErrorInfo
;
213 error_log("EMAIL ERROR: " . $email_status, 0);
218 // Upload a file to the client's browser
220 function upload_file_to_client($file_to_send)
222 header("Pragma: public");
223 header("Expires: 0");
224 header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
225 header("Content-Type: application/force-download");
226 header("Content-Length: " . filesize($file_to_send));
227 header("Content-Disposition: attachment; filename=" . basename($file_to_send));
228 header("Content-Description: File Transfer");
229 readfile($file_to_send);
230 // flush the content to the browser. If you don't do this, the text from the subsequent
231 // output from this script will be in the file instead of sent to the browser.
233 exit(); //added to exit from process properly in order to stop bad html code -ehrlive
234 // sleep one second to ensure there's no follow-on.
238 function upload_file_to_client_email($ppid, $file_to_send)
241 global $STMT_TEMP_FILE_PDF;
242 $file = fopen($file_to_send, "r");//this file contains the text to be converted to pdf.
243 while (!feof($file)) {
244 $OneLine = fgets($file);//one line is read
246 $message = $message . $OneLine . '<br>';
251 emailLogin($ppid, $message);
254 function upload_file_to_client_pdf($file_to_send, $aPatFirstName = '', $aPatID = null, $flagCFN = false)
256 //modified for statement title name
257 //Function reads a HTML file and converts to pdf.
259 $aPatFName = convert_safe_file_dir_name($aPatFirstName); //modified for statement title name
261 $STMT_TEMP_FILE_PDF = $GLOBALS['temporary_files_dir'] . "/Stmt_{$aPatFName}_{$aPatID}.pdf";
263 global $STMT_TEMP_FILE_PDF;
268 if ($GLOBALS['statement_appearance'] == '1') {
269 require_once("$srcdir/html2pdf/vendor/autoload.php");
270 $pdf2 = new HTML2PDF(
271 $GLOBALS['pdf_layout'],
272 $GLOBALS['pdf_size'],
273 $GLOBALS['pdf_language'],
274 true, // default unicode setting is true
275 'UTF-8', // default encoding setting is UTF-8
276 array($GLOBALS['pdf_left_margin'], $GLOBALS['pdf_top_margin'], $GLOBALS['pdf_right_margin'], $GLOBALS['pdf_bottom_margin']),
277 $_SESSION['language_direction'] == 'rtl' ?
true : false
280 readfile($file_to_send, "r");//this file contains the HTML to be converted to pdf.
282 $content = ob_get_clean();
284 // Fix a nasty html2pdf bug - it ignores document root!
285 global $web_root, $webserver_root;
287 $wrlen = strlen($web_root);
288 $wsrlen = strlen($webserver_root);
290 $i = stripos($content, " src='/", $i +
1);
295 if (substr($content, $i +
6, $wrlen) === $web_root &&
296 substr($content, $i +
6, $wsrlen) !== $webserver_root) {
297 $content = substr($content, 0, $i +
6) . $webserver_root . substr($content, $i +
6 +
$wrlen);
301 $pdf2->WriteHTML($content);
302 $temp_filename = $STMT_TEMP_FILE_PDF;
303 $content_pdf = $pdf2->Output($STMT_TEMP_FILE_PDF, 'F');
305 $pdf = new Cezpdf('LETTER');//pdf creation starts
306 $pdf->ezSetMargins(45, 9, 36, 10);
307 $pdf->selectFont('Courier');
308 $pdf->ezSetY($pdf->ez
['pageHeight'] - $pdf->ez
['topMargin']);
310 $file = fopen($file_to_send, "r");//this file contains the text to be converted to pdf.
311 while (!feof($file)) {
312 $OneLine = fgets($file);//one line is read
313 if (stristr($OneLine, "\014") == true && !feof($file)) {//form feed means we should start a new page.
315 $pdf->ezSetY($pdf->ez
['pageHeight'] - $pdf->ez
['topMargin']);
316 str_replace("\014", "", $OneLine);
319 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.
320 $pdf->ezText('<b>' . $OneLine . '</b>', 12, array('justification' => 'left', 'leading' => 6));
322 $pdf->ezText($OneLine, 12, array('justification' => 'left', 'leading' => 6));
328 $fh = @fopen
($STMT_TEMP_FILE_PDF, 'w');//stored to a pdf file
330 fwrite($fh, $pdf->ezOutput());
335 header("Pragma: public");//this section outputs the pdf file to browser
336 header("Expires: 0");
337 header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
338 header("Content-Type: application/force-download");
339 header("Content-Length: " . filesize($STMT_TEMP_FILE_PDF));
340 header("Content-Disposition: attachment; filename=" . basename($STMT_TEMP_FILE_PDF));
341 header("Content-Description: File Transfer");
342 readfile($STMT_TEMP_FILE_PDF);
343 // flush the content to the browser. If you don't do this, the text from the subsequent
344 // output from this script will be in the file instead of sent to the browser.
346 exit(); //added to exit from process properly in order to stop bad html code -ehrlive
347 // sleep one second to ensure there's no follow-on.
352 $today = date("Y-m-d");
353 // Print or download statements if requested.
355 if (($_REQUEST['form_print'] ||
$_REQUEST['form_download'] ||
$_REQUEST['form_email'] ||
$_REQUEST['form_pdf']) ||
$_REQUEST['form_portalnotify'] && $_REQUEST['form_cb']) {
356 if (!verifyCsrfToken($_REQUEST["csrf_token_form"])) {
360 $fhprint = fopen($STMT_TEMP_FILE, 'w');
362 $sqlBindArray = array();
364 foreach ($_REQUEST['form_cb'] as $key => $value) {
365 $where .= " OR f.id = ?";
366 array_push($sqlBindArray, $key);
369 if (!empty($where)) {
370 $where = substr($where, 4);
371 $where = '( ' . $where . ' ) AND';
374 $res = sqlStatement("SELECT " .
375 "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, " .
376 "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 " .
377 "FROM form_encounter AS f, patient_data AS p " .
380 "ORDER BY p.lname, p.fname, f.pid, f.date, f.encounter", $sqlBindArray);
386 $aPatientFirstName = '';
388 $multiplePatients = false;
389 $usePatientNamePdf = false;
391 // get pids for delimits
392 // need to only use summary invoice for multi visits
395 if ($_REQUEST['form_portalnotify']) {
396 foreach ($_REQUEST['form_invpids'] as $key => $v) {
397 if ($_REQUEST['form_cb'][$key]) {
398 array_push($inv_pid, key($v));
403 while ($row = sqlFetchArray($res)) {
405 if (!$inv_pid[$rcnt]) {
406 array_push($inv_pid, $row['pid']);
410 // This loops once for each invoice/encounter.
413 while ($row = $rows[$rcnt++
]) {
414 $svcdate = substr($row['date'], 0, 10);
415 $duedate = $svcdate; // TBD?
416 $duncount = $row['stmt_count'];
417 $enc_note = $row['enc_billing_note'];
421 $aPatientFirstName = $row['fname'];
422 $aPatientID = $row['pid'];
423 $usePatientNamePdf = true;
424 } elseif (!$multiplePatients) {
425 if ($aPatientID != $row['pid']) {
426 $multiplePatients = true;
427 $aPatientFirstName = '';
429 $usePatientNamePdf = false;
433 // If this is a new patient then print the pending statement
434 // and start a new one. This is an associative array:
437 // pid = OpenEMR patient ID
438 // patient = patient name
439 // amount = total amount due
440 // adjust = adjustments (already applied to amount)
441 // duedate = due date of the oldest included invoice
442 // age = number of days from duedate to today
443 // to = array of addressee name/address lines
445 // dos = date of service "yyyy-mm-dd"
446 // desc = description
447 // amount = charge less adjustments
448 // paid = amount paid
449 // notice = 1 for first notice, 2 for second, etc.
450 // detail = array of details, see invoice_summary.inc.php
452 if ($stmt['cid'] != $row['pid']) {
456 $stmt['fid'] = $row['id'];
457 $stmt['cid'] = $row['pid'];
458 $stmt['pid'] = $row['pid'];
459 $stmt['dun_count'] = $row['stmt_count'];
460 $stmt['bill_note'] = $row['pat_billing_note'];
461 $stmt['enc_bill_note'] = $row['enc_billing_note'];
462 $stmt['bill_level'] = $row['last_level_billed'];
463 $stmt['level_closed'] = $row['last_level_closed'];
464 $stmt['patient'] = $row['fname'] . ' ' . $row['lname'];
465 $stmt['encounter'] = $row['encounter'];
466 $stmt['provider_id'] = $row['provider_id'];
467 #If you use the field in demographics layout called
468 #guardiansname this will allow you to send statements to the parent
469 #of a child or a guardian etc
470 if (strlen($row['guardiansname']) == 0) {
471 $stmt['to'] = array($row['fname'] . ' ' . $row['lname']);
473 $stmt['to'] = array($row['guardiansname']);
476 if ($row['street']) {
477 $stmt['to'][] = $row['street'];
480 $stmt['to'][] = $row['city'] . ", " . $row['state'] . " " . $row['postal_code'];
481 $stmt['lines'] = array();
482 $stmt['amount'] = '0.00';
483 $stmt['ins_paid'] = 0;
484 $stmt['today'] = $today;
485 $stmt['duedate'] = $duedate;
487 // Report the oldest due date.
488 if ($duedate < $stmt['duedate']) {
489 $stmt['duedate'] = $duedate;
493 // Recompute age at each invoice.
494 $stmt['age'] = round((strtotime($today) - strtotime($stmt['duedate'])) / (24 * 60 * 60));
496 $invlines = ar_get_invoice_summary($row['pid'], $row['encounter'], true);
497 foreach ($invlines as $key => $value) {
499 $line['dos'] = $svcdate;
500 if ($GLOBALS['use_custom_statement']) {
501 $line['desc'] = ($key == 'CO-PAY') ?
"Patient Payment" : $value['code_text'];
503 $line['desc'] = ($key == 'CO-PAY') ?
"Patient Payment" : "Procedure $key";
506 $line['amount'] = sprintf("%.2f", $value['chg']);
507 $line['adjust'] = sprintf("%.2f", $value['adj']);
508 $line['paid'] = sprintf("%.2f", $value['chg'] - $value['bal']);
509 $line['notice'] = $duncount +
1;
510 $line['detail'] = $value['dtl'];
511 $stmt['lines'][] = $line;
512 $stmt['amount'] = sprintf("%.2f", $stmt['amount'] +
$value['bal']);
513 $stmt['ins_paid'] = $stmt['ins_paid'] +
$value['ins'];
516 // Record that this statement was run.
517 if (!$DEBUG && !$_REQUEST['form_without']) {
518 sqlStatement("UPDATE form_encounter SET " .
519 "last_stmt_date = ?, stmt_count = stmt_count + 1 " .
520 "WHERE id = ?", array($today, $row['id']));
523 if ($_REQUEST['form_portalnotify']) {
524 if (!is_auth_portal($stmt['pid'])) {
525 $alertmsg = xlt('Notification FAILED: Not Portal Authorized');
529 // we don't want to send the portal multiple invoices, thus this. Last invoice for pid is summary.
530 if ($inv_pid[$inv_count] != $inv_pid[$inv_count +
1]) {
531 fwrite($fhprint, make_statement($stmt));
532 if (!notify_portal($stmt['pid'], $pvoice, $STMT_TEMP_FILE, $stmt['pid'] . "-" . $stmt['encounter'])) {
533 $alertmsg = xlt('Notification FAILED');
539 ftruncate($fhprint, 0);
544 if ($inv_pid[$inv_count] != $inv_pid[$inv_count +
1]) {
545 $tmp = make_statement($stmt);
547 $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";
548 $tmp .= "<br />\n\014<br /><br />";
550 fwrite($fhprint, $tmp);
561 // Download or print the file, as selected
562 if ($_REQUEST['form_download']) {
563 upload_file_to_client($STMT_TEMP_FILE);
564 } elseif ($_REQUEST['form_pdf']) {
565 upload_file_to_client_pdf($STMT_TEMP_FILE, $aPatientFirstName, $aPatientID, $usePatientNamePdf);
566 } elseif ($_REQUEST['form_email']) {
567 upload_file_to_client_email($stmt['pid'], $STMT_TEMP_FILE);
568 } elseif ($_REQUEST['form_portalnotify']) {
569 if ($alertmsg == "") {
570 $alertmsg = xl('Sending Invoice to Patient Portal Completed');
572 } else { // Must be print!
574 $alertmsg = xl("Printing skipped; see test output in") . ' ' . $STMT_TEMP_FILE;
576 exec(escapeshellcmd($STMT_PRINT_CMD) . " " . escapeshellarg($STMT_TEMP_FILE));
577 if ($_REQUEST['form_without']) {
578 $alertmsg = xl('Now printing') . ' ' . $stmt_count . ' ' . xl('statements; invoices will not be updated.');
580 $alertmsg = xl('Now printing') . ' ' . $stmt_count . ' ' . xl('statements and updating invoices.');
583 } // end not form_download
584 } // end statements requested
588 <?php Header
::setupHeader(['datetime-picker']); ?
>
589 <title
><?php
echo xlt('EOB Posting - Search'); ?
></title
>
590 <script language
="JavaScript">
593 function checkAll(checked
) {
594 var f
= document
.forms
[0];
595 for (var i
= 0; i
< f
.elements
.length
; ++i
) {
596 var ename
= f
.elements
[i
].name
;
597 if (ename
.indexOf('form_cb[') == 0)
598 f
.elements
[i
].checked
= checked
;
602 function persistCriteria(el
, e
) {
604 let target
= "sl_eob_search.posting_adj_disable";
605 let val
= el
.checked ?
'checked' : '';
606 $
.post("./../../library/ajax/user_settings.php",
610 csrf_token_form
: "<?php echo attr(collectCsrfToken()); ?>"
615 function npopup(pid
) {
616 window
.open('sl_eob_patient_note.php?patient_id=' + pid
, '_blank', 'width=500,height=250,resizable=1');
620 function toEncSummary(pid
) {
622 top
.restoreSession();
623 let encurl
= 'patient_file/history/encounters.php?billing=1&issue=0&pagesize=20&pagestart=0';
624 let paturl
= "patient_file/summary/demographics.php?set_pid=" + pid
;
625 parent
.left_nav
.loadFrame('pat2', 'pat', paturl
);
626 // need a little time so can force a billing view
627 setTimeout(function(){parent
.left_nav
.loadFrame('enc2', 'enc', encurl
);}, 3000);
630 $
(document
).ready(function () {
631 $
('.datepicker').datetimepicker({
632 <?php
$datetimepicker_timepicker = false; ?
>
633 <?php
$datetimepicker_showseconds = false; ?
>
634 <?php
$datetimepicker_formatInput = false; ?
>
635 <?php
require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?
>
636 <?php
// can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
642 @media only screen
and (max
-width
: 768px
) {
645 text
-align
: left
!Important
;
649 @media only screen
and (max
-width
: 1004px
) and (min
-width
: 641px
) {
655 display
: inline
-block
;
664 .modal
-body
, .modal
-body
* {
678 if ($GLOBALS['enable_help'] == 1) {
679 $help_icon = '<a class="pull-right oe-help-redirect" data-target="#myModal" data-toggle="modal" href="#" id="help-href" name="help-href" style="color:#676666" title="' . xla("Click to view Help") . '"><i class="fa fa-question-circle" aria-hidden="true"></i></a>';
680 } elseif ($GLOBALS['enable_help'] == 2) {
681 $help_icon = '<a class="pull-right oe-help-redirect" data-target="#myModal" data-toggle="modal" href="#" id="help-href" name="help-href" style="color:#DCD6D0 !Important" title="' . xla("Enable help in Administration > Globals > Features > Enable Help Modal") . '"><i class="fa fa-question-circle" aria-hidden="true"></i></a>';
682 } elseif ($GLOBALS['enable_help'] == 0) {
687 //to determine and set the form to open in the desired state - expanded or centered, any selection the user makes will
688 //become the user-specific default for that page. collectAndOrganizeExpandSetting() contains a single array as an
689 //argument, containing one or more elements, the name of the current file is the first element, if there are linked
690 // files they should be listed thereafter, please add _xpd suffix to the file name
691 $arr_files_php = array("sl_eob_search_xpd");
692 $current_state = collectAndOrganizeExpandSetting($arr_files_php);
693 require_once("$srcdir/expand_contract_inc.php");
699 <div
class="<?php echo $container; ?> expandable">
701 <div
class="col-sm-12">
702 <div
class="page-header">
703 <h2
class="clearfix"><span id
='header_text'><?php
echo xlt('EOB Posting - Search'); ?
></span
> <i
705 class="fa <?php echo attr($expand_icon_class); ?> oe-superscript-small expand_contract"
706 title
="<?php echo attr($expand_title); ?>" aria
-hidden
="true"></i
> <a href
='sl_eob_search.php'
707 onclick
='top.restoreSession()'
708 title
="<?php echo xla('Reset'); ?>">
709 <i id
='advanced-tooltip' class='fa fa-undo fa-2x small' aria
-hidden
='true'></i
>
710 </a
><?php
echo $help_icon; ?
>
716 <div
class="col-sm-12">
717 <form id
="formSearch" action
="" enctype
='multipart/form-data' method
='post'>
718 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(collectCsrfToken()); ?>"/>
719 <fieldset id
="payment-allocate" class="oe-show-hide">
721  
;<?php
echo xlt('Post Item'); ?
><i id
="payment-info-do-not-remove"> </i
>
723 <div
class="col-xs-12 oe-custom-line">
724 <div
class="col-xs-3">
725 <label
class="control-label" for="form_payer_id"> <?php
echo xlt('Payer'); ?
>:</label
>
727 $insurancei = getInsuranceProviders();
728 echo " <select name='form_payer_id'id='form_payer_id' class='form-control'>\n";
729 echo " <option value='0'>-- " . xlt('Patient') . " --</option>\n";
730 foreach ($insurancei as $iid => $iname) {
731 echo "<option value='" . attr($iid) . "'";
732 if ($iid == $_REQUEST['form_payer_id']) {
735 echo ">" . text($iname) . "</option>\n";
740 <div
class="col-xs-2">
741 <label
class="control-label" for="form_source"><?php
echo xlt('Source'); ?
>:</label
>
742 <input type
='text' name
='form_source' id
='form_source' class='form-control'
743 value
='<?php echo attr($_REQUEST['form_source
']); ?>'
744 title
='<?php echo xla("A check number or claim number to identify the payment"); ?>'>
746 <div
class="col-xs-2">
747 <label
class="control-label" for="form_paydate"><?php
echo xlt('Pay Date'); ?
>:</label
>
748 <input type
='text' name
='form_paydate' id
='form_paydate' class='form-control datepicker'
749 value
='<?php echo attr($_REQUEST['form_paydate
']); ?>'
750 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)'
751 title
='<?php echo xla("Date of payment yyyy-mm-dd"); ?>'>
753 <div
class="col-xs-2">
754 <label
class="control-label oe-large"
755 for="form_deposit_date"><?php
echo xlt('Deposit Date'); ?
>:</label
>
756 <label
class="control-label oe-small" for="form_deposit_date"><?php
echo xlt('Dep Date'); ?
>
758 <input type
='text' name
='form_deposit_date' id
='form_deposit_date'
759 class='form-control datepicker'
760 value
='<?php echo attr($_REQUEST['form_deposit_date
']); ?>'
761 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)'
762 title
='<?php echo xla("Date of bank deposit yyyy-mm-dd"); ?>'>
764 <div
class="col-xs-2">
765 <label
class="control-label" for="form_amount"><?php
echo xlt('Amount'); ?
>:</label
>
766 <input type
='text' name
='form_amount' id
='form_amount' class='form-control'
767 value
='<?php echo attr($_REQUEST['form_amount
']); ?>'
768 title
='<?php echo xla("Paid amount that you will allocate"); ?>'>
770 <div
class="col-xs-1">
771 <label
class="control-label oe-large" for="only_with_debt"><?php
echo xlt('Pt Debt'); ?
>
773 <label
class="control-label oe-small" for="only_with_debt"><?php
echo xlt('Debt'); ?
>
775 <div
class="text-center">
776 <input
<?php
echo $_REQUEST['only_with_debt'] ?
'checked=checked' : ''; ?
>
777 type
="checkbox" name
="only_with_debt" id
="only_with_debt"/>
782 <fieldset id
="search-upload">
784  
;<span
><?php
echo xlt('Select Method'); ?
></span
> 
;<i id
='select-method-tooltip'
785 class="fa fa-info-circle oe-superscript"
786 aria
-hidden
="true"></i
>
787 <div id
="radio-div" class="pull-right oe-legend-radio">
788 <label
class="radio-inline">
789 <input type
="radio" id
="invoice_search" name
="radio-search" onclick
=""
790 value
="inv-search"><?php
echo xlt('Invoice Search'); ?
>
792 <label
class="radio-inline">
793 <input type
="radio" id
="era_upload" name
="radio-search" onclick
=""
794 value
="era-upld"><?php
echo xlt('ERA Upload'); ?
>
798 <input type
="hidden" id
="hid1" value
="<?php echo xla('Invoice Search'); ?>">
799 <input type
="hidden" id
="hid2" value
="<?php echo xla('ERA Upload'); ?>">
800 <input type
="hidden" id
="hid3" value
="<?php echo xla('Select Method'); ?>">
802 <div
class="col-xs-12 .oe-custom-line oe-show-hide" id
='inv-search'>
803 <div
class="col-xs-3">
804 <label
class="control-label" for="form_name"><?php
echo xlt('Name'); ?
>:</label
>
805 <input type
='text' name
='form_name' id
='form_name' class='form-control'
806 value
='<?php echo attr($_REQUEST['form_name
']); ?>'
807 title
='<?php echo xla("Any part of the patient name, or \"last,first\", or \"X-Y\""); ?>'
808 placeholder
='<?php echo xla('Last name
, First name
'); ?>'>
810 <div
class="col-xs-2">
811 <label
class="control-label" for="form_pid"><?php
echo xlt('Chart ID'); ?
>:</label
>
812 <input type
='text' name
='form_pid' id
='form_pid' class='form-control'
813 value
='<?php echo attr($_REQUEST['form_pid
']); ?>'
814 title
='<?php echo xla("Patient chart ID"); ?>'>
816 <div
class="col-xs-2">
817 <label
class="control-label" for="form_encounter"><?php
echo xlt('Encounter'); ?
>:</label
>
818 <input type
='text' name
='form_encounter' id
='form_encounter' class='form-control'
819 value
='<?php echo attr($_REQUEST['form_encounter
']); ?>'
820 title
='<?php echo xla("Encounter number"); ?>'>
822 <div
class="col-xs-2">
823 <label
class="control-label oe-large"
824 for="form_date"><?php
echo xlt('Service Date From'); ?
>:</label
>
825 <label
class="control-label oe-small" for="form_date"><?php
echo xlt('Svc Date'); ?
>
827 <input type
='text' name
='form_date' id
='form_date' class='form-control datepicker'
828 value
='<?php echo attr($_REQUEST['form_date
']); ?>'
829 title
='<?php echo xla("Date of service mm/dd/yyyy"); ?>'>
831 <div
class="col-xs-2">
832 <label
class="control-label" for="form_to_date"><?php
echo xlt('Service Date To'); ?
>
834 <input type
='text' name
='form_to_date' id
='form_to_date' class='form-control datepicker'
835 value
='<?php echo attr($_REQUEST['form_to_date
']); ?>'
836 title
='<?php echo xla("Ending DOS mm/dd/yyyy if you wish to enter a range"); ?>'>
838 <div
class="col-xs-1" style
="padding-right:0px">
839 <label
class="control-label" for="type_name"><?php
echo xlt('Type'); ?
>:</label
>
840 <select name
='form_category' id
='form_category' class='form-control'>
842 foreach (array(xl('Open'), xl('All'), xl('Due Pt'), xl('Due Ins')) as $value) {
843 echo " <option value='" . attr($value) . "'";
844 if ($_REQUEST['form_category'] == $value) {
847 echo ">" . text($value) . "</option>\n";
853 <div
class="col-xs-12 .oe-custom-line oe-show-hide" id
='era-upld'>
854 <div
class="form-group col-xs9 oe-file-div">
855 <div
class="input-group">
856 <label
class="input-group-btn">
857 <span
class="btn btn-default">Browse
&hellip
;<input type
="file" id
="uploadedfile" name
="form_erafile" style
="display: none;">
858 <input name
="MAX_FILE_SIZE" type
="hidden" value
="5000000">
861 <input type
="text" class="form-control"
862 placeholder
="<?php echo xla('Click Browse and select one Electronic Remittance Advice (ERA) file...'); ?>"
868 <?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 ?>
869 <div
class="form-group clearfix">
870 <div
class="col-sm-12 position-override oe-show-hide" id
="search-btn">
871 <div
class="btn-group" role
="group">
872 <button type
='submit' class="btn btn-default btn-search oe-show-hide" name
='form_search'
874 value
='<?php echo xla("Search"); ?>'><?php
echo xlt("Search"); ?
></button
>
875 <button type
='submit' class="btn btn-default btn-save oe-show-hide" name
='form_search'
877 value
='<?php echo xla("Upload"); ?>'><?php
echo xlt("Upload"); ?
></button
>
881 <fieldset id
="search-results" class="oe-show-hide">
882 <legend
><span
><?php
echo xlt('Search Results'); ?
></span
>
883 <div
class="pull-right oe-legend-radio">
884 <label
class="checkbox-inline">
885 <input type
="checkbox" id
="posting_adj_disable" name
="posting_adj_disable"
886 onchange
='persistCriteria(this, event)'
887 title
="<?php echo xlt("Disable automatically calculating balance adjustments
for invoice posting
") ?>"
888 value
="<?php echo attr($posting_adj_disable); ?>"
889 <?php
echo ' ' . attr($posting_adj_disable); ?
> /><?php
echo xlt('Disable Auto Adjustments'); ?
>
893 <div
class="table-responsive">
895 if ($_REQUEST['form_search'] ||
$_REQUEST['form_print']) {
896 if (!verifyCsrfToken($_REQUEST["csrf_token_form"])) {
900 $form_name = trim($_REQUEST['form_name']);
901 $form_pid = trim($_REQUEST['form_pid']);
902 $form_encounter = trim($_REQUEST['form_encounter']);
903 $form_date = fixDate($_REQUEST['form_date'], "");
904 $form_to_date = fixDate($_REQUEST['form_to_date'], "");
908 // Handle X12 835 file upload.
910 if ($_FILES['form_erafile']['size']) {
911 $tmp_name = $_FILES['form_erafile']['tmp_name'];
913 // Handle .zip extension if present. Probably won't work on Windows.
914 if (strtolower(substr($_FILES['form_erafile']['name'], -4)) == '.zip') {
915 rename($tmp_name, "$tmp_name.zip");
916 exec("unzip -p " . escapeshellarg($tmp_name . ".zip") . " > " . escapeshellarg($tmp_name));
917 unlink("$tmp_name.zip");
920 echo "<!-- Notes from ERA upload processing:\n";
921 $alertmsg .= parse_era($tmp_name, 'era_callback');
923 $erafullname = $GLOBALS['OE_SITE_DIR'] . "/era/$eraname.edi";
925 if (is_file($erafullname)) {
926 $alertmsg .= "Warning: Set $eraname was already uploaded ";
927 if (is_file($GLOBALS['OE_SITE_DIR'] . "/era/$eraname.html")) {
928 $alertmsg .= "and processed. ";
930 $alertmsg .= "but not yet processed. ";
933 rename($tmp_name, $erafullname);
937 // Note that parse_era() modified $eracount and $where.
946 // Allow the last name to be followed by a comma and some part of a first name.
947 if (preg_match('/^(.*\S)\s*,\s*(.*)/', $form_name, $matches)) {
948 $where .= "p.lname LIKE '" . add_escape_custom($matches[1]) . "%' AND p.fname LIKE '" . add_escape_custom($matches[2]) . "%'";
949 // Allow a filter like "A-C" on the first character of the last name.
950 } elseif (preg_match('/^(\S)\s*-\s*(\S)$/', $form_name, $matches)) {
952 while (ord($matches[1]) <= ord($matches[2])) {
953 $tmp .= " OR p.lname LIKE '" . add_escape_custom($matches[1]) . "%'";
954 $matches[1] = chr(ord($matches[1]) +
1);
956 $where .= "( $tmp ) ";
958 $where .= "p.lname LIKE '%" . add_escape_custom($form_name) . "%'";
965 $where .= "f.pid = '" . add_escape_custom($form_pid) . "'";
967 if ($form_encounter) {
971 $where .= "f.encounter = '" . add_escape_custom($form_encounter) . "'";
978 $where .= "f.date >= '" . add_escape_custom($form_date) . "' AND f.date <= '" . add_escape_custom($form_to_date) . "'";
980 $where .= "f.date = '" . add_escape_custom($form_date) . "'";
984 if ($_REQUEST['form_category'] == 'All') {
985 $alertmsg .= xlt("At least one search parameter is required if you select All.");
992 // Notes that as of release 4.1.1 the copays are stored
993 // in the ar_activity table marked with a PCP in the account_code column.
994 $query = "SELECT f.id, f.pid, f.encounter, f.date, " .
995 "f.last_level_billed, f.last_level_closed, f.last_stmt_date, f.stmt_count, " .
996 "p.fname, p.mname, p.lname, p.pubpid, p.billing_note, " .
997 "( SELECT SUM(b.fee) FROM billing AS b WHERE " .
998 "b.pid = f.pid AND b.encounter = f.encounter AND " .
999 "b.activity = 1 AND b.code_type != 'COPAY' ) AS charges, " .
1000 "( SELECT SUM(a.pay_amount) FROM ar_activity AS a WHERE " .
1001 "a.pid = f.pid AND a.encounter = f.encounter AND a.payer_type = 0 AND a.account_code = 'PCP')*-1 AS copays, " .
1002 "( SELECT SUM(a.pay_amount) FROM ar_activity AS a WHERE " .
1003 "a.pid = f.pid AND a.encounter = f.encounter AND a.account_code != 'PCP') AS payments, " .
1004 "( SELECT SUM(a.adj_amount) FROM ar_activity AS a WHERE " .
1005 "a.pid = f.pid AND a.encounter = f.encounter ) AS adjustments " .
1006 "FROM form_encounter AS f " .
1007 "JOIN patient_data AS p ON p.pid = f.pid " .
1009 "ORDER BY p.lname, p.fname, p.mname, f.pid, f.encounter";
1011 // Note that unlike the SQL-Ledger case, this query does not weed
1012 // out encounters that are paid up. Also the use of sub-selects
1013 // will require MySQL 4.1 or greater.
1015 // echo "<!-- $query -->\n"; // debugging
1018 $t_res = sqlStatement($query);
1019 $num_invoices = sqlNumRows($t_res);
1022 if ($eracount && $num_invoices != $eracount) {
1023 $alertmsg .= "Of $eracount remittances, there are $num_invoices " .
1024 "matching encounters in OpenEMR. ";
1027 <table
class="table table-striped table-condensed">
1030 <th
class="id dehead"><?php
echo xlt('id'); ?
></th
>
1031 <th
class="dehead"> 
;<?php
echo xlt('Patient'); ?
></th
>
1032 <th
class="dehead"> 
;<?php
echo xlt('Invoice'); ?
></th
>
1033 <th
class="dehead"> 
;<?php
echo xlt('Svc Date'); ?
></th
>
1034 <th
class="dehead"> 
;<?php
echo xlt('Last Stmt'); ?
></th
>
1035 <th align
="right" class="dehead"><?php
echo xlt('Charge'); ?
> 
;</th
>
1036 <th align
="right" class="dehead"><?php
echo xlt('Adjust'); ?
> 
;</th
>
1037 <th align
="right" class="dehead"><?php
echo xlt('Paid'); ?
> 
;</th
>
1038 <th align
="right" class="dehead"><?php
echo xlt('Balance'); ?
> 
;</th
>
1039 <th align
="center" class="dehead"><?php
echo xlt('Prv'); ?
></th
>
1041 if (!$eracount) { ?
>
1042 <th align
="left" class="dehead"><?php
echo xlt('Sel'); ?
></th
>
1043 <th align
="center" class="dehead"><?php
echo xlt('Email'); ?
></th
>
1051 while ($row = sqlFetchArray($t_res)) {
1052 $balance = sprintf("%.2f", $row['charges'] +
$row['copays'] - $row['payments'] - $row['adjustments']);
1053 //new filter only patients with debt.
1054 if ($_REQUEST['only_with_debt'] && $balance <= 0) {
1059 if ($_REQUEST['form_category'] != 'All' && $eracount == 0 && $balance == 0) {
1063 // $duncount was originally supposed to be the number of times that
1064 // the patient was sent a statement for this invoice.
1066 $duncount = $row['stmt_count'];
1068 // But if we have not yet billed the patient, then compute $duncount as a
1069 // negative count of the number of insurance plans for which we have not
1070 // yet closed out insurance.
1073 for ($i = 1; $i <= 3 && arGetPayerID($row['pid'], $row['date'], $i);
1076 $duncount = $row['last_level_closed'] +
1 - $i;
1079 $isdueany = ($balance > 0);
1081 // An invoice is now due from the patient if money is owed and we are
1082 // not waiting for insurance to pay.
1084 $isduept = ($duncount >= 0 && $isdueany) ?
" checked" : "";
1086 // Skip invoices not in the desired "Due..." category.
1088 if (substr($_REQUEST['form_category'], 0, 3) == 'Due' && !$isdueany) {
1091 if ($_REQUEST['form_category'] == 'Due Ins' && ($duncount >= 0 ||
!$isdueany)) {
1094 if ($_REQUEST['form_category'] == 'Due Pt' && ($duncount < 0 ||
!$isdueany)) {
1098 $bgcolor = ((++
$orow & 1) ?
"#ffdddd" : "#ddddff");
1100 $svcdate = substr($row['date'], 0, 10);
1101 $last_stmt_date = empty($row['last_stmt_date']) ?
'' : $row['last_stmt_date'];
1103 // Determine if customer is in collections.
1105 $billnote = $row['billing_note'];
1106 $in_collections = stristr($billnote, 'IN COLLECTIONS') !== false;
1111 onclick
="return npopup(<?php echo attr(addslashes($row['pid'])) ?>)"><?php
echo text($row['pid']); ?
></a
>
1113 <td
class="detail"> 
;
1115 onclick
="return npopup(<?php echo attr(addslashes($row['pid'])) ?>)"><?php
echo text($row['lname']) . ', ' . text($row['fname']); ?
></a
>
1117 <td
class="detail"> 
;
1118 <a href
="sl_eob_invoice.php?isPosting=1&id=<?php echo attr(urlencode($row['id'])); ?>"
1119 target
="_blank"><?php
echo text($row['pid']) . '.' . text($row['encounter']); ?
></a
>
1121 <td
class="detail"> 
;<?php
echo text(oeFormatShortDate($svcdate)); ?
></td
>
1123  
;<?php
echo text(oeFormatShortDate($last_stmt_date)); ?
></td
>
1124 <td align
="right" class="detail"><?php
echo text(bucks($row['charges'])); ?
> 
;
1126 <td align
="right" class="detail"><?php
echo text(bucks($row['adjustments'])); ?
>
1130 class="detail"><?php
echo text(bucks($row['payments'] - $row['copays'])); ?
>
1133 <td align
="right" class="detail"><?php
echo text(bucks($balance)); ?
> 
;</td
>
1135 class="detail"><?php
echo $duncount ?
text($duncount) : " " ?
></td
>
1136 <?php
if (!$eracount) { ?
>
1137 <td
class="detail" align
="left">
1138 <input type
='checkbox'
1139 name
='form_cb[<?php echo attr($row['id
']) ?>]'<?php
echo text($isduept); ?
> />
1141 if ($in_collections) {
1142 echo "<b><font color='red'>IC</font></b>";
1145 if (function_exists('is_auth_portal') ?
is_auth_portal($row['pid']) : false) {
1147 echo("<input type='hidden' name='form_invpids[" . attr($row['id']) . "][" . attr($row['pid']) . "]' />");
1152 <td align
="left" class="detail">
1154 $patientData = sqlQuery("SELECT * FROM `patient_data` WHERE `pid`=?", array($row['pid']));
1155 if ($patientData['hipaa_allowemail'] == "YES" && $patientData['allow_patient_portal'] == "YES" && $patientData['hipaa_notice'] == "YES" && validEmail($patientData['email'])) {
1165 } // end search/print logic
1168 </div
><!--End of table
-responsive div
-->
1170 <?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 ?>
1171 <div
class="form-group clearfix">
1172 <div
class="col-sm-12 text-left position-override oe-show-hide" id
="statement-download">
1173 <div
class="btn-group" role
="group">
1176 <button type
="button" class="btn btn-default btn-save" name
="Submit"
1177 onclick
='processERA()' value
="<?php echo xla('Process ERA File'); ?>">
1178 <?php
echo xlt('Process ERA File'); ?
></button
>
1181 <button type
="button" class="btn btn-default btn-save" name
="Submit1"
1182 onclick
='checkAll(true)'><?php
echo xlt('Select All'); ?
></button
>
1183 <button type
="button" class="btn btn-default btn-undo" name
="Submit2"
1184 onclick
='checkAll(false)'><?php
echo xlt('Clear All'); ?
></button
>
1185 <?php
if ($GLOBALS['statement_appearance'] != '1') { ?
>
1186 <button type
="submit" class="btn btn-default btn-print" name
='form_print'
1187 value
="<?php echo xla('Print Selected Statements'); ?>">
1188 <?php
echo xlt('Print Selected Statements'); ?
></button
>
1189 <button type
="submit" class="btn btn-default btn-download" name
='form_download'
1190 value
="<?php echo xla('Download Selected Statements'); ?>">
1191 <?php
echo xlt('Download Selected Statements'); ?
></button
>
1193 <button type
="submit" class="btn btn-default btn-download" name
='form_pdf'
1194 value
="<?php echo xla('PDF Download Selected Statements'); ?>">
1195 <?php
echo xlt('PDF Download Selected Statements'); ?
></button
>
1196 <button type
="submit" class="btn btn-default btn-mail" name
='form_download'
1197 value
="<?php echo xla('Email Selected Statements'); ?>">
1198 <?php
echo xlt('Email Selected Statements'); ?
></button
>
1200 if ($is_portal) { ?
>
1201 <button type
="submit" class="btn btn-default btn-save" name
='form_portalnotify'
1202 value
="<?php echo xla('Notify via Patient Portal'); ?>">
1203 <?php
echo xlt('Notify via Patient Portal'); ?
></button
>
1208 <input type
='checkbox' class="btn-separate-left" name
='form_without'
1209 value
='1'/><?php
echo xlt('Without Update'); ?
>
1216 </div
> <!--End of Container div
-->
1219 //home of the help modal ;)
1220 //$GLOBALS['enable_help'] = 0; // Please comment out line if you want help modal to function on this page
1221 if ($GLOBALS['enable_help'] == 1) {
1222 echo "<script>var helpFile = 'sl_eob_help.php'</script>";
1223 //help_modal.php lives in interface, set path accordingly
1224 require_once "../help_modal.php";
1227 <script language
="JavaScript">
1228 function processERA() {
1229 var f
= document
.forms
[0];
1230 var debug
= f
.form_without
.checked ?
'1' : '0';
1231 var paydate
= f
.form_paydate
.value
;
1232 window
.open('sl_eob_process.php?eraname=<?php echo attr(urlencode($eraname)); ?>&debug=' + debug +
'&paydate=' + paydate +
'&original=original' +
'&csrf_token_form=<?php echo attr(urlencode(collectCsrfToken())); ?>', '_blank');
1237 //https://www.abeautifulsite.net/whipping-file-inputs-into-shape-with-bootstrap-3
1238 // We can attach the `fileselect` event to all file inputs on the page
1239 $
(document
).on('change', ':file', function () {
1240 var input
= $
(this
),
1241 numFiles
= input
.get(0).files ? input
.get(0).files
.length
: 1,
1242 label
= input
.val().replace(/\\/g
, '/').replace(/.*\
//, '');
1243 input
.trigger('fileselect', [numFiles
, label
]);
1246 // We can watch for our custom `fileselect` event like this
1247 $
(document
).ready(function () {
1248 $
(':file').on('fileselect', function (event
, numFiles
, label
) {
1249 var input
= $
(this
).parents('.input-group').find(':text'),
1250 log
= numFiles
> 1 ? numFiles +
' files selected' : label
;
1256 if (log
) alert(log
);
1262 //to dynamically show /hide relevant divs and change Fieldset legends
1263 $
(document
).ready(function () {
1264 $
("input[name=radio-search]").on("change", function () {
1266 let flip
= $
(this
).val();
1267 $
(".oe-show-hide").hide();
1268 $
("#" + flip
).show();
1269 if (flip
== 'inv-search') {
1270 $
("#search-upload").insertAfter("#payment-allocate");
1271 $
('#payment-allocate').show();
1272 $
('#search-btn').show();
1273 $
('#btn-inv-search').show();
1274 var legend_text
= $
('#hid1').val();
1275 $
('#search-upload').find('legend').find('span').text(legend_text
);
1276 $
('#search-upload').find('#form_name').focus();
1277 $
('#select-method-tooltip').hide();
1279 else if (flip
== 'era-upld') {
1280 $
('#payment-allocate').hide();
1281 $
('#search-btn').show();
1282 $
('#btn-era-upld').show();
1283 var legend_text
= $
('#hid2').val();
1284 $
('#search-upload').find('legend').find('span').text(legend_text
);
1285 $
('#select-method-tooltip').hide();
1288 $
('#payment-allocate').hide();
1289 $
('#search-btn').hide();
1290 var legend_text
= $
('#hid3').val();
1291 $
('#search-upload').find('legend').find('span').text(legend_text
);
1292 $
('#select-method-tooltip').show();
1298 echo "alert('" . addslashes($alertmsg) . "');\n";
1302 $
(document
).ready(function () {
1303 //using jquery-ui-1-12-1 tooltip instead of bootstrap tooltip
1304 $
('#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();
1308 $tr_str = xl('Search');
1309 if ($_REQUEST['form_search'] == "$tr_str") { ?
>
1311 $
("#payment-allocate").insertAfter("#search-upload");
1312 $
('#payment-allocate').show();
1313 $
("#search-results").show();
1314 $
("#statement-download").show();
1320 $tr_str = xl('Upload');
1321 if ($_REQUEST['form_search'] == "$tr_str") { ?
>
1323 $
('#era-upld').show();
1324 $
('#search-results').show();
1325 $
("#statement-download").show();
1332 // jQuery script to change expanded/centered state dynamically
1333 require_once("../expand_contract_js.php")