Reconcile the invoice total excluding VAT with lines and adjustments

Error BR-FXEXT-CO-13 Factur-X

Absolute Value of (Invoice total amount without VAT (BT-109) - ∑ Invoice line net amounts (BT-131) + Σ Document level allowance amounts (BT-92) - Σ Document level charge amounts (BT-99)) <= 0,01 * (Number of line net amounts (BT-131) + Number of Document level allowance amounts (BT-92) + Number of Document level charge amounts (BT-99)).

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

ram:TaxBasisTotalAmount must equal the net amounts of the included invoice lines, minus document-level allowances and plus document-level charges. The permitted absolute difference is 0.01 for each included invoice line, allowance, or charge.

What the rule means

BT-109 is the invoice total excluding VAT. It reconciles invoice line net amounts (BT-131) with document-level allowances (BT-92) and charges (BT-99).

Affected fields BT-109 BT-131 BT-92 BT-99
Please reconcile the invoice total excluding VAT

The invoice total excluding VAT does not sufficiently match the net amounts of the included invoice lines and the document-level allowances and charges. Check the total against these amounts.

What to do
  1. Compare ram:TaxBasisTotalAmount with the included ram:LineTotalAmount values of the invoice lines.
  2. Account for document-level allowances and charges using ram:ActualAmount, and logistics service fees using ram:AppliedAmount.
  3. Check the relevant values through TaxBasisAmount, LineTotalAmount, and ActualAmount.
  4. Generate the invoice again and validate it.
Check in FactoorSharp
  • AbstractTradeAllowanceCharge.ActualAmount (Document level allowance: BT-92; Document level charge: BT-99)
  • FacturXInvoice.TaxBasisAmount (BT-109)
  • TradeLineItem.LineTotalAmount (BT-131)
Technical details

The test calculates the sum of ram:LineTotalAmount values from invoice lines with no ram:LineStatusReasonCode or with the value DETAIL, adds allowances from ram:ActualAmount, and subtracts charges from ram:ActualAmount and logistics service fees from ram:AppliedAmount. The permitted absolute difference from ram:TaxBasisTotalAmount is 0.01 multiplied by the number of included lines, allowances, and charges.

Where the rule applies

Applies to ram:TaxBasisTotalAmount in the monetary summary and compares it with invoice line net amounts and document-level allowances and charges.

Context (rule/@context)
//ram:SpecifiedTradeSettlementHeaderMonetarySummation
Test expression (assert/@test)
for $BT109 in xs:decimal(ram:TaxBasisTotalAmount), $BT131Sum 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)), $BT92Sum in xs:decimal(round(sum(/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeAllowanceCharge[ram:ChargeIndicator/ udt:Indicator='false']/ram:ActualAmount)* 10 * 10 ) div 100), $BT99Sum in xs:decimal(xs:decimal(round(sum(/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeAllowanceCharge[ram:ChargeIndicator/ udt:Indicator='true']/ram:ActualAmount)* 100 ) div 100)+ xs:decimal(round(sum(/ rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ ram:SpecifiedLogisticsServiceCharge/ram:AppliedAmount)* 10 * 10 ) div 100)), $nbLineItems in xs:decimal(count(../../ram:IncludedSupplyChainTradeLineItem[ not(ram:AssociatedDocumentLineDocument/ram:LineStatusReasonCode) or ram:AssociatedDocumentLineDocument/ram:LineStatusReasonCode = 'DETAIL' ])), $nbAllowanceItems in xs:decimal(count(../ram:SpecifiedTradeAllowanceCharge[ram:ChargeIndicator/ udt:Indicator='false'])), $nbChargeItems in xs:decimal(count(../ram:SpecifiedTradeAllowanceCharge[ram:ChargeIndicator/ udt:Indicator='true']) + count(../ram:SpecifiedLogisticsServiceCharge)), $tolerance in xs:decimal(0.01), $maxTolerance in $tolerance * ($nbLineItems + $nbAllowanceItems + $nbChargeItems), $diff in xs:decimal($BT109 - $BT131Sum + $BT92Sum - $BT99Sum), $abs in xs:decimal(abs($diff)) return $abs le $maxTolerance