F-LIB401

If Percent is greater than 0, TaxSubtotal/TaxAmount must be correctly calculated within a tolerance of +/- 1. Values found: - TaxCategory/ID: … - TaxAmount (TaxSubtotal): … - TaxableAmount: … - TaxCategory/Percent: … - Calculated TaxAmount (rounded): … - Difference: …

error: the document is invalid

What the rule checks

As the rule set's publisher wrote it. The rule runs on every element the context matches, and fails where the test is false; the validator reports the line of that element.

Test
not(cbc:ID = 'StandardRated') or ( (xs:decimal(cbc:Percent) = 0 and xs:decimal(../cbc:TaxAmount) = 0) or (xs:decimal(cbc:Percent) > 0 and abs( xs:decimal(../cbc:TaxAmount) - (round((xs:decimal(../cbc:TaxableAmount) * xs:decimal(cbc:Percent) div 100) * 100) div 100) ) <= 1 ) )

Checked with Denmark OIOUBL 2.1 Invoice