XV-FI-04
InvoiceTotalVatAmount (…) must be the sum of VatRateAmount in the VAT breakdown (…) (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(InvoiceTotalVatAmount and $vat/VatRateAmount) or fi:same(fi:dec(InvoiceTotalVatAmount), fi:dec($vat/VatRateAmount))
Checked with Finvoice 3.0