Net amount required for every child group line

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 related child group line with LineStatusReasonCode GROUP has no LineTotalAmount. The test compares the number of directly related group lines with the number of those lines that contain a net amount.

What the rule means

When a group line with a net amount has child group lines, each of those child group lines must also have a net amount.

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

At least one child group line is missing its net amount. Add the amount to every child group line.

What to do
  1. Find the child IncludedSupplyChainTradeLineItem lines with a ParentLineID and LineStatusReasonCode GROUP.
  2. Add TradeLineItem.LineTotalAmount to each of those group lines.
  3. Regenerate the invoice and validate it again.
What it looks like
✗ Triggers the message
<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:SpecifiedLineTradeSettlement>
</ram:IncludedSupplyChainTradeLineItem>
✓ Correct
<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>100.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 each LineID, the test counts child lines with the matching ParentLineID and LineStatusReasonCode GROUP, then compares that count with the number containing LineTotalAmount.

Where the rule applies

The rule applies to an IncludedSupplyChainTradeLineItem group line with LineStatusReasonCode GROUP when the line contains a LineTotalAmount.

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) )