# PEPPOL-EN16931-R055

Source: https://xmlvalid.com/rules/PEPPOL-EN16931-R055

> Invoice total VAT amount and Invoice total VAT amount in accounting currency MUST have the same operational sign

- Level: error
- Rule sets: Peppol BIS Billing 3.0 rules 3.0.21, XRechnung 3.0 rules (UBL) 2.6.0
- Context: `ubl-creditnote:CreditNote | ubl-invoice:Invoice`
- Test: `not(cbc:TaxCurrencyCode) or (cac:TaxTotal/cbc:TaxAmount[@currencyID=normalize-space(../../cbc:TaxCurrencyCode)] <= 0 and cac:TaxTotal/cbc:TaxAmount[@currencyID=normalize-space(../../cbc:DocumentCurrencyCode)] <= 0) or (cac:TaxTotal/cbc:TaxAmount[@currencyID=normalize-space(../../cbc:TaxCurrencyCode)] >= 0 and cac:TaxTotal/cbc:TaxAmount[@currencyID=normalize-space(../../cbc:DocumentCurrencyCode)] >= 0)`

> Invoice total VAT amount and Invoice total VAT amount in accounting currency MUST have the same operational sign

- Level: error
- Rule sets: XRechnung 3.0 rules (CII) 2.6.0
- Context: `ram:ApplicableHeaderTradeSettlement`
- Test: `not(/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:TaxCurrencyCode and ram:SpecifiedTradeSettlementHeaderMonetarySummation/ram:TaxTotalAmount[@currencyID = $documentCurrencyCode]) or (ram:SpecifiedTradeSettlementHeaderMonetarySummation/ram:TaxTotalAmount[@currencyID = $taxCurrencyCode] < 0 and ram:SpecifiedTradeSettlementHeaderMonetarySummation/ram:TaxTotalAmount[@currencyID = $documentCurrencyCode] < 0) or (ram:SpecifiedTradeSettlementHeaderMonetarySummation/ram:TaxTotalAmount[@currencyID = $taxCurrencyCode] >= 0 and ram:SpecifiedTradeSettlementHeaderMonetarySummation/ram:TaxTotalAmount[@currencyID = $documentCurrencyCode] >= 0)`

## Why it fails

- The VAT total in the invoice currency and the one in the accounting currency have different signs, typically on a credit note where only one of them was made negative.

## How to fix it

- Convert the VAT total with its sign: both are positive on an invoice and both negative where the VAT is negative.

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