Document validation rules

Page describes the validation that is getting applied on every submitted document.

Document validation

There are different kind of validations that get executed on the submitted document, below is the list of validators that run on submitted documents, if they are enabled by ETA.

  1. Structure Validator
  2. Core Fields Validator
  3. Signature Validator
  4. National ID Validator
  5. Taxpayer Validator
  6. Reference document validator
  7. Code Validator
  8. Simple fields Validator

Structure Validator

This validator enables validation of the submitted document type version to check its structure matching what is required by the document type version. Validator supports validating both XML and JSON based documents.

Core Fields Validator

This validator is used to validate that the document contains at least the main fields that any document should have to be processed by the system. The same validator should apply to all document types.

Signature Validator

This validator is responsible for validating the submitted document signature, each document can have either 1 or 2 signatures depend on the source who submitted these documents to the system. If intermediary submitted the document, then 2 signatures are present on the document, else if taxpayer submit the document one signature is present. Validation processor uses a component provided by ITIDA to perform the validation.

National ID Validator

National ID validator is used to check recipients of type person to verify that they are specified when required and they have valid values supplied. The validator depends on minimal amount parameter that defines when national ID information becomes mandatory for recipients of type person. This parameter is set by ETA.

Taxpayer Validator

This validator is the tool that validates if the taxpayers referenced in the submitted document are valid at the date of issuance of the document. It also performs checks on the issuer taxpayer that require async processing and cannot be done synchronously in core fields validator.

Reference Document Validator

This validator performs validation of submitted credit notes and debit notes to make sure that the documents they are referencing are valid invoices at the moment of registration of a new credit note and debit note, that amounts for credit note are not exceeding sum of the amounts of the previous invoices. Validator also checks to make sure no other document data is changed except the amounts, e.g., invoice lines the same, issuer and receiver of the documents the same.

Code Validator

This validator is the component that enables validation of various codes used in submitted documents to make sure they are referencing valid codes, for example, goods codes, services category codes, measure codes, currency codes. Code validator depends on cache of code table information that allows it to validate the documents quicker. Code validator can validate against specific level of codes in the code table if required, it also can check two codes, e.g., when tax type and tax subtype is used in the document, both of these codes get validated in a single validation checking that for a provided subtype type code is also valid code reference to parent code. All of this is configurable though the configuration screens

Simple field Validator

Simple fields validator is used to implement the simple value checks inside of the document by checking field value, its presence, by checking calculation of the percentage based fields and by checking the string based on its length or pattern through regular expression. Below is the list of validation equations used in the simple field validator

Validation on the level of invoice line

  1. Sales Total = Quantity * Amount Description: invoice line sales total is equal to multiplication of quantity by amount.

  2. Discount Amount = Discount.Rate * Invoice Line Sales Total Description: discount amount is equal to the multiplication of discount rate by invoice line sales total.If discount rate is provided as zero, then this validation equation will not be applied.

  3. Net total = Sales Total – Discount Amount
    Description: net total is equal invoice line sales total subtracting the invoice line discount amount.

  4. Taxable Items (T5–>T12 taxable fees)

    4.1 TaxableItem.Amount = TaxableItem.Rate * InvoiceLine.NetTotal
    Description: each taxable item amount is equal to the multiplication of taxable item rate by invoice line net total. If rate is not provided, then validation equation will not be applied.

    4.2 TotalTaxableFees += TaxableItem.Amount Description: Total taxable fees is equal the summation of all taxable fees amounts created for this invoice line.

  5. Non Taxable Items (T13–> T20)

    5.1 NonTaxableItem.Amount = NonTaxableItem.Rate * InvoiceLine.NetTotal
    Description: each non taxable item amount is equal to the multiplication of non taxable item rate by invoice line net total. If rate is not provided, then validation equation will not be applied.

    5.2 TotalNonTaxableFees += NonTaxableItem.Amount Description: Total non taxable fees is equal the summation of all non taxable fees amounts created for this invoice line.

  6. Table tax(percentage) (T2) TaxableItem.Amount = ( Net Total + TotalTaxableFees + Value Difference + taxableItems.taxtype(T3).Amount) * taxableItems.taxtype(T2).rate

  7. Table tax (Fixed Amount) (T3) Descriptoin: Rate should be equal zero (rate for this item should always be 0 as this is fixed amount taxable item)

  8. Stamping Tax (amount) (T6) Descriptoin: Rate should be equal zero (rate for this item should always be 0 as this is fixed amount taxable item)

  9. Value Added Service (VAT) (T1) TaxableItem.Amount = ( TaxableItem.Amount + Net Total + TotalTaxableFees + Value Difference + Taxable Item.Amount) * TaxableItem.Rate

  10. Withholding tax (WHT) (T4) TaxableItem<WHT-T4 + Subtype>.Amount = TaxableItem<WHT-T4 + Subtype>.Rate * (Net Total – Items Discount)

  11. Total invoice line Total(Line total) = NetTotal + Taxable Item.Amount + TotalTaxableFees + TaxableItem.Amount + TaxableItem.Amount + LineTotalNoneTaxableFees – Items Discount – sum of all (TaxableItem<WHT-T4 + Subtype>.Amount)

Validation on level of invoice

The below validation is done on the level of invoice:

  1. Total Sales Amount: TotalSalesAmount = Sum of All InvoiceLine.Sales Total

  2. Total item discount: Total item discount= Sum of all invoiceline.itemDiscount

  3. Net Amount: NetAmount = Sum of all invoicelines.NetTotal

  4. Total item discounts amount: TotalItemsDiscountAmount = sum of all Invoicelines.ItemsDiscount

  5. Total Amount: TotalAmount = sum of all Invoiceline.Total – Extra discount amount

  6. Extra discount amount: Extra discount amount= Value

  7. Taxable fees total (T1-->T12) Tax Totals = sum of all TaxableItems (ignore subtypes – this means WHT gets summed up regardless of subtypes that were used)

  8. Non Taxable fees total (T13-->T20) Tax Totals = sum of all NonTaxableItems