changes for new flexible frame-based layout - not yet complete
[openemr.git] / interface / billing / billing_report.php
blobb115c717ba13fe28841197f1e70797ae6f96655b
1 <?php
2 include_once("../globals.php");
3 include_once("../../library/acl.inc");
4 include_once("../../custom/code_types.inc.php");
6 include_once("$srcdir/patient.inc");
7 include_once("$srcdir/billrep.inc");
8 include_once(dirname(__FILE__) . "/../../library/classes/OFX.class.php");
9 include_once(dirname(__FILE__) . "/../../library/classes/X12Partner.class.php");
11 $EXPORT_INC = "$webserver_root/custom/BillingExport.php";
13 $alertmsg = '';
15 if ($_POST['mode'] == 'export') {
16 $sdate = $_POST['from_date'];
17 $edate = $_POST['to_date'];
19 $sql = "SELECT billing.*, concat(pd.fname, ' ', pd.lname) as name from billing "
20 . "join patient_data as pd on pd.pid = billing.pid where billed = '1' and "
21 . "(process_date > '" . mysql_real_escape_string($sdate)
22 . "' or DATE_FORMAT( process_date, '%Y-%m-%d' ) = '" . mysql_real_escape_string($sdate) ."') "
23 . "and (process_date < '" . mysql_real_escape_string($edate)
24 . "'or DATE_FORMAT( process_date, '%Y-%m-%d' ) = '" . mysql_real_escape_string($edate) ."') "
25 . "order by pid,encounter";
26 $db = get_db();
27 $results = $db->Execute($sql);
28 $billings = array();
29 if ($results->RecordCount() == 0) {
30 echo xl("No Bills Found to Include in OFX Export<br>");
32 else {
33 while(!$results->EOF) {
34 $billings[] = $results->fields;
35 $results->MoveNext();
37 $ofx = new OFX($billings);
38 header("Pragma: public");
39 header("Expires: 0");
40 header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
41 header("Content-Disposition: attachment; filename=openemr_ofx.ofx");
42 header("Content-Type: text/xml");
43 echo $ofx->get_OFX();
44 exit;
48 if ($_POST['mode'] == 'process') {
49 if (exec("ps x | grep 'process_bills[.]php'")) {
50 $alertmsg = xl('Request ignored - claims processing is already running!');
52 else {
53 exec("cd $webserver_root/library/freeb;" .
54 "php -q process_bills.php bill > process_bills.log 2>&1 &");
55 $alertmsg = xl('Batch processing initiated; this may take a while.');
59 //global variables:
60 if (!isset($_POST["mode"])) {
61 if (!isset($_POST["from_date"])) {
62 $from_date=date("Y-m-d");
63 } else {
64 $from_date = $_POST["from_date"];
66 if (!isset($_POST["to_date"])) {
67 $to_date = date("Y-m-d");
68 } else {
69 $to_date = $_POST["to_date"];
71 if (!isset($_POST["code_type"])) {
72 $code_type="all";
73 } else {
74 $code_type = $_POST["code_type"];
76 if (!isset($_POST["unbilled"])) {
77 $unbilled = "on";
78 } else {
79 $unbilled = $_POST["unbilled"];
81 if (!isset($_POST["authorized"])) {
82 $my_authorized = "on";
83 } else {
84 $my_authorized = $_POST["authorized"];
86 } else {
87 $from_date = $_POST["from_date"];
88 $to_date = $_POST["to_date"];
89 $code_type = $_POST["code_type"];
90 $unbilled = $_POST["unbilled"];
91 $my_authorized = $_POST["authorized"];
94 $ofrom_date = $from_date;
95 $oto_date = $to_date;
96 $ocode_type = $code_type;
97 $ounbilled = $unbilled;
98 $oauthorized = $my_authorized;
102 <html>
103 <head>
104 <link rel=stylesheet href="<?php echo $css_header; ?>" type="text/css">
105 <style>
106 .subbtn { margin-top:3px; margin-bottom:3px; margin-left:2px; margin-right:2px }
107 </style>
108 <script>
110 function select_all() {
111 for($i=0;$i < document.update_form.length;$i++) {
112 $name = document.update_form[$i].name;
113 if ($name.substring(0,7) == "claims[" && $name.substring($name.length -6) == "[bill]") {
114 document.update_form[$i].checked = true;
117 set_button_states();
120 function set_button_states() {
121 var f = document.update_form;
122 var count0 = 0;
123 var count1 = 0;
124 var count2 = 0;
125 for($i = 0; $i < f.length; ++$i) {
126 $name = f[$i].name;
127 if ($name.substring(0, 7) == "claims[" && $name.substring($name.length -6) == "[bill]" && f[$i].checked == true) {
128 if (f[$i].value == '0') ++count0;
129 else if (f[$i].value == '1' || f[$i].value == '5') ++count1;
130 else ++count2;
134 var can_generate = (count0 > 0 || count1 > 0 || count2 > 0);
135 var can_mark = (count1 == 0 && (count0 > 0 || count2 > 0));
136 var can_bill = (count0 == 0 && count1 == 0 && count2 > 0);
138 <?php if (file_exists($EXPORT_INC)) { ?>
139 f.bn_external.disabled = !can_generate;
140 <?php } else { ?>
141 f.bn_hcfa_print.disabled = !can_generate;
142 f.bn_hcfa.disabled = !can_generate;
143 f.bn_ub92_print.disabled = !can_generate;
144 f.bn_ub92.disabled = !can_generate;
145 f.bn_x12.disabled = !can_generate;
146 f.bn_electronic_file.disabled = !can_bill;
147 <?php } ?>
148 f.bn_mark.disabled = !can_mark;
151 </script>
152 </head>
153 <body <?php echo $top_bg_line; ?> topmargin=0 rightmargin=0 leftmargin=2 bottommargin=0 marginwidth=2 marginheight=0>
155 <p style='margin-top:5px;margin-bottom:5px;margin-left:5px'>
156 <?php if ($GLOBALS['concurrent_layout']) { ?>
157 <font class='title'><?php xl('Billing Report','e') ?></font>
158 <?php } else if ($userauthorized) { ?>
159 <a href="../main/main.php" target=Main><font class=title><?php xl('Billing Report','e') ?></font><font class=more> <?php echo $tback; ?></font></a>
160 <?php } else { ?>
161 <a href="../main/onotes/office_comments.php" target=Main><font class=title><?php xl('Billing Report','e') ?></font><font class=more><?php echo $tback; ?></font></a>
162 <?php } ?>
163 </p>
165 <form name=the_form method=post action=billing_report.php>
167 <style type="text/css">@import url(../../library/dynarch_calendar.css);</style>
168 <script type="text/javascript" src="../../library/dialog.js"></script>
169 <script type="text/javascript" src="../../library/textformat.js"></script>
170 <script type="text/javascript" src="../../library/dynarch_calendar.js"></script>
171 <script type="text/javascript" src="../../library/dynarch_calendar_en.js"></script>
172 <script type="text/javascript" src="../../library/dynarch_calendar_setup.js"></script>
173 <script language='JavaScript'>
174 var mypcc = '1';
175 </script>
177 <input type=hidden name=mode value="change">
178 <table width=100% border="1" cellspacing="0" cellpadding="0">
180 <tr>
182 <td nowrap>
183 &nbsp;<span class=text><?php xl('From: ','e') ?></span>
184 <input type='text' size='10' name='from_date' id='from_date'
185 value='<?php echo $from_date; ?>'
186 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)'
187 title='yyyy-mm-dd last date of this event' />
188 <img src='../../interface/pic/show_calendar.gif' align='absbottom' width='24' height='22'
189 id='img_fromdate' border='0' alt='[?]' style='cursor:pointer'
190 title='Click here to choose a date'>
191 <script>
192 Calendar.setup({inputField:"from_date", ifFormat:"%Y-%m-%d", button:"img_fromdate"});
193 </script>
194 </td>
196 <td nowrap>
197 &nbsp;<span class=text><?php xl('To: ','e') ?></span>
198 <input type='text' size='10' name='to_date' id='to_date'
199 value='<?php echo $to_date; ?>'
200 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)'
201 title='yyyy-mm-dd last date of this event' />
202 <img src='../../interface/pic/show_calendar.gif' align='absbottom' width='24' height='22'
203 id='img_todate' border='0' alt='[?]' style='cursor:pointer'
204 title='Click here to choose a date'>
205 <script>
206 Calendar.setup({inputField:"to_date", ifFormat:"%Y-%m-%d", button:"img_todate"});
207 </script>
208 </td>
210 <input type="hidden" name="code_type" value="%"></td>
211 <td nowrap><input type=checkbox name=unbilled <?php if ($unbilled == "on") {echo "checked";}; ?>><span class=text><?php xl('Show Unbilled Only','e') ?></span></td>
212 <td nowrap><input type=checkbox name=authorized <?php if ($my_authorized == "on") {echo "checked";}; ?>><span class=text><?php xl('Show Authorized Only','e') ?></span></td>
213 <td align='right' width='10%' nowrap>
214 &nbsp;<span class=text><a href="javascript:document.the_form.mode.value='change';document.the_form.submit()" class=link_submit><?php xl('[Change View]','e') ?></a>
216 <a href="javascript:document.the_form.mode.value='export';document.the_form.submit()" class=link_submit><?php xl('[Export OFX]','e') ?></a></span>&nbsp;
217 </td>
218 </tr>
219 <tr>
220 <td nowrap>&nbsp;<a href="print_billing_report.php?<?php print "from_date=".urlencode($ofrom_date)."&to_date=".urlencode($oto_date)."&code_type=".urlencode($ocode_type)."&unbilled=".urlencode($ounbilled)."&authorized=".urlencode($oauthorized); ?>" class=link_submit target=new><?php xl('[View Printable Report]','e') ?></a></td>
221 <td nowrap>
222 <?php
223 print '&nbsp;';
224 $acct_config = $GLOBALS['oer_config']['ws_accounting'];
225 if($acct_config['enabled'] == true) {
226 print '<span class=text><a href="javascript:void window.open(\'' . $acct_config['url_path'] . '\')">' . xl("[SQL-Ledger]") . '</a></span>';
227 if (acl_check('acct', 'rep')) {
228 print '<span class=text> &nbsp; <a href="javascript:void window.open(\'sl_receipts_report.php\')">' . xl('[Reports]') . '</a></span>';
230 if (acl_check('acct', 'eob')) {
231 print '<span class=text> &nbsp; <a href="javascript:void window.open(\'sl_eob_search.php\')">' . xl('[EOBs]') . '</a></span>';
235 </td>
236 <td colspan='2' nowrap>
237 &nbsp;
238 <?php if (! file_exists($EXPORT_INC)) { ?>
239 <a href="javascript:document.the_form.mode.value='process';document.the_form.submit()" class="link_submit"
240 title="Process all queued bills to create electronic data (and print if requested)"><?php xl('[Start Batch Processing]','e') ?></a>
241 &nbsp; <a href='../../library/freeb/process_bills.log' target='_blank' class='link_submit'
242 title='See messages from the last batch processing run'><?php xl('[view log]','e') ?></a></span>
243 <?php } ?>
244 </td>
245 <td align='right' nowrap>
246 <a href="javascript:select_all()" class="link_submit"><?php xl('[Select All]','e') ?></a>&nbsp;
247 </td>
248 </tr>
249 </table>
250 </form>
252 <form name=update_form method=post action=billing_process.php>
254 <center>
256 <?php if (file_exists($EXPORT_INC)) { ?>
257 <input type="submit" class="subbtn" name="bn_external" value="Export Billing" title="<?php xl('Export to external billing system','e') ?>">
258 <input type="submit" class="subbtn" name="bn_mark" value="Mark as Cleared" title="<?php xl('Mark as billed but skip billing','e') ?>">
259 <?php } else { ?>
260 <input type="submit" class="subbtn" name="bn_hcfa_print" value="Queue HCFA &amp; Print" title="<?php xl('Queue for HCFA batch processing and printing','e') ?>">
261 <input type="submit" class="subbtn" name="bn_hcfa" value="Queue HCFA" title="<?php xl('Queue for HCFA batch processing','e')?>">
262 <input type="submit" class="subbtn" name="bn_ub92_print" value="Queue UB92 &amp; Print" title="<?php xl('Queue for UB-92 batch processing and printing','e')?>">
263 <input type="submit" class="subbtn" name="bn_ub92" value="Queue UB92" title="<?php xl('Queue for UB-92 batch processing','e')?>">
264 <input type="submit" class="subbtn" name="bn_x12" value="Queue X12" title="<?php xl('Queue for X12 batch processing','e')?>">
265 <input type="submit" class="subbtn" name="bn_mark" value="Mark as Cleared" title="<?php xl('Post to accounting and mark as billed','e')?>">
266 <input type="submit" class="subbtn" name="bn_electronic_file" value="Make Electronic Batch &amp; Clear" title="<?php xl('Download billing file, post to accounting and mark as billed','e')?>">
267 <?php } ?>
269 </center>
271 <input type=hidden name=mode value="bill">
272 <input type=hidden name=authorized value="<?php echo $my_authorized; ?>">
273 <input type=hidden name=unbilled value="<?php echo $unbilled; ?>">
274 <input type=hidden name=code_type value="%">
275 <input type=hidden name=to_date value="<?php echo $to_date; ?>">
276 <input type=hidden name=from_date value="<?php echo $from_date; ?>">
277 <?php
278 if ($my_authorized == "on" ) {
279 $my_authorized = "1";
280 } else {
281 $my_authorized = "%";
284 if ($unbilled == "on") {
285 $unbilled = "0";
286 } else {
287 $unbilled = "%";
290 <input type=hidden name=bill_list value="<?php
291 $list = getBillsListBetween($from_date,$to_date,$my_authorized,$unbilled,"%");
292 print $list;
293 ?>">
294 <!-- new form for uploading -->
295 <?php
296 if (!isset($_POST["mode"])) {
297 if (!isset($_POST["from_date"])) {
298 $from_date=date("Y-m-d");
299 } else {
300 $from_date = $_POST["from_date"];
302 if (!isset($_POST["to_date"])) {
303 $to_date = date("Y-m-d");
304 } else {
305 $to_date = $_POST["to_date"];
307 if (!isset($_POST["code_type"])) {
308 $code_type="all";
309 } else {
310 $code_type = $_POST["code_type"];
312 if (!isset($_POST["unbilled"])) {
313 $unbilled = "on";
314 } else {
315 $unbilled = $_POST["unbilled"];
317 if (!isset($_POST["authorized"])) {
318 $my_authorized = "on";
319 } else {
320 $my_authorized = $_POST["authorized"];
322 } else {
323 $from_date = $_POST["from_date"];
324 $to_date = $_POST["to_date"];
325 $code_type = $_POST["code_type"];
326 $unbilled = $_POST["unbilled"];
327 $my_authorized = $_POST["authorized"];
329 if ($my_authorized == "on" ) {
330 $my_authorized = "1";
331 } else {
332 $my_authorized = "%";
335 if ($unbilled == "on") {
336 $unbilled = "0";
337 } else {
338 $unbilled = "%";
343 if (isset($_POST["mode"]) && $_POST["mode"] == "bill") {
344 billCodesList($list);
349 <table border="0" cellspacing="0" cellpadding="0" width="100%">
352 if ($ret = getBillsBetween($from_date,$to_date,$my_authorized,$unbilled,"%")) {
353 $loop = 0;
354 $oldcode = "";
355 $last_encounter_id = "";
356 $lhtml = "";
357 $rhtml = "";
358 $lcount = 0;
359 $rcount = 0;
360 $bgcolor = "";
361 $skipping = FALSE;
363 foreach ($ret as $iter) {
364 $this_encounter_id = $iter['pid'] . "-" . $iter['encounter'];
366 if ($last_encounter_id != $this_encounter_id) {
367 if ($lhtml) {
368 while ($rcount < $lcount) {
369 $rhtml .= "<tr bgcolor='$bgcolor'><td colspan='7'>&nbsp;</td></tr>";
370 ++$rcount;
372 echo "<tr bgcolor='$bgcolor'>\n<td rowspan='$rcount' valign='top'>\n$lhtml</td>$rhtml\n";
373 echo "<tr bgcolor='$bgcolor'><td colspan='8' height='5'></td></tr>\n\n";
376 $lhtml = "";
377 $rhtml = "";
379 // If there are ANY unauthorized items in this encounter and this is
380 // the normal case of viewing only authorized billing, then skip the
381 // entire encounter.
383 $skipping = FALSE;
384 if ($my_authorized == '1') {
385 $res = sqlQuery("select count(*) as count from billing where " .
386 "encounter = '" . $iter['encounter'] . "' and " .
387 "pid='" . $iter['pid'] . "' and " .
388 "activity = 1 and authorized = 0");
389 if ($res['count'] > 0) {
390 $skipping = TRUE;
391 $last_encounter_id = $this_encounter_id;
392 continue;
396 $name = getPatientData($iter['pid'], "fname, mname, lname");
398 # Check if patient has primary insurance and a subscriber exists for it.
399 # If not we will highlight their name in red.
400 # TBD: more checking here.
402 $res = sqlQuery("select count(*) as count from insurance_data where " .
403 "pid = " . $iter['pid'] . " and " .
404 "type='primary' and " .
405 "subscriber_lname is not null and " .
406 "subscriber_lname != '' limit 1");
407 $namecolor = ($res['count'] > 0) ? "black" : "#ff7777";
409 ++$encount;
410 $bgcolor = "#" . (($encount & 1) ? "ddddff" : "ffdddd");
411 echo "<tr bgcolor='$bgcolor'><td colspan='8' height='5'></td></tr>\n";
412 $lcount = 3;
413 $rcount = 0;
414 $oldcode = "";
416 $lhtml .= "&nbsp;<span class=bold><font color='$namecolor'>". $name['fname'] . "&nbsp;" . $name['lname'] . "</font></span><span class=small>&nbsp;(" . $iter['pid'] . "-" . $iter['encounter'] . ")</span>";
417 $lhtml .= "&nbsp;&nbsp;&nbsp;<a class=\"link_submit\" href=\"" . $GLOBALS['webroot'] ."/interface/patient_file/encounter/patient_encounter.php?set_encounter=" . $iter['encounter'] . "&pid=" . $iter['pid'] . "\">[To&nbsp;Encounter]</a>";
418 $lhtml .= "&nbsp;&nbsp;&nbsp;<a class=\"link_submit\" href=\"" . $GLOBALS['webroot'] ."/interface/patient_file/summary/demographics_full.php?&pid=" . $iter['pid'] . "\">[To&nbsp;Demographics]</a>";
419 $lhtml .= "<br />\n";
420 $lhtml .= "&nbsp;<span class=text>Bill: ";
421 $lhtml .= "<select name='claims[" . $this_encounter_id . "][payer]' style='background-color:$bgcolor'>";
423 $query = "SELECT id.provider AS id, id.type, " .
424 "ic.x12_default_partner_id AS ic_x12id, ic.name AS provider " .
425 "FROM insurance_data AS id, insurance_companies AS ic WHERE " .
426 "ic.id = id.provider AND pid = '" . mysql_escape_string($iter['pid']) .
427 "' ORDER BY type";
428 $result = sqlStatement($query);
430 $count = 0;
431 $default_x12_partner = $iter['ic_x12id'];
433 while ($row = mysql_fetch_array($result)) {
434 if (strlen($row['provider']) > 0) {
436 // This preserves any existing insurance company selection, which is
437 // important when EOB posting has re-queued for secondary billing.
438 $lhtml .= "<option value=\"" . $row['id'] . "\"";
439 if (($count == 0 && !$iter['payer_id']) || $row['id'] == $iter['payer_id']) {
440 $lhtml .= " selected";
441 if (!is_numeric($default_x12_partner)) $default_x12_partner = $row['ic_x12id'];
443 $lhtml .= ">" . $row['type'] . ": " . $row['provider'] . "</option>";
445 /****
446 if ($count == 0) {
447 $lhtml .= "<option value=\"" .$row['id'] . "\" selected>" . $row['type'] . ": " . $row['provider']. "</option>";
448 if (!is_numeric($default_x12_partner)) $default_x12_partner = $row['ic_x12id'];
450 else {
451 $lhtml .= "<option value=\"" . $row['id'] . "\">" . $row['type'] . ": " . $row['provider']. "</option>";
453 ****/
456 $count++;
459 $lhtml .= "<option value='-1'>Unassigned</option>\n";
460 $lhtml .= "</select>&nbsp;&nbsp;\n";
461 $lhtml .= "<select name='claims[" . $this_encounter_id . "][partner]' style='background-color:$bgcolor'>";
462 $x = new X12Partner();
463 $partners = $x->_utility_array($x->x12_partner_factory());
464 foreach ($partners as $xid => $xname) {
465 $lhtml .= '<option label="' . $xname . '" value="' . $xid .'"';
466 if ($xid == $default_x12_partner) {
467 $lhtml .= "selected";
469 $lhtml .= '>' . $xname . '</option>';
471 $lhtml .= "</select>";
472 $lhtml .= "<br>\n&nbsp;".xl("Claim was initiated: ") . $iter['date'];
473 if ($iter['billed'] == 1) {
474 $lhtml .= "<br>\n&nbsp;".xl("Claim was billed: ") . $iter['bill_date'];
475 ++$lcount;
477 if ($iter['bill_process'] == 1) {
478 $lhtml .= "<br>\n&nbsp;".xl("Claim is queued for processing");
479 ++$lcount;
481 if ($iter['bill_process'] == 5) {
482 $lhtml .= "<br>\n&nbsp;".xl("Claim is queued for printing and processing");
483 ++$lcount;
485 if ($iter['bill_process'] == 2) {
486 $lhtml .= "<br>\n&nbsp;".xl("Claim was processed: ") . $iter['process_date'];
487 $lhtml .= '<br>' . "\n" . '&nbsp;'.xl("Claim is in file:").' <a href="get_claim_file.php?key=' . $iter['process_file'] .'">' . $iter['process_file'] . '</a> or ';
488 $lhtml .= '<a href="get_claim_file.php?action=print&key=' . $iter['process_file'] .'">Print It</a> or ';
489 $lhtml .= '<a target="_new" href="freebtest.php?format=' . $iter['target'] . '&billkey=' . $iter['pid'] . '-' . $iter['encounter'] . '">'.xl('Run Test').'</a>';
490 $lhtml .= '<input type="hidden" name="claims[' . $this_encounter_id . '][file]" value="' . $iter['process_file'] . '">';
491 $lcount += 2;
493 if ($iter['bill_process'] == 3) {
494 $lhtml .= "<br>\n&nbsp;".xl("Claim was processed: ") . $iter['process_date'] . xl(" but there was an error: "). $iter['process_file'];
495 ++$lcount;
499 if ($skipping) continue;
501 ++$rcount;
502 if ($rhtml) {
503 $rhtml .= "<tr bgcolor='$bgcolor'>\n";
505 $rhtml .= "<td width='50'>";
506 if ($oldcode != $iter['code_type']) {
507 $rhtml .= "<span class=text>" . $iter['code_type'] . ": </span>";
509 $oldcode = $iter['code_type'];
510 $rhtml .= "</td>\n";
511 $justify = "";
512 // if ($iter['code_type'] == "CPT4" || $iter['code_type'] == "HCPCS") {
513 if ($code_types[$iter['code_type']]['just']) {
514 $js = split(":",$iter['justify']);
515 $counter = 0;
516 foreach ($js as $j) {
517 if(!empty($j)) {
518 if ($counter == 0) {
519 $justify .= " (<b>$j</b>)";
521 else {
522 $justify .= " ($j)";
524 $counter++;
529 $rhtml .= "<td><span class=text>" . $iter{"code"}. "</span>" . '<span style="font-size:8pt;">' . $justify . "</span></td>\n";
530 $rhtml .= '<td align="right"><span style="font-size:8pt;">&nbsp;&nbsp;&nbsp;';
531 if ($iter['fee'] > 0) {
532 $rhtml .= '$' . $iter['fee'];
534 $rhtml .= "</span></td>\n";
535 $rhtml .= '<td><span style="font-size:8pt;">&nbsp;&nbsp;&nbsp;';
536 $rhtml .= getProviderName($iter['provider_id']);
537 $rhtml .= "</span></td>\n";
538 $rhtml .= '<td width=100>&nbsp;&nbsp;&nbsp;<span style="font-size:8pt;">' . date("Y-m-d",strtotime($iter{"date"})) . "</span></td>\n";
539 if ($iter['authorized'] != 1) {
540 $rhtml .= "<td><span class=alert>".xl("Note: This code was not entered by an authorized user. Only authorized codes may be uploaded to the Open Medical Billing Network for processing. If you wish to upload these codes, please select an authorized user here.")."</span></td>\n";
542 else {
543 $rhtml .= "<td></td>\n";
545 if ($last_encounter_id != $this_encounter_id) {
546 $rhtml .= "<td><input type='checkbox' value='" . $iter['bill_process'] . "$procstatus' name='claims[" . $this_encounter_id . "][bill]' onclick='set_button_states()'>&nbsp;</td>\n";
548 else {
549 $rhtml .= "<td></td>\n";
551 $rhtml .= "</tr>\n";
552 $last_encounter_id = $this_encounter_id;
555 if ($lhtml) {
556 while ($rcount < $lcount) {
557 $rhtml .= "<tr bgcolor='$bgcolor'><td colspan='7'>&nbsp;</td></tr>";
558 ++$rcount;
560 echo "<tr bgcolor='$bgcolor'>\n<td rowspan='$rcount' valign='top'>\n$lhtml</td>$rhtml\n";
561 echo "<tr bgcolor='$bgcolor'><td colspan='8' height='5'></td></tr>\n";
567 </table>
569 </form>
570 <script>
571 set_button_states();
573 <?php
574 if ($alertmsg) {
575 echo "alert('$alertmsg');\n";
579 </script>
580 </body>
581 </html>