The summary is not free-form: summaryByVatRate must carry one entry per
distinct VAT rate appearing on the lines, its net and VAT amounts must be
the sums of the corresponding line amounts, and the invoice totals must be
the sums of those. NAV rejects the whole batch when they disagree, so this
derives them rather than trusting a caller to keep them in step.
Lines are grouped by their entire lineVatRate value, not by percentage
alone: a 27% line and an exempt line are different rates, and so are two
exempt lines citing different legal grounds.
Compute the invoice summary from the lines.
The summary is not free-form:
summaryByVatRatemust carry one entry per distinct VAT rate appearing on the lines, its net and VAT amounts must be the sums of the corresponding line amounts, and the invoice totals must be the sums of those. NAV rejects the whole batch when they disagree, so this derives them rather than trusting a caller to keep them in step.Lines are grouped by their entire
lineVatRatevalue, not by percentage alone: a 27% line and an exempt line are different rates, and so are two exempt lines citing different legal grounds.