Finance — Posting lifecycle

Product version: 1.0.0+1
Last updated: 2026-11-02
Audience: Tenant Owners, Finance operators


Automated postings (Sales & Inventory)

Finance listens on the shared event bus and posts balanced journal entries through an idempotent poster keyed by (tenant, source_type, source_id, posting_kind).

Trigger (ops owner) Typical posting_kind Effect (simplified)
Sales invoice created sale_revenue DR AR / CR Revenue
Sales payment recorded sale_payment DR Cash/Bank / CR AR. Cash a sales representative records on their own sale debits their custody cash (1050-…) instead — see Cash settlements
Sales invoice voided sale_void Reverse revenue / AR
Sales return completed sale_return DR Revenue; CR AR and/or Customer Credits (AR-first)
Sales refund recorded sale_refund Cash/credits effect when kind is cash refund
Sales payment reversed sale_payment_reversal Reverse that payment’s JE. If the payment went to custody cash that has since been handed in, the cash leaves the company cash book instead
New inventory item created with stock inventory_opening_stock DR Inventory / CR Opening Balance Equity (3900) — quantity × cost, no profit
Inventory movement (sale) inventory_cogs DR COGS / CR Inventory
Inventory return / reversed sale issue inventory_cogs_return Reverse COGS
Approved adjustment — cycle count, physical count, correction inventory_adjustment Inventory vs Inventory Shrinkage & Count Variance (5110)
Approved adjustment — damage (or loss) inventory_adjustment Inventory vs Inventory Damage & Loss (5120)
Approved adjustment — expiry inventory_adjustment Inventory vs Inventory Expiry Write-offs (5130)
Unit cost corrected by an approved adjustment (stock on hand) inventory_adjustment (new − old cost) × quantity; Inventory vs Inventory Revaluation (5140)
Internal use / other movements inventory_adjustment Inventory vs Inventory Adjustments (5100) — no sales revenue
Inventory requisition accepted supplier_bill_posted (AP sub-ledger) Automatically creates, approves, and posts the corresponding supplier bill (status="posted", invoice number REQ-..., linked via requisition_id and requisition_number) via EnsureRequisitionPayableUseCase
Warehouse-to-warehouse transfer — Not posted (value stays in Inventory)

Adjustments are valued at the item's carrying cost. A decrease debits the expense account and credits Inventory; a count overage does the reverse, so each expense account shows the net variance for the period. Adjustment journals are dated on the adjustment date (never later than approval), so a period-end count approved after the period still lands in the counted period. If that period is already closed, the journal posts on the approval date instead.

Duplicate event delivery does not double-post. Failures (for example no open period) mark the posting FAILED; a later retry with an open period can succeed on the same key.

Review outcomes under Finance → Postings (/finance/postings).


Finance Guide — Accounting Lifecycle & JoFotara Fiscal Setup, Opening Balances, Daily Operations & JoFotara Adapter

A practical step-by-step walkthrough of fiscal years, chart of accounts, balanced opening balances, cash transfers, expenses, GL journals, and configuring the Jordan JoFotara national e-invoicing integration adapter.


Supplier-payables accounting boundary

When an inventory requisition is accepted (RequisitionAcceptedEvent, or synced via POST /api/finance/v1/tenants/{tenant_id}/payables/sync-requisition), Finance (handle_requisition_accepted → EnsureRequisitionPayableUseCase) automatically creates, approves, and posts the corresponding supplier bill (status="posted", invoice number equal to the requisition number REQ-..., linked via requisition_id and requisition_number). Manual supplier bill drafts (/finance/payables/bills/new, POST .../supplier-bills/drafts) are used only for standalone supplier invoices not originating from an inventory requisition.

Purchase receipt posting changes Inventory stock, then Finance receives a PurchaseReceiptPostedEvent projection as pending/no-journal accrual data. It does not create a Finance journal at receipt time. A standalone supplier bill can be posted only after approval and fully posted receipt matches; its journal uses GRNI/tax/charge-to-AP legs and does not debit Inventory Asset. From the Supplier Payable Detail page (/finance/payables/:id), users can pay or schedule a supplier bill in 1 step via POST /api/finance/v1/tenants/{tenant_id}/payables/{document_id}/pay (PayOrScheduleSupplierBillUseCase): either Full Payment (automatically approves/posts the bill if needed, records the external payment against Cash 1000 or Bank 1010, and allocates the full amount) or Installment Split (pays an optional immediate amount now and schedules the remaining balance across custom installment amounts and due dates stored in supplier_snapshot.installments). Recording a supplier payment requires explicit confirmation that the payment was completed outside SanadiqCloud; Finance then posts the balanced AP-to-cash/bank effect as supplier_payment_recorded. Allocation reservations do not post cash or journals.

