XV-FI-03

The sum of RowVatExcludedAmount of the invoice rows (…) must be RowsTotalVatExcludedAmount, or InvoiceTotalVatExcludedAmount when there are no invoice level discounts or charges (Finvoice 3.0 guidelines, 14).

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
/Finvoice/InvoiceDetails[matches(InvoiceTypeCode, '^(INV|SEI|REC|RES)') or InvoiceTypeCode = 'TES01']
Test
not($rows) or $rows[not(RowVatExcludedAmount)] or (if (RowsTotalVatExcludedAmount) then fi:same(fi:dec(RowsTotalVatExcludedAmount), $rowSum) else ($invoiceLevel or not(InvoiceTotalVatExcludedAmount) or fi:same($excluded, $rowSum)))

Checked with Finvoice 3.0