# DT-CIUS-PT-165

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

> Invoice total amount with VAT (BT-112) = Invoice total amount without VAT (BT-109) + Invoice total VAT amount (BT-110), 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: `//ubl:Invoice | //cn:CreditNote`
- Test: `every $Currency in cbc:DocumentCurrencyCode satisfies ((round( (cac:LegalMonetaryTotal/xs:decimal(cbc:TaxExclusiveAmount) + cac:TaxTotal/xs:decimal(cbc:TaxAmount[@currencyID=$Currency])) * 10 * 10) div 100) <= (cac:LegalMonetaryTotal/xs:decimal(cbc:TaxInclusiveAmount) + 1.00) and (round( (cac:LegalMonetaryTotal/xs:decimal(cbc:TaxExclusiveAmount) + cac:TaxTotal/xs:decimal(cbc:TaxAmount[@currencyID=$Currency])) * 10 * 10) div 100) >= (cac:LegalMonetaryTotal/xs:decimal(cbc:TaxInclusiveAmount) - 1.00))`

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