Net amount of the subtotal

Error BR-FXEXT-08 Factur-X

If the "Subtype of invoice item" (BT-X-8) has the value "Subtotal" (GROUP) and the "Net amount of the invoice item" (BT-131) is specified, it must correspond to the sum of the BT-131 of the next lower levels for which the "Subtype of the invoice item" (BT-X-8) has the value "Regular item (standard case)" (DETAIL) or "Subtotal" (GROUP). As a consequence, all lower levels shall contain a BT-131 value, when BT-X-8 has the value DETAIL or GROUP.

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

If LineStatusReasonCode has the value GROUP and LineTotalAmount is provided, that amount must equal the sum of the LineTotalAmount values of directly associated lines with subtype DETAIL or GROUP. The test rounds the sum to two decimal places.

What the rule means

The net amount of a subtotal must match the net amounts of its associated subordinate invoice lines. This maintains the arithmetic consistency of the line hierarchy.

Affected fields BT-X-8 BT-131
Please reconcile the subtotal’s net amount

The net amount of an invoice line marked GROUP does not match the amounts of its directly subordinate lines. Adjust the amount or the amounts of the associated lines.

What to do
  1. Check the LineTotalAmount value on the subtotal.
  2. Compare it with the LineTotalAmount values of directly associated lines marked DETAIL or GROUP.
  3. Make sure each of those lines has a net amount.
  4. Regenerate the invoice and validate it again.
What it looks like
✗ Triggers the message
<ram:IncludedSupplyChainTradeLineItem>
  <ram:AssociatedDocumentLineDocument>
    <ram:LineID>1</ram:LineID>
    <ram:LineStatusReasonCode>GROUP</ram:LineStatusReasonCode>
  </ram:AssociatedDocumentLineDocument>
  <ram:SpecifiedLineTradeSettlement>
    <ram:SpecifiedTradeSettlementLineMonetarySummation>
      <ram:LineTotalAmount>10.00</ram:LineTotalAmount>
    </ram:SpecifiedTradeSettlementLineMonetarySummation>
  </ram:SpecifiedLineTradeSettlement>
</ram:IncludedSupplyChainTradeLineItem>
<ram:IncludedSupplyChainTradeLineItem>
  <ram:AssociatedDocumentLineDocument>
    <ram:LineID>2</ram:LineID>
    <ram:ParentLineID>1</ram:ParentLineID>
    <ram:LineStatusReasonCode>DETAIL</ram:LineStatusReasonCode>
  </ram:AssociatedDocumentLineDocument>
  <ram:SpecifiedLineTradeSettlement>
    <ram:SpecifiedTradeSettlementLineMonetarySummation>
      <ram:LineTotalAmount>4.00</ram:LineTotalAmount>
    </ram:SpecifiedTradeSettlementLineMonetarySummation>
  </ram:SpecifiedLineTradeSettlement>
</ram:IncludedSupplyChainTradeLineItem>
✓ Correct
<ram:IncludedSupplyChainTradeLineItem>
  <ram:AssociatedDocumentLineDocument>
    <ram:LineID>1</ram:LineID>
    <ram:LineStatusReasonCode>GROUP</ram:LineStatusReasonCode>
  </ram:AssociatedDocumentLineDocument>
  <ram:SpecifiedLineTradeSettlement>
    <ram:SpecifiedTradeSettlementLineMonetarySummation>
      <ram:LineTotalAmount>4.00</ram:LineTotalAmount>
    </ram:SpecifiedTradeSettlementLineMonetarySummation>
  </ram:SpecifiedLineTradeSettlement>
</ram:IncludedSupplyChainTradeLineItem>
<ram:IncludedSupplyChainTradeLineItem>
  <ram:AssociatedDocumentLineDocument>
    <ram:LineID>2</ram:LineID>
    <ram:ParentLineID>1</ram:ParentLineID>
    <ram:LineStatusReasonCode>DETAIL</ram:LineStatusReasonCode>
  </ram:AssociatedDocumentLineDocument>
  <ram:SpecifiedLineTradeSettlement>
    <ram:SpecifiedTradeSettlementLineMonetarySummation>
      <ram:LineTotalAmount>4.00</ram:LineTotalAmount>
    </ram:SpecifiedTradeSettlementLineMonetarySummation>
  </ram:SpecifiedLineTradeSettlement>
</ram:IncludedSupplyChainTradeLineItem>
Check in FactoorSharp
  • AssociatedDocument.LineStatusReasonCode (BT-X-8)
  • LineStatusReasonCodes (BT-X-8)
  • TradeLineItem.LineTotalAmount (BT-131)
Technical details

The test compares a line’s LineTotalAmount with the sum, rounded to two decimal places, of lines whose ParentLineID matches that line’s LineID and whose LineStatusReasonCode is DETAIL or GROUP.

Where the rule applies

The rule applies to invoice lines in IncludedSupplyChainTradeLineItem. It checks the amount of a line marked GROUP against its directly subordinate lines.

Context (rule/@context)
//ram:IncludedSupplyChainTradeLineItem
Test expression (assert/@test)
every $item in //ram:IncludedSupplyChainTradeLineItem[ ram:AssociatedDocumentLineDocument/ram:LineStatusReasonCode = 'GROUP' and normalize-space(ram:SpecifiedLineTradeSettlement/ ram:SpecifiedTradeSettlementLineMonetarySummation/ ram:LineTotalAmount) != '' ] satisfies number(normalize-space($item/ram:SpecifiedLineTradeSettlement/ ram:SpecifiedTradeSettlementLineMonetarySummation/ ram:LineTotalAmount)) = round(sum( for $child in //ram:IncludedSupplyChainTradeLineItem[ normalize-space(ram:AssociatedDocumentLineDocument/ram:ParentLineID) = normalize-space($item/ ram:AssociatedDocumentLineDocument/ram:LineID) and ( ram:AssociatedDocumentLineDocument/ram:LineStatusReasonCode = 'DETAIL' or ram:AssociatedDocumentLineDocument/ram:LineStatusReasonCode = 'GROUP' ) ] return number(normalize-space( $child/ram:SpecifiedLineTradeSettlement/ ram:SpecifiedTradeSettlementLineMonetarySummation/ ram:LineTotalAmount)) )*100) div 100