Skip to main content

mathematical-discrepancy

HTTP 422 · Tenant fixable.

ERPly Pro validates the document maths before submitting it to DGII to reduce production rejections. This error means the sums do not add up.

Validated rules

For each line:

lineTotal == round(qty * unitPrice, 2)
itbisLine == round(lineTotal * itbisRate / 100, 2)

For the document:

subtotal == sum(lineTotal)
itbisTotal == sum(itbisLine)
total == subtotal + itbisTotal

How to fix

  • Round every calculation to 2 decimals using banker's rounding (ROUND_HALF_EVEN) or half-up — both are accepted, but must be consistent.
  • If your ERP uses more decimals internally, round to the field that is sent, not afterwards.
  • If DGII still rejects with code 17 or 18, the document has a real discrepancy between line quantities and declared totals.