e-conomic Chart of Accounts
Every account in the chart with its type, the chart's own section heading, a classifier guess for P&L accounts and the current balance.
What it answers
- Which accounts does the company post to, and under which heading?
- What is the balance on each account this year?
The view is named after the company, such as "Acme ApS Chart of Accounts", and reads the company's e-conomic data.
How to add it
Gatlas adds it for a company when the company connects e-conomic, and it fills in after the first sync. For a company that connected earlier, ask an AI assistant on a Read/write MCP connection:
Add the e-conomic Chart of Accounts view for Acme ApS.
The assistant creates it with the template id economic/chart-of-accounts, after checking that the company's data has every column the template reads.
Columns
connection_label: The e-conomic agreement the row comes from; a company can hold several.account_number: Account number in the chart.account_name: Account name.account_type: heading, headingStart, profitAndLoss, status, totalFrom or sumInterval.debit_credit: The account's normal side: debit or credit.chart_section: Name of the nearest heading account at or above this account in the company's chart.section: Classifier guess for P&L accounts (null on others). A guess, not the company's own grouping.vat_code: Default VAT code on the account, if any.block_direct_entries: True when e-conomic blocks direct postings to the account.balance: Current accounting year balance in base currency, as e-conomic reports it.data_as_of: When this row was last synced.
What the AI assistant is told
The company's chart of accounts from e-conomic, one row per account and agreement (connection_label).
account_type: heading and headingStart are section titles, profitAndLoss and status (balance sheet) carry postings, totalFrom and sumInterval are subtotal lines.
chart_section is the nearest heading at or above the account in the company's own chart; it works on any chart.
section is a GUESS from the shared classifier, on P&L accounts only; prefer chart_section when they disagree.
balance is the current accounting year's balance as e-conomic reports it. Posted movements are in the Ledger and Monthly Trial Balance views.
The SQL
__SCHEMA__ stands for the company's schema. To adapt the view, copy the SQL, put the schema in its place and change what your company needs.
SELECT
a."_gatlas_connection_label" AS connection_label,
a."accountNumber" AS account_number,
a."name" AS account_name,
a."accountType" AS account_type,
a."debitCredit" AS debit_credit,
(SELECT h."name"
FROM __SCHEMA__.economic_accounts h
WHERE COALESCE(h."_gatlas_connection_label", '') = COALESCE(a."_gatlas_connection_label", '')
AND h."accountType" IN ('heading', 'headingStart')
AND h."accountNumber" <= a."accountNumber"
ORDER BY h."accountNumber" DESC
LIMIT 1) AS chart_section,
CASE WHEN a."accountType" = 'profitAndLoss'
THEN public.gatlas_classify_account(a."accountNumber", a."name", a."debitCredit")
END AS section,
NULLIF(a."vatAccount"::text, '')::jsonb ->> 'vatCode' AS vat_code,
a."blockDirectEntries" AS block_direct_entries,
a."balance" AS balance,
a."_gatlas_synced_at" AS data_as_of
FROM __SCHEMA__.economic_accounts a
ORDER BY 1, 2