Receipt-to-Finance delivery is eventual with a durable inbox claim, a bounded Finance recovery worker that replays failed or stale receipt projections, and a service-token-only reconciliation feed (/internal/supplier-payables-reconciliation/{tenant_id}). Inspect the receipt projection status (/finance/payables/grni) and service logs before treating a pending row as an accounting failure. Both posted supplier bills and recorded supplier payments have durable reservation/approval/execution reversal flows: execution unwinds persisted match, allocation, or advance dependencies and appends compensating accounting facts in one Finance transaction, without transferring cash or calling a provider. Supplier-refund recording and its reversal flow restore source allocation only; they do not reverse an external receipt, mutate cash, call a provider, or post a journal. See Supplier payables.

When Inventory successfully reverses the stock movement, it emits the versioned PurchaseReceiptReversedEvent. Finance validates the source and idempotently transitions the matching pending/no-journal accrual projection to reversed (or appends an idempotent compensating journal when a posted receipt accrual's source journal and target open period are available). It fails closed when downstream dependencies remain; this bounded slice never transfers funds or calls an external payment provider.

AP control-account safeguard: System AP (2000), GRNI (2010), Supplier Advances (1160), and Supplier Credits (1180) are owned by the supplier-payables sub-ledger. Manual and opening-balance journals cannot post them directly. Use the approved opening AP/GRNI/advance cutover path so a supplier balance is imported once with evidence and is not duplicated by a hand-entered journal.

Manual / ops surfaces in Finance

Action Notes
Chart of accounts Accounts → Add account creates a custom account (code, name, type) with finance:account:create. Codes must be unique, and system codes such as 1000–6000 and 3900, plus every 1050-… code (representative custody cash), are reserved. Tap a custom account to rename or deactivate it (finance:account:update). An inactive account keeps its history but can't be used in new entries. System accounts can't be edited, and an account behind an active cash book can't be deactivated. Missing system accounts are restored the next time the list loads.
Cash books & payment routing Cash & bank → Add cash book links a new cash or bank book to an active asset account (finance:cash:transfer). Inventory Asset and non-asset accounts are refused. Where sales payments go picks the cash book that receives each sales payment method (cash, card, transfer, other). A missing method is restored to its default book. Representatives' custody cash books are not listed here and cannot receive a payment method, an expense, a transfer, or a manual or opening-balance line.
Cash settlement Finance → Cash settlements confirms a representative's hand-over (finance:settlement:approve): DR the chosen company cash book / CR their custody cash, with any difference to 1150, 2200 or 6100 (posting_kind cash_settlement). See Cash settlements
Record expense Expense JE from Expenses (finance:expense:create)
Record other revenue Non-sales income JE (finance:journal:create); not counted in Sales MTD
Cash transfer Between cash books when permitted (finance:cash:transfer). Posts a balanced journal (kind=cash_transfer: DR destination / CR source). Cash & bank shows book balances from the ledger and lists recent transfers (tap → journal detail).
Opening balances Initial / migration balances via Opening balances (finance:journal:create). Posts kind=opening_balance into the selected open fiscal year (balanced CoA lines). While the year is open, Revise reverses the prior manual opening-balance journal and posts a corrected one (audit trail). Year-close carry (opening_balance_carry) is not editable here. Year-close still auto-carries balances into the next year. Inventory Asset is not entered here: its value is Σ quantity × cost of your inventory items and grows each time you add an item with stock, so the page shows it read-only. Manual and opening-balance journals that use Inventory Asset are rejected. An older opening balance that already holds an Inventory Asset line is flagged; Revise drops that line, then reduce the matching equity line by the same amount.
Close period / fiscal year Closes P&L into retained earnings and opens the next year (finance:period:close). A fiscal year (always 1 Jan – 31 Dec) can only be closed after it ends. Reopen a closed year (same permission) to correct it

National e-invoicing

Finance → E-invoicing (/finance/e-invoicing) lists sales documents reported to the tax authority. Jordan (ISTD JoFotara) is the only registered jurisdiction today.

Step Behaviour
Tracking Each new sales invoice is tracked as an invoice; each completed sales return as a credit note linked to its invoice. Duplicate events do not create a second record.
Settings E-invoicing settings (finance:einvoice:configure): jurisdiction, seller tax number and legal name, authority settings, credentials, auto-submit. Credentials are write-only and stored encrypted. Enabling requires credentials; changing jurisdiction clears stored credentials.
Preview Validates the document and renders the payload without sending it (finance:einvoice:read).
Submit Send one document, or select up to 50 and submit them as a batch (finance:einvoice:submit). Each attempt is recorded with the authority response.
Auto-submit When the profile is enabled with auto-submit on, a new invoice is sent as soon as it is tracked. A credit note auto-submits only once its original invoice is accepted.
Void Voiding the sales invoice cancels its e-invoice unless the authority already accepted it.

Statuses: Pending, Submitting, Submitted, Accepted, Rejected, Failed, Needs action, Cancelled.

Dashboard cutover

Merchant Sales MTD / COGS / Gross Profit update from Finance journal events (FinanceJournalPostedEvent and related), not from Sales invoice create alone. Rebuild can replace KPI projections from a Finance snapshot feed.


Related: Overview · Boundaries · Supplier payables · Events · Dashboard KPIs · Sales invoices