CRP20217

La suma de los valores registrados en el campo ImpPagado de los apartados DoctoRelacionado no es menor o igual que el valor del campo Monto (…, Monto …).

In English When the related documents are in the payment's currency, the sum of their ImpPagado must not be more than the payment's Monto.

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:Pago
Test
not($same) or sum(for $x in $docs return mx:dec($x/@ImpPagado)) le mx:dec(@Monto)

Checked with CFDI 4.0