3 * Billing Report Program
6 * @link http://www.open-emr.org
7 * @author Jerry Padgett <sjpadgett@gmail.com>
8 * @author Terry Hill <terry@lilysystems.com>
9 * @author Brady Miller <brady.g.miller@gmail.com>
10 * @copyright Copyright (c) 2017 Jerry Padgett <sjpadgett@gmail.com>
11 * @copyright Copyright (c) 2016 Terry Hill <terry@lillysystems.com>
12 * @copyright Copyright (c) 2017 Brady Miller <brady.g.miller@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 include_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 ($_POST['mode'] == 'export') {
50 $sql = ReturnOFXSql();
52 $results = $db->Execute($sql);
54 if ($results->RecordCount() == 0) {
55 echo xlt("No Bills Found to Include in OFX Export") . "<br>";
57 while (! $results->EOF
) {
58 $billings[] = $results->fields
;
61 $ofx = new OFX($billings);
62 header("Pragma: public");
64 header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
65 header("Content-Disposition: attachment; filename=openemr_ofx.ofx");
66 header("Content-Type: text/xml");
74 $from_date = isset($_POST['from_date']) ?
$_POST['from_date'] : date('Y-m-d');
75 $to_date = isset($_POST['to_date']) ?
$_POST['to_date'] : '';
76 $code_type = isset($_POST['code_type']) ?
$_POST['code_type'] : 'all';
77 $unbilled = isset($_POST['unbilled']) ?
$_POST['unbilled'] : 'on';
78 $my_authorized = isset($_POST["authorized"]) ?
$_POST["authorized"] : '';
80 // This tells us if only encounters that appear to be missing a "25" modifier
81 // are to be reported.
82 $missing_mods_only = (isset($_POST['missing_mods_only']) && ! empty($_POST['missing_mods_only']));
84 $left_margin = isset($_POST["left_margin"]) ?
$_POST["left_margin"] : $GLOBALS['cms_left_margin_default'];
85 $top_margin = isset($_POST["top_margin"]) ?
$_POST["top_margin"] : $GLOBALS['cms_top_margin_default'];
87 $left_ubmargin = isset($_POST["left_ubmargin"]) ?
$_POST["left_ubmargin"] : $GLOBALS['left_ubmargin_default'];
88 $top_ubmargin = isset($_POST["top_ubmargin"]) ?
$_POST["top_ubmargin"] : $GLOBALS['top_ubmargin_default'];
90 $ofrom_date = $from_date;
92 $ocode_type = $code_type;
93 $ounbilled = $unbilled;
94 $oauthorized = $my_authorized;
100 <?php Header
::setupHeader(['datetime-picker','common']); ?
>
101 <script type
="text/javascript">
103 function select_all() {
104 for($i=0;$i < document
.update_form
.length
;$i++
) {
105 $name = document
.update_form
[$i].name
;
106 if ($name.substring(0,7) == "claims[" && $name.substring($name.length
-6) == "[bill]") {
107 document
.update_form
[$i].checked
= true;
113 function set_button_states() {
114 var f
= document
.update_form
;
115 var count0
= 0; // selected and not billed or queued
116 var count1
= 0; // selected and queued
117 var count2
= 0; // selected and billed
118 for($i = 0; $i < f
.length
; ++
$i) {
120 if ($name.substring(0, 7) == "claims[" && $name.substring($name.length
-6) == "[bill]" && f
[$i].checked
== true) {
121 if (f
[$i].value
== '0') ++count0
;
122 else if (f
[$i].value
== '1' || f
[$i].value
== '5') ++count1
;
127 var can_generate
= (count0
> 0 || count1
> 0 || count2
> 0);
128 var can_mark
= (count1
> 0 || count0
> 0 || count2
> 0);
129 var can_bill
= (count0
== 0 && count1
== 0 && count2
> 0);
131 <?php
if (file_exists($EXPORT_INC)) { ?
>
132 f
.bn_external
.disabled
= !can_generate
;
134 f
.bn_x12_support
.disabled
= !can_generate
;
135 <?php
if ($GLOBALS['support_encounter_claims']) { ?
>
136 f
.bn_x12_encounter
.disabled
= !can_generate
;
138 f
.bn_process_hcfa_support
.disabled
= !can_generate
;
139 <?php
if ($GLOBALS['preprinted_cms_1500']) { ?
>
140 f
.bn_process_hcfa_form
.disabled
= !can_generate
;
142 <?php
if ($GLOBALS['ub04_support']) { ?
>
143 f
.bn_process_ub04_support
.disabled
= !can_generate
;
145 f
.bn_hcfa_txt_file
.disabled
= !can_generate
;
146 f
.bn_reopen
.disabled
= !can_bill
;
148 f
.bn_mark
.disabled
= !can_mark
;
151 // Process a click to go to an encounter.
152 function toencounter(pid
, pubpid
, pname
, enc
, datestr
, dobstr
) {
153 top
.restoreSession();
154 encurl
= 'patient_file/encounter/encounter_top.php?set_encounter=' + enc +
'&pid=' + pid
;
155 parent
.left_nav
.setPatient(pname
,pid
,pubpid
,'',dobstr
);
156 <?php
if ($GLOBALS['new_tabs_layout']) { ?
>
157 parent
.left_nav
.setEncounter(datestr
, enc
, 'enc');
158 parent
.left_nav
.loadFrame('enc2', 'enc', encurl
);
160 var othername
= (window
.name
== 'RTop') ?
'RBot' : 'RTop';
161 parent
.left_nav
.setEncounter(datestr
, enc
, othername
);
162 parent
.frames
[othername
].location
.href
= '../' + encurl
;
165 // Process a click to go to an patient.
166 function topatient(pid
, pubpid
, pname
, enc
, datestr
, dobstr
) {
167 top
.restoreSession();
168 paturl
= 'patient_file/summary/demographics_full.php?pid=' + pid
;
169 parent
.left_nav
.setPatient(pname
,pid
,pubpid
,'',dobstr
);
170 <?php
if ($GLOBALS['new_tabs_layout']) { ?
>
171 parent
.left_nav
.loadFrame('ens1', 'enc', 'patient_file/history/encounters.php?pid=' + pid
);
172 parent
.left_nav
.loadFrame('dem1', 'pat', paturl
);
174 var othername
= (window
.name
== 'RTop') ?
'RBot' : 'RTop';
175 parent
.frames
[othername
].location
.href
= '../' + paturl
;
178 function popUB04(pid
,enc
) {
179 if (! window
.focus
) return true;
180 if(!ProcessBeforeSubmitting()) return false;
181 top
.restoreSession();
182 var href
= "<?php echo $GLOBALS['web_root']?>/interface/billing/ub04_form.php?pid="+pid+
"&enc="+enc
184 var h
= (screen
.height
-130).toString();
185 window
.open(href
, '', 'location=0,scrollbars=yes,centerscreen=yes,width=1200,height='+h+
'');
190 <script type
="text/javascript">
191 EncounterDateArray
=new Array;
192 CalendarCategoryArray
=new Array;
193 EncounterIdArray
=new Array;
194 EncounterNoteArray
=new Array;
196 function SubmitTheScreen()
197 {//Action on Update List link
198 if(!ProcessBeforeSubmitting())
200 top
.restoreSession();
201 document
.the_form
.mode
.value
='change';
202 document
.the_form
.target
='_self';
203 document
.the_form
.action
='billing_report.php';
204 document
.the_form
.submit();
207 function SubmitTheScreenPrint()
208 {//Action on View Printable Report link
209 if(!ProcessBeforeSubmitting())
211 top
.restoreSession();
212 document
.the_form
.target
='new';
213 document
.the_form
.action
='print_billing_report.php';
214 document
.the_form
.submit();
217 function SubmitTheEndDayPrint()
218 {//Action on View End of Day Report link
219 if(!ProcessBeforeSubmitting())
221 top
.restoreSession();
222 document
.the_form
.target
='new';
223 <?php
if ($GLOBALS['use_custom_daysheet'] == 1) { ?
>
224 document
.the_form
.action
='print_daysheet_report_num1.php';
226 <?php
if ($GLOBALS['use_custom_daysheet'] == 2) { ?
>
227 document
.the_form
.action
='print_daysheet_report_num2.php';
229 <?php
if ($GLOBALS['use_custom_daysheet'] == 3) { ?
>
230 document
.the_form
.action
='print_daysheet_report_num3.php';
232 document
.the_form
.submit();
235 function SubmitTheScreenExportOFX()
236 {//Action on Export OFX link
237 if(!ProcessBeforeSubmitting())
239 top
.restoreSession();
240 document
.the_form
.mode
.value
='export';
241 document
.the_form
.target
='_self';
242 document
.the_form
.action
='billing_report.php';
243 document
.the_form
.submit();
246 function TestExpandCollapse()
247 {//Checks whether the Expand All, Collapse All labels need to be placed.If any result set is there these will be placed.
249 for(i
=1;i
<=document
.getElementById("divnos").value
;i++
)
251 var ele
= document
.getElementById("divid_"+i
);
260 if(document
.getElementById("ExpandAll"))
262 document
.getElementById("ExpandAll").innerHTML
='';
263 document
.getElementById("CollapseAll").innerHTML
='';
267 function expandcollapse(atr
){
268 if(atr
== "expand") {//Called in the Expand All, Collapse All links(All items will be expanded or collapsed)
269 for(i
=1;i
<=document
.getElementById("divnos").value
;i++
){
270 var mydivid
="divid_"+i
;var myspanid
="spanid_"+i
;
271 var ele
= document
.getElementById(mydivid
); var text
= document
.getElementById(myspanid
);
274 ele
.style
.display
= "inline";text
.innerHTML
= "<?php echo htmlspecialchars(xl('Collapse'), ENT_QUOTES); ?>";
279 for(i
=1;i
<=document
.getElementById("divnos").value
;i++
){
280 var mydivid
="divid_"+i
;var myspanid
="spanid_"+i
;
281 var ele
= document
.getElementById(mydivid
); var text
= document
.getElementById(myspanid
);
284 ele
.style
.display
= "none"; text
.innerHTML
= "<?php echo htmlspecialchars(xl('Expand'), ENT_QUOTES); ?>";
290 function divtoggle(spanid
, divid
) {//Called in the Expand, Collapse links(This is for a single item)
291 var ele
= document
.getElementById(divid
);
294 var text
= document
.getElementById(spanid
);
295 if(ele
.style
.display
== "inline") {
296 ele
.style
.display
= "none";
297 text
.innerHTML
= "<?php echo htmlspecialchars(xl('Expand'), ENT_QUOTES); ?>";
300 ele
.style
.display
= "inline";
301 text
.innerHTML
= "<?php echo htmlspecialchars(xl('Collapse'), ENT_QUOTES); ?>";
305 function MarkAsCleared(Type
)
307 CheckBoxBillingCount
=0;
308 for (var CheckBoxBillingIndex
=0; ; CheckBoxBillingIndex++
)
310 CheckBoxBillingObject
=document
.getElementById('CheckBoxBilling'+CheckBoxBillingIndex
);
311 if(!CheckBoxBillingObject
)
313 if(CheckBoxBillingObject
.checked
)
315 ++CheckBoxBillingCount
;
320 Message
='<?php echo htmlspecialchars(xl('After saving your batch
, click
[View Log
] to check
for errors
.'), ENT_QUOTES); ?>';
324 Message
='<?php echo htmlspecialchars(xl('After saving the PDF
, click
[View Log
] to check
for errors
.'), ENT_QUOTES); ?>';
328 Message
='<?php echo htmlspecialchars(xl('After saving the TEXT
file(s
), click
[View Log
] to check
for errors
.'), ENT_QUOTES); ?>';
330 if(confirm(Message +
"\n\n\n<?php echo addslashes(xl('Total')); ?>" +
' ' + CheckBoxBillingCount +
' ' +
"<?php echo addslashes(xl('Selected')); ?>\n" +
331 "<?php echo addslashes(xl('Would You Like them to be Marked as Cleared.')); ?>\n" +
"<?php echo addslashes(xl('Click OK to Clear or Cancel to continue processing.')); ?>"))
333 document
.getElementById('HiddenMarkAsCleared').value
='yes';
337 document
.getElementById('HiddenMarkAsCleared').value
='';
341 <?php
include_once("$srcdir/../interface/reports/report.script.php"); ?
>
342 <!-- Criteria Section common javascript page
-->
343 <!-- =============Included
for Insurance ajax criteria
==== -->
344 <?php
include_once("{$GLOBALS['srcdir']}/ajax/payment_ajax_jav.inc.php"); ?
>
346 #ajax_div_insurance {
349 background
-color
: #FBFDD0;
350 border
: 1px solid
#ccc;
354 button
[type
="submit"].subbtn
-warning
{
355 background
: #ec971f !important;
356 color
: black
!important
;
359 button
[type
="submit"].subbtn
-warning
:hover
{
360 background
: #da8104 !important;
361 color
: #fff !important;
364 <script type
="text/javascript">
365 document
.onclick
=TakeActionOnHide
;
367 <!-- =============Included
for Insurance ajax criteria
==== -->
369 <body
class="body_top" onLoad
="TestExpandCollapse()">
370 <div
class="container">
371 <p style
='margin-top: 5px; margin-bottom: 5px; margin-left: 5px; text-align: left;'>
372 <div
class='title'><?php
echo xlt('Billing Manager') ?
></div
>
375 <form name
='the_form' method
='post' action
='billing_report.php' onsubmit
='return top.restoreSession()' style
="display: inline">
377 <script type
="text/javascript">
380 <input type
='hidden' name
='mode' value
='change'>
381 <!-- Criteria section Starts
-->
383 // The following are the search criteria per page.All the following variable which ends with 'Master' need to be filled properly.
384 // Each item is seperated by a comma(,).
385 // $ThisPageSearchCriteriaDisplayMaster ==>It is the display on screen for the set of criteria.
386 // $ThisPageSearchCriteriaKeyMaster ==>Corresponding database fields in the same order.
387 // $ThisPageSearchCriteriaDataTypeMaster ==>Corresponding data type in the same order.
388 $ThisPageSearchCriteriaDisplayRadioMaster = array();
389 $ThisPageSearchCriteriaRadioKeyMaster = array();
390 $ThisPageSearchCriteriaQueryDropDownMaster = array();
391 $ThisPageSearchCriteriaQueryDropDownMasterDefault = array();
392 $ThisPageSearchCriteriaQueryDropDownMasterDefaultKey = array();
393 $ThisPageSearchCriteriaIncludeMaster = array();
395 $ThisPageSearchCriteriaDisplayMaster = array(
396 xl("Date of Service"),
398 xl("Date of Billing"),
402 xl("Insurance Company"),
404 xl("Whether Insured"),
406 xl("Billing Status"),
407 xl("Authorization Status"),
408 xl("Last Level Billed"),
412 $ThisPageSearchCriteriaKeyMaster = "form_encounter.date,billing.date,claims.process_time,claims.target,patient_data.fname," .
413 "form_encounter.pid,claims.payer_id,form_encounter.encounter,insurance_data.provider,billing.id,billing.billed," .
414 "billing.authorized,form_encounter.last_level_billed,billing.x12_partner_id,billing.user";
415 $ThisPageSearchCriteriaDataTypeMaster = "datetime,datetime,datetime,radio,text_like," .
416 "text,include,text,radio,radio,radio," .
417 "radio_like,radio,query_drop_down,text";
419 $ThisPageSearchCriteriaDisplayMaster = array(
420 xl("Date of Service"),
422 xl("Date of Billing"),
426 xl("Insurance Company"),
428 xl("Whether Insured"),
430 xl("Billing Status"),
431 xl("Authorization Status"),
432 xl("Last Level Billed"),
435 $ThisPageSearchCriteriaKeyMaster = "form_encounter.date,billing.date,claims.process_time,claims.target,patient_data.fname," .
436 "form_encounter.pid,claims.payer_id,form_encounter.encounter,insurance_data.provider,billing.id,billing.billed," .
437 "billing.authorized,form_encounter.last_level_billed,billing.x12_partner_id";
438 $ThisPageSearchCriteriaDataTypeMaster = "datetime,datetime,datetime,radio,text_like," .
439 "text,include,text,radio,radio,radio," .
440 "radio_like,radio,query_drop_down";
442 // The below section is needed if there is any 'radio' or 'radio_like' type in the $ThisPageSearchCriteriaDataTypeMaster
443 // $ThisPageSearchCriteriaDisplayRadioMaster,$ThisPageSearchCriteriaRadioKeyMaster ==>For each radio data type this pair comes.
444 // 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.
445 $ThisPageSearchCriteriaDisplayRadioMaster[1] = array(
450 $ThisPageSearchCriteriaRadioKeyMaster[1] = "all,standard,hcfa"; // Key
451 $ThisPageSearchCriteriaDisplayRadioMaster[2] = array(
456 $ThisPageSearchCriteriaRadioKeyMaster[2] = "all,1,0"; // Key
457 $ThisPageSearchCriteriaDisplayRadioMaster[3] = array(
462 $ThisPageSearchCriteriaRadioKeyMaster[3] = "all,not null,null"; // Key
463 $ThisPageSearchCriteriaDisplayRadioMaster[4] = array(
469 $ThisPageSearchCriteriaRadioKeyMaster[4] = "all,0,1,7"; // Key
470 $ThisPageSearchCriteriaDisplayRadioMaster[5] = array(
475 $ThisPageSearchCriteriaRadioKeyMaster[5] = "%,1,0";
476 $ThisPageSearchCriteriaDisplayRadioMaster[6] = array(
482 $ThisPageSearchCriteriaRadioKeyMaster[6] = "all,0,1,2";
483 // The below section is needed if there is any 'query_drop_down' type in the $ThisPageSearchCriteriaDataTypeMaster
484 $ThisPageSearchCriteriaQueryDropDownMaster[1] = "SELECT name,id FROM x12_partners;";
485 $ThisPageSearchCriteriaQueryDropDownMasterDefault[1] = xl("All"); // Only one item will be here
486 $ThisPageSearchCriteriaQueryDropDownMasterDefaultKey[1] = "all"; // Only one item will be here
487 // The below section is needed if there is any 'include' type in the $ThisPageSearchCriteriaDataTypeMaster
488 // Function name is added here.Corresponding include files need to be included in the respective pages as done in this page.
489 // It is labled(Included for Insurance ajax criteria)(Line:-279-299).
490 $ThisPageSearchCriteriaIncludeMaster[1] = "InsuranceCompanyDisplay"; // This is php function defined in the file 'report.inc.php'
492 if (! isset($_REQUEST['mode'])) { // default case
493 $_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") . "')";
494 $_REQUEST['final_this_page_criteria'][1] = "billing.billed = '0'";
496 $_REQUEST['final_this_page_criteria_text'][0] = xl("Date of Service = Today");
497 $_REQUEST['final_this_page_criteria_text'][1] = xl("Billing Status = Unbilled");
499 $_REQUEST['date_master_criteria_form_encounter_date'] = "today";
500 $_REQUEST['master_from_date_form_encounter_date'] = date("Y-m-d");
501 $_REQUEST['master_to_date_form_encounter_date'] = date("Y-m-d");
503 $_REQUEST['radio_billing_billed'] = 0;
506 <table
class="table" style
="background: #f9f9ff;">
507 <tr
class="hideAway">
510 <?php
include_once("$srcdir/../interface/reports/criteria.tab.php"); ?
>
513 <!-- Criteria section Ends
-->
518 <td
><span
class='text'>
519 <button onClick
="return SubmitTheScreen();" class='btn btn-default btn-sm'><?php
echo xlt('Update List') ?
></button
>
520 <button onClick
="return SubmitTheScreenExportOFX();" class='btn btn-default btn-sm'><?php
echo xlt('Export OFX') ?
></button
></span
></td
>
524 <td
><button onClick
="return SubmitTheScreenPrint();" class='btn btn-default btn-sm'><?php
echo xlt('View Printable Report') ?
></button
></td
>
526 <?php
if ($daysheet) { ?
>
529 <td
><button onClick
="return SubmitTheEndDayPrint();" class='btn btn-default btn-sm'><?php
echo xlt('End Of Day Report') ?
></button
>
530 <?php
if ($daysheet_total) { ?
>
531 <span
class=text
><?php
echo xlt('Totals'); ?
> </span
> <input type
=checkbox name
="end_of_day_totals_only" value
="1" <?php
if ($obj['end_of_day_totals_only'] === '1') {
534 <?php
if ($provider_run) { ?
>
535 <span
class=text
><?php
echo xlt('Provider'); ?
> </span
> <input type
=checkbox name
="end_of_day_provider_only" value
="1" <?php
if ($obj['end_of_day_provider_only'] === '1') {
544 <?php
if (! file_exists($EXPORT_INC)) { ?
>
545 <a id
="view-log-link" href
="#" class='btn btn-default btn-sm' title
='<?php xla('See messages from the last set of generated claims
'); ?>'><?php
echo xlt('View Log') ?
></a
>
551 <td
><button onclick
="select_all(); return false;" class="btn btn-default btn-sm"><?php
echo xlt('Select All') ?
></button
></td
>
558 <!-- </div
><div
class="container-responsive"> -->
559 <form name
='update_form' method
='post' action
='billing_process.php' onsubmit
='return top.restoreSession()' style
="display: inline">
560 <span
class='text' style
="display: inline">
561 <span
class="btn-group pull-left">
562 <button type
="button" class="subbtn dropdown-toggle" data
-toggle
="dropdown" name
="bn_x12_support"
563 title
="<?php echo xla('A claim must be selected to enable this menu.')?>"><?php
echo xla('X12 OPTIONS')?
><span
class="caret"></span
></button
>
564 <ul
class="dropdown-menu" role
="menu">
565 <?php
if (file_exists($EXPORT_INC)) { ?
>
566 <li
><button type
="submit" data
-open
-popup
="true" class="btn btn-link" name
="bn_external"
567 title
="<?php echo xla('Export to external billing system') ?>"><?php
echo xla("Export Billing")?
></button
></li
>
568 <li
><button type
="submit" data
-open
-popup
="true" class="btn btn-link" name
="bn_mark"
569 title
="<?php echo xla('Mark as billed but skip billing') ?>"><?php
echo xla("Mark as Cleared")?
></button
></li
>
571 <li
><button type
="submit" class="btn btn-link" name
="bn_x12" onclick
="MarkAsCleared(1)"
572 title
="<?php echo xla('Generate and download X12 batch')?>"><?php
echo xla('Generate X12')?
></button
></li
>
573 <?php
if ($GLOBALS['ub04_support']) { ?
>
574 <li
><button type
="submit" class="btn btn-link" name
="bn_ub04_x12"
575 title
="<?php echo xla('Generate Institutional X12 837I')?>"><?php
echo xla('Generate X12 837I')?
></button
></li
>
577 <?php
if ($GLOBALS['support_encounter_claims']) { ?
>
578 <li
><button type
="submit" class="btn btn-link" name
="bn_x12_encounter" onclick
="MarkAsCleared(1)"
579 title
="<?php echo xla('Generate and download X12 encounter claim batch')?>" ><?php
echo xla('Generate X12 Encounter')?
></button
></li
>
583 <span
class="btn-group pull-left">
584 <button type
="button" class="subbtn dropdown-toggle" data
-toggle
="dropdown" name
="bn_process_hcfa_support"
585 title
="<?php echo xla('A claim must be selected to enable this menu.')?>"><?php
echo xla('HCFA FORM')?
>
586 <span
class="caret"></span
></button
>
587 <ul
class="dropdown-menu" role
="menu">
588 <li
><button type
="submit" class="btn btn-link" name
="bn_process_hcfa" onclick
="MarkAsCleared(2)"
589 title
="<?php echo xla('Generate and download CMS 1500 paper claims')?>"><?php
echo xla('CMS 1500 PDF')?
></button
></li
>
590 <?php
if ($GLOBALS['preprinted_cms_1500']) { ?
>
591 <li
><button type
="submit" class="btn btn-link" name
="bn_process_hcfa_form" onclick
="MarkAsCleared(2)"
592 title
="<?php echo xla('Generate and download CMS 1500 paper claims on Preprinted form')?>"><?php
echo xla('CMS 1500 incl FORM')?
></button
></li
>
594 <li
><button type
="submit" class="btn btn-link" name
="bn_hcfa_txt_file" onclick
="MarkAsCleared(3)"
595 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
></li
>
598 <?php
if ($GLOBALS['ub04_support']) { ?
>
599 <span
class="btn-group pull-left">
600 <button type
="button" class="subbtn dropdown-toggle" data
-toggle
="dropdown" name
="bn_process_ub04_support"
601 title
="<?php echo xla('A claim must be selected to enable this menu.')?>"><?php
echo xla('UB04 FORM')?
><span
class="caret"></span
></button
>
602 <ul
class="dropdown-menu" role
="menu">
603 <li
><button type
="submit" class="btn btn-link" name
="bn_process_ub04_form"
604 title
="<?php echo xla('Generate and download UB-04 CMS1450 with form')?>"><?php
echo xla('UB04 FORM PDF')?
></button
></li
>
605 <li
><button type
="submit" class="btn btn-link" name
="bn_process_ub04"
606 title
="<?php echo xla('Generate and download UB-04 CMS1450')?>"><?php
echo xla('UB04 TEXT PDF')?
></button
></li
>
610 <button type
="submit" data
-open
-popup
="true" class="subbtn-warning" name
="bn_mark" title
="<?php echo xla('Post to accounting and mark as billed')?>"><?php
echo xla('Mark as Cleared')?
></button
>
611 <button type
="submit" data
-open
-popup
="true" class="subbtn-warning" name
="bn_reopen" title
="<?php echo xla('Mark as not billed')?>"><?php
echo xla('Re-Open')?
></button
>
613 <?php
echo xlt('CMS 1500 Margins'); ?
>:
614 <?php
echo xlt('Left'); ?
>:
615 <input type
='text' size
='2' name
='left_margin' value
='<?php echo attr($left_margin); ?>'
616 title
='<?php echo xla('HCFA left margin in points
'); ?>' />
617 <?php
echo xlt('Top'); ?
>:
618 <input type
='text' size
='2' name
='top_margin' value
='<?php echo attr($top_margin); ?>'
619 title
='<?php echo xla('HCFA top margin in points
'); ?>' />
620 <?php
if ($ub04_support) { ?
>
621 <?php
echo xlt('UB04 Margins'); ?
>:
622 <?php
echo xlt('Left'); ?
>:
623 <input type
='text' size
='2' name
='left_ubmargin' value
='<?php echo attr($left_ubmargin); ?>'
624 title
='<?php echo xla('UB04 left margin in points
'); ?>' />
625 <?php
echo xlt('Top'); ?
>:
626 <input type
='text' size
='2' name
='top_ubmargin' value
='<?php echo attr($top_ubmargin); ?>'
627 title
='<?php echo xla('UB04 top margin in points
'); ?>' />
629 <button type
="button" class="btn btn-xs btn-danger pull-right" onclick
="$('.hideAway').toggle()"><?php
echo xlt("Criteria") ?
></button
></span
>
632 <input type
='hidden' name
='HiddenMarkAsCleared' id
='HiddenMarkAsCleared' value
="" />
633 <input type
='hidden' name
='mode' value
="bill" />
634 <input type
='hidden' name
='authorized' value
="<?php echo attr($my_authorized); ?>" />
635 <input type
='hidden' name
='unbilled' value
="<?php echo attr($unbilled); ?>" />
636 <input type
='hidden' name
='code_type' value
="%" />
637 <input type
='hidden' name
='to_date' value
="<?php echo attr($to_date); ?>" />
638 <input type
='hidden' name
='from_date' value
="<?php echo attr($from_date); ?>" />
640 if ($my_authorized == "on") {
641 $my_authorized = "1";
643 $my_authorized = "%";
645 if ($unbilled == "on") {
650 $list = getBillsListBetween("%");
653 <input type
='hidden' name
='bill_list' value
="<?php echo attr($list); ?>" />
655 <!-- new form
for uploading
-->
658 if (! isset($_POST["mode"])) {
659 if (! isset($_POST["from_date"])) {
660 $from_date = date("Y-m-d");
662 $from_date = $_POST["from_date"];
664 if (empty($_POST["to_date"])) {
667 $to_date = $_POST["to_date"];
669 if (! isset($_POST["code_type"])) {
672 $code_type = $_POST["code_type"];
674 if (! isset($_POST["unbilled"])) {
677 $unbilled = $_POST["unbilled"];
679 if (! isset($_POST["authorized"])) {
680 $my_authorized = "on";
682 $my_authorized = $_POST["authorized"];
685 $from_date = $_POST["from_date"];
686 $to_date = $_POST["to_date"];
687 $code_type = $_POST["code_type"];
688 $unbilled = $_POST["unbilled"];
689 $my_authorized = $_POST["authorized"];
692 if ($my_authorized == "on") {
693 $my_authorized = "1";
695 $my_authorized = "%";
698 if ($unbilled == "on") {
704 if (isset($_POST["mode"]) && $_POST["mode"] == "bill") {
705 billCodesList($list);
709 <table style
="width: 100%;">
713 if ($ret = getBillsBetween("%")) {
714 if (is_array($ret)) {
717 <td colspan
='9' align
="right"><table style
="width: 250px; border-collapse: collapse;">
719 <td id
='ExpandAll'><a onclick
="expandcollapse('expand');"
720 class='small' href
="JavaScript:void(0);"><?php
echo '('.htmlspecialchars(xl('Expand All'), ENT_QUOTES
).')' ?
></a
></td
>
721 <td id
='CollapseAll'><a onclick
="expandcollapse('collapse');"
722 class='small' href
="JavaScript:void(0);"><?php
echo '('.htmlspecialchars(xl('Collapse All'), ENT_QUOTES
).')' ?
></a
></td
>
731 $last_encounter_id = "";
739 $mmo_empty_mod = false;
740 $mmo_num_charges = 0;
742 foreach ($ret as $iter) {
743 // We include encounters here that have never been billed. However
744 // if it had no selected billing items but does have non-selected
745 // billing items, then it is not of interest.
747 $res = sqlQuery("SELECT count(*) AS count FROM billing WHERE " .
748 "encounter = ? AND " .
750 "activity = 1", array(
751 $iter['enc_encounter'],
754 if ($res['count'] > 0) {
759 $this_encounter_id = $iter['enc_pid'] . "-" . $iter['enc_encounter'];
761 if ($last_encounter_id != $this_encounter_id) {
762 // This dumps all HTML for the previous encounter.
765 while ($rcount < $lcount) {
766 $rhtml .= "<tr bgcolor='$bgcolor'><td colspan='8'></td></tr>";
769 // This test handles the case where we are only listing encounters
770 // that appear to have a missing "25" modifier.
771 if (! $missing_mods_only ||
($mmo_empty_mod && $mmo_num_charges > 1)) {
772 if ($DivPut == 'yes') {
776 echo "<tr bgcolor='$bgcolor'>\n<td rowspan='$rcount' valign='top'>\n$lhtml</td>$rhtml\n";
777 echo "<tr bgcolor='$bgcolor'><td colspan='9' height='5'></td></tr>\n\n";
784 $mmo_empty_mod = false;
785 $mmo_num_charges = 0;
787 // If there are ANY unauthorized items in this encounter and this is
788 // the normal case of viewing only authorized billing, then skip the
792 if ($my_authorized == '1') {
793 $res = sqlQuery("select count(*) as count from billing where " .
794 "encounter = ? and " .
796 "activity = 1 and authorized = 0", array(
797 $iter['enc_encounter'],
800 if ($res['count'] > 0) {
802 $last_encounter_id = $this_encounter_id;
807 $name = getPatientData($iter['enc_pid'], "fname, mname, lname, pubpid, billing_note, DATE_FORMAT(DOB,'%Y-%m-%d') as DOB_YMD");
809 // Check if patient has primary insurance and a subscriber exists for it.
810 // If not we will highlight their name in red.
811 // TBD: more checking here.
813 $res = sqlQuery("select count(*) as count from insurance_data where " .
815 "type='primary' and " .
816 "subscriber_lname is not null and " .
817 "subscriber_lname != '' limit 1", array(
820 $namecolor = ($res['count'] > 0) ?
"black" : "#ff7777";
822 $bgcolor = "#" . (($encount & 1) ?
"ffffff" : "f9f9f9");
823 echo "<tr bgcolor='$bgcolor'><td colspan='9' height='5'></td></tr>\n";
828 $ptname = $name['fname'] . " " . $name['lname'];
829 $raw_encounter_date = date("Y-m-d", strtotime($iter['enc_date']));
830 $billing_note = $name['billing_note'];
831 // Add Encounter Date to display with "To Encounter" button 2/17/09 JCH
832 $lhtml .= " <span class=bold><font color='$namecolor'>" . text($ptname) . "</font></span><span class=small> (" . text($iter['enc_pid']) . "-" . text($iter['enc_encounter']) . ")</span>";
834 // Encounter details are stored to javacript as array.
835 $result4 = sqlStatement("SELECT fe.encounter,fe.date,fe.billing_note,openemr_postcalendar_categories.pc_catname FROM form_encounter AS fe " .
836 " left join openemr_postcalendar_categories on fe.pc_catid=openemr_postcalendar_categories.pc_catid WHERE fe.pid = ? order by fe.date desc", array(
839 if (sqlNumRows($result4) > 0) {
842 <script type
="text/javascript">
844 EncounterDateArray
[<?php
echo attr($iter['enc_pid']); ?
>]=new Array;
845 CalendarCategoryArray
[<?php
echo attr($iter['enc_pid']); ?
>]=new Array;
846 EncounterIdArray
[<?php
echo attr($iter['enc_pid']); ?
>]=new Array;
847 EncounterNoteArray
[<?php
echo attr($iter['enc_pid']); ?
>]=new Array;
849 while ($rowresult4 = sqlFetchArray($result4)) {
851 EncounterIdArray
[<?php
echo attr($iter['enc_pid']); ?
>][Count
]='<?php echo htmlspecialchars($rowresult4['encounter
'], ENT_QUOTES); ?>';
852 EncounterDateArray
[<?php
echo attr($iter['enc_pid']); ?
>][Count
]='<?php echo htmlspecialchars(oeFormatShortDate(date("Y-m-d", strtotime($rowresult4['date
']))), ENT_QUOTES); ?>';
853 CalendarCategoryArray
[<?php
echo attr($iter['enc_pid']); ?
>][Count
]='<?php echo htmlspecialchars(xl_appt_category($rowresult4['pc_catname
']), ENT_QUOTES); ?>';
854 EncounterNoteArray
[<?php
echo attr($iter['enc_pid']); ?
>][Count
]='<?php echo htmlspecialchars($rowresult4['billing_note
'], ENT_QUOTES); ?>';
857 $enc_billing_note = $rowresult4['billing_note'];
863 // Not sure why the next section seems to do nothing except post "To Encounter" button 2/17/09 JCH
864 $lhtml .= " <a class=\"btn btn-xs btn-default\" role=\"button\" " . "href=\"javascript:window.toencounter(" . $iter['enc_pid'] . ",'" . addslashes($name['pubpid']) . "','" . addslashes($ptname) . "'," . $iter['enc_encounter'] . ",'" . addslashes(oeFormatShortDate($raw_encounter_date)) . "',' " . xl('DOB') . ": " . addslashes(oeFormatShortDate($name['DOB_YMD'])) . " " . xl('Age') . ": " . getPatientAge($name['DOB_YMD']) . "');
865 top.window.parent.left_nav.setPatientEncounter(EncounterIdArray[" . $iter['enc_pid'] . "],EncounterDateArray[" . $iter['enc_pid'] . "], CalendarCategoryArray[" . $iter['enc_pid'] . "])\">" . xlt('Encounter') . " " . text(oeFormatShortDate($raw_encounter_date)) . "</a>";
867 // Changed "To xxx" buttons to allow room for encounter date display 2/17/09 JCH
868 $lhtml .= " <a class=\"btn btn-xs btn-default\" role=\"button\" " . "href=\"javascript:window.topatient(" . $iter['enc_pid'] . ",'" . addslashes($name['pubpid']) . "','" . addslashes($ptname) . "'," . $iter['enc_encounter'] . ",'" . addslashes(oeFormatShortDate($raw_encounter_date)) . "',' " . xl('DOB') . ": " . addslashes(oeFormatShortDate($name['DOB_YMD'])) . " " . xl('Age') . ": " . getPatientAge($name['DOB_YMD']) . "');
869 top.window.parent.left_nav.setPatientEncounter(EncounterIdArray[" . $iter['enc_pid'] . "],EncounterDateArray[" . $iter['enc_pid'] . "], CalendarCategoryArray[" . $iter['enc_pid'] . "])\">" . xlt('Patient') . "</a>";
870 if ($ub04_support && isset($iter['billed'])) {
871 $c = sqlQuery("SELECT submitted_claim AS status FROM claims WHERE " .
872 "encounter_id = ? AND " .
874 "ORDER BY version DESC LIMIT 1", array(
875 $iter['enc_encounter'],
878 $is_edited = $c['status'] ?
'btn-success' : 'btn-warning';
879 $bname = $c['status'] ?
'Reviewed' : xlt('Review UB04');
880 $lhtml .= " <a class='btn btn-xs $is_edited' role='button' onclick='popUB04(" . $iter['enc_pid'] . "," . $iter['enc_encounter'] . "); return false;'>" . $bname . "</a>";
882 $divnos = $divnos +
1;
883 $lhtml .= " <a onclick='divtoggle(\"spanid_$divnos\",\"divid_$divnos\");' class='small' id='aid_$divnos' href=\"JavaScript:void(0);" . "\">(<span id=spanid_$divnos class=\"indicator\">" . htmlspecialchars(xl('Expand'), ENT_QUOTES
) . '</span>)<br></a>';
884 if ($GLOBALS['notes_to_display_in_Billing'] == 2 ||
$GLOBALS['notes_to_display_in_Billing'] == 3) {
885 $lhtml .= '<span style="margin-left: 20px; font-weight bold; color: red">' . text($billing_note) . '</span>';
890 $lhtml .= "<br />\n";
891 $lhtml .= " <span class=text>Bill: ";
892 $lhtml .= "<select name='claims[" . attr($this_encounter_id) . "][payer]' style='background-color:$bgcolor'>";
894 $query = "SELECT id.provider AS id, id.type, id.date, " .
895 "ic.x12_default_partner_id AS ic_x12id, ic.name AS provider " .
896 "FROM insurance_data AS id, insurance_companies AS ic WHERE " .
897 "ic.id = id.provider AND " .
900 "ORDER BY id.type ASC, id.date DESC";
902 $result = sqlStatement($query, array(
907 $default_x12_partner = $iter['ic_x12id'];
910 while ($row = sqlFetchArray($result)) {
911 if (strcmp($row['type'], $prevtype) == 0) {
914 $prevtype = $row['type'];
915 if (strlen($row['provider']) > 0) {
916 // This preserves any existing insurance company selection, which is
917 // important when EOB posting has re-queued for secondary billing.
918 $lhtml .= "<option value=\"" . attr(substr($row['type'], 0, 1) . $row['id']) . "\"";
919 if (($count == 0 && ! $iter['payer_id']) ||
$row['id'] == $iter['payer_id']) {
920 $lhtml .= " selected";
921 if (! is_numeric($default_x12_partner)) {
922 $default_x12_partner = $row['ic_x12id'];
925 $lhtml .= ">" . text($row['type']) . ": " . text($row['provider']) . "</option>";
930 $lhtml .= "<option value='-1'>" . xlt("Unassigned") . "</option>\n";
931 $lhtml .= "</select> \n";
932 $lhtml .= "<select name='claims[" . attr($this_encounter_id) . "][partner]' style='background-color:$bgcolor'>";
933 $x = new X12Partner();
934 $partners = $x->_utility_array($x->x12_partner_factory());
935 foreach ($partners as $xid => $xname) {
936 $lhtml .= '<option label="' . attr($xname) . '" value="' . attr($xid) . '"';
937 if ($xid == $default_x12_partner) {
938 $lhtml .= "selected";
940 $lhtml .= '>' . text($xname) . '</option>';
942 $lhtml .= "</select>";
945 if ($GLOBALS['notes_to_display_in_Billing'] == 1 ||
$GLOBALS['notes_to_display_in_Billing'] == 3) {
946 $lhtml .= "<br><span style='margin-left: 20px; font-weight bold; color: green'>" . text($enc_billing_note) . "</span>";
948 $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");
950 $query = "SELECT * FROM claims WHERE " . "patient_id = ? AND " . "encounter_id = ? " . "ORDER BY version";
951 $cres = sqlStatement($query, array(
953 $iter['enc_encounter']
958 while ($crow = sqlFetchArray($cres)) {
959 $query = "SELECT id.type, ic.name " .
960 "FROM insurance_data AS id, insurance_companies AS ic WHERE " .
962 "id.provider = ? AND " .
963 "id.date <= ? AND " .
964 "ic.id = id.provider " .
965 "ORDER BY id.type ASC, id.date DESC";
967 $irow = sqlQuery($query, array(
973 if ($crow['bill_process']) {
974 $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']);
976 } else if ($crow['status'] < 6) {
977 if ($crow['status'] > 1) {
978 $lhtml .= "<br>\n " . text(oeFormatShortDate(substr($crow['bill_time'], 0, 10))) . text(substr($crow['bill_time'], 10, 6)) . " " . htmlspecialchars(xl("Marked as cleared"), ENT_QUOTES
);
981 $lhtml .= "<br>\n " . text(oeFormatShortDate(substr($crow['bill_time'], 0, 10))) . text(substr($crow['bill_time'], 10, 6)) . " " . htmlspecialchars(xl("Re-opened"), ENT_QUOTES
);
984 } else if ($crow['status'] == 6) {
985 $lhtml .= "<br>\n " . text(oeFormatShortDate(substr($crow['bill_time'], 0, 10))) . text(substr($crow['bill_time'], 10, 6)) . " " . htmlspecialchars(xl("This claim has been forwarded to next level."), ENT_QUOTES
);
987 } else if ($crow['status'] == 7) {
988 $lhtml .= "<br>\n " . text(oeFormatShortDate(substr($crow['bill_time'], 0, 10))) . text(substr($crow['bill_time'], 10, 6)) . " " . htmlspecialchars(xl("This claim has been denied.Reason:-"), ENT_QUOTES
);
989 if ($crow['process_file']) {
990 $code_array = explode(',', $crow['process_file']);
991 foreach ($code_array as $code_key => $code_value) {
992 $lhtml .= "<br>\n ";
993 $reason_array = explode('_', $code_value);
994 if (! isset($adjustment_reasons[$reason_array[3]])) {
995 $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]) . ']';
997 $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]]);
1001 $lhtml .= htmlspecialchars(xl("Not Specified."), ENT_QUOTES
);
1006 if ($crow['process_time']) {
1007 $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']) . "' onclick='top.restoreSession()'>" . text($crow['process_file']) . "</a>";
1012 } // end while ($crow = sqlFetchArray($cres))
1014 if ($lastcrow && $lastcrow['status'] == 4) {
1015 $lhtml .= "<br>\n " . xlt("This claim has been closed.");
1019 if ($lastcrow && $lastcrow['status'] == 5) {
1020 $lhtml .= "<br>\n " . xlt("This claim has been canceled.");
1023 } // end if ($iter['id'])
1024 } // end if ($last_encounter_id != $this_encounter_id)
1030 // Collect info related to the missing modifiers test.
1031 if ($iter['fee'] > 0) {
1032 ++
$mmo_num_charges;
1033 $tmp = substr($iter['code'], 0, 3);
1034 if (($tmp == '992' ||
$tmp == '993') && empty($iter['modifier'])) {
1035 $mmo_empty_mod = true;
1042 $rhtml .= "<tr bgcolor='$bgcolor'>\n";
1044 $rhtml .= "<td width='50'>";
1045 if ($iter['id'] && $oldcode != $iter['code_type']) {
1046 $rhtml .= "<span class=text>" . text($iter['code_type']) . ": </span>";
1049 $oldcode = $iter['code_type'];
1050 $rhtml .= "</td>\n";
1053 if ($iter['id'] && $code_types[$iter['code_type']]['just']) {
1054 $js = explode(":", $iter['justify']);
1056 foreach ($js as $j) {
1058 if ($counter == 0) {
1059 $justify .= " (<b>" . text($j) . "</b>)";
1061 $justify .= " (" . text($j) . ")";
1068 $rhtml .= "<td><span class='text'>" . ($iter['code_type'] == 'COPAY' ?
text(oeFormatMoney($iter['code'])) : text($iter['code']));
1069 if ($iter['modifier']) {
1070 $rhtml .= ":" . text($iter['modifier']);
1072 $rhtml .= "</span><span style='font-size:8pt;'>$justify</span></td>\n";
1074 $rhtml .= '<td align="right"><span style="font-size:8pt;"> ';
1075 if ($iter['id'] && $iter['fee'] > 0) {
1076 $rhtml .= text(oeFormatMoney($iter['fee']));
1078 $rhtml .= "</span></td>\n";
1079 $rhtml .= '<td><span style="font-size:8pt;"> ';
1081 $rhtml .= getProviderName(empty($iter['provider_id']) ?
text($iter['enc_provider_id']) : text($iter['provider_id']));
1083 $rhtml .= "</span></td>\n";
1084 $rhtml .= '<td><span style="font-size:8pt;"> ';
1085 if ($GLOBALS['display_units_in_billing'] != 0) {
1087 $rhtml .= xlt("Units") . ":" . text($iter{"units"});
1090 $rhtml .= "</span></td>\n";
1091 $rhtml .= '<td width=100> <span style="font-size:8pt;">';
1093 $rhtml .= text(oeFormatSDFT(strtotime($iter{"date"})));
1095 $rhtml .= "</span></td>\n";
1096 // This error message is generated if the authorized check box is not checked
1097 if ($iter['id'] && $iter['authorized'] != 1) {
1098 $rhtml .= "<td><span class=alert>" . xlt("Note: This code has not been authorized.") . "</span></td>\n";
1100 $rhtml .= "<td></td>\n";
1102 if ($iter['id'] && $last_encounter_id != $this_encounter_id) {
1103 $tmpbpr = $iter['bill_process'];
1104 if ($tmpbpr == '0' && $iter['billed']) {
1107 $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";
1108 $CheckBoxBilling ++
;
1110 $rhtml .= "<td></td>\n";
1112 if ($last_encounter_id != $this_encounter_id) {
1115 $resMoneyGot = sqlStatement("SELECT pay_amount as PatientPay,date(post_time) as date FROM ar_activity where " .
1116 "pid = ? and encounter = ? and payer_type=0 and account_code='PCP'", array(
1118 $iter['enc_encounter']
1120 // new fees screen copay gives account_code='PCP'
1121 if (sqlNumRows($resMoneyGot) > 0) {
1125 // checks whether a copay exists for the encounter and if exists displays it.
1126 while ($rowMoneyGot = sqlFetchArray($resMoneyGot)) {
1128 $PatientPay = $rowMoneyGot['PatientPay'];
1129 $date = $rowMoneyGot['date'];
1130 if ($PatientPay > 0) {
1132 $rhtml2 .= "<tr bgcolor='$bgcolor'>\n";
1134 $rhtml2 .= "<td width='50'>";
1135 $rhtml2 .= "<span class='text'>" . xlt('COPAY') . ": </span>";
1136 $rhtml2 .= "</td>\n";
1137 $rhtml2 .= "<td><span class='text'>" . text(oeFormatMoney($PatientPay)) . "</span><span style='font-size:8pt;'> </span></td>\n";
1138 $rhtml2 .= '<td align="right"><span style="font-size:8pt;"> ';
1139 $rhtml2 .= "</span></td>\n";
1140 $rhtml2 .= '<td><span style="font-size:8pt;"> ';
1141 $rhtml2 .= "</span></td>\n";
1142 $rhtml2 .= '<td><span style="font-size:8pt;"> ';
1143 $rhtml2 .= "</span></td>\n";
1144 $rhtml2 .= '<td width=100> <span style="font-size:8pt;">';
1145 $rhtml2 .= text(oeFormatSDFT(strtotime($date)));
1146 $rhtml2 .= "</span></td>\n";
1147 if ($iter['id'] && $iter['authorized'] != 1) {
1148 $rhtml2 .= "<td><span class=alert>" . xlt("Note: This copay was entered against billing that has not been authorized. Please review status.") . "</span></td>\n";
1150 $rhtml2 .= "<td></td>\n";
1152 if (! $iter['id'] && $rowcnt == 1) {
1153 $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";
1154 $CheckBoxBilling ++
;
1156 $rhtml2 .= "<td></td>\n";
1162 $rhtml .= "</tr>\n";
1163 $last_encounter_id = $this_encounter_id;
1167 while ($rcount < $lcount) {
1168 $rhtml .= "<tr bgcolor='$bgcolor'><td colspan='8'></td></tr>";
1171 if (! $missing_mods_only ||
($mmo_empty_mod && $mmo_num_charges > 1)) {
1172 if ($DivPut == 'yes') {
1176 echo "<tr bgcolor='$bgcolor'>\n<td rowspan='$rcount' valign='top'>\n$lhtml</td>$rhtml\n";
1177 echo "<tr bgcolor='$bgcolor'><td colspan='9' height='5'></td></tr>\n";
1187 <script type
="text/javascript">
1188 set_button_states();
1191 echo "alert('" . addslashes($alertmsg) . "');\n";
1194 $
(document
).ready(function() {
1195 $
("#view-log-link").click( function() {
1196 top
.restoreSession();
1197 dlgopen('customize_log.php', '_blank', 500, 400);
1200 $
('button[type="submit"]').click( function() {
1201 top
.restoreSession();
1202 $
(this
).attr('data-clicked', true);
1205 $
('form[name="update_form"]').submit( function(e
) {
1206 var clickedButton
= $
("button[type=submit][data-clicked='true'")[0];
1208 // clear clicked button indicator
1209 $
('button[type="submit"]').attr('data-clicked', false);
1211 if ( !clickedButton || $
(clickedButton
).attr("data-open-popup") !== "true" ) {
1212 $
(this
).removeAttr("target");
1213 return top
.restoreSession();
1215 top
.restoreSession();
1216 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');
1217 this
.target
= 'Popup_Window';
1221 $
('.datepicker').datetimepicker({
1222 <?php
$datetimepicker_timepicker = false; ?
>
1223 <?php
$datetimepicker_showseconds = false; ?
>
1224 <?php
$datetimepicker_formatInput = false; ?
>
1225 <?php
require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?
>
1226 <?php
// can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
1230 <input type
="hidden" name
="divnos" id
="divnos" value
="<?php echo attr($divnos) ?>" />
1231 <input type
='hidden' name
='ajax_mode' id
='ajax_mode' value
='' />