Trial balance — data source, views, scope

Source of the trial balance legs, client resolution, calculation of the balance sheet and income statement views, the expandable posting list and the rights.

ledger/trialbalance is a read-only report: per account opening balance, period debit/credit turnover and closing balance; by switching the view a balance sheet (BS) and income statement (PL) based on row mapping and formulas.

Data source

  • The legs come from entry + entry_item (net and gross legs together).
  • The client comes from the linked invoice (invoice) or transaction (transaction).
  • Account names from account; company data from company.
  • Table names carry the installation's own prefix in the database.

Views

  1. tb: trial balance.
  2. BS / PL: ledger/statement::computeStatement() carries the closing balances onto the rows; without a version the latest active schema.
  3. Expand: ledger/trialbalance.preview — the account's postings in pages of 25 with “x–y / total”; from there a link to the ledger card.

Filters: company group, client, supplier, customer, date range, account class, search, “with movement only” (on by default), view, version.

Permissions

  • list (UNMAPPED, gl_trialbalance_v1.sql); the shared company picker companiesByGroup checks it too.
  • debug: SQL toggle; on error the exception text is shown as well.
  • Content scope: only the user's allowed clients; access to no company → empty report.

Dependencies

ledger/statement (row set), ledger/account (mapping), and invoice account coding (finance/invoice::accounting), which provides the data.