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 …).

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.

error: the document is invalid

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.

What the rule checks

As the rule set's publisher wrote it. The rule runs on every element the context matches, and fails where the test is false; the validator reports the line of that element.

Context
/cfdi:Comprobante
Test
not($type = ('I', 'E', 'N')) or abs(mx:dec(@SubTotal) - $lines) le $half

Checked with CFDI 4.0