The value of "Invoice line net amount" (BT-131) of an "INVOICE LINE" (BG-25) or a "SUB INVOICE LINE" (BG-DEX-01) should correspond to the sum of the "Invoice line net amount" (BT-131) of the directly underlying "SUB INVOICE LINE" (BG-DEX-01).
The value of cbc:LineExtensionAmount on a parent invoice line does not equal the sum of the amounts on its directly nested sub invoice lines. For nested sub invoice lines, each parent sub line must also equal the sum of its direct child sub lines.
The net amount of a parent invoice line must reflect the amounts of its direct sub invoice lines. This keeps the amounts of the invoice line and its sub lines arithmetically consistent.
The net amount of an invoice line does not match the sum of its direct sub invoice lines. You can reconcile the amounts on the parent and child lines.
- Find the
cac:InvoiceLineorcac:SubInvoiceLinethat has childcac:SubInvoiceLineelements. - Compare its
cbc:LineExtensionAmountwith the sum of its direct sub lines. - For nested sub lines, check the same sum relationship at each level.
- Check the amount mapping through
TradeLineItem.LineTotalAmount. - Regenerate the invoice and validate it again.
<cac:InvoiceLine> <cbc:LineExtensionAmount>10</cbc:LineExtensionAmount> <cac:SubInvoiceLine> <cbc:LineExtensionAmount>9</cbc:LineExtensionAmount> </cac:SubInvoiceLine> </cac:InvoiceLine>
<cac:InvoiceLine> <cbc:LineExtensionAmount>10</cbc:LineExtensionAmount> <cac:SubInvoiceLine> <cbc:LineExtensionAmount>10</cbc:LineExtensionAmount> </cac:SubInvoiceLine> </cac:InvoiceLine>
TradeLineItem.LineTotalAmount(BT-131)
Technical details
The test compares the decimal value of cbc:LineExtensionAmount on each parent invoice line with the sum of the decimal values of its direct cac:SubInvoiceLine children. It also checks the same sum relationship for nested sub invoice lines.
In an extended UBL invoice, the rule applies to cbc:LineExtensionAmount of a cac:InvoiceLine with child cac:SubInvoiceLine elements and to nested cac:SubInvoiceLine elements.
rule/@context)assert/@test)