CFDI40111

El TipoDeComprobante no es I,E o N, y un concepto incluye el campo descuento (Descuento …, conceptos …).

In English When a line of an I, E or N CFDI has a Descuento, the comprobante must have Descuento, the sum of the lines' discounts rounded to the currency's decimals; otherwise Descuento is left out (we accept 0).

error: the document is invalid

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
if ($type = ('I', 'E', 'N') and $concepts/@Descuento) then (@Descuento and abs(mx:dec(@Descuento) - $discounts) le $half) else (not(@Descuento) or mx:dec(@Descuento) = 0)

Checked with CFDI 4.0