Sum of invoice line net amounts

Error BR-FXEXT-CO-10 Factur-X

Absolute Value of (Sum of Invoice line net amount (BT-106) - Σ Invoice line net amounts (BT-131))<= 0,01 * Number of line net amounts (BT-131).

Mandatory rule: As long as it is violated, the invoice is invalid and will be rejected by validators.
What is wrong

The value in ram:LineTotalAmount differs from the sum of ram:LineTotalAmount values for the included invoice lines by more than the permitted tolerance. The tolerance is 0.01 for each counted invoice line.

What the rule means

The document total for invoice line net amounts must agree with the individual net amounts. A limited rounding difference is allowed.

Affected fields BT-106 BT-131
Please reconcile the invoice line net total

The document’s net total does not agree sufficiently with the net amounts of the invoice lines. Comparing the relevant amounts can help resolve the difference.

What to do
  1. Compare FacturXInvoice.LineTotalAmount with the TradeLineItem.LineTotalAmount values of the included invoice lines.
  2. Check that the included invoice lines contain the amounts that should contribute to the total.
  3. Generate the invoice again and validate it once more.
Check in FactoorSharp
  • FacturXInvoice.LineTotalAmount (BT-106)
  • TradeLineItem.LineTotalAmount (BT-131)
Technical details

The included line amounts are summed and rounded to two decimal places. The absolute difference is compared with 0.01 multiplied by the number of invoice lines.

Where the rule applies

The rule applies to ram:SpecifiedTradeSettlementHeaderMonetarySummation in the document totals and compares its ram:LineTotalAmount with the invoice line net amounts.

Context (rule/@context)
//ram:SpecifiedTradeSettlementHeaderMonetarySummation
Test expression (assert/@test)
for $calculatedAmount in xs:decimal(round(sum(../../ram:IncludedSupplyChainTradeLineItem[ not(ram:AssociatedDocumentLineDocument/ram:LineStatusReasonCode) or ram:AssociatedDocumentLineDocument/ram:LineStatusReasonCode = 'DETAIL' ]/ram:SpecifiedLineTradeSettlement/ram:SpecifiedTradeSettlementLineMonetarySummation/ ram:LineTotalAmount) * xs:decimal(100)) div xs:decimal(100)), $totalAmount in xs:decimal(ram:LineTotalAmount), $nbLineItems in xs:decimal(count(../../ram:IncludedSupplyChainTradeLineItem)), $tolerance in xs:decimal(0.01), $maxTolerance in $nbLineItems * $tolerance, $diff in xs:decimal($totalAmount - $calculatedAmount), $abs in xs:decimal(abs($diff)) return $abs le $maxTolerance