Skip to main content
Version: v0.0.2

Function: checkRemitTotalBalance()

checkRemitTotalBalance(bpr02, claims, providerAdjustments, position): X12ParseWarning | undefined

Check the top-of-remit invariant BPR-02 === Σ(CLP-04) - Σ(PLB amounts). PLB amounts are preserved with their raw EDI sign (positive = take-back from provider; negative = credit to provider - see "./types.js".X12RemitProviderAdjustment), so the subtraction is what makes the equation balance. Returns the warning when out of balance, or undefined when balanced.

Parameters

bpr02

X12Decimal

claims

readonly X12RemitClaim[]

providerAdjustments

readonly X12RemitProviderAdjustment[]

position

X12Position

Returns

X12ParseWarning | undefined

Example

import { checkRemitTotalBalance } from "@cosyte/x12";
declare const remit: import("./types.js").X12Remittance;
const w = checkRemitTotalBalance(
remit.payment.totalActualPayment,
remit.claims,
remit.providerAdjustments,
{ segmentIndex: 2, transactionIndex: 0 },
);