Skip to main content

Tax Calculation

Tax calculation in FTX is automatic — it runs via database triggers whenever an AR transaction is finalised or an AP transaction is validated. The result is a set of tax lines that record the calculated tax for each transaction line.

When tax is calculated​

Tax calculation is triggered at specific points in the transaction lifecycle:

ModuleTrigger pointCondition
AR (Receivables)Transaction status changes to FINALBEFORE the status update is committed
AP (Payables)Transaction status changes to VALIDATEDBEFORE the status update is committed

The triggers fire before the status update, ensuring tax lines are in place before the FSL accounting event triggers fire after the update. This guarantees that fsl_create_accounting always has access to the calculated tax lines.

How tax is calculated​

For each transaction line, the ftx_calculate_tax function:

  1. Resolves the tax regime from the transaction's organisation → legal entity → country
  2. Finds the applicable tax rate:
    • If the line has a tax_classification_code, look up the rate matching that classification, the regime's tax, and the current effective date
    • If the line has no classification, use the rate marked default_flag = TRUE
    • If no applicable rate is found, raise error FTX-00003
  3. Calculates the tax amount: taxable_amount × percentage_rate / 100, rounded to 4 decimal places
  4. Splits the recoverable portion (AP only):
    • If recoverable_flag is true: recoverable_amount = tax_amount × recovery_rate_percentage / 100
    • non_recoverable_amount = tax_amount − recoverable_amount
    • For AR lines, both recoverable and non-recoverable amounts are set to zero

Tax lines​

Each calculated tax produces a tax line that records:

FieldPurpose
source_line_tableFAR for AR lines, FAP for AP lines
source_line_idThe AR or AP transaction line that was taxed
transaction_header_idThe parent transaction header
rate_idThe tax rate used for the calculation
taxable_amountThe pre-tax amount (the transaction line's extended transaction price)
tax_amountThe calculated tax
entered_currency_codeThe transaction currency
recoverable_amountFor AP: the portion of tax that can be recovered
non_recoverable_amountFor AP: the portion of tax that cannot be recovered

Tax lines are recalculated from scratch each time — existing tax lines for the header are deleted before new ones are created.

Classification codes on transaction lines​

The tax_classification_code field on AR and AP transaction lines controls which tax rate is applied. Common values:

CodeTypical use
STANDARDNormal taxable supply at the standard rate
ZEROZero-rated supply — tax calculated at 0%
EXEMPTExempt supply — no tax applies
REDUCEDReduced-rate supply (where the regime supports it, e.g. UK VAT)

When the field is left blank, the default rate for the regime's tax is used (typically STANDARD).

The recoverable split (AP only)​

For Accounts Payable, tax on supplier invoices may be fully recoverable, partially recoverable, or non-recoverable depending on the tax rate configuration:

  • Fully recoverable (e.g. NZ GST at 100% recovery): the entire tax amount is posted to TAX_RECOVERABLE in the subledger
  • Partially recoverable: the recoverable portion posts to TAX_RECOVERABLE and the non-recoverable portion posts to EXPENSE
  • Non-recoverable (e.g. EXEMPT rate with 0% recovery): the entire tax amount posts to EXPENSE

This split is critical for correct accounting — see Create Accounting and Transfer to GL for how the subledger handles these amounts.

Accounting of tax​

Tax lines feed directly into subledger journal entries:

AR (Receivables)​

  • Each tax line creates a TAX_LIABILITY credit line in the subledger journal
  • The GL account is derived from the tax rate via the TAX_RATE source type in the derivation rules
  • The total tax liability is included in the RECEIVABLE debit (i.e. the customer owes the gross amount including tax)

AP (Payables)​

  • The recoverable portion of each tax line creates a TAX_RECOVERABLE debit line
  • The non-recoverable portion is added to EXPENSE
  • The total payable (credit) includes the full tax amount
  • The GL account for TAX_RECOVERABLE is derived from the tax rate

Further reading​