CRP20201

El valor del campo TotalRetencionesIVA no es igual al redondeo de la suma del resultado de multiplicar cada uno de los importes de los atributos ImporteP de los impuestos retenidos registrados en el elemento RetencionP donde el atributo ImpuestoP contenga el valor IVA por el valor registrado en el atributo TipoCambioP de cada nodo Pago (…, …).

In English TotalRetencionesIVA must be the sum, rounded, of each payment's withheld VAT (RetencionP with ImpuestoP 002) times its TipoCambioP: the totals are in pesos.

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
pago20:Pagos/pago20:Totales
Test
not(@TotalRetencionesIVA) or abs(mx:dec(@TotalRetencionesIVA) - mx:withheld($pagos, '002')) le 0.005

Checked with CFDI 4.0