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:
| Module | Trigger point | Condition |
|---|---|---|
| AR (Receivables) | Transaction status changes to FINAL | BEFORE the status update is committed |
| AP (Payables) | Transaction status changes to VALIDATED | BEFORE 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:
- Resolves the tax regime from the transaction's organisation → legal entity → country
- 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
- If the line has a
- Calculates the tax amount:
taxable_amount × percentage_rate / 100, rounded to 4 decimal places - Splits the recoverable portion (AP only):
- If
recoverable_flagis 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
- If
Tax lines
Each calculated tax produces a tax line that records:
| Field | Purpose |
|---|---|
| source_line_table | FAR for AR lines, FAP for AP lines |
| source_line_id | The AR or AP transaction line that was taxed |
| transaction_header_id | The parent transaction header |
| rate_id | The tax rate used for the calculation |
| taxable_amount | The pre-tax amount (the transaction line's extended transaction price) |
| tax_amount | The calculated tax |
| entered_currency_code | The transaction currency |
| recoverable_amount | For AP: the portion of tax that can be recovered |
| non_recoverable_amount | For 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:
| Code | Typical use |
|---|---|
STANDARD | Normal taxable supply at the standard rate |
ZERO | Zero-rated supply — tax calculated at 0% |
EXEMPT | Exempt supply — no tax applies |
REDUCED | Reduced-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_RECOVERABLEin the subledger - Partially recoverable: the recoverable portion posts to
TAX_RECOVERABLEand the non-recoverable portion posts toEXPENSE - Non-recoverable (e.g.
EXEMPTrate with 0% recovery): the entire tax amount posts toEXPENSE
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_LIABILITYcredit line in the subledger journal - The GL account is derived from the tax rate via the
TAX_RATEsource type in the derivation rules - The total tax liability is included in the
RECEIVABLEdebit (i.e. the customer owes the gross amount including tax)
AP (Payables)
- The recoverable portion of each tax line creates a
TAX_RECOVERABLEdebit line - The non-recoverable portion is added to
EXPENSE - The total payable (credit) includes the full tax amount
- The GL account for
TAX_RECOVERABLEis derived from the tax rate
Further reading
- Regimes, Taxes, and Rates — the configuration that drives tax calculation
- Customer Transactions — where
tax_classification_codeis set on AR lines - Supplier Transactions — where
tax_classification_codeis set on AP lines - Create Accounting and Transfer to GL — how tax lines are turned into journal entries