3 * This program is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU General Public License
5 * as published by the Free Software Foundation; either version 2
6 * of the License, or (at your option) any later version.
7 * Added hooks for UB04 and End of day reporting Terry Hill 2014 terry@lillysystems.com
10 $fake_register_globals=false;
11 $sanitize_all_escapes=true;
13 require_once("../globals.php");
14 require_once("../../library/acl.inc");
15 require_once("../../custom/code_types.inc.php");
16 require_once("$srcdir/patient.inc");
17 include_once("$srcdir/../interface/reports/report.inc.php");//Criteria Section common php page
18 require_once("$srcdir/billrep.inc");
19 require_once(dirname(__FILE__
) . "/../../library/classes/OFX.class.php");
20 require_once(dirname(__FILE__
) . "/../../library/classes/X12Partner.class.php");
21 require_once("$srcdir/formatting.inc.php");
22 require_once("$srcdir/options.inc.php");
23 require_once("adjustment_reason_codes.php");
25 $EXPORT_INC = "$webserver_root/custom/BillingExport.php";
26 //echo $GLOBALS['daysheet_provider_totals'];
29 $daysheet_total = false;
30 $provider_run = false;
32 if ($GLOBALS['use_custom_daysheet'] != 0) {
34 if ($GLOBALS['daysheet_provider_totals'] == 1) {
35 $daysheet_total = true;
36 $provider_run = false;
38 if ($GLOBALS['daysheet_provider_totals'] == 0) {
39 $daysheet_total = false;
46 if (isset($_POST['mode'])) {
47 if ($_POST['mode'] == 'export') {
48 $sql = ReturnOFXSql();
50 $results = $db->Execute($sql);
52 if ($results->RecordCount() == 0) {
53 echo xlt("No Bills Found to Include in OFX Export")."<br>";
55 while(!$results->EOF
) {
56 $billings[] = $results->fields
;
59 $ofx = new OFX($billings);
60 header("Pragma: public");
62 header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
63 header("Content-Disposition: attachment; filename=openemr_ofx.ofx");
64 header("Content-Type: text/xml");
72 $from_date = isset($_POST['from_date']) ?
$_POST['from_date'] : date('Y-m-d');
73 $to_date = isset($_POST['to_date' ]) ?
$_POST['to_date' ] : '';
74 $code_type = isset($_POST['code_type']) ?
$_POST['code_type'] : 'all';
75 $unbilled = isset($_POST['unbilled' ]) ?
$_POST['unbilled' ] : 'on';
76 $my_authorized = isset($_POST["authorized"]) ?
$_POST["authorized"] : '';
79 // This tells us if only encounters that appear to be missing a "25" modifier
80 // are to be reported.
81 $missing_mods_only = (isset($_POST['missing_mods_only']) && !empty($_POST['missing_mods_only']));
83 $left_margin = isset($_POST["left_margin"]) ?
$_POST["left_margin"] : 24;
84 $top_margin = isset($_POST["top_margin"] ) ?
$_POST["top_margin" ] : 20;
86 $ofrom_date = $from_date;
88 $ocode_type = $code_type;
89 $ounbilled = $unbilled;
90 $oauthorized = $my_authorized;
95 <?php
if (function_exists('html_header_show')) html_header_show(); ?
>
96 <link rel
="stylesheet" href
="<?php echo $css_header; ?>" type
="text/css">
98 .subbtn
{ margin
-top
:3px
; margin
-bottom
:3px
; margin
-left
:2px
; margin
-right
:2px
}
102 function select_all() {
103 for($i=0;$i < document
.update_form
.length
;$i++
) {
104 $name = document
.update_form
[$i].name
;
105 if ($name.substring(0,7) == "claims[" && $name.substring($name.length
-6) == "[bill]") {
106 document
.update_form
[$i].checked
= true;
112 function set_button_states() {
113 var f
= document
.update_form
;
114 var count0
= 0; // selected and not billed or queued
115 var count1
= 0; // selected and queued
116 var count2
= 0; // selected and billed
117 for($i = 0; $i < f
.length
; ++
$i) {
119 if ($name.substring(0, 7) == "claims[" && $name.substring($name.length
-6) == "[bill]" && f
[$i].checked
== true) {
120 if (f
[$i].value
== '0') ++count0
;
121 else if (f
[$i].value
== '1' || f
[$i].value
== '5') ++count1
;
126 var can_generate
= (count0
> 0 || count1
> 0 || count2
> 0);
127 var can_mark
= (count1
> 0 || count0
> 0 || count2
> 0);
128 var can_bill
= (count0
== 0 && count1
== 0 && count2
> 0);
130 <?php
if (file_exists($EXPORT_INC)) { ?
>
131 f
.bn_external
.disabled
= !can_generate
;
133 // f.bn_hcfa_print.disabled = !can_generate;
134 // f.bn_hcfa.disabled = !can_generate;
135 // f.bn_ub92_print.disabled = !can_generate;
136 // f.bn_ub92.disabled = !can_generate;
137 f
.bn_x12
.disabled
= !can_generate
;
138 <?php
if ($GLOBALS['support_encounter_claims']) { ?
>
139 f
.bn_x12_encounter
.disabled
= !can_generate
;
141 f
.bn_process_hcfa
.disabled
= !can_generate
;
142 f
.bn_hcfa_txt_file
.disabled
= !can_generate
;
143 // f.bn_electronic_file.disabled = !can_bill;
144 f
.bn_reopen
.disabled
= !can_bill
;
146 f
.bn_mark
.disabled
= !can_mark
;
149 // Process a click to go to an encounter.
150 function toencounter(pid
, pubpid
, pname
, enc
, datestr
, dobstr
) {
151 top
.restoreSession();
152 encurl
= 'patient_file/encounter/encounter_top.php?set_encounter=' + enc +
'&pid=' + pid
;
153 parent
.left_nav
.setPatient(pname
,pid
,pubpid
,'',dobstr
);
154 <?php
if ($GLOBALS['new_tabs_layout']) { ?
>
155 parent
.left_nav
.setEncounter(datestr
, enc
, 'enc');
156 parent
.left_nav
.loadFrame('enc2', 'enc', encurl
);
158 var othername
= (window
.name
== 'RTop') ?
'RBot' : 'RTop';
159 parent
.left_nav
.setEncounter(datestr
, enc
, othername
);
160 parent
.frames
[othername
].location
.href
= '../' + encurl
;
163 // Process a click to go to an patient.
164 function topatient(pid
, pubpid
, pname
, enc
, datestr
, dobstr
) {
165 top
.restoreSession();
166 paturl
= 'patient_file/summary/demographics_full.php?pid=' + pid
;
167 parent
.left_nav
.setPatient(pname
,pid
,pubpid
,'',dobstr
);
168 <?php
if ($GLOBALS['new_tabs_layout']) { ?
>
169 parent
.left_nav
.loadFrame('ens1', 'enc', 'patient_file/history/encounters.php?pid=' + pid
);
170 parent
.left_nav
.loadFrame('dem1', 'pat', paturl
);
172 var othername
= (window
.name
== 'RTop') ?
'RBot' : 'RTop';
173 parent
.frames
[othername
].location
.href
= '../' + paturl
;
177 <script language
="javascript" type
="text/javascript">
178 EncounterDateArray
=new Array;
179 CalendarCategoryArray
=new Array;
180 EncounterIdArray
=new Array;
181 EncounterNoteArray
=new Array;
182 function SubmitTheScreen()
183 {//Action on Update List link
184 if(!ProcessBeforeSubmitting())
186 top
.restoreSession();
187 document
.the_form
.mode
.value
='change';
188 document
.the_form
.target
='_self';
189 document
.the_form
.action
='billing_report.php';
190 document
.the_form
.submit();
193 function SubmitTheScreenPrint()
194 {//Action on View Printable Report link
195 if(!ProcessBeforeSubmitting())
197 top
.restoreSession();
198 document
.the_form
.target
='new';
199 document
.the_form
.action
='print_billing_report.php';
200 document
.the_form
.submit();
203 function SubmitTheEndDayPrint()
204 {//Action on View End of Day Report link
205 if(!ProcessBeforeSubmitting())
207 top
.restoreSession();
208 document
.the_form
.target
='new';
209 <?php
if ($GLOBALS['use_custom_daysheet'] == 1) { ?
>
210 document
.the_form
.action
='print_daysheet_report_num1.php';
212 <?php
if ($GLOBALS['use_custom_daysheet'] == 2) { ?
>
213 document
.the_form
.action
='print_daysheet_report_num2.php';
215 <?php
if ($GLOBALS['use_custom_daysheet'] == 3) { ?
>
216 document
.the_form
.action
='print_daysheet_report_num3.php';
218 document
.the_form
.submit();
221 function SubmitTheScreenExportOFX()
222 {//Action on Export OFX link
223 if(!ProcessBeforeSubmitting())
225 top
.restoreSession();
226 document
.the_form
.mode
.value
='export';
227 document
.the_form
.target
='_self';
228 document
.the_form
.action
='billing_report.php';
229 document
.the_form
.submit();
232 function TestExpandCollapse()
233 {//Checks whether the Expand All, Collapse All labels need to be placed.If any result set is there these will be placed.
235 for(i
=1;i
<=document
.getElementById("divnos").value
;i++
)
237 var ele
= document
.getElementById("divid_"+i
);
246 if(document
.getElementById("ExpandAll"))
248 document
.getElementById("ExpandAll").innerHTML
='';
249 document
.getElementById("CollapseAll").innerHTML
='';
253 function expandcollapse(atr
){
254 if(atr
== "expand") {//Called in the Expand All, Collapse All links(All items will be expanded or collapsed)
255 for(i
=1;i
<=document
.getElementById("divnos").value
;i++
){
256 var mydivid
="divid_"+i
;var myspanid
="spanid_"+i
;
257 var ele
= document
.getElementById(mydivid
); var text
= document
.getElementById(myspanid
);
260 ele
.style
.display
= "inline";text
.innerHTML
= "<?php echo htmlspecialchars(xl('Collapse'), ENT_QUOTES); ?>";
265 for(i
=1;i
<=document
.getElementById("divnos").value
;i++
){
266 var mydivid
="divid_"+i
;var myspanid
="spanid_"+i
;
267 var ele
= document
.getElementById(mydivid
); var text
= document
.getElementById(myspanid
);
270 ele
.style
.display
= "none"; text
.innerHTML
= "<?php echo htmlspecialchars(xl('Expand'), ENT_QUOTES); ?>";
276 function divtoggle(spanid
, divid
) {//Called in the Expand, Collapse links(This is for a single item)
277 var ele
= document
.getElementById(divid
);
280 var text
= document
.getElementById(spanid
);
281 if(ele
.style
.display
== "inline") {
282 ele
.style
.display
= "none";
283 text
.innerHTML
= "<?php echo htmlspecialchars(xl('Expand'), ENT_QUOTES); ?>";
286 ele
.style
.display
= "inline";
287 text
.innerHTML
= "<?php echo htmlspecialchars(xl('Collapse'), ENT_QUOTES); ?>";
291 function MarkAsCleared(Type
)
293 CheckBoxBillingCount
=0;
294 for (var CheckBoxBillingIndex
=0; ; CheckBoxBillingIndex++
)
296 CheckBoxBillingObject
=document
.getElementById('CheckBoxBilling'+CheckBoxBillingIndex
);
297 if(!CheckBoxBillingObject
)
299 if(CheckBoxBillingObject
.checked
)
301 ++CheckBoxBillingCount
;
306 Message
='<?php echo htmlspecialchars( xl('After saving your batch
, click
[View Log
] to check
for errors
.'), ENT_QUOTES); ?>';
310 Message
='<?php echo htmlspecialchars( xl('After saving the PDF
, click
[View Log
] to check
for errors
.'), ENT_QUOTES); ?>';
314 Message
='<?php echo htmlspecialchars( xl('After saving the TEXT
file(s
), click
[View Log
] to check
for errors
.'), ENT_QUOTES); ?>';
316 if(confirm(Message +
"\n\n\n<?php echo addslashes( xl('Total') ); ?>" +
' ' + CheckBoxBillingCount +
' ' +
"<?php echo addslashes( xl('Selected') ); ?>\n" +
317 "<?php echo addslashes( xl('Would You Like them to be Marked as Cleared.') ); ?>"))
319 document
.getElementById('HiddenMarkAsCleared').value
='yes';
323 document
.getElementById('HiddenMarkAsCleared').value
='';
327 <?php
include_once("$srcdir/../interface/reports/report.script.php"); ?
><!-- Criteria Section common javascript page
-->
328 <!-- ================================================== -->
329 <!-- =============Included
for Insurance ajax criteria
==== -->
330 <!-- ================================================== -->
331 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-3-2/index.js"></script
>
332 <?php
include_once("{$GLOBALS['srcdir']}/ajax/payment_ajax_jav.inc.php"); ?
>
333 <script type
="text/javascript" src
="../../library/js/common.js"></script
>
335 #ajax_div_insurance {
338 background
-color
: #FBFDD0;
339 border
: 1px solid
#ccc;
343 <script language
="javascript" type
="text/javascript">
344 document
.onclick
=TakeActionOnHide
;
346 <!-- ================================================== -->
347 <!-- =============Included
for Insurance ajax criteria
==== -->
348 <!-- ================================================== -->
350 <body
class="body_top" onLoad
="TestExpandCollapse()">
352 <p style
='margin-top:5px;margin-bottom:5px;margin-left:5px'>
354 <font
class='title'><?php
echo xlt('Billing Manager') ?
></font
>
358 <form name
='the_form' method
='post' action
='billing_report.php' onsubmit
='return top.restoreSession()' style
="display:inline">
360 <style type
="text/css">@import
url(../../library
/dynarch_calendar
.css
);</style
>
361 <script type
="text/javascript" src
="../../library/dialog.js"></script
>
362 <script type
="text/javascript" src
="../../library/textformat.js"></script
>
363 <script type
="text/javascript" src
="../../library/dynarch_calendar.js"></script
>
364 <?php
include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?
>
365 <script type
="text/javascript" src
="../../library/dynarch_calendar_setup.js"></script
>
366 <script language
='JavaScript'>
370 <input type
='hidden' name
='mode' value
='change'>
371 <!-- ============================================================================================================================================= -->
372 <!-- Criteria section Starts
-->
373 <!-- ============================================================================================================================================= -->
375 //The following are the search criteria per page.All the following variable which ends with 'Master' need to be filled properly.
376 //Each item is seperated by a comma(,).
377 //$ThisPageSearchCriteriaDisplayMaster ==>It is the display on screen for the set of criteria.
378 //$ThisPageSearchCriteriaKeyMaster ==>Corresponding database fields in the same order.
379 //$ThisPageSearchCriteriaDataTypeMaster ==>Corresponding data type in the same order.
380 $ThisPageSearchCriteriaDisplayRadioMaster=array();
381 $ThisPageSearchCriteriaRadioKeyMaster=array();
382 $ThisPageSearchCriteriaQueryDropDownMaster=array();
383 $ThisPageSearchCriteriaQueryDropDownMasterDefault=array();
384 $ThisPageSearchCriteriaQueryDropDownMasterDefaultKey=array();
385 $ThisPageSearchCriteriaIncludeMaster=array();
388 $ThisPageSearchCriteriaDisplayMaster= array( xl("Date of Service"),xl("Date of Entry"),xl("Date of Billing"),xl("Claim Type"),xl("Patient Name"),xl("Patient Id"),xl("Insurance Company"),xl("Encounter"),xl("Whether Insured"),xl("Charge Coded"),xl("Billing Status"),xl("Authorization Status"),xl("Last Level Billed"),xl("X12 Partner"),xl("User") );
389 $ThisPageSearchCriteriaKeyMaster="form_encounter.date,billing.date,claims.process_time,claims.target,patient_data.fname,".
390 "form_encounter.pid,claims.payer_id,form_encounter.encounter,insurance_data.provider,billing.id,billing.billed,".
391 "billing.authorized,form_encounter.last_level_billed,billing.x12_partner_id,billing.user";
392 $ThisPageSearchCriteriaDataTypeMaster="datetime,datetime,datetime,radio,text_like,".
393 "text,include,text,radio,radio,radio,".
394 "radio_like,radio,query_drop_down,text";
399 $ThisPageSearchCriteriaDisplayMaster= array( xl("Date of Service"),xl("Date of Entry"),xl("Date of Billing"),xl("Claim Type"),xl("Patient Name"),xl("Patient Id"),xl("Insurance Company"),xl("Encounter"),xl("Whether Insured"),xl("Charge Coded"),xl("Billing Status"),xl("Authorization Status"),xl("Last Level Billed"),xl("X12 Partner") );
400 $ThisPageSearchCriteriaKeyMaster="form_encounter.date,billing.date,claims.process_time,claims.target,patient_data.fname,".
401 "form_encounter.pid,claims.payer_id,form_encounter.encounter,insurance_data.provider,billing.id,billing.billed,".
402 "billing.authorized,form_encounter.last_level_billed,billing.x12_partner_id";
403 $ThisPageSearchCriteriaDataTypeMaster="datetime,datetime,datetime,radio,text_like,".
404 "text,include,text,radio,radio,radio,".
405 "radio_like,radio,query_drop_down";
410 //The below section is needed if there is any 'radio' or 'radio_like' type in the $ThisPageSearchCriteriaDataTypeMaster
411 //$ThisPageSearchCriteriaDisplayRadioMaster,$ThisPageSearchCriteriaRadioKeyMaster ==>For each radio data type this pair comes.
412 //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.
413 $ThisPageSearchCriteriaDisplayRadioMaster[1] = array( xl("All"),xl("eClaims"),xl("Paper") );//Display Value
414 $ThisPageSearchCriteriaRadioKeyMaster[1]="all,standard,hcfa";//Key
415 $ThisPageSearchCriteriaDisplayRadioMaster[2]= array( xl("All"),xl("Insured"),xl("Non-Insured") );//Display Value
416 $ThisPageSearchCriteriaRadioKeyMaster[2]="all,1,0";//Key
417 $ThisPageSearchCriteriaDisplayRadioMaster[3]= array( xl("All"),xl("Coded"),xl("Not Coded") );//Display Value
418 $ThisPageSearchCriteriaRadioKeyMaster[3]="all,not null,null";//Key
419 $ThisPageSearchCriteriaDisplayRadioMaster[4]= array( xl("All"),xl("Unbilled"),xl("Billed"),xl("Denied") );//Display Value
420 $ThisPageSearchCriteriaRadioKeyMaster[4]="all,0,1,7";//Key
421 $ThisPageSearchCriteriaDisplayRadioMaster[5]= array( xl("All"),xl("Authorized"),xl("Unauthorized") );
422 $ThisPageSearchCriteriaRadioKeyMaster[5]="%,1,0";
423 $ThisPageSearchCriteriaDisplayRadioMaster[6]= array( xl("All"),xl("None"),xl("Ins 1"),xl("Ins 2 or Ins 3") );
424 $ThisPageSearchCriteriaRadioKeyMaster[6]="all,0,1,2";
425 //The below section is needed if there is any 'query_drop_down' type in the $ThisPageSearchCriteriaDataTypeMaster
426 $ThisPageSearchCriteriaQueryDropDownMaster[1]="SELECT name,id FROM x12_partners;";
427 $ThisPageSearchCriteriaQueryDropDownMasterDefault[1]= xl("All");//Only one item will be here
428 $ThisPageSearchCriteriaQueryDropDownMasterDefaultKey[1]="all";//Only one item will be here
429 //The below section is needed if there is any 'include' type in the $ThisPageSearchCriteriaDataTypeMaster
430 //Function name is added here.Corresponding include files need to be included in the respective pages as done in this page.
431 //It is labled(Included for Insurance ajax criteria)(Line:-279-299).
432 $ThisPageSearchCriteriaIncludeMaster[1]="InsuranceCompanyDisplay";//This is php function defined in the file 'report.inc.php'
434 if(!isset($_REQUEST['mode']))//default case
436 $_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")."')";
437 $_REQUEST['final_this_page_criteria'][1]="billing.billed = '0'";
439 $_REQUEST['final_this_page_criteria_text'][0]=xl("Date of Service = Today");
440 $_REQUEST['final_this_page_criteria_text'][1]=xl("Billing Status = Unbilled");
442 $_REQUEST['date_master_criteria_form_encounter_date']="today";
443 $_REQUEST['master_from_date_form_encounter_date']=date("Y-m-d");
444 $_REQUEST['master_to_date_form_encounter_date']=date("Y-m-d");
446 $_REQUEST['radio_billing_billed']=0;
450 <table width
='100%' border
="0" cellspacing
="0" cellpadding
="0">
452 <td width
="25%"> 
;</td
>
454 <?php
include_once("$srcdir/../interface/reports/criteria.tab.php"); ?
>
458 // ============================================================================================================================================= -->
459 // Criteria section Ends -->
460 // ============================================================================================================================================= -->
463 <table width
="100%" border
="0" cellspacing
="0" cellpadding
="0">
465 <td width
="15%"> 
;</td
>
466 <td width
="85%"><span
class='text'><a onClick
="javascript:return SubmitTheScreen();" href
="#" class=link_submit
>[<?php
echo xlt('Update List') ?
>]</a
>
468 <a onClick
="javascript:return SubmitTheScreenExportOFX();" href
="#" class='link_submit'><?php
echo '[' . xlt('Export OFX') .']' ?
></a
></span
> </td
>
472 <td
><a onClick
="javascript:return SubmitTheScreenPrint();" href
="#"
473 class='link_submit' ><?php
echo '['. xlt('View Printable Report').']' ?
></a
></td
>
476 <?php
if ($daysheet) { ?
>
479 <td
><a onClick
="javascript:return SubmitTheEndDayPrint();" href
="#"
480 class='link_submit' ><?php
echo '['.xlt('End Of Day Report').']' ?
></a
>
481 <?php
if ($daysheet_total) { ?
>
482 <span
class=text
><?php
echo xlt('Totals'); ?
> </span
>
483 <input type
=checkbox name
="end_of_day_totals_only" value
="1" <?php
if ($obj['end_of_day_totals_only'] === '1') echo "checked";?
>>
485 <?php
if ($provider_run) { ?
>
486 <span
class=text
><?php
echo xlt('Provider'); ?
> </span
>
487 <input type
=checkbox name
="end_of_day_provider_only" value
="1" <?php
if ($obj['end_of_day_provider_only'] === '1') echo "checked";?
>>
495 <?php
if (! file_exists($EXPORT_INC)) { ?
>
497 <a href
="javascript:top.restoreSession();document.the_form.mode.value='process';document.the_form.submit()" class="link_submit"
498 title
="Process all queued bills to create electronic data (and print if requested)"><?php
echo '['. xlt('Start Batch Processing') .']' ?
></a
>
501 <a href
='#' id
="view-log-link" class='link_submit'
502 title
='<?php xla('See messages from the last set of generated claims
'); ?>'><?php
echo '['. xlt('View Log') .']'?
></a
>
508 <td
><a href
="javascript:select_all()" class="link_submit"><?php
echo '['. xlt('Select All') .']'?
></a
></td
>
516 <table width
='100%' border
="0" cellspacing
="0" cellpadding
="0" >
524 <form name
='update_form' method
='post' action
='billing_process.php' onsubmit
='return top.restoreSession()' style
="display:inline">
526 <span
class='text' style
="display:inline">
527 <?php
if (file_exists($EXPORT_INC)) { ?
>
528 <input type
="submit" data
-open
-popup
="true" class="subbtn" name
="bn_external" value
="Export Billing" title
="<?php echo xla('Export to external billing system') ?>">
529 <input type
="submit" data
-open
-popup
="true" class="subbtn" name
="bn_mark" value
="Mark as Cleared" title
="<?php echo xla('Mark as billed but skip billing') ?>">
532 <input type
="submit" class="subbtn" name
="bn_hcfa_print" value
="Queue HCFA & Print" title
="<?php echo xla('Queue for HCFA batch processing and printing') ?>">
533 <input type
="submit" class="subbtn" name
="bn_hcfa" value
="Queue HCFA" title
="<?php echo xla('Queue for HCFA batch processing')?>">
534 <input type
="submit" class="subbtn" name
="bn_ub92_print" value
="Queue UB92 & Print" title
="<?php echo xla('Queue for UB-92 batch processing and printing')?>">
535 <input type
="submit" class="subbtn" name
="bn_ub92" value
="Queue UB92" title
="<?php echo xla('Queue for UB-92 batch processing')?>">
537 <input type
="submit" class="subbtn" name
="bn_x12" value
="<?php echo xla('Generate X12')?>"
538 title
="<?php echo xla('Generate and download X12 batch')?>"
539 onclick
="MarkAsCleared(1)">
540 <?php
if ($GLOBALS['support_encounter_claims']) { ?
>
541 <input type
="submit" class="subbtn" name
="bn_x12_encounter" value
="<?php echo xla('Generate X12 Encounter')?>"
542 title
="<?php echo xla('Generate and download X12 encounter claim batch')?>"
543 onclick
="MarkAsCleared(1)">
545 <input type
="submit" class="subbtn" style
="width:175px;" name
="bn_process_hcfa" value
="<?php echo xla('Generate CMS 1500 PDF')?>"
546 title
="<?php echo xla('Generate and download CMS 1500 paper claims')?>"
547 onclick
="MarkAsCleared(2)">
548 <input type
="submit" class="subbtn" style
="width:175px;" name
="bn_hcfa_txt_file" value
="<?php echo xla('Generate CMS 1500 TEXT')?>"
549 title
="<?php echo xla('Making batch text files for uploading to Clearing House and will mark as billed')?>"
550 onclick
="MarkAsCleared(3)">
551 <input type
="submit" data
-open
-popup
="true" class="subbtn" name
="bn_mark" value
="<?php echo xla('Mark as Cleared')?>" title
="<?php echo xla('Post to accounting and mark as billed')?>">
552 <input type
="submit" data
-open
-popup
="true" class="subbtn" name
="bn_reopen" value
="<?php echo xla('Re-Open')?>" title
="<?php echo xla('Mark as not billed')?>">
554 <input type
="submit" class="subbtn" name
="bn_electronic_file" value
="Make Electronic Batch & Clear" title
="<?php echo xla('Download billing file, post to accounting and mark as billed')?>">
557 <?php
echo xlt('CMS 1500 Margins'); ?
>:
558  
;<?php
echo xlt('Left'); ?
>:
559 <input type
='text' size
='2' name
='left_margin'
560 value
='<?php echo attr($left_margin); ?>'
561 title
='<?php echo xla('HCFA left margin in points
'); ?>' />
562  
;<?php
echo xlt('Top'); ?
>:
563 <input type
='text' size
='2' name
='top_margin'
564 value
='<?php echo attr($top_margin); ?>'
565 title
='<?php echo xla('HCFA top margin in points
'); ?>' />
570 <input type
='hidden' name
='HiddenMarkAsCleared' id
='HiddenMarkAsCleared' value
="" />
571 <input type
='hidden' name
='mode' value
="bill" />
572 <input type
='hidden' name
='authorized' value
="<?php echo attr($my_authorized); ?>" />
573 <input type
='hidden' name
='unbilled' value
="<?php echo attr($unbilled); ?>" />
574 <input type
='hidden' name
='code_type' value
="%" />
575 <input type
='hidden' name
='to_date' value
="<?php echo attr($to_date); ?>" />
576 <input type
='hidden' name
='from_date' value
="<?php echo attr($from_date); ?>" />
579 if ($my_authorized == "on" ) {
580 $my_authorized = "1";
582 $my_authorized = "%";
584 if ($unbilled == "on") {
589 $list = getBillsListBetween("%");
592 <input type
='hidden' name
='bill_list' value
="<?php echo attr($list); ?>" />
594 <!-- new form
for uploading
-->
597 if (!isset($_POST["mode"])) {
598 if (!isset($_POST["from_date"])) {
599 $from_date = date("Y-m-d");
601 $from_date = $_POST["from_date"];
603 if (empty($_POST["to_date"])) {
606 $to_date = $_POST["to_date"];
608 if (!isset($_POST["code_type"])) {
611 $code_type = $_POST["code_type"];
613 if (!isset($_POST["unbilled"])) {
616 $unbilled = $_POST["unbilled"];
618 if (!isset($_POST["authorized"])) {
619 $my_authorized = "on";
621 $my_authorized = $_POST["authorized"];
624 $from_date = $_POST["from_date"];
625 $to_date = $_POST["to_date"];
626 $code_type = $_POST["code_type"];
627 $unbilled = $_POST["unbilled"];
628 $my_authorized = $_POST["authorized"];
631 if ($my_authorized == "on" ) {
632 $my_authorized = "1";
634 $my_authorized = "%";
637 if ($unbilled == "on") {
643 if (isset($_POST["mode"]) && $_POST["mode"] == "bill") {
644 billCodesList($list);
648 <table border
="0" cellspacing
="0" cellpadding
="0" width
="100%">
652 if ($ret = getBillsBetween("%"))
657 <tr
><td colspan
='9' align
="right" ><table width
="250" border
="0" cellspacing
="0" cellpadding
="0">
659 <td width
="100" id
='ExpandAll'><a onclick
="expandcollapse('expand');" class='small' href
="JavaScript:void(0);"><?php
echo '('.htmlspecialchars( xl('Expand All'), ENT_QUOTES
).')' ?
></a
></td
>
660 <td width
="100" id
='CollapseAll'><a onclick
="expandcollapse('collapse');" class='small' href
="JavaScript:void(0);"><?php
echo '('.htmlspecialchars( xl('Collapse All'), ENT_QUOTES
).')' ?
></a
></td
>
661 <td width
="50"> 
;</td
>
669 $last_encounter_id = "";
677 $mmo_empty_mod = false;
678 $mmo_num_charges = 0;
680 foreach ($ret as $iter) {
682 // We include encounters here that have never been billed. However
683 // if it had no selected billing items but does have non-selected
684 // billing items, then it is not of interest.
686 $res = sqlQuery("SELECT count(*) AS count FROM billing WHERE " .
687 "encounter = ? AND " .
689 "activity = 1", array($iter['enc_encounter'],$iter['enc_pid']) );
690 if ($res['count'] > 0) continue;
693 $this_encounter_id = $iter['enc_pid'] . "-" . $iter['enc_encounter'];
695 if ($last_encounter_id != $this_encounter_id) {
697 // This dumps all HTML for the previous encounter.
700 while ($rcount < $lcount) {
701 $rhtml .= "<tr bgcolor='$bgcolor'><td colspan='8'></td></tr>";
704 // This test handles the case where we are only listing encounters
705 // that appear to have a missing "25" modifier.
706 if (!$missing_mods_only ||
($mmo_empty_mod && $mmo_num_charges > 1)) {
712 echo "<tr bgcolor='$bgcolor'>\n<td rowspan='$rcount' valign='top'>\n$lhtml</td>$rhtml\n";
713 echo "<tr bgcolor='$bgcolor'><td colspan='9' height='5'></td></tr>\n\n";
720 $mmo_empty_mod = false;
721 $mmo_num_charges = 0;
723 // If there are ANY unauthorized items in this encounter and this is
724 // the normal case of viewing only authorized billing, then skip the
728 if ($my_authorized == '1') {
729 $res = sqlQuery("select count(*) as count from billing where " .
730 "encounter = ? and " .
732 "activity = 1 and authorized = 0", array($iter['enc_encounter'],$iter['enc_pid']) );
733 if ($res['count'] > 0) {
735 $last_encounter_id = $this_encounter_id;
740 $name = getPatientData($iter['enc_pid'], "fname, mname, lname, pubpid, billing_note, DATE_FORMAT(DOB,'%Y-%m-%d') as DOB_YMD");
742 # Check if patient has primary insurance and a subscriber exists for it.
743 # If not we will highlight their name in red.
744 # TBD: more checking here.
746 $res = sqlQuery("select count(*) as count from insurance_data where " .
748 "type='primary' and " .
749 "subscriber_lname is not null and " .
750 "subscriber_lname != '' limit 1", array($iter['enc_pid']) );
751 $namecolor = ($res['count'] > 0) ?
"black" : "#ff7777";
753 $bgcolor = "#" . (($encount & 1) ?
"ddddff" : "ffdddd");
754 echo "<tr bgcolor='$bgcolor'><td colspan='9' height='5'></td></tr>\n";
759 $ptname = $name['fname'] . " " . $name['lname'];
760 $raw_encounter_date = date("Y-m-d", strtotime($iter['enc_date']));
761 $billing_note = $name['billing_note'];
762 // Add Encounter Date to display with "To Encounter" button 2/17/09 JCH
763 $lhtml .= " <span class=bold><font color='$namecolor'>". text($ptname) .
764 "</font></span><span class=small> (" . text($iter['enc_pid']) . "-" .
765 text($iter['enc_encounter']) . ")</span>";
767 //Encounter details are stored to javacript as array.
768 $result4 = sqlStatement("SELECT fe.encounter,fe.date,fe.billing_note,openemr_postcalendar_categories.pc_catname FROM form_encounter AS fe ".
769 " left join openemr_postcalendar_categories on fe.pc_catid=openemr_postcalendar_categories.pc_catid WHERE fe.pid = ? order by fe.date desc", array($iter['enc_pid']) );
770 if(sqlNumRows($result4)>0)
772 <script language
='JavaScript'>
774 EncounterDateArray
[<?php
echo attr($iter['enc_pid']); ?
>]=new Array;
775 CalendarCategoryArray
[<?php
echo attr($iter['enc_pid']); ?
>]=new Array;
776 EncounterIdArray
[<?php
echo attr($iter['enc_pid']); ?
>]=new Array;
777 EncounterNoteArray
[<?php
echo attr($iter['enc_pid']); ?
>]=new Array;
779 while($rowresult4 = sqlFetchArray($result4))
782 EncounterIdArray
[<?php
echo attr($iter['enc_pid']); ?
>][Count
]='<?php echo htmlspecialchars($rowresult4['encounter
'], ENT_QUOTES); ?>';
783 EncounterDateArray
[<?php
echo attr($iter['enc_pid']); ?
>][Count
]='<?php echo htmlspecialchars(oeFormatShortDate(date("Y-m-d", strtotime($rowresult4['date
']))), ENT_QUOTES); ?>';
784 CalendarCategoryArray
[<?php
echo attr($iter['enc_pid']); ?
>][Count
]='<?php echo htmlspecialchars( xl_appt_category($rowresult4['pc_catname
']), ENT_QUOTES); ?>';
785 EncounterNoteArray
[<?php
echo attr($iter['enc_pid']); ?
>][Count
]='<?php echo htmlspecialchars($rowresult4['billing_note
'], ENT_QUOTES); ?>';
788 $enc_billing_note = $rowresult4['billing_note'];
794 // Not sure why the next section seems to do nothing except post "To Encounter" button 2/17/09 JCH
795 $lhtml .= " <a class=\"link_submit\" " .
796 "href=\"javascript:window.toencounter(" . $iter['enc_pid'] .
797 ",'" . addslashes($name['pubpid']) .
798 "','" . addslashes($ptname) . "'," . $iter['enc_encounter'] .
799 ",'" . oeFormatShortDate($raw_encounter_date) . "',' " .
800 xl('DOB') . ": " . oeFormatShortDate($name['DOB_YMD']) . " " . xl('Age') . ": " . getPatientAge($name['DOB_YMD']) . "');
801 top.window.parent.left_nav.setPatientEncounter(EncounterIdArray[" . $iter['enc_pid'] . "],EncounterDateArray[" . $iter['enc_pid'] .
802 "], CalendarCategoryArray[" . $iter['enc_pid'] . "])\">[" .
803 xlt('To Enctr') . " " . text(oeFormatShortDate($raw_encounter_date)) . "]</a>";
805 // Changed "To xxx" buttons to allow room for encounter date display 2/17/09 JCH
806 $lhtml .= " <a class=\"link_submit\" " .
807 "href=\"javascript:window.topatient(" . $iter['enc_pid'] .
808 ",'" . addslashes($name['pubpid']) .
809 "','" . addslashes($ptname) . "'," . $iter['enc_encounter'] .
810 ",'" . oeFormatShortDate($raw_encounter_date) . "',' " .
811 xl('DOB') . ": " . oeFormatShortDate($name['DOB_YMD']) . " " . xl('Age') . ": " . getPatientAge($name['DOB_YMD']) . "');
812 top.window.parent.left_nav.setPatientEncounter(EncounterIdArray[" . $iter['enc_pid'] . "],EncounterDateArray[" . $iter['enc_pid'] .
813 "], CalendarCategoryArray[" . $iter['enc_pid'] . "])\">[" . xlt('To Dems') . "]</a>";
815 $lhtml .= " <a onclick='divtoggle(\"spanid_$divnos\",\"divid_$divnos\");' class='small' id='aid_$divnos' href=\"JavaScript:void(0);".
816 "\">(<span id=spanid_$divnos class=\"indicator\">" . htmlspecialchars( xl('Expand'), ENT_QUOTES
) . '</span>)<br></a>';
817 if($GLOBALS['notes_to_display_in_Billing'] == 2 ||
$GLOBALS['notes_to_display_in_Billing'] == 3){
818 $lhtml .= '<span style="margin-left: 20px; font-weight bold; color: red">'.text($billing_note).'</span>';
824 $lhtml .= "<br />\n";
825 $lhtml .= " <span class=text>Bill: ";
826 $lhtml .= "<select name='claims[" . attr($this_encounter_id) . "][payer]' style='background-color:$bgcolor'>";
828 $query = "SELECT id.provider AS id, id.type, id.date, " .
829 "ic.x12_default_partner_id AS ic_x12id, ic.name AS provider " .
830 "FROM insurance_data AS id, insurance_companies AS ic WHERE " .
831 "ic.id = id.provider AND " .
834 "ORDER BY id.type ASC, id.date DESC";
836 $result = sqlStatement($query, array($iter['enc_pid'],$raw_encounter_date) );
838 $default_x12_partner = $iter['ic_x12id'];
841 while ($row = sqlFetchArray($result)) {
842 if (strcmp($row['type'], $prevtype) == 0) continue;
843 $prevtype = $row['type'];
844 if (strlen($row['provider']) > 0) {
845 // This preserves any existing insurance company selection, which is
846 // important when EOB posting has re-queued for secondary billing.
847 $lhtml .= "<option value=\"" . attr(substr($row['type'],0,1).$row['id']) . "\"";
848 if (($count == 0 && !$iter['payer_id']) ||
$row['id'] == $iter['payer_id']) {
849 $lhtml .= " selected";
850 if (!is_numeric($default_x12_partner)) $default_x12_partner = $row['ic_x12id'];
852 $lhtml .= ">" . text($row['type']) . ": " . text($row['provider']) . "</option>";
857 $lhtml .= "<option value='-1'>" . xlt("Unassigned") . "</option>\n";
858 $lhtml .= "</select> \n";
859 $lhtml .= "<select name='claims[" . attr($this_encounter_id) . "][partner]' style='background-color:$bgcolor'>";
860 $x = new X12Partner();
861 $partners = $x->_utility_array($x->x12_partner_factory());
862 foreach ($partners as $xid => $xname) {
863 $lhtml .= '<option label="' . attr($xname) . '" value="' . attr($xid) .'"';
864 if ($xid == $default_x12_partner) {
865 $lhtml .= "selected";
867 $lhtml .= '>' . text($xname) . '</option>';
869 $lhtml .= "</select>";
872 if($GLOBALS['notes_to_display_in_Billing'] == 1 ||
$GLOBALS['notes_to_display_in_Billing'] == 3) {
873 $lhtml .= "<br><span style='margin-left: 20px; font-weight bold; color: red'>".text($enc_billing_note)."</span>";
875 $lhtml .= "<br>\n <div id='divid_$divnos' style='display:none'>" . text(oeFormatShortDate(substr($iter['date'], 0, 10)))
876 . text(substr($iter['date'], 10, 6)) . " " . xlt("Encounter was coded");
878 $query = "SELECT * FROM claims WHERE " .
879 "patient_id = ? AND " .
880 "encounter_id = ? " .
882 $cres = sqlStatement($query, array($iter['enc_pid'],$iter['enc_encounter']) );
886 while ($crow = sqlFetchArray($cres)) {
887 $query = "SELECT id.type, ic.name " .
888 "FROM insurance_data AS id, insurance_companies AS ic WHERE " .
890 "id.provider = ? AND " .
891 "id.date <= ? AND " .
892 "ic.id = id.provider " .
893 "ORDER BY id.type ASC, id.date DESC";
895 $irow= sqlQuery($query, array($iter['enc_pid'],$crow['payer_id'],$raw_encounter_date) );
897 if ($crow['bill_process']) {
898 $lhtml .= "<br>\n " .
899 text(oeFormatShortDate(substr($crow['bill_time'], 0, 10))) .
900 text(substr($crow['bill_time'], 10, 6)) . " " .
901 xlt("Queued for") . " " . text($irow['type']) . " " . text($crow['target']) . " " .
902 xlt("billing to ") . text($irow['name']);
905 else if ($crow['status'] < 6) {
906 if ($crow['status'] > 1) {
907 $lhtml .= "<br>\n " .
908 text(oeFormatShortDate(substr($crow['bill_time'], 0, 10))) .
909 text(substr($crow['bill_time'], 10, 6)) . " " .
910 htmlspecialchars( xl("Marked as cleared"), ENT_QUOTES
);
914 $lhtml .= "<br>\n " .
915 text(oeFormatShortDate(substr($crow['bill_time'], 0, 10))) .
916 text(substr($crow['bill_time'], 10, 6)) . " " .
917 htmlspecialchars( xl("Re-opened"), ENT_QUOTES
);
921 else if ($crow['status'] == 6) {
922 $lhtml .= "<br>\n " .
923 text(oeFormatShortDate(substr($crow['bill_time'], 0, 10))) .
924 text(substr($crow['bill_time'], 10, 6)) . " " .
925 htmlspecialchars( xl("This claim has been forwarded to next level."), ENT_QUOTES
);
928 else if ($crow['status'] == 7) {
929 $lhtml .= "<br>\n " .
930 text(oeFormatShortDate(substr($crow['bill_time'], 0, 10))) .
931 text(substr($crow['bill_time'], 10, 6)) . " " .
932 htmlspecialchars( xl("This claim has been denied.Reason:-"), ENT_QUOTES
);
933 if($crow['process_file'])
935 $code_array=explode(',',$crow['process_file']);
936 foreach($code_array as $code_key => $code_value)
938 $lhtml .= "<br>\n ";
939 $reason_array=explode('_',$code_value);
940 if(!isset($adjustment_reasons[$reason_array[3]]))
942 $lhtml .=htmlspecialchars( xl("For code"), ENT_QUOTES
).' ['.text($reason_array[0]).'] '.htmlspecialchars( xl("and modifier"), ENT_QUOTES
).' ['.text($reason_array[1]).'] '.htmlspecialchars( xl("the Denial code is"), ENT_QUOTES
).' ['.text($reason_array[2]).' '.text($reason_array[3]).']';
946 $lhtml .=htmlspecialchars( xl("For code"), ENT_QUOTES
).' ['.text($reason_array[0]).'] '.htmlspecialchars( xl("and modifier"), ENT_QUOTES
).' ['.text($reason_array[1]).'] '.htmlspecialchars( xl("the Denial Group code is"), ENT_QUOTES
).' ['.text($reason_array[2]).'] '.htmlspecialchars( xl("and the Reason is"), ENT_QUOTES
).':- '.text($adjustment_reasons[$reason_array[3]]);
952 $lhtml .=htmlspecialchars( xl("Not Specified."), ENT_QUOTES
);
957 if ($crow['process_time']) {
958 $lhtml .= "<br>\n " .
959 text(oeFormatShortDate(substr($crow['process_time'], 0, 10))) .
960 text(substr($crow['process_time'], 10, 6)) . " " .
961 xlt("Claim was generated to file") . " " .
962 "<a href='get_claim_file.php?key=" . attr($crow['process_file']) .
963 "' onclick='top.restoreSession()'>" .
964 text($crow['process_file']) . "</a>";
969 } // end while ($crow = sqlFetchArray($cres))
971 if ($lastcrow && $lastcrow['status'] == 4) {
972 $lhtml .= "<br>\n " . xlt("This claim has been closed.");
976 if ($lastcrow && $lastcrow['status'] == 5) {
977 $lhtml .= "<br>\n " . xlt("This claim has been canceled.");
980 } // end if ($iter['id'])
982 } // end if ($last_encounter_id != $this_encounter_id)
984 if ($skipping) continue;
986 // Collect info related to the missing modifiers test.
987 if ($iter['fee'] > 0) {
989 $tmp = substr($iter['code'], 0, 3);
990 if (($tmp == '992' ||
$tmp == '993') && empty($iter['modifier']))
991 $mmo_empty_mod = true;
997 $rhtml .= "<tr bgcolor='$bgcolor'>\n";
999 $rhtml .= "<td width='50'>";
1000 if ($iter['id'] && $oldcode != $iter['code_type']) {
1001 $rhtml .= "<span class=text>" . text($iter['code_type']) . ": </span>";
1004 $oldcode = $iter['code_type'];
1005 $rhtml .= "</td>\n";
1008 if ($iter['id'] && $code_types[$iter['code_type']]['just']) {
1009 $js = explode(":",$iter['justify']);
1011 foreach ($js as $j) {
1013 if ($counter == 0) {
1014 $justify .= " (<b>" . text($j) . "</b>)";
1017 $justify .= " (" . text($j) . ")";
1024 $rhtml .= "<td><span class='text'>" .
1025 ($iter['code_type'] == 'COPAY' ?
text(oeFormatMoney($iter['code'])) : text($iter['code']));
1026 if ($iter['modifier']) $rhtml .= ":" . text($iter['modifier']);
1027 $rhtml .= "</span><span style='font-size:8pt;'>$justify</span></td>\n";
1029 $rhtml .= '<td align="right"><span style="font-size:8pt;"> ';
1030 if ($iter['id'] && $iter['fee'] > 0) {
1031 $rhtml .= text(oeFormatMoney($iter['fee']));
1033 $rhtml .= "</span></td>\n";
1034 $rhtml .= '<td><span style="font-size:8pt;"> ';
1035 if ($iter['id']) $rhtml .= getProviderName(empty($iter['provider_id']) ?
text($iter['enc_provider_id']) : text($iter['provider_id']));
1036 $rhtml .= "</span></td>\n";
1037 $rhtml .= '<td><span style="font-size:8pt;"> ';
1038 if($GLOBALS['display_units_in_billing'] != 0) {
1039 if ($iter['id']) $rhtml .= xlt("Units") . ":" . text($iter{"units"});
1041 $rhtml .= "</span></td>\n";
1042 $rhtml .= '<td width=100> <span style="font-size:8pt;">';
1043 if ($iter['id']) $rhtml .= text(oeFormatSDFT(strtotime($iter{"date"})));
1044 $rhtml .= "</span></td>\n";
1045 # This error message is generated if the authorized check box is not checked
1046 if ($iter['id'] && $iter['authorized'] != 1) {
1047 $rhtml .= "<td><span class=alert>".xlt("Note: This code has not been authorized.")."</span></td>\n";
1050 $rhtml .= "<td></td>\n";
1052 if ($iter['id'] && $last_encounter_id != $this_encounter_id) {
1053 $tmpbpr = $iter['bill_process'];
1054 if ($tmpbpr == '0' && $iter['billed']) $tmpbpr = '2';
1055 $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";
1059 $rhtml .= "<td></td>\n";
1061 if($last_encounter_id != $this_encounter_id){
1064 $resMoneyGot = sqlStatement("SELECT pay_amount as PatientPay,date(post_time) as date FROM ar_activity where ".
1065 "pid = ? and encounter = ? and payer_type=0 and account_code='PCP'",
1066 array($iter['enc_pid'],$iter['enc_encounter']));
1067 //new fees screen copay gives account_code='PCP'
1068 if(sqlNumRows($resMoneyGot) > 0){
1072 //checks whether a copay exists for the encounter and if exists displays it.
1073 while($rowMoneyGot = sqlFetchArray($resMoneyGot)){
1075 $PatientPay=$rowMoneyGot['PatientPay'];
1076 $date=$rowMoneyGot['date'];
1077 if($PatientPay > 0){
1079 $rhtml2 .= "<tr bgcolor='$bgcolor'>\n";
1081 $rhtml2 .= "<td width='50'>";
1082 $rhtml2 .= "<span class='text'>".xlt('COPAY').": </span>";
1083 $rhtml2 .= "</td>\n";
1084 $rhtml2 .= "<td><span class='text'>".text(oeFormatMoney($PatientPay))."</span><span style='font-size:8pt;'> </span></td>\n";
1085 $rhtml2 .= '<td align="right"><span style="font-size:8pt;"> ';
1086 $rhtml2 .= "</span></td>\n";
1087 $rhtml2 .= '<td><span style="font-size:8pt;"> ';
1088 $rhtml2 .= "</span></td>\n";
1089 $rhtml2 .= '<td><span style="font-size:8pt;"> ';
1090 $rhtml2 .= "</span></td>\n";
1091 $rhtml2 .= '<td width=100> <span style="font-size:8pt;">';
1092 $rhtml2 .= text(oeFormatSDFT(strtotime($date)));
1093 $rhtml2 .= "</span></td>\n";
1094 if ($iter['id'] && $iter['authorized'] != 1) {
1095 $rhtml2 .= "<td><span class=alert>".xlt("Note: This copay was entered against billing that has not been authorized. Please review status.")."</span></td>\n";
1097 $rhtml2 .= "<td></td>\n";
1099 if(!$iter['id'] && $rowcnt == 1){
1100 $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";
1103 $rhtml2 .= "<td></td>\n";
1109 $rhtml .= "</tr>\n";
1110 $last_encounter_id = $this_encounter_id;
1115 while ($rcount < $lcount) {
1116 $rhtml .= "<tr bgcolor='$bgcolor'><td colspan='8'></td></tr>";
1119 if (!$missing_mods_only ||
($mmo_empty_mod && $mmo_num_charges > 1)) {
1125 echo "<tr bgcolor='$bgcolor'>\n<td rowspan='$rcount' valign='top'>\n$lhtml</td>$rhtml\n";
1126 echo "<tr bgcolor='$bgcolor'><td colspan='9' height='5'></td></tr>\n";
1138 set_button_states();
1141 echo "alert('".addslashes($alertmsg)."');\n";
1144 $
(document
).ready(function() {
1145 $
("#view-log-link").click( function() {
1146 top
.restoreSession();
1147 dlgopen('customize_log.php', '_blank', 500, 400);
1150 $
('input[type="submit"]').click( function() {
1151 top
.restoreSession();
1152 $
(this
).attr('data-clicked', true);
1155 $
('form[name="update_form"]').submit( function(e
) {
1156 var clickedButton
= $
("input[type=submit][data-clicked='true'")[0];
1158 // clear clicked button indicator
1159 $
('input[type="submit"]').attr('data-clicked', false);
1161 if ( !clickedButton || $
(clickedButton
).attr("data-open-popup") !== "true" ) {
1162 $
(this
).removeAttr("target");
1163 return top
.restoreSession();
1165 top
.restoreSession();
1166 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');
1167 this
.target
= 'Popup_Window';
1172 <input type
="hidden" name
="divnos" id
="divnos" value
="<?php echo attr($divnos) ?>"/>
1173 <input type
='hidden' name
='ajax_mode' id
='ajax_mode' value
='' />