SDI-00422

2.2.2.5 <ImponibileImporto> non calcolato secondo le regole definite nelle specifiche tecniche

In English For a VAT rate, the taxable amounts of the summaries (ImponibileImporto, 2.2.2.5) do not add up to the line totals at that rate, plus the pension fund contributions and the summaries' Arrotondamento, within one euro.

error: the document is invalid

Why it fails

  • A line was changed or added after the summary was calculated.
  • A pension fund contribution (DatiCassaPrevidenziale) at that rate was left out of ImponibileImporto.
  • A document level discount (ScontoMaggiorazione in DatiGeneraliDocumento) was subtracted from the summary; the SdI adds up the lines only, so a discount has to be a line or go into Arrotondamento.

How to fix it

For each rate, make ImponibileImporto the sum of PrezzoTotale of the lines at that rate plus ImportoContributoCassa at that rate, and put any rounding difference in Arrotondamento.

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
/p:FatturaElettronica/FatturaElettronicaBody
Test
every $r in distinct-values(($rates, for $s in $summaries/AliquotaIVA return it:dec($s))) satisfies abs(sum(for $s in $summaries[it:dec(AliquotaIVA) = $r] return it:dec($s/ImponibileImporto)) - sum(for $l in $lines[it:dec(AliquotaIVA) = $r] return it:dec($l/PrezzoTotale)) - sum(for $f in $funds[it:dec(AliquotaIVA) = $r] return it:dec($f/ImportoContributoCassa)) - sum(for $s in $summaries[it:dec(AliquotaIVA) = $r] return it:dec($s/Arrotondamento))) le 1

Checked with FatturaPA 1.2.3