mirror of
https://github.com/renee-png/acmcc.git
synced 2026-06-21 01:40:01 +00:00
Income Statement: Buildium-style category subgroups
Group the multi-period Income Statement by account category (Operating Income, Administration, Utilities, Reserves Budget, …) with "Total for <category>" subtotals, matching the Buildium layout, in the on-screen table, PDF, and CSV. - New accounting.accounts.category column (nullable; null = ungrouped), seeded from the local chart_of_accounts parent hierarchy. - Editable in Chart of Accounts: single-edit (with datalist autocomplete) and bulk-edit (blank = no change, __clear__ to unset). - buildium-account-categories edge function pulls each account's parent-GL category from Buildium (matched by code, fallback name) and backfills accounting.accounts.category; idempotent and re-runnable. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
-- Income-statement subgroups (Buildium-style): each income/expense account can
|
||||
-- carry a free-text category ("Operating Income", "Administration", "Utilities",
|
||||
-- "Reserves Budget", …). The Income Statement groups accounts under it with a
|
||||
-- "Total for <category>" subtotal. Sourced from Buildium's parent-GL hierarchy
|
||||
-- and editable in the Chart of Accounts. Null = ungrouped.
|
||||
alter table accounting.accounts
|
||||
add column if not exists category text;
|
||||
|
||||
-- Seed from the local chart_of_accounts parent hierarchy where it exists
|
||||
-- (a partial first pass — mostly a few income groups; the Buildium pull fills the rest).
|
||||
update accounting.accounts a
|
||||
set category = parent.account_name
|
||||
from accounting.companies c
|
||||
join public.chart_of_accounts coa
|
||||
on coa.association_id = c.association_id
|
||||
join public.chart_of_accounts parent
|
||||
on parent.id = coa.parent_account_id
|
||||
where a.company_id = c.id
|
||||
and coa.account_number = a.code
|
||||
and a.type in ('income','expense')
|
||||
and a.category is null
|
||||
and parent.account_name is not null;
|
||||
Reference in New Issue
Block a user