3 * Billing Report Program
6 * @link http://www.open-emr.org
7 * @author Terry Hill <terry@lilysystems.com>
8 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @author Jerry Padgett <sjpadgett@gmail.com>
10 * @copyright Copyright (c) 2016 Terry Hill <terry@lillysystems.com>
11 * @copyright Copyright (c) 2017 Brady Miller <brady.g.miller@gmail.com>
12 * @copyright Copyright (c) 2018 Jerry Padgett <sjpadgett@gmail.com>
13 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
16 require_once "../globals.php";
17 require_once "../../library/acl.inc";
18 require_once "../../custom/code_types.inc.php";
19 require_once "$srcdir/patient.inc";
20 require_once "$srcdir/../interface/reports/report.inc.php"; // Criteria Section common php page
21 require_once "$srcdir/billrep.inc";
22 require_once "$srcdir/options.inc.php";
23 require_once "adjustment_reason_codes.php";
25 use OpenEMR\Core\Header
;
27 $EXPORT_INC = "$webserver_root/custom/BillingExport.php";
28 // echo $GLOBALS['daysheet_provider_totals'];
31 $daysheet_total = false;
32 $provider_run = false;
34 if ($GLOBALS['use_custom_daysheet'] != 0) {
36 if ($GLOBALS['daysheet_provider_totals'] == 1) {
37 $daysheet_total = true;
38 $provider_run = false;
40 if ($GLOBALS['daysheet_provider_totals'] == 0) {
41 $daysheet_total = false;
48 if (isset($_POST['mode'])) {
49 if (!verifyCsrfToken($_POST["csrf_token_form"])) {
53 if ($_POST['mode'] == 'export') {
54 $sql = ReturnOFXSql();
56 $results = $db->Execute($sql);
58 if ($results->RecordCount() == 0) {
59 echo "<fieldset id='error_info' style='border:1px solid #ff5d5a !Important; background-color: #ff5d5a !Important; color: #fff ! Important; font-weight: bold; font-family:sans-serif; border-radius:5px; padding:20px 5px !Important;'>";
60 echo xlt("No Bills Found to Include in OFX Export") . "<br>";
63 while (!$results->EOF
) {
64 $billings[] = $results->fields
;
67 $ofx = new OFX($billings);
68 header("Pragma: public");
70 header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
71 header("Content-Disposition: attachment; filename=openemr_ofx.ofx");
72 header("Content-Type: text/xml");
80 $from_date = isset($_POST['from_date']) ?
$_POST['from_date'] : date('Y-m-d');
81 $to_date = isset($_POST['to_date']) ?
$_POST['to_date'] : '';
82 $code_type = isset($_POST['code_type']) ?
$_POST['code_type'] : 'all';
83 $unbilled = isset($_POST['unbilled']) ?
$_POST['unbilled'] : 'on';
84 $my_authorized = isset($_POST["authorized"]) ?
$_POST["authorized"] : '';
86 // This tells us if only encounters that appear to be missing a "25" modifier
87 // are to be reported.
88 $missing_mods_only = (isset($_POST['missing_mods_only']) && !empty($_POST['missing_mods_only']));
90 $left_margin = isset($_POST["left_margin"]) ?
$_POST["left_margin"] : $GLOBALS['cms_left_margin_default'];
91 $top_margin = isset($_POST["top_margin"]) ?
$_POST["top_margin"] : $GLOBALS['cms_top_margin_default'];
93 $left_ubmargin = isset($_POST["left_ubmargin"]) ?
$_POST["left_ubmargin"] : $GLOBALS['left_ubmargin_default'];
94 $top_ubmargin = isset($_POST["top_ubmargin"]) ?
$_POST["top_ubmargin"] : $GLOBALS['top_ubmargin_default'];
96 $ofrom_date = $from_date;
98 $ocode_type = $code_type;
99 $ounbilled = $unbilled;
100 $oauthorized = $my_authorized;
106 <?php Header
::setupHeader(['datetime-picker', 'common']); ?
>
108 /*.subbtn { margin-top:3px; margin-bottom:3px; margin-left:2px; margin-right:2px }*/
109 .btn
-group
-pinch
> .btn
:nth
-last
-child(4):not(.dropdown
-toggle
) {
110 border
-top
-right
-radius
: 3px
!Important
;
111 border
-bottom
-right
-radius
: 3px
!Important
;
115 function select_all() {
116 for ($i = 0; $i < document
.update_form
.length
; $i++
) {
117 $name = document
.update_form
[$i].name
;
118 if ($name.substring(0, 7) == "claims[" && $name.substring($name.length
-
120 document
.update_form
[$i].checked
= true;
126 function set_button_states() {
127 var f
= document
.update_form
;
128 var count0
= 0; // selected and not billed or queued
129 var count1
= 0; // selected and queued
130 var count2
= 0; // selected and billed
131 for ($i = 0; $i < f
.length
; ++
$i) {
133 if ($name.substring(0, 7) == "claims[" && $name.substring($name.length
-
134 6) == "[bill]" && f
[$i].checked
== true) {
135 if (f
[$i].value
== '0') ++count0
;
136 else if (f
[$i].value
== '1' || f
[$i].value
== '5') ++count1
;
140 var can_generate
= (count0
> 0 || count1
> 0 || count2
> 0);
141 var can_mark
= (count1
> 0 || count0
> 0 || count2
> 0);
142 var can_bill
= (count0
== 0 && count1
== 0 && count2
> 0);
143 <?php
if (file_exists($EXPORT_INC)) { ?
>
144 f
.bn_external
.disabled
= !can_generate
;
146 f
.bn_x12_support
.disabled
= !can_generate
;
147 <?php
if ($GLOBALS['support_encounter_claims']) { ?
>
148 f
.bn_x12_encounter
.disabled
= !can_generate
;
150 f
.bn_process_hcfa_support
.disabled
= !can_generate
;
151 <?php
if ($GLOBALS['preprinted_cms_1500']) { ?
>
152 f
.bn_process_hcfa_form
.disabled
= !can_generate
;
154 <?php
if ($GLOBALS['ub04_support']) { ?
>
155 f
.bn_process_ub04_support
.disabled
= !can_generate
;
157 f
.bn_hcfa_txt_file
.disabled
= !can_generate
;
158 f
.bn_reopen
.disabled
= !can_bill
;
160 f
.bn_mark
.disabled
= !can_mark
;
163 // Process a click to go to an encounter.
164 function toencounter(pid
, pubpid
, pname
, enc
, datestr
, dobstr
) {
165 top
.restoreSession();
166 encurl
= 'patient_file/encounter/encounter_top.php?set_encounter=' + enc +
168 parent
.left_nav
.setPatient(pname
, pid
, pubpid
, '', dobstr
);
169 <?php
if ($GLOBALS['new_tabs_layout']) { ?
>
170 parent
.left_nav
.setEncounter(datestr
, enc
, 'enc');
171 parent
.left_nav
.loadFrame('enc2', 'enc', encurl
);
173 var othername
= (window
.name
== 'RTop') ?
'RBot' : 'RTop';
174 parent
.left_nav
.setEncounter(datestr
, enc
, othername
);
175 parent
.frames
[othername
].location
.href
= '../' + encurl
;
179 // Process a click to go to an patient.
180 function topatient(pid
, pubpid
, pname
, enc
, datestr
, dobstr
) {
181 top
.restoreSession();
182 paturl
= 'patient_file/summary/demographics_full.php?pid=' + pid
;
183 parent
.left_nav
.setPatient(pname
, pid
, pubpid
, '', dobstr
);
184 <?php
if ($GLOBALS['new_tabs_layout']) { ?
>
185 parent
.left_nav
.loadFrame('ens1', 'enc',
186 'patient_file/history/encounters.php?pid=' + pid
);
187 parent
.left_nav
.loadFrame('dem1', 'pat', paturl
);
189 var othername
= (window
.name
== 'RTop') ?
'RBot' : 'RTop';
190 parent
.frames
[othername
].location
.href
= '../' + paturl
;
194 function popMBO(pid
, enc
, mboid
) {
195 if (!window
.focus
) return true;
196 if (!ProcessBeforeSubmitting()) return false;
197 top
.restoreSession();
198 let qstring
= "&pid=" + pid +
"&enc=" + enc +
"&id=" + mboid
;
199 let href
= "<?php echo $GLOBALS['web_root']?>/interface/patient_file/encounter/view_form.php?formname=misc_billing_options&isBilling=1" + qstring
;
200 dlgopen(href
, 'mbopop', 'modal-lg', 750, false, '', {
201 sizeHeight
: 'full' // override min height auto size.
206 function popUB04(pid
, enc
) {
207 if (!window
.focus
) return true;
208 if (!ProcessBeforeSubmitting()) return false;
209 top
.restoreSession();
210 let href
= "<?php echo $GLOBALS['web_root']?>/interface/billing/ub04_form.php?pid=" + pid +
"&enc=" + enc
;
211 dlgopen(href
, 'ub04pop', 1175, 750, false, '', {
212 sizeHeight
: 'full' // override min height auto size.
218 var EncounterDateArray
= new Array;
219 var CalendarCategoryArray
= new Array;
220 var EncounterIdArray
= new Array;
221 var EncounterNoteArray
= new Array;
223 function SubmitTheScreen() { //Action on Update List link
224 if (!ProcessBeforeSubmitting()) return false;
225 $
("#update-tooltip").replaceWith("<i class='fa fa-refresh fa-spin fa-1x' style=\"color:red\"></i>");
226 top
.restoreSession();
227 document
.the_form
.mode
.value
= 'change';
228 document
.the_form
.target
= '_self';
229 document
.the_form
.action
= 'billing_report.php';
230 document
.the_form
.submit();
234 function SubmitTheScreenPrint() { //Action on View Printable Report link
235 if (!ProcessBeforeSubmitting()) return false;
236 top
.restoreSession();
237 document
.the_form
.target
= 'new';
238 document
.the_form
.action
= 'print_billing_report.php';
239 document
.the_form
.submit();
243 function SubmitTheEndDayPrint() { //Action on View End of Day Report link
244 if (!ProcessBeforeSubmitting()) return false;
245 top
.restoreSession();
246 document
.the_form
.target
= 'new';
247 <?php
if ($GLOBALS['use_custom_daysheet'] == 1) { ?
>
248 document
.the_form
.action
= 'print_daysheet_report_num1.php';
250 <?php
if ($GLOBALS['use_custom_daysheet'] == 2) { ?
>
251 document
.the_form
.action
= 'print_daysheet_report_num2.php';
253 <?php
if ($GLOBALS['use_custom_daysheet'] == 3) { ?
>
254 document
.the_form
.action
= 'print_daysheet_report_num3.php';
256 document
.the_form
.submit();
260 function SubmitTheScreenExportOFX() { //Action on Export OFX link
261 if (!ProcessBeforeSubmitting()) return false;
262 top
.restoreSession();
263 document
.the_form
.mode
.value
= 'export';
264 document
.the_form
.target
= '_self';
265 document
.the_form
.action
= 'billing_report.php';
266 document
.the_form
.submit();
270 function TestExpandCollapse() { //Checks whether the Expand All, Collapse All labels need to be placed.If any result set is there these will be placed.
272 for (i
= 1; i
<= document
.getElementById("divnos").value
; i++
) {
273 var ele
= document
.getElementById("divid_" + i
);
280 if (document
.getElementById("ExpandAll")) {
281 document
.getElementById("ExpandAll").innerHTML
= '';
282 document
.getElementById("CollapseAll").innerHTML
= '';
287 function expandcollapse(atr
) {
288 if (atr
== "expand") { //Called in the Expand All, Collapse All links(All items will be expanded or collapsed)
289 for (i
= 1; i
<= document
.getElementById("divnos").value
; i++
) {
290 var mydivid
= "divid_" + i
;
291 var myspanid
= "spanid_" + i
;
292 var ele
= document
.getElementById(mydivid
);
293 var text
= document
.getElementById(myspanid
);
295 ele
.style
.display
= "inline";
297 "<?php echo xla('Collapse'); ?>";
301 for (i
= 1; i
<= document
.getElementById("divnos").value
; i++
) {
302 var mydivid
= "divid_" + i
;
303 var myspanid
= "spanid_" + i
;
304 var ele
= document
.getElementById(mydivid
);
305 var text
= document
.getElementById(myspanid
);
307 ele
.style
.display
= "none";
309 "<?php echo xla('Expand'); ?>";
315 function divtoggle(spanid
, divid
) { //Called in the Expand, Collapse links(This is for a single item)
316 var ele
= document
.getElementById(divid
);
318 var text
= document
.getElementById(spanid
);
319 if (ele
.style
.display
== "inline") {
320 ele
.style
.display
= "none";
322 "<?php echo xla('Expand'); ?>";
324 ele
.style
.display
= "inline";
326 "<?php echo xla('Collapse'); ?>";
331 function MarkAsCleared(Type
) {
332 CheckBoxBillingCount
= 0;
333 for (var CheckBoxBillingIndex
= 0; ; CheckBoxBillingIndex++
) {
334 CheckBoxBillingObject
= document
.getElementById('CheckBoxBilling' +
335 CheckBoxBillingIndex
);
336 if (!CheckBoxBillingObject
) break;
337 if (CheckBoxBillingObject
.checked
) {
338 ++CheckBoxBillingCount
;
342 Message
= '<?php echo xla('After saving your batch
, click
[View Log
] to check
for errors
.'); ?>';
345 Message
= '<?php echo xla('After saving the PDF
, click
[View Log
] to check
for errors
.'); ?>';
348 Message
= '<?php echo xla('After saving the TEXT
file(s
), click
[View Log
] to check
for errors
.'); ?>';
350 if (confirm(Message +
"\n\n\n<?php echo xls('Total'); ?>" +
' ' +
351 CheckBoxBillingCount +
' ' +
352 "<?php echo xls('Selected'); ?>\n" +
353 "<?php echo xls('Would You Like them to be Marked as Cleared.'); ?>\n" +
354 "<?php echo xls('Click OK to Clear or Cancel to continue processing.'); ?>"
356 document
.getElementById('HiddenMarkAsCleared').value
= 'yes';
358 document
.getElementById('HiddenMarkAsCleared').value
= '';
362 <?php
require_once "$srcdir/../interface/reports/report.script.php"; ?
>
363 <!-- Criteria Section common javascript page
-->
364 <!-- =============Included
for Insurance ajax criteria
==== -->
365 <?php
require_once "{$GLOBALS['srcdir']}/ajax/payment_ajax_jav.inc.php"; ?
>
367 #ajax_div_insurance {
370 background
-color
: #FBFDD0;
371 border
: 1px solid
#ccc;
374 button
[type
="submit"].subbtn
-warning
{
375 background
: #ec971f !important;
376 color
: black
!important
;
378 button
[type
="submit"].subbtn
-warning
:hover
{
379 background
: #da8104 !important;
380 color
: #fff !important;
382 @media only screen
and (max
-width
: 1024px
) {
385 text
-align
: left
!Important
;
391 @media
(min
-width
: 992px
) {
393 width
: 1000px
!Important
;
396 .table th
, .table td
{
397 border
-top
: none
!important
;
400 font
-family
: "FontAwesome"
405 a
, a
:visited
, a
:hover
{
406 text
-decoration
: none
;
411 document
.onclick
= TakeActionOnHide
;
413 <!-- =============Included
for Insurance ajax criteria
==== -->
415 //to determine and set the form to open in the desired state - expanded or centered, any selection the user makes will
416 //become the user-specific default for that page. collectAndOrganizeExpandSetting() contains a single array as an
417 //argument, containing one or more elements, the name of the current file is the first element, if there are linked
418 // files they should be listed thereafter, please add _xpd suffix to the file name
419 $arr_files_php = array("billing_report_xpd");
420 $current_state = collectAndOrganizeExpandSetting($arr_files_php);
421 require_once("$srcdir/expand_contract_inc.php");
423 <title
><?php
echo xlt('Billing Manager'); ?
></title
>
425 <body
class="body_top" onLoad
="TestExpandCollapse()">
426 <div
class="<?php echo $container;?> expandable">
428 <div
class="col-sm-12">
429 <div
class="page-header">
431 <?php
echo xlt('Billing Manager') ?
> <i id
="exp_cont_icon" class="fa <?php echo attr($expand_icon_class);?> oe-superscript-small expand_contract"
432 title
="<?php echo attr($expand_title); ?>" aria
-hidden
="true"></i
> <i id
="show_hide" class="fa fa-eye-slash fa-2x small"
433 title
="<?php echo xla('Click to Hide'); ?>"></i
>
439 <div
class="col-sm-12">
440 <form name
='the_form' method
='post' action
='billing_report.php' onsubmit
='return top.restoreSession()' style
="display:inline">
441 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(collectCsrfToken()); ?>" />
442 <input type
='hidden' name
='mode' value
='change'>
443 <div
class="col-xs-9">
444 <!-- ============================================================================================================================================= -->
445 <!-- Criteria section Starts
-->
446 <!-- ============================================================================================================================================= -->
448 // The following are the search criteria per page.All the following variable which ends with 'Master' need to be filled properly.
449 // Each item is seperated by a comma(,).
450 // $ThisPageSearchCriteriaDisplayMaster ==>It is the display on screen for the set of criteria.
451 // $ThisPageSearchCriteriaKeyMaster ==>Corresponding database fields in the same order.
452 // $ThisPageSearchCriteriaDataTypeMaster ==>Corresponding data type in the same order.
453 $ThisPageSearchCriteriaDisplayRadioMaster = array();
454 $ThisPageSearchCriteriaRadioKeyMaster = array();
455 $ThisPageSearchCriteriaQueryDropDownMaster = array();
456 $ThisPageSearchCriteriaQueryDropDownMasterDefault = array();
457 $ThisPageSearchCriteriaQueryDropDownMasterDefaultKey = array();
458 $ThisPageSearchCriteriaIncludeMaster = array();
461 $ThisPageSearchCriteriaDisplayMaster = array(
462 xl("Date of Service"),
464 xl("Date of Billing"),
468 xl("Insurance Company"),
470 xl("Whether Insured"),
472 xl("Billing Status"),
473 xl("Authorization Status"),
474 xl("Last Level Billed"),
478 $ThisPageSearchCriteriaKeyMaster = "form_encounter.date,billing.date,claims.process_time,claims.target,patient_data.fname," . "form_encounter.pid,claims.payer_id,form_encounter.encounter,insurance_data.provider,billing.id,billing.billed," . "billing.authorized,form_encounter.last_level_billed,billing.x12_partner_id,billing.user";
479 $ThisPageSearchCriteriaDataTypeMaster = "datetime,datetime,datetime,radio,text_like," . "text,include,text,radio,radio,radio," . "radio_like,radio,query_drop_down,text";
481 $ThisPageSearchCriteriaDisplayMaster = array(
482 xl("Date of Service"),
484 xl("Date of Billing"),
488 xl("Insurance Company"),
490 xl("Whether Insured"),
492 xl("Billing Status"),
493 xl("Authorization Status"),
494 xl("Last Level Billed"),
497 $ThisPageSearchCriteriaKeyMaster = "form_encounter.date,billing.date,claims.process_time,claims.target,patient_data.fname," . "form_encounter.pid,claims.payer_id,form_encounter.encounter,insurance_data.provider,billing.id,billing.billed," . "billing.authorized,form_encounter.last_level_billed,billing.x12_partner_id";
498 $ThisPageSearchCriteriaDataTypeMaster = "datetime,datetime,datetime,radio,text_like," . "text,include,text,radio,radio,radio," . "radio_like,radio,query_drop_down";
500 // The below section is needed if there is any 'radio' or 'radio_like' type in the $ThisPageSearchCriteriaDataTypeMaster
501 // $ThisPageSearchCriteriaDisplayRadioMaster,$ThisPageSearchCriteriaRadioKeyMaster ==>For each radio data type this pair comes.
502 // The key value 'all' indicates that no action need to be taken based on this.For that the key must be 'all'.Display value can be any thing.
503 $ThisPageSearchCriteriaDisplayRadioMaster[1] = array(
508 $ThisPageSearchCriteriaRadioKeyMaster[1] = "all,standard,hcfa"; // Key
509 $ThisPageSearchCriteriaDisplayRadioMaster[2] = array(
514 $ThisPageSearchCriteriaRadioKeyMaster[2] = "all,1,0"; // Key
515 $ThisPageSearchCriteriaDisplayRadioMaster[3] = array(
520 $ThisPageSearchCriteriaRadioKeyMaster[3] = "all,not null,null"; // Key
521 $ThisPageSearchCriteriaDisplayRadioMaster[4] = array(
527 $ThisPageSearchCriteriaRadioKeyMaster[4] = "all,0,1,7"; // Key
528 $ThisPageSearchCriteriaDisplayRadioMaster[5] = array(
533 $ThisPageSearchCriteriaRadioKeyMaster[5] = "%,1,0";
534 $ThisPageSearchCriteriaDisplayRadioMaster[6] = array(
540 $ThisPageSearchCriteriaRadioKeyMaster[6] = "all,0,1,2";
541 // The below section is needed if there is any 'query_drop_down' type in the $ThisPageSearchCriteriaDataTypeMaster
542 $ThisPageSearchCriteriaQueryDropDownMaster[1] = "SELECT name,id FROM x12_partners;";
543 $ThisPageSearchCriteriaQueryDropDownMasterDefault[1] = xl("All"); // Only one item will be here
544 $ThisPageSearchCriteriaQueryDropDownMasterDefaultKey[1] = "all"; // Only one item will be here
545 // The below section is needed if there is any 'include' type in the $ThisPageSearchCriteriaDataTypeMaster
546 // Function name is added here.Corresponding include files need to be included in the respective pages as done in this page.
547 // It is labled(Included for Insurance ajax criteria)(Line:-279-299).
548 $ThisPageSearchCriteriaIncludeMaster[1] = "InsuranceCompanyDisplay"; // This is php function defined in the file 'report.inc.php'
550 if (!isset($_REQUEST['mode'])) {// default case
551 $_REQUEST['final_this_page_criteria'][0] = "(form_encounter.date between '" . date("Y-m-d 00:00:00") . "' and '" . date("Y-m-d 23:59:59") . "')";
552 $_REQUEST['final_this_page_criteria'][1] = "billing.billed = '0'";
553 $_REQUEST['final_this_page_criteria_text'][0] = xl("Date of Service = Today");
554 $_REQUEST['final_this_page_criteria_text'][1] = xl("Billing Status = Unbilled");
555 $_REQUEST['date_master_criteria_form_encounter_date'] = "today";
556 $_REQUEST['master_from_date_form_encounter_date'] = date("Y-m-d");
557 $_REQUEST['master_to_date_form_encounter_date'] = date("Y-m-d");
558 $_REQUEST['radio_billing_billed'] = 0;
561 <div
class="hideaway">
562 <?php
require_once "$srcdir/../interface/reports/criteria.tab.php"; ?
>
565 // ============================================================================================================================================= -->
566 // Criteria section Ends -->
567 // ============================================================================================================================================= -->
571 <div
class="form-group col-xs-3 hideaway">
573 <legend
><?php
echo xlt('Select Action'); ?
></legend
>
574 <div
class="form-group col-xs-12">
577 <li
><a
class="link_submit" href
="#"
578 onclick
="javascript:return SubmitTheScreen();"><strong
><?php
echo xlt('Update List') ?
></strong
>
579 </a
><i id
='update-tooltip' class="fa fa-info-circle text-primary" aria
-hidden
="true"></i
></li
>
580 <li
><a
class='link_submit' href
="#"
581 onclick
="javascript:return SubmitTheScreenExportOFX();"><strong
><?php
echo xlt('Export OFX'); ?
></strong
></a
>
583 <li
><a
class='link_submit' href
="#" onclick
="javascript:return SubmitTheScreenPrint();"><strong
><?php
echo xlt('View Printable Report'); ?
></strong
></a
>
586 <?php
if ($daysheet) { ?
>
587 <li
><a
class='link_submit' href
="#"
588 onclick
="javascript:return SubmitTheEndDayPrint();"><strong
><?php
echo xlt('End Of Day Report') . ' - ' ?
></strong
></a
>
589 <?php
if ($daysheet_total) { ?
>
590 <span
class="text"><strong
><?php
echo xlt('Totals'); ?
></strong
></span
>
591 <input name
="end_of_day_totals_only" type
="checkbox" value
="1"></li
>
593 <?php
if ($provider_run) { ?
>
594 <span
class="text"><strong
><?php
echo xlt('Provider'); ?
></strong
></span
>
595 <input name
="end_of_day_provider_only" type
="checkbox" value
="1"></li
>
599 <?php
if (!file_exists($EXPORT_INC)) { ?
>
600 <li
><a href
='#' id
="view-log-link" data
-toggle
="modal" data
-target
="#myModal" class='link_submit'
601 title
='<?php xla('See messages from the last set of generated claims
'); ?>'><strong
><?php
echo xlt('View Log'); ?
></strong
></a
>
604 <li
><a
class="link_submit"
605 href
="JavaScript:void(0);" onclick
="select_all(); return false;"><strong
><?php
echo xlt('Select All'); ?
></strong
></a
>
617 <div
class="col-sm-12">
618 <form
class="form-inline" name
='update_form' method
='post' action
='billing_process.php' onsubmit
='return top.restoreSession()' style
="display:inline">
619 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(collectCsrfToken()); ?>" />
620 <?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 ?>
621 <div
class="form-group clearfix">
622 <div
class="btn-group btn-group-pinch position-override" role
="group">
623 <div
class="btn-group">
624 <button type
="button" class="btn btn-default dropdown-toggle" data
-toggle
="dropdown"
625 name
="bn_x12_support"
626 title
="<?php echo xla('A claim must be selected to enable this menu.') ?>"><?php
echo xla('X12 OPTIONS') ?
>
627 <span
class="caret"></span
></button
>
628 <ul
class="dropdown-menu" role
="menu">
629 <?php
if (file_exists($EXPORT_INC)) { ?
>
631 <button type
="submit" data
-open
-popup
="true" class="btn btn-default btn-download"
633 title
="<?php echo xla('Export to external billing system') ?>"
634 value
="<?php echo xla("Export Billing
") ?>"><?php
echo xla("Export Billing") ?
></button
>
637 <button type
="submit" data
-open
-popup
="true" class="btn btn-default btn-download"
639 title
="<?php echo xla('Mark as billed but skip billing') ?>"><?php
echo xla("Mark as Cleared") ?
></button
>
643 <button type
="submit" class="btn btn-default btn-download" name
="bn_x12"
644 onclick
="MarkAsCleared(1)"
645 title
="<?php echo xla('Generate and download X12 batch') ?>"><?php
echo xla('Generate X12') ?
></button
>
648 <?php
if ($GLOBALS['ub04_support']) { ?
>
650 <button type
="submit" class="btn btn-default btn-download" name
="bn_ub04_x12"
651 title
="<?php echo xla('Generate Institutional X12 837I') ?>"><?php
echo xla('Generate X12 837I') ?
></button
>
654 <?php
if ($GLOBALS['support_encounter_claims']) { ?
>
656 <button type
="submit" class="btn btn-default btn-download" name
="bn_x12_encounter"
657 onclick
="MarkAsCleared(1)"
658 title
="<?php echo xla('Generate and download X12 encounter claim batch') ?>"><?php
echo xla('Generate X12 Encounter') ?
></button
>
663 <div
class="btn-group">
664 <button type
="button" class="btn btn-default dropdown-toggle" data
-toggle
="dropdown"
665 name
="bn_process_hcfa_support"
666 title
="<?php echo xla('A claim must be selected to enable this menu.') ?>"><?php
echo xla('HCFA FORM') ?
>
667 <span
class="caret"></span
></button
>
668 <ul
class="dropdown-menu" role
="menu">
670 <button type
="submit" class="btn btn-default btn-download" name
="bn_process_hcfa"
671 onclick
="MarkAsCleared(2)"
672 title
="<?php echo xla('Generate and download CMS 1500 paper claims') ?>"><?php
echo xla('CMS 1500 PDF') ?
></button
>
674 <?php
if ($GLOBALS['preprinted_cms_1500']) { ?
>
676 <button type
="submit" class="btn btn-default btn-download"
677 name
="bn_process_hcfa_form" onclick
="MarkAsCleared(2)"
678 title
="<?php echo xla('Generate and download CMS 1500 paper claims on Preprinted form') ?>"><?php
echo xla('CMS 1500 incl FORM') ?
></button
>
682 <button type
="submit" class="btn btn-default btn-download" name
="bn_hcfa_txt_file"
683 onclick
="MarkAsCleared(3)"
684 title
="<?php echo xla('Making batch text files for uploading to Clearing House and will mark as billed') ?>"><?php
echo xla('CMS 1500 TEXT') ?
></button
>
688 <?php
if ($GLOBALS['ub04_support']) { ?
>
689 <div
class="btn-group">
690 <button type
="button" class="btn btn-default dropdown-toggle" data
-toggle
="dropdown"
691 name
="bn_process_ub04_support"
692 title
="<?php echo xla('A claim must be selected to enable this menu.') ?>"><?php
echo xla('UB04 FORM') ?
>
693 <span
class="caret"></span
></button
>
694 <ul
class="dropdown-menu" role
="menu">
696 <button type
="submit" class="btn btn-default btn-download"
697 name
="bn_process_ub04_form"
698 title
="<?php echo xla('Generate and download UB-04 CMS1450 with form') ?>"><?php
echo xla('UB04 FORM PDF') ?
></button
>
701 <button type
="submit" class="btn btn-default btn-download" name
="bn_process_ub04"
702 title
="<?php echo xla('Generate and download UB-04 CMS1450') ?>"><?php
echo xla('UB04 TEXT PDF') ?
></button
>
707 <button
class="btn btn-default btn-download" data
-open
-popup
="true" name
="bn_mark"
708 title
="<?php echo xla('Post to accounting and mark as billed') ?>"
709 type
="submit"><?php
echo xla('Mark as Cleared') ?
></button
>
710 <button
class="btn btn-default btn-undo" data
-open
-popup
="true" name
="bn_reopen"
711 title
="<?php echo xla('Mark as not billed') ?>"
712 type
="submit"><?php
echo xla('Re-Open') ?
></button
>
714 <div
class="input-group">
715 <label
for="left_margin"><?php
echo xlt('CMS 1500 Margins Left'); ?
>:</label
>
716 <input type
='text' size
='2' id
='left_margin' name
='left_margin'
717 value
='<?php echo attr($left_margin); ?>'
718 title
='<?php echo xla('HCFA left margin in points
'); ?>'/>
719 <label
for="top_margin"><?php
echo xlt('Top'); ?
>:</label
>
720 <input type
='text' size
='2' id
='top_margin' name
='top_margin'
721 value
='<?php echo attr($top_margin); ?>'
722 title
='<?php echo xla('HCFA top margin in points
'); ?>'/>
724 <?php
if ($ub04_support) { ?
>
725 <div
class="input-group">
726 <label
for="left_ubmargin"><?php
echo xlt('UB04 Margins Left'); ?
>:</label
>
727 <input type
='text' size
='2' id
='left_ubmargin' name
='left_ubmargin'
728 value
='<?php echo attr($left_ubmargin); ?>'
729 title
='<?php echo xla('UB04 left margin in points
'); ?>'/>
730 <label
for="top_ubmargin"><?php
echo xlt('Top'); ?
>:</label
>
731 <input type
='text' size
='2' id
='top_ubmargin' name
='top_ubmargin'
732 value
='<?php echo attr($top_ubmargin); ?>'
733 title
='<?php echo xla('UB04 top margin in points
'); ?>'/>
737 <input id
='HiddenMarkAsCleared' name
='HiddenMarkAsCleared' type
='hidden' value
="">
738 <input name
='mode' type
='hidden' value
="bill">
739 <input name
='authorized' type
='hidden' value
="<?php echo attr($my_authorized); ?>">
740 <input name
='unbilled' type
='hidden' value
="<?php echo attr($unbilled); ?>">
741 <input name
='code_type' type
='hidden' value
="%">
742 <input name
='to_date' type
='hidden' value
="<?php echo attr($to_date); ?>">
743 <input name
='from_date' type
='hidden' value
="<?php echo attr($from_date); ?>">
745 if ($my_authorized == "on") {
746 $my_authorized = "1";
748 $my_authorized = "%";
750 if ($unbilled == "on") {
755 $list = getBillsListBetween("%");
757 <input name
='bill_list' type
='hidden' value
="<?php echo attr($list); ?>"> <!-- new form
for uploading
-->
759 if (!isset($_POST["mode"])) {
760 if (!isset($_POST["from_date"])) {
761 $from_date = date("Y-m-d");
763 $from_date = $_POST["from_date"];
765 if (empty($_POST["to_date"])) {
768 $to_date = $_POST["to_date"];
770 if (!isset($_POST["code_type"])) {
773 $code_type = $_POST["code_type"];
775 if (!isset($_POST["unbilled"])) {
778 $unbilled = $_POST["unbilled"];
780 if (!isset($_POST["authorized"])) {
781 $my_authorized = "on";
783 $my_authorized = $_POST["authorized"];
786 $from_date = $_POST["from_date"];
787 $to_date = $_POST["to_date"];
788 $code_type = $_POST["code_type"];
789 $unbilled = $_POST["unbilled"];
790 $my_authorized = $_POST["authorized"];
793 if ($my_authorized == "on") {
794 $my_authorized = "1";
796 $my_authorized = "%";
799 if ($unbilled == "on") {
805 if (isset($_POST["mode"]) && $_POST["mode"] == "bill") {
806 billCodesList($list);
809 <div
class="table-responsive">
810 <table
class="table table-condensed">
813 if ($ret = getBillsBetween("%")) {
814 if (is_array($ret)) {
817 <td colspan
='9' align
="right">
818 <table width
="250" border
="0" cellspacing
="0" cellpadding
="0">
820 <td width
="100" id
='ExpandAll'><a
821 onclick
="expandcollapse('expand');" class='small'
822 href
="JavaScript:void(0);"><?php
echo '(' . xla('Expand All') . ')' ?
></a
>
824 <td width
="100" id
='CollapseAll'><a
825 onclick
="expandcollapse('collapse');" class='small'
826 href
="JavaScript:void(0);"><?php
echo '(' . xla('Collapse All') . ')' ?
></a
>
828 <td width
="50"> 
;</td
>
837 $last_encounter_id = "";
845 $mmo_empty_mod = false;
846 $mmo_num_charges = 0;
848 foreach ($ret as $iter) {
849 // We include encounters here that have never been billed. However
850 // if it had no selected billing items but does have non-selected
851 // billing items, then it is not of interest.
854 "SELECT count(*) AS count FROM billing WHERE " .
855 "encounter = ? AND " .
859 $iter['enc_encounter'],
863 if ($res['count'] > 0) {
868 $this_encounter_id = $iter['enc_pid'] . "-" . $iter['enc_encounter'];
870 if ($last_encounter_id != $this_encounter_id) {
871 // This dumps all HTML for the previous encounter.
874 while ($rcount < $lcount) {
875 $rhtml .= "<tr bgcolor='$bgcolor'><td colspan='9'></td></tr>";
878 // This test handles the case where we are only listing encounters
879 // that appear to have a missing "25" modifier.
880 if (!$missing_mods_only ||
($mmo_empty_mod && $mmo_num_charges > 1)) {
881 if ($DivPut == 'yes') {
885 echo "<tr bgcolor='$bgcolor'>\n<td rowspan='" . attr($rcount) . "' valign='top'>\n$lhtml</td>$rhtml\n";
886 echo "<tr bgcolor='$bgcolor'><td colspan='9' height='5'></td></tr>\n\n";
893 $mmo_empty_mod = false;
894 $mmo_num_charges = 0;
896 // If there are ANY unauthorized items in this encounter and this is
897 // the normal case of viewing only authorized billing, then skip the
901 if ($my_authorized == '1') {
903 "SELECT count(*) AS count FROM billing WHERE " .
904 "encounter = ? AND " .
906 "activity = 1 AND authorized = 0",
908 $iter['enc_encounter'],
912 if ($res['count'] > 0) {
914 $last_encounter_id = $this_encounter_id;
920 $mboid = sqlQuery("SELECT forms.form_id FROM forms WHERE forms.encounter = ? AND forms.authorized = 1 AND forms.formdir = 'misc_billing_options' AND forms.deleted != 1 LIMIT 1", array($iter['enc_encounter']));
921 $iter['mboid'] = $mboid ?
attr($mboid['form_id']) : 0;
923 $name = getPatientData($iter['enc_pid'], "fname, mname, lname, pubpid, billing_note, DATE_FORMAT(DOB,'%Y-%m-%d') as DOB_YMD");
925 // Check if patient has primary insurance and a subscriber exists for it.
926 // If not we will highlight their name in red.
927 // TBD: more checking here.
930 "SELECT count(*) AS count FROM insurance_data WHERE " .
932 "type='primary' AND " .
933 "subscriber_lname IS NOT NULL AND " .
934 "subscriber_lname != '' LIMIT 1",
939 $namecolor = ($res['count'] > 0) ?
"black" : "#ff7777";
941 $bgcolor = "#" . (($encount & 1) ?
"FFFAEF" : "F8F8FF");
942 echo "<tr bgcolor='$bgcolor'><td colspan='9' height='5'></td></tr>\n";
947 $ptname = $name['fname'] . " " . $name['lname'];
948 $raw_encounter_date = date("Y-m-d", strtotime($iter['enc_date']));
949 $billing_note = $name['billing_note'];
950 // Add Encounter Date to display with "To Encounter" button 2/17/09 JCH
951 $lhtml .= "<span class=bold><font color='$namecolor'>" . text($ptname) . "</font></span><span class=small> (" . text($iter['enc_pid']) . "-" . text($iter['enc_encounter']) . ")</span>";
953 // Encounter details are stored to javacript as array.
954 $result4 = sqlStatement(
955 "SELECT fe.encounter,fe.date,fe.billing_note,openemr_postcalendar_categories.pc_catname FROM form_encounter AS fe " .
956 " LEFT JOIN openemr_postcalendar_categories ON fe.pc_catid=openemr_postcalendar_categories.pc_catid WHERE fe.pid = ? ORDER BY fe.date DESC",
961 if (sqlNumRows($result4) > 0) {
966 EncounterDateArray
[<?php
echo attr($iter['enc_pid']); ?
>] = new Array;
967 CalendarCategoryArray
[<?php
echo attr($iter['enc_pid']); ?
>] = new Array;
968 EncounterIdArray
[<?php
echo attr($iter['enc_pid']); ?
>] = new Array;
969 EncounterNoteArray
[<?php
echo attr($iter['enc_pid']); ?
>] = new Array;
971 while ($rowresult4 = sqlFetchArray($result4)) {
973 EncounterIdArray
[<?php
echo attr($iter['enc_pid']); ?
>][Count
] = '<?php echo attr($rowresult4['encounter
']); ?>';
974 EncounterDateArray
[<?php
echo attr($iter['enc_pid']); ?
>][Count
] = '<?php echo attr(oeFormatShortDate(date("Y-m-d", strtotime($rowresult4['date
'])))); ?>';
975 CalendarCategoryArray
[<?php
echo attr($iter['enc_pid']); ?
>][Count
] = '<?php echo attr(xl_appt_category($rowresult4['pc_catname
'])); ?>';
976 EncounterNoteArray
[<?php
echo attr($iter['enc_pid']); ?
>][Count
] = '<?php echo attr($rowresult4['billing_note
']); ?>';
979 $enc_billing_note = $rowresult4['billing_note'];
984 $lhtml .= "<div class='button-group'>";
985 // Not sure why the next section seems to do nothing except post "To Encounter" button 2/17/09 JCH
986 $lhtml .= "<a class=\"btn btn-xs btn-default\" role=\"button\" " . "href=\"javascript:window.toencounter(" . attr(addslashes($iter['enc_pid'])) . ",'" . attr(addslashes($name['pubpid'])) . "','" . attr(addslashes($ptname)) . "'," . attr(addslashes($iter['enc_encounter'])) . ",'" . attr(addslashes(oeFormatShortDate($raw_encounter_date))) . "',' " . attr(xls('DOB')) . ": " . attr(addslashes(oeFormatShortDate($name['DOB_YMD']))) . " " . attr(xls('Age')) . ": " . attr(addslashes(getPatientAge($name['DOB_YMD']))) . "');
987 top.window.parent.left_nav.setPatientEncounter(EncounterIdArray[" . attr(addslashes($iter['enc_pid'])) . "],EncounterDateArray[" . attr(addslashes($iter['enc_pid'])) . "], CalendarCategoryArray[" . attr(addslashes($iter['enc_pid'])) . "])\">" . xlt('Encounter') . " " . text(oeFormatShortDate($raw_encounter_date)) . "</a>";
989 // Changed "To xxx" buttons to allow room for encounter date display 2/17/09 JCH
990 $lhtml .= "<a class=\"btn btn-xs btn-default\" role=\"button\" " . "href=\"javascript:window.topatient(" . attr(addslashes($iter['enc_pid'])) . ",'" . attr(addslashes($name['pubpid'])) . "','" . attr(addslashes($ptname)) . "'," . attr(addslashes($iter['enc_encounter'])) . ",'" . attr(addslashes(oeFormatShortDate($raw_encounter_date))) . "',' " . attr(xls('DOB')) . ": " . attr(addslashes(oeFormatShortDate($name['DOB_YMD']))) . " " . attr(xls('Age')) . ": " . attr(addslashes(getPatientAge($name['DOB_YMD']))) . "');
991 top.window.parent.left_nav.setPatientEncounter(EncounterIdArray[" . attr(addslashes($iter['enc_pid'])) . "],EncounterDateArray[" . attr(addslashes($iter['enc_pid'])) . "], CalendarCategoryArray[" . attr(addslashes($iter['enc_pid'])) . "])\">" . xlt('Patient') . "</a>";
992 $is_edited = $iter['mboid'] ?
'btn-success' : 'btn-default';
993 $title = $iter['mboid'] ?
xlt("This claim has HCFA 1500 miscellaneous billing options") : xlt("Click to add HCFA 1500 miscellaneous billing options");
994 $lhtml .= "<a class='btn btn-xs $is_edited' role='button' title='" . attr($title) . "' onclick='popMBO(" . attr(addslashes($iter['enc_pid'])) . "," . attr(addslashes($iter['enc_encounter'])) . "," . attr(addslashes($iter['mboid'])) . "); return false;'>" . xlt('MBO ') . "</a>";
995 if ($ub04_support && isset($iter['billed'])) {
997 "SELECT submitted_claim AS status FROM claims WHERE " .
998 "encounter_id = ? AND " .
1000 "ORDER BY version DESC LIMIT 1",
1002 $iter['enc_encounter'],
1006 $is_edited = $c['status'] ?
'btn-success' : 'btn-warning';
1007 $bname = $c['status'] ?
xl('Reviewed') : xl('Review UB04');
1008 $lhtml .= "<a class='btn btn-xs $is_edited' role='button' onclick='popUB04(" . attr(addslashes($iter['enc_pid'])) . "," . attr(addslashes($iter['enc_encounter'])) . "); return false;'>" . text($bname) . "</a>";
1011 $divnos = $divnos +
1;
1012 $lhtml .= " <a onclick='divtoggle(\"spanid_" . attr(addslashes($divnos)) . "\",\"divid_" . attr(addslashes($divnos)) . "\");' class='small' id='aid_" . attr($divnos) . "' href=\"JavaScript:void(0);" . "\">(<span id=spanid_" . attr($divnos) . " class=\"indicator\">" . xlt('Expand') . '</span>)<br></a>';
1013 if ($GLOBALS['notes_to_display_in_Billing'] == 2 ||
$GLOBALS['notes_to_display_in_Billing'] == 3) {
1014 $lhtml .= '<span style="margin-left: 20px; font-weight: bold; color: red">' . text($billing_note) . '</span>';
1019 $lhtml .= "<br />\n";
1020 $lhtml .= " <span class='form-group'>" . xlt('Bill') . ": ";
1021 $lhtml .= "<select name='claims[" . attr($this_encounter_id) . "][payer]' style='background-color:$bgcolor'>";
1023 $query = "SELECT id.provider AS id, id.type, id.date, " .
1024 "ic.x12_default_partner_id AS ic_x12id, ic.name AS provider " .
1025 "FROM insurance_data AS id, insurance_companies AS ic WHERE " .
1026 "ic.id = id.provider AND " .
1029 "ORDER BY id.type ASC, id.date DESC";
1031 $result = sqlStatement(
1039 $default_x12_partner = $iter['ic_x12id'];
1042 while ($row = sqlFetchArray($result)) {
1043 if (strcmp($row['type'], $prevtype) == 0) {
1046 $prevtype = $row['type'];
1047 if (strlen($row['provider']) > 0) {
1048 // This preserves any existing insurance company selection, which is
1049 // important when EOB posting has re-queued for secondary billing.
1050 $lhtml .= "<option value=\"" . attr(substr($row['type'], 0, 1) . $row['id']) . "\"";
1051 if (($count == 0 && !$iter['payer_id']) ||
$row['id'] == $iter['payer_id']) {
1052 $lhtml .= " selected";
1053 if (!is_numeric($default_x12_partner)) {
1054 $default_x12_partner = $row['ic_x12id'];
1057 $lhtml .= ">" . text($row['type']) . ": " . text($row['provider']) . "</option>";
1062 $lhtml .= "<option value='-1'>" . xlt("Unassigned") . "</option>\n";
1063 $lhtml .= "</select> \n";
1064 $lhtml .= " <span class='form-group'>X12: ";
1065 $lhtml .= "<select name='claims[" . attr($this_encounter_id) . "][partner]' style='background-color:$bgcolor'>";
1066 $x = new X12Partner();
1067 $partners = $x->_utility_array($x->x12_partner_factory());
1068 foreach ($partners as $xid => $xname) {
1069 $lhtml .= '<option label="' . attr($xname) . '" value="' . attr($xid) . '"';
1070 if ($xid == $default_x12_partner) {
1071 $lhtml .= "selected";
1073 $lhtml .= '>' . text($xname) . '</option>';
1075 $lhtml .= "<option value='-1' label='Unassigned'>" . xlt("Unassigned") . "</option>\n";
1076 $lhtml .= "</select></span>";
1079 if ($GLOBALS['notes_to_display_in_Billing'] == 1 ||
$GLOBALS['notes_to_display_in_Billing'] == 3) {
1080 $lhtml .= "<br><span style='margin-left: 20px; font-weight: bold; color: green'>" . text($enc_billing_note) . "</span>";
1082 $lhtml .= "<br>\n <div id='divid_$divnos' style='display:none'>" . text(oeFormatShortDate(substr($iter['date'], 0, 10))) . text(substr($iter['date'], 10, 6)) . " " . xlt("Encounter was coded");
1084 $query = "SELECT * FROM claims WHERE patient_id = ? AND encounter_id = ? ORDER BY version";
1085 $cres = sqlStatement(
1089 $iter['enc_encounter']
1095 while ($crow = sqlFetchArray($cres)) {
1096 $query = "SELECT id.type, ic.name " .
1097 "FROM insurance_data AS id, insurance_companies AS ic WHERE " .
1099 "id.provider = ? AND " .
1100 "id.date <= ? AND " .
1101 "ic.id = id.provider " .
1102 "ORDER BY id.type ASC, id.date DESC";
1113 if ($crow['bill_process']) {
1114 $lhtml .= "<br>\n " . text(oeFormatShortDate(substr($crow['bill_time'], 0, 10))) . text(substr($crow['bill_time'], 10, 6)) . " " . xlt("Queued for") . " " . text($irow['type']) . " " . text($crow['target']) . " " . xlt("billing to ") . text($irow['name']);
1116 } elseif ($crow['status'] < 6) {
1117 if ($crow['status'] > 1) {
1118 $lhtml .= "<br>\n " . text(oeFormatShortDate(substr($crow['bill_time'], 0, 10))) . text(substr($crow['bill_time'], 10, 6)) . " " . xlt("Marked as cleared");
1121 $lhtml .= "<br>\n " . text(oeFormatShortDate(substr($crow['bill_time'], 0, 10))) . text(substr($crow['bill_time'], 10, 6)) . " " . xlt("Re-opened");
1124 } elseif ($crow['status'] == 6) {
1125 $lhtml .= "<br>\n " . text(oeFormatShortDate(substr($crow['bill_time'], 0, 10))) . text(substr($crow['bill_time'], 10, 6)) . " " . xlt("This claim has been forwarded to next level.");
1127 } elseif ($crow['status'] == 7) {
1128 $lhtml .= "<br>\n " . text(oeFormatShortDate(substr($crow['bill_time'], 0, 10))) . text(substr($crow['bill_time'], 10, 6)) . " " . xlt("This claim has been denied.Reason:-");
1129 if ($crow['process_file']) {
1130 $code_array = explode(',', $crow['process_file']);
1131 foreach ($code_array as $code_key => $code_value) {
1132 $lhtml .= "<br>\n ";
1133 $reason_array = explode('_', $code_value);
1134 if (!isset($adjustment_reasons[$reason_array[3]])) {
1135 $lhtml .= xlt("For code") . ' [' . text($reason_array[0]) . '] ' . xlt("and modifier") . ' [' . text($reason_array[1]) . '] ' . xlt("the Denial code is") . ' [' . text($reason_array[2]) . ' ' . text($reason_array[3]) . ']';
1137 $lhtml .= xlt("For code") . ' [' . text($reason_array[0]) . '] ' . xlt("and modifier") . ' [' . text($reason_array[1]) . '] ' . xlt("the Denial Group code is") . ' [' . text($reason_array[2]) . '] ' . xlt("and the Reason is") . ':- ' . text($adjustment_reasons[$reason_array[3]]);
1141 $lhtml .= xlt("Not Specified.");
1146 if ($crow['process_time']) {
1147 $lhtml .= "<br>\n " . text(oeFormatShortDate(substr($crow['process_time'], 0, 10))) . text(substr($crow['process_time'], 10, 6)) . " " . xlt("Claim was generated to file") . " " . "<a href='get_claim_file.php?key=" . attr($crow['process_file']) . "&csrf_token_form=" . attr(urlencode(collectCsrfToken())) . "' onclick='top.restoreSession()'>" . text($crow['process_file']) . "</a>";
1152 } // end while ($crow = sqlFetchArray($cres))
1154 if ($lastcrow && $lastcrow['status'] == 4) {
1155 $lhtml .= "<br>\n " . xlt("This claim has been closed.");
1159 if ($lastcrow && $lastcrow['status'] == 5) {
1160 $lhtml .= "<br>\n " . xlt("This claim has been canceled.");
1163 } // end if ($iter['id'])
1164 } // end if ($last_encounter_id != $this_encounter_id)
1170 // Collect info related to the missing modifiers test.
1171 if ($iter['fee'] > 0) {
1173 $tmp = substr($iter['code'], 0, 3);
1174 if (($tmp == '992' ||
$tmp == '993') && empty($iter['modifier'])) {
1175 $mmo_empty_mod = true;
1182 $rhtml .= "<tr bgcolor='$bgcolor'>\n";
1184 $rhtml .= "<td width='50'>";
1185 if ($iter['id'] && $oldcode != $iter['code_type']) {
1186 $rhtml .= "<span class=text>" . text($iter['code_type']) . ": </span>";
1189 $oldcode = $iter['code_type'];
1190 $rhtml .= "</td>\n";
1193 if ($iter['id'] && $code_types[$iter['code_type']]['just']) {
1194 $js = explode(":", $iter['justify']);
1196 foreach ($js as $j) {
1198 if ($counter == 0) {
1199 $justify .= " (<b>" . text($j) . "</b>)";
1201 $justify .= " (" . text($j) . ")";
1208 $rhtml .= "<td><span class='text'>" . ($iter['code_type'] == 'COPAY' ?
text(oeFormatMoney($iter['code'])) : text($iter['code']));
1209 if ($iter['modifier']) {
1210 $rhtml .= ":" . text($iter['modifier']);
1212 $rhtml .= "</span><span style='font-size:8pt;'>$justify</span></td>\n";
1214 $rhtml .= '<td align="right"><span style="font-size:8pt;"> ';
1215 if ($iter['id'] && $iter['fee'] > 0) {
1216 $rhtml .= text(oeFormatMoney($iter['fee']));
1218 $rhtml .= "</span></td>\n";
1219 $rhtml .= '<td><span style="font-size:8pt;"> ';
1221 $rhtml .= getProviderName(empty($iter['provider_id']) ?
text($iter['enc_provider_id']) : text($iter['provider_id']));
1223 $rhtml .= "</span></td>\n";
1224 $rhtml .= '<td><span style="font-size:8pt;"> ';
1225 if ($GLOBALS['display_units_in_billing'] != 0) {
1227 $rhtml .= xlt("Units") . ":" . text($iter{"units"});
1230 $rhtml .= "</span></td>\n";
1231 $rhtml .= '<td width=100> <span style="font-size:8pt;">';
1233 $rhtml .= text(oeFormatSDFT(strtotime($iter{"date"})));
1235 $rhtml .= "</span></td>\n";
1236 // This error message is generated if the authorized check box is not checked
1237 if ($iter['id'] && $iter['authorized'] != 1) {
1238 $rhtml .= "<td><span class=alert>" . xlt("Note: This code has not been authorized.") . "</span></td>\n";
1240 $rhtml .= "<td></td>\n";
1242 if ($iter['id'] && $last_encounter_id != $this_encounter_id) {
1243 $tmpbpr = $iter['bill_process'];
1244 if ($tmpbpr == '0' && $iter['billed']) {
1247 $rhtml .= "<td><input type='checkbox' value='" . attr($tmpbpr) . "' name='claims[" . attr($this_encounter_id) . "][bill]' onclick='set_button_states()' id='CheckBoxBilling" . attr($CheckBoxBilling * 1) . "'> </td>\n";
1250 $rhtml .= "<td></td>\n";
1252 if ($last_encounter_id != $this_encounter_id) {
1255 $resMoneyGot = sqlStatement(
1256 "SELECT pay_amount AS PatientPay,date(post_time) AS date FROM ar_activity WHERE " .
1257 "pid = ? AND encounter = ? AND payer_type=0 AND account_code='PCP'",
1260 $iter['enc_encounter']
1263 // new fees screen copay gives account_code='PCP'
1264 if (sqlNumRows($resMoneyGot) > 0) {
1268 // checks whether a copay exists for the encounter and if exists displays it.
1269 while ($rowMoneyGot = sqlFetchArray($resMoneyGot)) {
1271 $PatientPay = $rowMoneyGot['PatientPay'];
1272 $date = $rowMoneyGot['date'];
1273 if ($PatientPay > 0) {
1275 $rhtml2 .= "<tr bgcolor='$bgcolor'>\n";
1277 $rhtml2 .= "<td width='50'>";
1278 $rhtml2 .= "<span class='text'>" . xlt('COPAY') . ": </span>";
1279 $rhtml2 .= "</td>\n";
1280 $rhtml2 .= "<td><span class='text'>" . text(oeFormatMoney($PatientPay)) . "</span><span style='font-size:8pt;'> </span></td>\n";
1281 $rhtml2 .= '<td align="right"><span style="font-size:8pt;"> ';
1282 $rhtml2 .= "</span></td>\n";
1283 $rhtml2 .= '<td><span style="font-size:8pt;"> ';
1284 $rhtml2 .= "</span></td>\n";
1285 $rhtml2 .= '<td><span style="font-size:8pt;"> ';
1286 $rhtml2 .= "</span></td>\n";
1287 $rhtml2 .= '<td width=100> <span style="font-size:8pt;">';
1288 $rhtml2 .= text(oeFormatSDFT(strtotime($date)));
1289 $rhtml2 .= "</span></td>\n";
1290 if ($iter['id'] && $iter['authorized'] != 1) {
1291 $rhtml2 .= "<td><span class=alert>" . xlt("Note: This copay was entered against billing that has not been authorized. Please review status.") . "</span></td>\n";
1293 $rhtml2 .= "<td></td>\n";
1295 if (!$iter['id'] && $rowcnt == 1) {
1296 $rhtml2 .= "<td><input type='checkbox' value='0' name='claims[" . attr($this_encounter_id) . "][bill]' onclick='set_button_states()' id='CheckBoxBilling" . attr($CheckBoxBilling * 1) . "'> </td>\n";
1299 $rhtml2 .= "<td></td>\n";
1305 $rhtml .= "</tr>\n";
1306 $last_encounter_id = $this_encounter_id;
1310 while ($rcount < $lcount) {
1311 $rhtml .= "<tr bgcolor='$bgcolor'><td colspan='9'></td></tr>";
1314 if (!$missing_mods_only ||
($mmo_empty_mod && $mmo_num_charges > 1)) {
1315 if ($DivPut == 'yes') {
1319 echo "<tr bgcolor='$bgcolor'>\n<td rowspan='" . attr($rcount) . "' valign='top' width='25%'>\n$lhtml</td>$rhtml\n";
1320 echo "<tr bgcolor='$bgcolor'><td colspan='9' height='5'></td></tr>\n";
1331 </div
><!--end of container div
-->
1333 <div
class="col-sm-12">
1334 <div
class="modal fade" id
="myModal" tabindex
="-1" role
="dialog" aria
-labelledby
="myModalLabel" aria
-hidden
="true">
1335 <div
class="modal-dialog oe-modal-dialog modal-lg">
1336 <div
class="modal-content oe-modal-content">
1337 <div
class="modal-header clearfix">
1338 <button type
="button" class="close" data
-dismiss
="modal" aria
-label
="Close"><span aria
-hidden
="true"
1339 style
="color:#000000; font-size:1.5em;">×
</span
>
1342 <div
class="modal-body">
1343 <iframe src
="" id
="targetiframe" style
="height:650px; width:100%; overflow-x: hidden; border:none"
1344 allowtransparency
="true"></iframe
>
1346 <div
class="modal-footer" style
="margin-top:0px;">
1347 <button
class="btn btn-link btn-cancel pull-right" data
-dismiss
="modal"
1348 type
="button"><?php
echo xlt('close'); ?
></button
>
1356 $
(document
).ready(function () {
1357 $
('#help-href').click(function () {
1358 document
.getElementById('targetiframe').src
= '';
1360 $
('#view-log-link').click(function () {
1361 document
.getElementById('targetiframe').src
= 'customize_log.php';
1366 $
('#show_hide').click(function () {
1367 var elementTitle
= $
('#show_hide').prop('title');
1368 var hideTitle
= '<?php echo xla('Click to Hide
'); ?>';
1369 var showTitle
= '<?php echo xla('Click to Show
'); ?>';
1370 $
('.hideaway').toggle('1000');
1371 $
(this
).toggleClass('fa-eye-slash fa-eye');
1372 if (elementTitle
== hideTitle
) {
1373 elementTitle
= showTitle
;
1374 } else if (elementTitle
== showTitle
) {
1375 elementTitle
= hideTitle
;
1377 $
('#show_hide').prop('title', elementTitle
);
1381 set_button_states();
1384 echo "alert('" . addslashes($alertmsg) . "');\n";
1387 $
(document
).ready(function () {
1388 $
('button[type="submit"]').click(function () {
1389 top
.restoreSession();
1390 $
(this
).attr('data-clicked', true);
1393 $
('form[name="update_form"]').submit(function (e
) {
1394 var clickedButton
= $
("button[type=submit][data-clicked='true'")[0];
1395 // clear clicked button indicator
1396 $
('button[type="submit"]').attr('data-clicked', false);
1398 if (!clickedButton || $
(clickedButton
).attr("data-open-popup") !== "true") {
1399 $
(this
).removeAttr("target");
1400 return top
.restoreSession();
1402 top
.restoreSession();
1403 var w
= window
.open('about:blank', 'Popup_Window', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=400,height=300,left = 312,top = 234');
1404 this
.target
= 'Popup_Window';
1408 $
('.datepicker').datetimepicker({
1409 <?php
$datetimepicker_timepicker = false; ?
>
1410 <?php
$datetimepicker_showseconds = false; ?
>
1411 <?php
$datetimepicker_formatInput = false; ?
>
1412 <?php
require $GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'; ?
>
1413 <?php
// can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
1418 $
(document
).ready(function () {
1419 $
('#update-tooltip').tooltip({title
: "<?php echo xla('Click Update List to display billing information filtered by the selected Current Criteria'); ?>"});
1424 // jQuery script to change expanded/centered state dynamically
1425 require_once("../expand_contract_js.php")
1428 <input type
="hidden" name
="divnos" id
="divnos" value
="<?php echo attr($divnos) ?>"/>
1429 <input type
='hidden' name
='ajax_mode' id
='ajax_mode' value
=''/>