Skip to main content

Accounting Events

Accounting events are the bridge between business transactions in AR and AP and the subledger journal entries that record their financial effect. Events are raised automatically by database triggers whenever a transaction reaches a milestone — there is no manual step.

Event classes​

Each accounting event is categorised by an event class that identifies what happened. The event class determines which journal lines fsl_create_accounting will generate.

AR event classes​

Event classTrigger pointWhat it records
AR_INVOICETransaction status → FINAL (type INVOICE or DEBIT_MEMO)Revenue recognition and the receivable
AR_CREDIT_MEMOTransaction status → FINAL (type CREDIT_MEMO)Reversal of revenue and reduction of the receivable
AR_RECEIPTCash receipt createdCash received and unapplied balance
AR_RECEIPT_APPLICATIONReceipt schedule created (receipt linked to a transaction)Application of cash against the receivable, with realised FX gain/loss
AR_RECEIPT_REVERSALReceipt status → REVReversal of the original receipt

AP event classes​

Event classTrigger pointWhat it records
AP_INVOICETransaction status → VALIDATEDExpense recognition and the payable
AP_PAYMENTPayment schedule amount applied increasesCash disbursement against the payable, with realised FX gain/loss
AP_PAYMENT_VOIDPayment schedule amount applied decreasesReversal of a prior payment

How events are raised​

Events are raised by database triggers on AR and AP tables. The triggers fire automatically — application code does not need to call any accounting function.

AR triggers​

TriggerFires onCondition
fsl_ar_invoice_event_tgt_far_customer_transaction_headers AFTER UPDATE of transaction_statusNew status is FINAL
fsl_ar_receipt_event_tgt_far_cash_receipts AFTER INSERTEvery new receipt
fsl_ar_receipt_application_event_tgt_far_receipt_schedules AFTER INSERTEvery new receipt schedule (links receipt to transaction)
fsl_ar_receipt_reversal_event_tgt_far_cash_receipts AFTER UPDATE of receipt_statusNew status is REV

AP triggers​

TriggerFires onCondition
fsl_ap_invoice_event_tgt_fap_supplier_transaction_headers AFTER UPDATE of transaction_statusNew status is VALIDATED
fsl_ap_payment_event_tgt_fap_payment_schedules AFTER UPDATE of amount_appliedAmount applied changes — increase raises AP_PAYMENT, decrease raises AP_PAYMENT_VOID

What each trigger records​

Every trigger creates one row in t_fsl_accounting_events with:

  • event_class_code — the event class (e.g. AR_INVOICE)
  • source_table — FAR or FAP
  • source_header_id — the AR or AP transaction header ID
  • ledger_id — resolved from the organisation's ledger
  • accounting_date — typically the transaction date or receipt date
  • entered_currency_code — the transaction currency
  • exchange_rate_type and exchange_rate — from the source transaction, defaulting to CORPORATE
  • status — always UNPROCESSED

Event statuses​

StatusMeaning
UNPROCESSEDThe event has been raised but not yet turned into a journal entry
PROCESSEDfsl_create_accounting has successfully created a journal entry for this event
ERRORProcessing failed; the error_text field contains the error message

Events move from UNPROCESSED to either PROCESSED or ERROR. An ERROR event can be retried after the underlying issue is resolved.

Relationship to tax calculation​

Tax calculation happens before accounting events are raised. The FTX triggers fire on BEFORE UPDATE (calculating tax lines), while the FSL triggers fire on AFTER UPDATE (creating accounting events). This means tax lines are always available when fsl_create_accounting runs.

See Tax Calculation for details on how tax lines are generated.

Further reading​