CFDI40167
El valor del campo Importe no se encuentra entre el limite inferior y superior permitido (…, … × …).
In English A line's Importe must be Cantidad times ValorUnitario, within the limits Anexo 20 computes from the decimals written: (Cantidad - half a unit) × (ValorUnitario - half a unit) truncated, up to (Cantidad + half a unit) × (ValorUnitario + half a unit) rounded up.
Why it fails
- The amount was computed from a price with more decimals than the one written in ValorUnitario.
- A discount subtracted from Importe instead of being given in Descuento.
How to fix it
Give ValorUnitario with the decimals the computation used (up to six), Importe as Cantidad times ValorUnitario, and the discount in the line's Descuento.
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.
cfdi:Conceptos/cfdi:Concepto
mx:between(@Cantidad, @ValorUnitario, true(), @Importe)
Checked with CFDI 4.0