Skip to content

Commit

Permalink
work on payment reversals, but forcing manual handling of them and al…
Browse files Browse the repository at this point in the history
…so denied claims for now
  • Loading branch information
sunsetsystems committed Apr 11, 2007
1 parent e36e819 commit 262fcc5
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 16 deletions.
29 changes: 24 additions & 5 deletions interface/billing/sl_eob_process.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
// Copyright (C) 2006 Rod Roark <[email protected]>
// Copyright (C) 2006-2007 Rod Roark <[email protected]>
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
Expand Down Expand Up @@ -167,6 +167,17 @@ function era_callback(&$out) {
// }
}

if ($csc == '4') {
$inverror = true;
writeMessageLine($bgcolor, 'errdetail',
"Not posting adjustments for denied claims, please follow up manually!");
}
else if ($csc == '22') {
$inverror = true;
writeMessageLine($bgcolor, 'errdetail',
"Payment reversals are not automated, please enter manually!");
}

if ($out['warnings']) {
writeMessageLine($bgcolor, 'infdetail', nl2br(rtrim($out['warnings'])));
}
Expand All @@ -189,7 +200,7 @@ function era_callback(&$out) {
writeOldDetail($prev, $patient_name, $invnumber, $service_date, $svc['code'], $bgcolor);
// Check for sanity in amount charged.
$prevchg = sprintf("%.2f", $prev['chg'] + $prev['adj']);
if ($prevchg != $svc['chg']) {
if ($prevchg != abs($svc['chg'])) {
writeMessageLine($bgcolor, 'errdetail',
"EOB charge amount " . $svc['chg'] . " for this code does not match our invoice");
$error = true;
Expand Down Expand Up @@ -320,13 +331,21 @@ function era_callback(&$out) {

} // End of service item

// Report any existing service items not mentioned in the ERA.
// Report any existing service items not mentioned in the ERA, and
// determine if any of them are still missing an insurance response
// (if so, then insurance is not yet done with the claim).
$insurance_done = true;
foreach ($codes as $code => $prev) {
writeOldDetail($prev, $arrow['name'], $invnumber, $service_date, $code, $bgcolor);
$got_response = false;
foreach ($prev['dtl'] as $ddata) {
if ($ddata['pmt'] || $ddata['rsn']) $got_response = true;
}
if (!$got_response) $insurance_done = false;
}

// Cleanup: If all is well, mark Ins1 done and check for secondary billing.
if (!$error && !$debug) {
// Cleanup: If all is well, mark Ins<x> done and check for secondary billing.
if (!$error && !$debug && $insurance_done) {
$shipvia = 'Done: Ins1';
if ($inslabel != 'Ins1') $shipvia .= ',Ins2';
if ($inslabel == 'Ins3') $shipvia .= ',Ins3';
Expand Down
54 changes: 43 additions & 11 deletions library/parse_era.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,51 @@
function parse_era_2100(&$out, $cb) {
if ($out['loopid'] == '2110' || $out['loopid'] == '2100') {

// Production date is posted with adjustments, so make sure it exists.
if (!$out['production_date']) $out['production_date'] = $out['check_date'];

// Force the sum of service payments to equal the claim payment
// amount. Whenever this is an issue it should result from
// claim-level adjustments, and in this case the first SVC item
// that we stored was a 'Claim' type.
// amount, and the sum of service adjustments to equal the CLP's
// (charged amount - paid amount - patient responsibility amount).
// This may result from claim-level adjustments, and in this case the
// first SVC item that we stored was a 'Claim' type. It also may result
// from poorly reported payment reversals, in which case we may need to
// create the 'Claim' service type here.
//
$paytotal = $out['amount_approved'];
foreach ($out['svc'] as $svc) $paytotal -= $svc['paid'];
$adjtotal = $out['amount_charged'] - $out['amount_approved'] - $out['amount_patient'];
foreach ($out['svc'] as $svc) {
$paytotal -= $svc['paid'];
foreach ($svc['adj'] as $adj) {
if ($adj['group_code'] != 'PR') $adjtotal -= $adj['amount'];
}
}
$paytotal = round($paytotal, 2);
if ($paytotal != 0) {
$out['svc'][0]['paid'] += $paytotal;
$adjtotal = round($adjtotal, 2);
if ($paytotal != 0 || $adjtotal != 0) {
if ($out['svc'][0]['code'] != 'Claim') {
$out['warnings'] .= "First service item payment amount " .
"adjusted by $paytotal due to payment imbalance. " .
"This should not happen!\n";
array_unshift($out['svc'], array());
$out['svc'][0]['code'] = 'Claim';
$out['svc'][0]['mod'] = '';
$out['svc'][0]['chg'] = '0';
$out['svc'][0]['paid'] = '0';
$out['svc'][0]['adj'] = array();
$out['warnings'] .= "Procedure 'Claim' is inserted artificially to " .
"force claim balancing.\n";
}
$out['svc'][0]['paid'] += $paytotal;
if ($adjtotal) {
$j = count($out['svc'][0]['adj']);
$out['svc'][0]['adj'][$j] = array();
$out['svc'][0]['adj'][$j]['group_code'] = 'CR'; // presuming a correction or reversal
$out['svc'][0]['adj'][$j]['reason_code'] = 'Balancing';
$out['svc'][0]['adj'][$j]['amount'] = $adjtotal;
}
// if ($out['svc'][0]['code'] != 'Claim') {
// $out['warnings'] .= "First service item payment amount " .
// "adjusted by $paytotal due to payment imbalance. " .
// "This should not happen!\n";
// }
}

$cb($out);
Expand Down Expand Up @@ -285,12 +316,13 @@ function parse_era($filename, $cb) {
if (! $out['loopid']) return 'Unexpected SVC segment';
$out['loopid'] = '2110';
if ($seg[6]) {
// SVC06 if present is our original procedure code that they are bundling.
// SVC06 if present is our original procedure code that they are changing.
// We will not put their crap in our invoice, but rather log a note and
// treat it as adjustments to our originally submitted coding.
$svc = explode('^', $seg[6]);
$tmp = explode('^', $seg[1]);
$out['warnings'] .= "Payer is bundling " . $svc[1] . " into " . $tmp[1] . ".\n";
$out['warnings'] .= "Payer is restating our procedure " . $svc[1] .
" as " . $tmp[1] . ".\n";
} else {
$svc = explode('^', $seg[1]);
}
Expand Down

0 comments on commit 262fcc5

Please sign in to comment.