Worked accounting lifecycle
This example follows one invoice through the complete accounting lifecycle. It uses simplified accounts and amounts to show when each part becomes provisional, frozen, or final.
1. Create the profile and its books
Section titled “1. Create the profile and its books”The first table creates profile company_2026 with EUR as its accounting currency. The server provisions the managed accounting tables:
accountsgeneral_ledgerjournal_linescustom_exchange_ratesEUR is the currency in which journals, account book balances, and period book snapshots are stored. Individual business columns and leaf accounts may still use another currency.
2. Configure the reporting period
Section titled “2. Configure the reporting period”Configure a year period beginning on 2026-01-01. Its end is derived as 2026-12-31.
The period starts open. Posting is still allowed within its date range. Configuring it early makes the intended reporting boundary visible, but the period does not own a separate journal: journals belong to the profile and are selected by accounting date when the period closes.
3. Create the accounts
Section titled “3. Create the accounts”Create the account paths used by automatic source rows:
311 Receivables604 Revenue343 Tax payableAn accounting-enabled business row resolves account to an existing account; it does not create a missing path. Manual journal posting is different: it atomically creates missing account ancestors and the leaf account as part of posting.
All three accounts use EUR denomination in this example.
4. Define an accounting source table
Section titled “4. Define an accounting source table”Create invoice_posting with an ACCOUNTING definition in EUR and any additional domain fields needed to trace the invoice.
The definition expands into:
nameaccounttax_point_datedebitcreditEvery saved row must select exactly one side. The source table is now registered to create one journal line per row.
5. Save the invoice movements
Section titled “5. Save the invoice movements”Save three rows:
| Name | Account | Date | Debit | Credit |
|---|---|---|---|---|
INV-42 |
311 |
2026-08-09 | 120.00 | — |
INV-42 |
604 |
2026-08-09 | — | 100.00 |
INV-42 |
343 |
2026-08-09 | — | 20.00 |
The first row creates open journal INV-42; the next rows join it because the name and date match.
After the first row the journal is temporarily unbalanced. After all three rows:
total debit = 120.00total credit = 120.00balance = 0.00The source rows, journal lines, totals, and account projections are updated transactionally. Each line retains the source table, row ID, and row revision.
6. Correct mistakes while the journal is open
Section titled “6. Correct mistakes while the journal is open”Suppose the revenue should be 98.00 and tax 22.00. Updating those two source rows:
- soft-deletes each previous active source line;
- posts a replacement from the new row revision;
- updates journal totals;
- removes the old account contribution and applies the new one.
The historical lines remain available for audit, but only the replacements contribute to active totals.
7. Close the journal
Section titled “7. Close the journal”Once all expected lines are present and total debit equals total credit, close INV-42.
Closing freezes its header and lines and moves its signed account contribution from the open projection to closed. It does not change each account’s total.
If another correction is needed before period close, reopen the journal, correct the source rows, then close it again.
8. Close the period
Section titled “8. Close the period”Before closing the 2026 period, every journal dated on or before 2026-12-31 must be closed. Any unbalanced journal is necessarily still open and must be completed or corrected first.
Period close stores frozen balances for each relevant account:
opening + debit - credit = closingIt also freezes denomination quantities for foreign-denominated accounts. After close, changes at or before 2026-12-31 are rejected.
9. Carry balances into the successor
Section titled “9. Carry balances into the successor”Create the successor period and point it to the closed 2026 period.
If it uses the same profile and account paths remain unchanged, balances carry by path automatically. If account paths changed or the successor belongs to another profile, explicitly map every nonzero source balance to a target account.
For a reviewable transformation, generate an ACCOUNTING_TRANSFER table instead. Its source facts come from the frozen 2026 snapshot; its target fields describe where those amounts will open in the successor. The transfer must be complete and balanced before the successor can close.
10. Approve the profile
Section titled “10. Approve the profile”After every period in company_2026 is closed, approve the profile’s financial statement.
Approval is final for that profile. Its periods cannot be reopened. A later-discovered error belongs in a later corrective period rather than rewriting the approved statement.
State summary
Section titled “State summary”| State | Source rows and journal lines | Journal action | Period action |
|---|---|---|---|
| Journal open, date mutable | May post, replace, or soft-delete | May append or close | Period remains open |
| Journal closed, period open | Source-linked changes are blocked | May reopen | Period may close when all journals qualify |
| Period closed | Changes through its end date are blocked | Journals through the boundary stay frozen | May reopen only in reverse successor order and before approval |
| Profile approved | Approved-period history is final | Closed history remains frozen | Periods cannot reopen or be extended |