# F-LIB401

Source: https://xmlvalid.com/rules/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: …

- Level: error
- Rule sets: OIOUBL 2.1 Invoice rules (Denmark) 1.17.2, OIOUBL 2.1 Credit Note rules (Denmark) 1.17.2, OIOUBL 2.1 Reminder rules (Denmark) 1.17.2
- 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 ) )`

Validate a document against these rules: https://xmlvalid.com/validate
