Message

Expected total amount for payment MUST be equal to the sum of line amounts minus sum of allowances at document level plus sum of charges at document level and VAT total amount, if expected total amount for payment is provided

Context
//cac:AnticipatedMonetaryTotal
Test
((/ubl:Order/cac:TaxTotal/cbc:TaxAmount) and (((cbc:ChargeTotalAmount) and (cbc:AllowanceTotalAmount) and (cbc:PayableAmount = (round((cbc:LineExtensionAmount + /ubl:Order/cac:TaxTotal/cbc:TaxAmount + cbc:ChargeTotalAmount - cbc:AllowanceTotalAmount) * 10 * 10) div 100))) or (not(cbc:ChargeTotalAmount) and (cbc:AllowanceTotalAmount) and (cbc:PayableAmount = (round((cbc:LineExtensionAmount + /ubl:Order/cac:TaxTotal/cbc:TaxAmount - cbc:AllowanceTotalAmount) * 10 * 10) div 100))) or ((cbc:ChargeTotalAmount) and not(cbc:AllowanceTotalAmount) and (cbc:PayableAmount = (round((cbc:LineExtensionAmount + /ubl:Order/cac:TaxTotal/cbc:TaxAmount + cbc:ChargeTotalAmount) * 10 * 10) div 100))) or (not(cbc:ChargeTotalAmount) and not(cbc:AllowanceTotalAmount) and (cbc:PayableAmount = (round((cbc:LineExtensionAmount + /ubl:Order/cac:TaxTotal/cbc:TaxAmount ) * 10 * 10) div 100))))) or ( not(/ubl:Order/cac:TaxTotal/cbc:TaxAmount) and (((cbc:ChargeTotalAmount) and (cbc:AllowanceTotalAmount) and (cbc:PayableAmount = (round((cbc:LineExtensionAmount + cbc:ChargeTotalAmount - cbc:AllowanceTotalAmount) * 10 * 10) div 100))) or (not(cbc:ChargeTotalAmount) and (cbc:AllowanceTotalAmount) and (cbc:PayableAmount = (round((cbc:LineExtensionAmount - cbc:AllowanceTotalAmount) * 10 * 10) div 100))) or ((cbc:ChargeTotalAmount) and not(cbc:AllowanceTotalAmount) and (cbc:PayableAmount = (round((cbc:LineExtensionAmount + cbc:ChargeTotalAmount) * 10 * 10) div 100))) or (not(cbc:ChargeTotalAmount) and not(cbc:AllowanceTotalAmount) and (cbc:PayableAmount = (round((cbc:LineExtensionAmount ) * 10 * 10) div 100)))))
Usage
/ ubl:Order / cac:AnticipatedMonetaryTotal / cbc:PayableAmount