2 // Copyright (C) 2005 Rod Roark <rod@sunsetsystems.com>
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
9 // This is the second of two pages to support posting of EOBs.
10 // The first is sl_eob_search.php.
12 include_once("../globals.php");
13 include_once("../../library/patient.inc");
14 include_once("../../library/forms.inc");
15 include_once("../../library/sql-ledger.inc");
16 include_once("../../library/invoice_summary.inc.php");
17 include_once("../../custom/code_types.inc.php");
19 $debug = 0; // set to 1 for debugging mode
22 "", // not choosing this allows a reason with no adjustment amount
41 // Format money for display.
43 function bucks($amount) {
45 printf("%.2f", $amount);
48 // Insert a row into the acc_trans table.
50 function addTransaction($invid, $chartid, $amount, $date, $source, $memo, $insplan) {
51 global $sl_err, $debug;
52 $date = fixDate($date);
53 $query = "INSERT INTO acc_trans ( " .
62 "$invid, " . // trans_id
63 "$chartid, " . // chart_id
64 "$amount, " . // amount
65 "'$date', " . // transdate
66 "'$source', " . // source
67 "$insplan, " . // project_id
71 echo $query . "<br>\n";
74 if ($sl_err) die($sl_err);
78 // Insert a row into the invoice table.
80 function addLineItem($invid, $serialnumber, $amount, $adjdate, $insplan, $reason) {
81 global $sl_err, $services_id, $debug;
82 $adjdate = fixDate($adjdate);
83 $description = "Adjustment $adjdate $reason";
84 $query = "INSERT INTO invoice ( " .
97 "$invid, " . // trans_id
98 "$services_id, " . // parts_id
99 "'$description', " . // description
102 "$amount, " . // sellprice
103 "$amount, " . // fxsellprice
106 "$insplan, " . // project_id
107 "'$serialnumber'" . // serialnumber
110 echo $query . "<br>\n";
113 if ($sl_err) die($sl_err);
117 // Update totals and payment date in the invoice header. Dollar amounts are
118 // stored as double precision floats so we have to be careful about rounding.
120 function updateAR($invid, $amount, $paid = 0, $paydate = "") {
121 global $sl_err, $debug;
122 $paydate = fixDate($paydate);
123 $query = "UPDATE ar SET amount = round(CAST (amount AS numeric) + $amount, 2), " .
124 "netamount = round(CAST (netamount AS numeric) + $amount, 2)";
125 if ($paid) $query .= ", paid = round(CAST (paid AS numeric) + $paid, 2), datepaid = '$paydate'";
126 $query .= " WHERE id = $invid";
128 echo $query . "<br>\n";
131 if ($sl_err) die($sl_err);
135 // Do whatever is necessary to make this invoice re-billable.
137 function setupSecondary($invid) {
138 global $sl_err, $debug, $info_msg, $GLOBALS;
140 // Get some needed items from the SQL-Ledger invoice.
141 $arres = SLQuery("select invnumber, transdate, customer_id, employee_id " .
142 "from ar where ar.id = $invid");
143 if ($sl_err) die($sl_err);
144 $arrow = SLGetRow($arres, 0);
145 if (! $arrow) die(xl('There is no match for invoice id') . ' = ' . "$trans_id.");
146 $customer_id = $arrow['customer_id'];
147 list($trash, $encounter) = explode(".", $arrow['invnumber']);
149 // Get the OpenEMR PID corresponding to the customer.
150 $pdrow = sqlQuery("SELECT patient_data.pid " .
151 "FROM integration_mapping, patient_data WHERE " .
152 "integration_mapping.foreign_id = $customer_id AND " .
153 "integration_mapping.foreign_table = 'customer' AND " .
154 "patient_data.id = integration_mapping.local_id");
155 $pid = $pdrow['pid'];
156 if (! $pid) die(xl("Cannot find patient from SQL-Ledger customer id") . " = $customer_id.");
158 // Find out if the encounter exists.
159 $ferow = sqlQuery("SELECT pid FROM form_encounter WHERE " .
160 "encounter = $encounter");
161 $encounter_pid = $ferow['pid'];
163 // If it exists, just update the billing items.
164 if ($encounter_pid) {
165 if ($encounter_pid != $pid)
166 die(xl("Expected form_encounter.pid to be ") . $pid . ', ' . xl(' but was ') . $encounter_pid);
167 $query = "UPDATE billing SET billed = 0, bill_process = 0, payer_id = -1, " .
168 "bill_date = NULL, process_date = NULL, process_file = NULL " .
169 "WHERE encounter = $encounter AND pid = $pid AND activity = 1";
171 echo $query . "<br>\n";
175 $info_msg = xl("Encounter ") . $encounter . xl(" is ready for re-billing.");
179 // It does not exist then it better be a date.
180 if (! preg_match("/^20\d\d\d\d\d\d$/", $encounter))
181 die(xl("Internal error: encounter '") . $encounter . xl("' should exist but does not."));
183 $employee_id = $arrow['employee_id'];
185 // Get the OpenEMR provider info corresponding to the SQL-Ledger salesman.
186 $drrow = sqlQuery("SELECT users.id, users.username, users.facility " .
187 "FROM integration_mapping, users WHERE " .
188 "integration_mapping.foreign_id = $employee_id AND " .
189 "integration_mapping.foreign_table = 'salesman' AND " .
190 "users.id = integration_mapping.local_id");
191 $provider_id = $drrow['id'];
192 if (! $provider_id) die(xl("Cannot find provider from SQL-Ledger employee = ") . $employee_id );
194 $date_of_service = $arrow['transdate'];
195 if (! $date_of_service) die(xl("Invoice has no date!"));
197 // Generate a new encounter number.
198 $conn = $GLOBALS['adodb']['db'];
199 $new_encounter = $conn->GenID("sequences");
201 // Create the "new encounter".
203 $query = "INSERT INTO form_encounter ( " .
204 "date, reason, facility, pid, encounter, onset_date " .
206 "'$date_of_service', " .
207 "'" . xl('Imported from Accounting') . "', " .
208 "'" . addslashes($drrow['facility']) . "', " .
211 "'$date_of_service' " .
214 echo $query . "<br>\n";
215 echo xl("Call to addForm() goes here.<br>") . "\n";
217 $encounter_id = idSqlStatement($query);
218 if (! $encounter_id) die(xl("Insert failed: ") . $query);
219 addForm($new_encounter, xl("New Patient Encounter"), $encounter_id,
220 "newpatient", $pid, 1, $date_of_service);
221 $info_msg = xl("Encounter ") . $new_encounter . xl(" has been created. ");
224 // For each invoice line item with a billing code we will insert
225 // a billing row with payer_id set to -1. Order the line items
226 // chronologically so that each procedure code will be followed by
227 // its associated icd9 code.
229 $inres = SLQuery("SELECT * FROM invoice WHERE trans_id = $invid " .
231 if ($sl_err) die($sl_err);
233 // When nonzero, this will be the ID of a billing row that needs to
234 // have its justify field set.
237 for ($irow = 0; $irow < SLRowCount($inres); ++
$irow) {
238 $row = SLGetRow($inres, $irow);
239 $amount = $row['sellprice'];
241 // Extract the billing code.
242 $code = xl("Unknown");
243 if (preg_match("/([A-Za-z0-9]\d\d\S*)/", $row['serialnumber'], $matches)) {
244 $code = strtoupper($matches[1]);
246 else if (preg_match("/([A-Za-z0-9]\d\d\S*)/", $row['description'], $matches)) {
247 $code = strtoupper($matches[1]);
250 list($code, $modifier) = explode("-", $code);
252 // Set the billing code type and description.
257 if (preg_match("/CPT/", $row['serialnumber'])) {
259 $code_text = "Procedure $code";
261 else if (preg_match("/HCPCS/", $row['serialnumber'])) {
262 $code_type = "HCPCS";
263 $code_text = "Procedure $code";
265 else if (preg_match("/ICD/", $row['serialnumber'])) {
267 $code_text = "Diagnosis $code";
269 $query = "UPDATE billing SET justify = '$code' WHERE id = $proc_ins_id";
271 echo $query . "<br>\n";
280 foreach ($code_types as $key => $value) {
281 if (preg_match("/$key/", $row['serialnumber'])) {
284 $code_text = xl("Procedure") . " $code";
286 $code_text = xl("Diagnosis") . " $code";
288 $query = "UPDATE billing SET justify = '$code' WHERE id = $proc_ins_id";
290 echo $query . "<br>\n";
302 if (! $code_type) continue;
304 // Insert the billing item. If this for a procedure code then save
305 // the row ID so that we can update the "justify" field with the ICD9
306 // code, which should come next in the loop.
308 $query = "INSERT INTO billing ( " .
309 "date, code_type, code, pid, provider_id, user, groupname, authorized, " .
310 "encounter, code_text, activity, payer_id, billed, bill_process, " .
311 "modifier, units, fee, justify " .
318 "'" . $_SESSION['authId'] . "', " .
319 "'" . $_SESSION['authProvider'] . "', " .
333 echo $query . "<br>\n";
335 $proc_ins_id = idSqlStatement($query);
336 if ($code_type != "CPT4" && $code_type != "HCPCS")
341 // Finally, change this invoice number to contain the new encounter number.
343 $new_invnumber = "$pid.$new_encounter";
344 $query = "UPDATE ar SET invnumber = '$new_invnumber' WHERE id = $invid";
346 echo $query . "<br>\n";
349 if ($sl_err) die($sl_err);
350 $info_msg .= xl("This invoice number has been changed to ") . $new_invnumber;
356 <link rel
=stylesheet href
="<?echo $css_header;?>" type
="text/css">
357 <title
><?
xl('EOB Posting - Invoice','e')?
></title
>
358 <script language
="JavaScript">
360 // An insurance radio button is selected.
361 function setins(istr
) {
362 var f
= document
.forms
[0];
363 for (var i
= 0; i
< f
.elements
.length
; ++i
) {
364 var ename
= f
.elements
[i
].name
;
365 if (ename
.indexOf('[src]') < 0) continue;
366 var evalue
= f
.elements
[i
].value
;
367 var tmp
= evalue
.substring(0, 4).toLowerCase();
368 if (tmp
>= 'ins1' && tmp
<= 'ins3')
369 evalue
= evalue
.substring(4);
370 else if (evalue
.substring(0, 2).toLowerCase() == 'pt')
371 evalue
= evalue
.substring(2);
372 while (evalue
.substring(0, 1) == '/')
373 evalue
= evalue
.substring(1);
374 f
.elements
[i
].value
= istr +
'/' + evalue
;
379 // Compute an adjustment that writes off the balance:
380 function writeoff(code
) {
381 var f
= document
.forms
[0];
383 f
['form_line[' + code +
'][bal]'].value
-
384 f
['form_line[' + code +
'][pay]'].value
;
385 f
['form_line[' + code +
'][adj]'].value
= Number(tmp
).toFixed(2);
389 // Onsubmit handler. A good excuse to write some JavaScript.
390 function validate(f
) {
391 for (var i
= 0; i
< f
.elements
.length
; ++i
) {
392 var ename
= f
.elements
[i
].name
;
393 var pfxlen
= ename
.indexOf('[pay]');
394 if (pfxlen
< 0) continue;
395 var pfx
= ename
.substring(0, pfxlen
);
396 var code
= pfx
.substring(pfx
.indexOf('[')+
1, pfxlen
-1);
397 if (f
[pfx+
'[pay]'].value || f
[pfx+
'[adj]'].value
) {
398 var srcobj
= f
[pfx+
'[src]'];
399 while (srcobj
.value
.length
) {
400 var tmp
= srcobj
.value
.substring(srcobj
.value
.length
- 1);
401 if (tmp
> ' ' && tmp
!= '/') break;
402 srcobj
.value
= srcobj
.value
.substring(0, srcobj
.value
.length
- 1);
404 var svalue
= srcobj
.value
;
406 alert('<? xl('Source is missing
for code
','e
') ?>' + code
);
409 var tmp
= svalue
.substring(0, 4).toLowerCase();
410 if (tmp
>= 'ins1' && tmp
<= 'ins3') {
411 svalue
= svalue
.substring(4);
412 } else if (svalue
.substring(0, 2).toLowerCase() == 'pt') {
413 svalue
= svalue
.substring(2);
415 alert('<?xl('Invalid
or missing payer in source
for code
','e
')?>' + code
);
419 if (svalue
.substring(0, 1) != '/') {
420 alert('<?xl('Missing slash after payer in source
for code
','e
')?>' + code
);
423 if (false) { // Please keep this, Oakland Clinic wants it. -- Rod
424 tmp
= svalue
.substring(1, 3).toLowerCase();
425 if (tmp
!= 'nm' && tmp
!= 'ci' && tmp
!= 'cp' && tmp
!= 'ne' &&
426 tmp
!= 'it' && tmp
!= 'pf' && tmp
!= 'pp' && tmp
!= 'ok')
428 alert('<? xl('Invalid source designation
"','e') ?>' + tmp + '<? xl('" for code
','e
') ?>' + code
);
434 if (! f
[pfx+
'[date]'].value
) {
435 alert('<?xl('Date is missing
for code
','e
')?>' + code
);
439 if (f
[pfx+
'[pay]'].value
&& isNaN(parseFloat(f
[pfx+
'[pay]'].value
))) {
440 alert('<? xl('Payment value
for code
','e
') ?>' + code +
'<? xl(' is not a number
','e
') ?>');
443 if (f
[pfx+
'[adj]'].value
&& isNaN(parseFloat(f
[pfx+
'[adj]'].value
))) {
444 alert('<? xl('Adjustment value
for code
','e
') ?>' + code +
'<? xl(' is not a number
','e
') ?>');
447 if (f
[pfx+
'[adj]'].value
&& ! f
[pfx+
'[reason]'].value
) {
448 alert('<? xl('Please select an adjustment reason
for code
','e
') ?>' + code
);
451 // TBD: validate the date format
458 <body leftmargin
='0' topmargin
='0' marginwidth
='0' marginheight
='0'>
460 $trans_id = $_GET['id'];
461 if (! $trans_id) die(xl("You cannot access this page directly."));
465 $chart_id_cash = SLQueryValue("select id from chart where accno = '$sl_cash_acc'");
466 if ($sl_err) die($sl_err);
467 if (! $chart_id_cash) die(xl("There is no COA entry for cash account ") . "'$sl_cash_acc'");
469 $chart_id_ar = SLQueryValue("select id from chart where accno = '$sl_ar_acc'");
470 if ($sl_err) die($sl_err);
471 if (! $chart_id_ar) die(xl("There is no COA entry for AR account ") . "'$sl_ar_acc'");
473 $chart_id_income = SLQueryValue("select id from chart where accno = '$sl_income_acc'");
474 if ($sl_err) die($sl_err);
475 if (! $chart_id_income) die(xl("There is no COA entry for income account ") . "'$sl_income_acc'");
477 $services_id = SLQueryValue("select id from parts where partnumber = '$sl_services_id'");
478 if ($sl_err) die($sl_err);
479 if (! $services_id) die(xl("There is no parts entry for services ID ") . "'$sl_services_id'");
481 if ($_POST['form_save'] ||
$_POST['form_cancel']) {
482 if ($_POST['form_save']) {
484 echo xl("This module is in test mode. The database will not be changed.",'','<p><b>',"</b><p>\n");
487 foreach ($_POST['form_line'] as $code => $cdata) {
488 $thissrc = trim($cdata['src']);
489 $thisdate = trim($cdata['date']);
490 $thispay = trim($cdata['pay']);
491 $thisadj = trim($cdata['adj']);
492 $thisins = trim($cdata['ins']);
493 $reason = trim($cdata['reason']);
494 if (strpos(strtolower($reason), 'ins') !== false)
495 $reason .= ' ' . $_POST['form_insurance'];
496 if (! $thisins) $thisins = 0;
498 // Post a payment: add to ar, subtract from cash.
499 addTransaction($trans_id, $chart_id_ar, $thispay, $thisdate, $thissrc, $code, $thisins);
500 addTransaction($trans_id, $chart_id_cash, 0 - $thispay, $thisdate, $thissrc, $code, $thisins);
501 updateAR($trans_id, 0, $thispay, $thisdate);
502 $paytotal +
= $thispay;
506 // // Post an adjustment: add negative invoice item, add to ar, subtract from income
507 // addLineItem($trans_id, $code, 0 - $thisadj, $thisdate, $thisins, $reason);
508 // addTransaction($trans_id, $chart_id_ar, $thisadj, $thisdate, "InvAdj $thissrc", $code, $thisins);
509 // addTransaction($trans_id, $chart_id_income, 0 - $thisadj, $thisdate, "InvAdj $thissrc", $code, $thisins);
510 // updateAR($trans_id, 0 - $thisadj);
513 // Be sure to record adjustment reasons even for zero adjustments.
514 if ($thisadj ||
$reason) {
515 // Post an adjustment: add negative invoice item, add to ar, subtract from income
516 addLineItem($trans_id, $code, 0 - $thisadj, $thisdate, $thisins, $reason);
518 addTransaction($trans_id, $chart_id_ar, $thisadj, $thisdate, "InvAdj $thissrc", $code, $thisins);
519 addTransaction($trans_id, $chart_id_income, 0 - $thisadj, $thisdate, "InvAdj $thissrc", $code, $thisins);
520 updateAR($trans_id, 0 - $thisadj);
525 $form_duedate = fixDate($_POST['form_duedate']);
526 $form_notes = trim($_POST['form_notes']);
528 // Maintain the list of insurances that we mark as finished.
529 // We use the "Ship Via" field of the invoice to hold these.
532 foreach (array('Ins1', 'Ins2', 'Ins3') as $value) {
533 if ($_POST["form_done_$value"]) {
534 if ($form_eobs) $form_eobs .= ","; else $form_eobs = "Done: ";
535 $form_eobs .= $value;
539 $query = "UPDATE ar SET duedate = '$form_duedate', notes = '$form_notes', " .
540 "shipvia = '$form_eobs' WHERE id = $trans_id";
543 echo $query . "<br>\n";
546 if ($sl_err) die($sl_err);
548 if ($_POST['form_secondary']) {
549 setupSecondary($trans_id);
551 echo "<script language='JavaScript'>\n";
552 echo " var tmp = opener.document.forms[0].form_amount.value - $paytotal;\n";
553 echo " opener.document.forms[0].form_amount.value = Number(tmp).toFixed(2);\n";
555 echo "<script language='JavaScript'>\n";
557 if ($info_msg) echo " alert('$info_msg');\n";
558 if (! $debug) echo " window.close();\n";
559 echo "</script></body></html>\n";
564 // Get invoice data into $arrow.
565 $arres = SLQuery("select ar.*, customer.name, employee.name as doctor " .
566 "from ar, customer, employee where ar.id = $trans_id and " .
567 "customer.id = ar.customer_id and employee.id = ar.employee_id");
568 if ($sl_err) die($sl_err);
569 $arrow = SLGetRow($arres, 0);
570 if (! $arrow) die(xl("There is no match for invoice id = ") . $trans_id);
572 // Determine the date of service. An 8-digit encounter number is
573 // presumed to be a date of service imported during conversion.
574 // Otherwise look it up in the form_encounter table.
577 list($trash, $encounter) = explode(".", $arrow['invnumber']);
578 if (strlen($encounter) == 8) {
579 $svcdate = substr($encounter, 0, 4) . "-" . substr($encounter, 4, 2) .
580 "-" . substr($encounter, 6, 2);
582 else if ($encounter) {
583 $tmp = sqlQuery("SELECT date FROM form_encounter WHERE " .
584 "encounter = $encounter");
585 $svcdate = substr($tmp['date'], 0, 10);
588 // Get invoice charge details.
589 $codes = get_invoice_summary($trans_id, true);
593 <form method
='post' action
='sl_eob_invoice.php?id=<? echo $trans_id ?>'
594 onsubmit
='return validate(this)'>
596 <table border
='0' cellpadding
='3'>
599 <?
xl('Patient:','e')?
>
602 <?
echo $arrow['name'] ?
>
604 <td colspan
="2" rowspan
="3">
605 <textarea name
="form_notes" cols
="50" style
="height:100%"><?
echo $arrow['notes'] ?
></textarea
>
610 <?
xl('Provider:','e')?
>
613 <?
echo $arrow['doctor'] ?
>
618 <?
xl('Invoice:','e')?
>
621 <?
echo $arrow['invnumber'] ?
>
627 <?
xl('Svc Date:','e')?
>
633 <!-- <?
echo $arrow['shipvia'] ?
> -->
634 <?
xl('Done with:','e',''," ")?
>;
636 // Write a checkbox for each insurance. It is to be checked when
637 // we no longer expect any payments from that company for the claim.
638 // The information is stored in the 'shipvia' field of the invoice.
640 $insgot = strtolower($arrow['notes']);
641 $insdone = strtolower($arrow['shipvia']);
642 foreach (array('Ins1', 'Ins2', 'Ins3') as $value) {
643 $lcvalue = strtolower($value);
644 $checked = (strpos($insdone, $lcvalue) === false) ?
"" : " checked";
645 if (strpos($insgot, $lcvalue) !== false) {
646 echo " <input type='checkbox' name='form_done_$value' value='1'$checked />$value \n";
655 <?php
xl('Bill Date:','e') ?
>
658 <?
echo $arrow['transdate'] ?
>
661 <?
xl('Now posting for:','e',''," ")?
>;
662 <input type
='radio' name
='form_insurance' value
='Ins1' onclick
='setins("Ins1")' checked
/><?
xl('Ins1','e')?
> 
;
663 <input type
='radio' name
='form_insurance' value
='Ins2' onclick
='setins("Ins2")' /><?
xl('Ins2','e')?
> 
;
664 <input type
='radio' name
='form_insurance' value
='Ins3' onclick
='setins("Ins3")' /><?
xl('Ins3','e')?
> 
;
665 <input type
='radio' name
='form_insurance' value
='Pt' onclick
='setins("Pt")' /><?
xl('Patient','e')?
>
666 <input type
='hidden' name
='form_eobs' value
='<?echo addslashes($arrow['shipvia
']) ?>' />
671 <?
xl('Due Date:','e')?
>
674 <input type
='text' name
='form_duedate' size
='10' value
='<?echo $arrow['duedate
'] ?>'
675 title
='<?xl('Due date mm
/dd
/yyyy
or yyyy
-mm
-dd
','e
')?>'>
678 <input type
="checkbox" name
="form_secondary" value
="1"> <?
xl('Needs secondary billing','e')?
>
680 <input type
='submit' name
='form_save' value
='<?xl('Save
','e
')?>'>
682 <input type
='button' value
='<?xl('Cancel
','e
')?>' onclick
='window.close()'>
691 <table border
='0' cellpadding
='2' cellspacing
='0' width
='98%'>
693 <tr bgcolor
="#cccccc">
697 <td
class="dehead" align
="right">
700 <td
class="dehead" align
="right">
701 <?
xl('Balance','e')?
> 
;
721 foreach ($codes as $code => $cdata) {
723 $bgcolor = "#" . (($encount & 1) ?
"ddddff" : "ffdddd");
725 // this sorts the details more or less chronologically:
726 ksort($cdata['dtl']);
727 foreach ($cdata['dtl'] as $dkey => $ddata) {
728 $ddate = substr($dkey, 0, 10);
729 if (preg_match('/^(\d\d\d\d)(\d\d)(\d\d)\s*$/', $ddate, $matches)) {
730 $ddate = $matches[1] . '-' . $matches[2] . '-' . $matches[3];
734 if ($ddata['chg'] > 0)
735 $tmpchg = $ddata['chg'];
736 else if ($ddata['chg'] < 0)
737 $tmpadj = 0 - $ddata['chg'];
739 <tr bgcolor
='<? echo $bgcolor ?>'>
741 <?
echo $dispcode; $dispcode = "" ?
>
743 <td
class="detail" align
="right">
746 <td
class="detail" align
="right">
750 <?
echo $ddata['src'] ?
>
756 <?
bucks($ddata['pmt']) ?
>
762 <?
echo $ddata['rsn'] ?
>
766 } // end of prior detail line
768 <tr bgcolor
='<? echo $bgcolor ?>'>
770 <?
echo $dispcode; $dispcode = "" ?
>
772 <td
class="detail" align
="right">
775 <td
class="detail" align
="right">
776 <input type
="hidden" name
="form_line[<? echo $code ?>][bal]" value
="<? bucks($cdata['bal']) ?>">
777 <input type
="hidden" name
="form_line[<? echo $code ?>][ins]" value
="<? echo $cdata['ins'] ?>">
778 <?
printf("%.2f", $cdata['bal']) ?
> 
;
781 <input type
="text" name
="form_line[<? echo $code ?>][src]" size
="10"
782 style
="background-color:<? echo $bgcolor ?>"
783 <?php
if (false) { ?
>
784 title
="NM=notmet, CI=coins, CP=copay, NE=notelig, IT=insterm, PF=ptfull, PP=ptpart"
789 <input type
="text" name
="form_line[<? echo $code ?>][date]" size
="10" style
="background-color:<? echo $bgcolor ?>" />
792 <input type
="text" name
="form_line[<? echo $code ?>][pay]" size
="10" style
="background-color:<? echo $bgcolor ?>" />
795 <input type
="text" name
="form_line[<? echo $code ?>][adj]" size
="10" style
="background-color:<? echo $bgcolor ?>" />
796  
; <a href
="" onclick
="return writeoff('<? echo $code ?>')">W
</a
>
799 <select name
="form_line[<? echo $code ?>][reason]" style
="background-color:<? echo $bgcolor ?>">
801 foreach ($reasons as $value) {
802 echo " <option value=\"$value\">$value</option>\n";
816 <script language
="JavaScript">
817 var f1
= opener
.document
.forms
[0];
818 var f2
= document
.forms
[0];
820 foreach ($codes as $code => $cdata) {
821 echo " f2['form_line[$code][src]'].value = f1.form_source.value;\n";
822 echo " f2['form_line[$code][date]'].value = f1.form_paydate.value;\n";