Bryce e9970bd41a fix(reports): collapse accounts sharing a numeric code to one row
A client's bank account and the financial account it posts to carry the
same numeric code. Reports keyed their detail rows on [code, name], so
the pair rendered as two rows — one labelled for the bank account, one
for the financial account.

The amount was duplicated too, not just the label: the row's figure is
filtered by code alone, so both rows printed the whole code's total. The
group subtotal counts the code once, so a section's visible rows stopped
footing to their own subtotal. Penelope's Coffee and Tea overshot the
2000 Accounts Payable subtotal by $251,751.80 this way.

Resolve it in two places:

- build-account-lookup now maps every account at a shared code down to
  the bank account's name, per client. Where a client has two bank
  accounts on one code, lowest :bank-account/sort-order wins, then
  lowest :db/id, so the label is stable across runs.
- used-accounts now keys rows on the code alone. Across a multi-client
  report the clients can still disagree, since only some of them have a
  bank account at the code; a bank-sourced name wins there, which the
  new :bank_account_name? flag carries through from the lookup.

Rows are code-keyed now, so detail-rows decides whether to print a
figure by asking whether the client has data at the code rather than
under the winning name — otherwise a client reaching a code under a name
another client won would blank out.

Balance sheet, profit and loss and cash flows all route through
used-accounts and are all fixed. The GraphQL and cljs balance sheets
pick up the unified name through build-account-lookup.

A sweep of all 146 clients with bank accounts finds duplicate rows on 8
of them before this change and none after, with every section total
unchanged.
2026-08-14 16:36:01 -07:00
2026-05-30 00:08:27 -07:00
2026-07-29 10:25:04 -07:00
2024-02-08 11:41:03 -08:00
2026-06-23 22:03:26 -07:00
2026-05-27 08:42:42 -07:00
2026-06-04 22:59:51 -07:00
2024-05-02 20:37:13 -07:00
2026-04-26 22:15:05 -07:00
2024-11-17 22:32:43 -08:00
2026-05-19 09:21:28 -07:00
ok.
2026-02-08 08:43:53 -08:00
2022-09-26 16:12:39 -07:00
2023-10-12 21:55:37 -07:00
2026-05-21 11:51:29 -07:00
2023-07-27 09:50:22 -07:00
2026-05-30 00:08:27 -07:00
2022-12-08 08:51:34 -08:00
2026-05-18 15:50:09 -07:00
2026-07-25 21:13:44 -07:00
2023-03-24 10:57:53 -07:00
2023-08-31 23:43:19 -07:00
2026-05-19 09:21:28 -07:00
2026-05-21 11:50:50 -07:00
2026-05-21 11:50:50 -07:00
2026-06-23 22:03:26 -07:00
2026-04-09 14:32:39 -07:00
2025-03-31 10:55:47 -07:00
Description
No description provided
22 MiB
Languages
Clojure 91%
CSS 4.2%
Sass 2.3%
HTML 1.2%
HCL 0.4%
Other 0.7%