From 024ddc04686498b584b027851e88098e8c8105ec Mon Sep 17 00:00:00 2001 From: RunasSudo Date: Sun, 5 Jan 2025 19:31:00 +1100 Subject: [PATCH] Show unassigned accounts in chart of accounts --- src/pages/ChartOfAccountsView.vue | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/pages/ChartOfAccountsView.vue b/src/pages/ChartOfAccountsView.vue index ed744d1..6a6752c 100644 --- a/src/pages/ChartOfAccountsView.vue +++ b/src/pages/ChartOfAccountsView.vue @@ -73,13 +73,17 @@ async function load() { const session = await db.load(); - const accountKindsRaw: {account: string, kind: string}[] = await session.select( - `SELECT account, kind FROM account_configurations ORDER BY account, kind` + const accountKindsRaw: {account: string, kind: string | null}[] = await session.select( + `SELECT q1.account, q2.kind FROM + (SELECT account FROM account_configurations UNION SELECT account FROM postings ORDER BY account) q1 + LEFT JOIN account_configurations q2 ON q1.account = q2.account` ); for (const accountKindRaw of accountKindsRaw) { const kinds = accounts.value.get(accountKindRaw.account) ?? []; - kinds.push(accountKindRaw.kind); + if (accountKindRaw.kind !== null) { + kinds.push(accountKindRaw.kind); + } accounts.value.set(accountKindRaw.account, kinds); } }