Journals and Journal Entries (JRN)
The jrn submodule of acc is the heart of double-entry bookkeeping: it owns the journals (one per type — bank, cash, sales, purchase, memorandum), the immutable journal entries posted to those journals, and the lines (debit/credit postings against ledger accounts) that make up each entry. Every other accounting submodule routes its postings through this one. It depends on acc.bas for period gating, acc.gld for the ledger accounts, acc.bnk for bank-statement-line links, acc.doc for source-document links, acc.cst for cost-unit allocation, acc.vat for the VAT code on lines, cat.itm for the cost item, com.par / com.org for partner/company, and on the acc.inv extension interfaces (HasInvoice, HasInvoiceLine) for invoice posting.
Concepts
JournalA named ledger book of a particular type (bank, cash, sales, purchase, memorandum, system memorandum). Each journal can have a default ledger account (used for balance lookups) and a default ledger account for currency differences.
Journal EntryAn immutable transaction posted to a journal. Carries the document the entry was created for, the financial period it posts to, and the lines that balance it. Goes through
Draft→Confirmed→Posted to Ledgerlifecycle.Journal Entry LineOne debit or credit line of an entry, posting an amount in the transaction currency and the internal currency against a single ledger account, optionally tagged with partner, item, project unit, inventory unit, and VAT code.
Journal Entry ICAn intercompany journal-entry container that holds the matching ledger account on the receivable-creditor (RC) side; multiple
JournalEntryrows in different companies can share oneJournalEntryIc.Journal Entry TypeWhat kind of transaction the entry represents — invoice sent/received, invoice payment initiated/received, money spent/received, purchase receipt, sales delivery, or memorandum.
Journal Entry SourceWhether the entry was entered manually or generated by the system from a downstream flow.
Entities
Journal (Journal)
A named ledger book.
| Field | Description |
|---|---|
| Business key (up to 4 characters). |
| Journal type — see Journal Types below (final). |
| Human-readable name. |
| Optional default account. |
| Optional default currency. |
| Optional ledger account used to book currency differences. |
Journal Types (JournalType)
| Code | Name | Used for |
|---|---|---|
| Bank | Bank statement and outbound payment postings. |
| Cash | Cash transactions. |
| Sales | Sales-invoice and sales-delivery postings. |
| Purchase | Purchase-invoice and purchase-receipt postings. |
| Manual Memorandum | Manually entered correction/adjustment entries. |
| System Memorandum | System-generated correction/adjustment entries. |
Journal Entry (JournalEntry)
An immutable transaction posted to a journal.
| Field | Description |
|---|---|
| Business key — generated transaction id. |
| Optional intercompany container. |
| The kind of transaction — see Journal Entry Types below (final). |
| Whether the entry was entered manually or generated (final). |
| Optional document line the entry was created for (final). |
| Optional document date (final). |
| Optional document id (final). |
| Optional counter-party (final). |
| Optional originating bank-statement line (final). |
| The journal the entry posts to (set while in draft). |
| The owning finance company (set while in draft). |
| Posting date (set while in draft). |
| Free-form description (set while in draft). |
| The financial period the entry posts to (set while in draft). |
| Optional reverse-link to the entry this one reverses. |
| Optional forward-link to the entry that reverses this one. |
| Lifecycle flag. |
| Lifecycle flag. |
| Derived status — see Journal Entry Statuses below. |
A validation rule enforces that any reversal/reversed-by entry shares the partner with this one, and that the bank-statement-line’s company equals the journal company.
Journal Entry Sources (JournalEntrySource)
| Code | Name | Meaning |
|---|---|---|
| Manual | Entered by a user. |
| System | Generated by a downstream flow. |
Journal Entry Types (JournalEntryType / JournalEntryLineType)
| Code | Name | Meaning |
|---|---|---|
| Invoice Sent | Sales invoice posting. |
| Invoice Received | Purchase invoice posting. |
| Invoice Payment Initiated | Outbound payment of an invoice. |
| Invoice Payment Received | Inbound payment of an invoice. |
| Money Spent | Outbound money movement (non-invoice). |
| Money Received | Inbound money movement (non-invoice). |
| Purchase Receipt | Inventory-side posting for a purchase receipt. |
| Sales Delivery | Inventory-side posting for a sales delivery. |
| Memorandum | Manual or system memorandum. |
Journal Entry Statuses (JournalEntryStatus)
| Code | Name | Meaning |
|---|---|---|
| Draft | Editable; not yet confirmed. |
| Confirmed | Locked; ready to post to the ledger. |
| Posted to Ledger | Archived; balances have been updated. |
Journal Entry Line (JournalEntryLine)
One debit or credit line of an entry.
| Field | Description |
|---|---|
| Owning entry (composite business key with |
| Line number within the entry (a |
| Optional document line the posting is about (final). |
| The account being posted to. |
| Optional foreign currency. |
| Optional currency rate used for the conversion. |
| Optional debit amount in internal/foreign currency. |
| Optional credit amount in internal/foreign currency. |
| Optional partner the line is for. |
| Optional product item. |
| Optional quantity in the item’s UoM. |
| Optional project cost-unit. |
| Optional inventory cost-unit. |
| Optional inventory quantity. |
| Optional VAT code (informative). |
| Derived posting amount in the internal currency. |
A validation rule enforces that the line’s partner does not equal the entry’s partner (intercompany invariant) and that any inventory- or project-unit’s owning partner equals the line’s partner.
Journal Entry IC (JournalEntryIc)
An intercompany container.
| Field | Description |
|---|---|
| Business key — generated transaction id. |
| The "RC" (receivable-creditor) ledger account used as the bridge between the participating entries (final). |
| The entries that share this container. |
Functionality
Journal-entry creation
JournalEntryWriterService is the seam other modules call when they need to post. It builds a journal entry from an invoice abstraction (any type implementing acc.inv.extension.HasInvoice), populates the lines from the invoice’s lines (HasInvoiceLine), runs them through the line-completion pipeline (JournalEntryLineComplementor, JournalEntryLineBuilder), validates the resulting entry against JournalEntryValidator, and persists it. It can also remove an entry that was created for an invoice.
Validation
Three validators enforce the business invariants before an entry is allowed to confirm:
JournalEntryValidatorCross-line and journal-level checks (line count, allowed entry types per journal type, period gating, total debit/credit balance).
JournalEntryLineValidatorPer-line checks (debit/credit XOR rule, exchange-rate bounds, maximum line amount, allowed account types for the journal type).
JournalEntryIcValidatorCross-entry checks for intercompany containers.
The hard-coded bounds live in JournalConstant: exchange rate must be inside (1e-6, 999999.0), per-line amount must be ≤ 9 999 999.99, and an entry must have at most 999 lines. The same constant maps each journal type to its allowed entry types (e.g. a BNK journal accepts only IPIN, IPRC, MNSP, MNRC).
Confirm / unconfirm and post-to-ledger
The confirm and confirmUndo write actions on JournalEntryViewModel flip the entry between Draft and Confirmed. The postToLedger and postToLedgerUndo actions then move it between Confirmed and Posted-to-Ledger; posting updates the per-(account, company, year) LedgerAccountBalance rows and archives the entry. JournalEntryActionWriter is the action handler the framework dispatches to.
Public API
ACC_JRN_QueryApi and ACC_JRN_CommandApi
This submodule does not provide query- or command-API classes from its hand-written package. Other modules read journals and entries through the standard generated readers and post entries by calling JournalEntryWriterService (an internal service that other modules in the acc boundary inject).
ViewModel actions
| Action | User-visible effect |
|---|---|
| Locks a draft entry after the validators pass. |
| Reverts a confirmed entry back to draft. |
| Posts the confirmed entry to the ledger and archives it. |
| Reverts a posted entry back to confirmed. |