# DT-CIUS-PT-167

Source: https://xmlvalid.com/rules/DT-CIUS-PT-167

> VAT category tax amount (BT-117) = VAT category taxable amount (BT-116) x (VAT category rate (BT-119) / 100), rounded to two decimals and with an acceptance range of 1.00 € (it does not mean that this tolerance is accepted by the customer).

- Level: error
- Rule sets: CIUS-PT rules (Portugal, UBL) 2.1.1
- Context: `cac:TaxTotal/cac:TaxSubtotal`
- Test: `(round(cac:TaxCategory/xs:decimal(cbc:Percent)) = 0 and (round(xs:decimal(cbc:TaxAmount)) = 0)) or (round(cac:TaxCategory/xs:decimal(cbc:Percent)) != 0 and ((round(xs:decimal(cbc:TaxableAmount) * (cac:TaxCategory/xs:decimal(cbc:Percent) div 100) * 10 * 10) div 100 ) <= (xs:decimal(cbc:TaxAmount) + 1.00)) and ((round(xs:decimal(cbc:TaxableAmount) * (cac:TaxCategory/xs:decimal(cbc:Percent) div 100) * 10 * 10) div 100 ) >= (xs:decimal(cbc:TaxAmount) - 1.00))) or (not(exists(cac:TaxCategory/xs:decimal(cbc:Percent))) and (round(xs:decimal(cbc:TaxAmount)) = 0))`

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