# CFDI40108

Source: https://xmlvalid.com/rules/CFDI40108

> El TipoDeComprobante es I,E o N, el importe registrado en el campo no es igual al redondeo de la suma de los importes de los conceptos registrados (SubTotal …, conceptos …).

- Level: error
- Rule sets: SAT validations of CFDI 4.0 and Pagos 2.0 Matrices of 25 March 2026 and Pagos 2.0 rev. B
- Context: `/cfdi:Comprobante`
- Test: `not($type = ('I', 'E', 'N')) or abs(mx:dec(@SubTotal) - $lines) le $half`

In English: In an income (I), expense (E) or payroll (N) CFDI, SubTotal must be the sum of the lines' Importe rounded to the currency's decimals.

## Why it fails

- Each line was rounded to two decimals before adding, while SubTotal was computed from the unrounded amounts, or the other way round.
- A line was added or removed after the totals were computed.

## How to fix it

- Add up the lines' Importe as written, round once at the end to the currency's decimals, and give that as SubTotal.

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