Child group lines need a net amount

Error BR-FXEXT-12 Factur-X

If the "Subtype of invoice line item" (EXT-FR-FE-163 / BT-X-8) has the value "GROUP" and if the "Invoice line net amount" (BT-131) is specified, all lower levels which has "Subtype of invoice line item" (EXT-FR-FE-163) equal to "GROUP" MUST contain a "Invoice line net amount" (BT-131) value.

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

At least one directly subordinate invoice line with ram:LineStatusReasonCode equal to GROUP has no ram:LineTotalAmount. The parent group line already contains a net amount.

What the rule means

When a group line has a net amount, every directly subordinate group line must also have a net amount. This ensures that net amounts are stated at the nested group levels.

Affected fields BT-X-8 BT-131
Please add a net amount to each child group line

A child group line has no net amount even though the parent group line has one. Add the missing amount to each directly subordinate group line.

What to do
  1. Find the group line that has a ram:LineTotalAmount.
  2. Check its child group lines using their ram:ParentLineID and ram:LineStatusReasonCode.
  3. Set the net amount using TradeLineItem.LineTotalAmount.
  4. Generate the invoice again and validate it.
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>100.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>GROUP</ram:LineStatusReasonCode>
  </ram:AssociatedDocumentLineDocument>
</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>100.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>GROUP</ram:LineStatusReasonCode>
  </ram:AssociatedDocumentLineDocument>
  <ram:SpecifiedLineTradeSettlement>
    <ram:SpecifiedTradeSettlementLineMonetarySummation>
      <ram:LineTotalAmount>60.00</ram:LineTotalAmount>
    </ram:SpecifiedTradeSettlementLineMonetarySummation>
  </ram:SpecifiedLineTradeSettlement>
</ram:IncludedSupplyChainTradeLineItem>
Check in FactoorSharp
  • TradeLineItem.LineTotalAmount (BT-131)
  • AssociatedDocument.LineStatusReasonCode (BT-X-8)
  • LineStatusReasonCodes (BT-X-8)
Technical details

For the current ram:LineID, the test counts invoice lines with a matching ram:ParentLineID and ram:LineStatusReasonCode equal to GROUP, then compares that count with the number of those lines containing ram:LineTotalAmount.

Where the rule applies

The rule applies to an ram:IncludedSupplyChainTradeLineItem with ram:LineStatusReasonCode equal to GROUP and a present ram:LineTotalAmount. It checks the directly subordinate group lines using ram:ParentLineID.

Context (rule/@context)
//ram:IncludedSupplyChainTradeLineItem[ ram:AssociatedDocumentLineDocument/ram:LineStatusReasonCode = 'GROUP' and exists(ram:SpecifiedLineTradeSettlement/ram:SpecifiedTradeSettlementLineMonetarySummation/ ram:LineTotalAmount) ]
Test expression (assert/@test)
( for $lineID in ram:AssociatedDocumentLineDocument/ram:LineID, $numberChildWG in count(//rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ ram:IncludedSupplyChainTradeLineItem[ ram:AssociatedDocumentLineDocument/ram:ParentLineID = $lineID and ram:AssociatedDocumentLineDocument/ram:LineStatusReasonCode = 'GROUP' ]), $numberChildWGAndBT131 in count(/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ ram:IncludedSupplyChainTradeLineItem[ ram:AssociatedDocumentLineDocument/ram:ParentLineID = $lineID and ram:AssociatedDocumentLineDocument/ram:LineStatusReasonCode = 'GROUP' ]/ram:SpecifiedLineTradeSettlement/ram:SpecifiedTradeSettlementLineMonetarySummation/ ram:LineTotalAmount) return ($numberChildWG = $numberChildWGAndBT131) )