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.
The net amount ram:LineTotalAmount of a subtotal does not match the sum of the net amounts of its directly linked child invoice lines. Child lines with subtype DETAIL or GROUP are included, and each must also have a net amount.
The subtotal must correctly aggregate the amounts of its child detail lines and subtotals. This keeps the hierarchical structure of invoice lines arithmetically consistent.
The net amount of a subtotal does not match the sum of its linked child lines. Compare the amounts of the subtotal and its detail or group lines.
- Check that each child line’s
ParentLineIDrefers to theLineIDof its subtotal. - Add the
LineTotalAmountvalues of child lines with subtypeDETAILorGROUP. - Set the subtotal’s
LineTotalAmountto the matching sum and make sure the child amounts are present. - Check the
TradeLineItem.LineTotalAmountproperty. - Regenerate the invoice and validate it again.
<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>DETAIL</ram:LineStatusReasonCode> </ram:AssociatedDocumentLineDocument> <ram:SpecifiedLineTradeSettlement> <ram:SpecifiedTradeSettlementLineMonetarySummation> <ram:LineTotalAmount>60.00</ram:LineTotalAmount> </ram:SpecifiedTradeSettlementLineMonetarySummation> </ram:SpecifiedLineTradeSettlement> </ram:IncludedSupplyChainTradeLineItem>
<ram:IncludedSupplyChainTradeLineItem> <ram:AssociatedDocumentLineDocument> <ram:LineID>1</ram:LineID> <ram:LineStatusReasonCode>GROUP</ram:LineStatusReasonCode> </ram:AssociatedDocumentLineDocument> <ram:SpecifiedLineTradeSettlement> <ram:SpecifiedTradeSettlementLineMonetarySummation> <ram:LineTotalAmount>60.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>60.00</ram:LineTotalAmount> </ram:SpecifiedTradeSettlementLineMonetarySummation> </ram:SpecifiedLineTradeSettlement> </ram:IncludedSupplyChainTradeLineItem>
AssociatedDocument.LineStatusReasonCode(BT-X-8)LineStatusReasonCodes(BT-X-8)TradeLineItem.LineTotalAmount(BT-131)
Technical details
The XPath selects GROUP lines with a provided ram:LineTotalAmount and compares the amount, rounded to two decimal places, with the sum of directly linked DETAIL and GROUP lines identified through ram:ParentLineID.
This rule applies to invoice lines ram:IncludedSupplyChainTradeLineItem whose ram:LineStatusReasonCode is GROUP and whose ram:LineTotalAmount is provided.
rule/@context)assert/@test)