Ledgers
Verified against source (9)
accounting/Ledger.csaccounting/LedgerItem.csaccounting/LedgerTemplate.Fields.csaccounting/LedgerTemplateItem.Fields.csConfig/Ledger.configConfig/LedgerItem.configConfig/LedgerTemplate.configProperties/Settings.settingsTables/Ledger.sql
Power users shape ledgers through ledger templates: one per kind of ledger, such as “Case Fees”, “Vendor Invoice”, or “Order Costs”. A template lists its items, sets how the ledger calculates, and decides what invoice approval produces.
Ledger templates
Section titled “Ledger templates”| Setting | Property | Purpose |
|---|---|---|
| Applies To | AppliesTo |
The kind of record the ledger attaches to, such as a process or an organization. |
| Repeatable | Repeatable |
One ledger per record, one active ledger, or many. See Templates. |
| Refresh on insert | RefreshOnInsert |
Calculate the ledger as soon as it is created, so prices are filled in immediately. |
| Calculate method / Project method | CalculateMethod, ProjectMethod |
Optional custom methods that replace the standard calculation (see below). |
| Invoice template | InvoiceTemplateID |
The document template generated when the ledger is approved. |
| Invoice matrix | InvoiceMatrixID |
A matrix that chooses the invoice template per record instead. |
Each ledger also carries two flags of its own. Turn Is Expandable off to stop items being added beyond those the template created; a ledger with Is Locked set can’t be recalculated, approved, posted, or charged without the LedgerUpdateLocked permission.
Templates also support custom types and statuses for the ledger, plus Item Types and Item Statuses panels for its line items, and partner (extranet) security like other templates. From a template’s summary page you can Copy it.
Template items
Section titled “Template items”Each item in the template’s Items panel defines one expected line:
| Setting | Purpose |
|---|---|
| Type and Sequence | Classify the line and set its order. |
| Is Debit | Debit (adds to the balance) or credit (subtracts). |
| Is Totaled | Whether the line counts toward the adjusted balance by default. |
| Can Exclude | Whether users may exclude the line from the adjusted balance. |
| Can Refresh | Whether recalculation may change the line once it exists. |
| Is Locked | Whether the line starts locked. |
| Default Amount, Default Decimal, Default Units | Starting money amount, quantity, and unit (for example Hours). |
| Manual Insert | Whether the line is created automatically with each new ledger or added only by hand. |
| Matrix | Rule-based pricing for the line (see below). |
When a ledger is created, QBO adds every automatic line from its template, with its defaults.
Price lines with rules
Section titled “Price lines with rules”Bind a matrix to a template item to price it from the record’s data, such as a fee that varies by client, product, or jurisdiction. When the line is calculated, QBO looks up the matrix and copies each output measure onto the line item by name: a measure named AmountMoney sets the amount, AmountDecimal sets the quantity, and so on. Lines without a matrix result fall back to the template item’s defaults. Remove the binding with Remove Matrix.
Matrices are built in the rules engine; see Business Rules.
How calculation works
Section titled “How calculation works”Calculate (on demand, on insert if the template asks for it, or from a workflow step) does three things:
- Projects items. By default QBO runs the standard projection statement, using the ledger’s Good Through date when it is set, and calculates each line: child ledger total first, then matrix, then defaults. Locked items, and items whose template forbids refresh, are left alone.
- Totals the ledger. Balance is the sum of debits minus credits over every item with an amount. Adjusted balance is the same sum over items that are totaled.
- Rolls up. If this ledger is the child of a line on another ledger, that line’s amount is updated to this ledger’s adjusted balance.
Saving a single item recalculates the totals without re-projecting every item.
A template’s Calculate method or Project method can replace steps 2 or 1 with your own statement. A calculate method must return Balance and BalanceAdjusted columns; a project method returns the line items to calculate.
Approval and invoices
Section titled “Approval and invoices”Approve generates an invoice when the template has an invoice template or invoice matrix, then marks the ledger Approved, sets its completed date, and locks the ledger and its items.
- With an invoice template, that document template is used.
- With an invoice matrix, QBO looks up its
AttachmentTemplatemeasure against the ledger’s parent record to choose the document template by name. Creating an invoice matrix clears the fixed invoice template.
The invoice is saved as a document on the ledger’s parent record (or on the ledger itself if it has no parent). Build it like any generated document; see Document Management.
Post marks the ledger Posted, sets its posted date, and locks it. Use it for ledgers that don’t need an invoice, or to close a ledger after payment.
Permissions
Section titled “Permissions”Each ledger action has its own permission: LedgerCalculate, LedgerApprove, LedgerPost, and LedgerAuthorizeAndCapture. LedgerUpdateLocked lets a user act on a ledger after it is locked; grant it sparingly.