Files
accounted/lib
Jonas Flodén b2aa79d553 fix(reports): exclude opening-balance entry from SIE #UB movement (#809)
* fix(reports): exclude opening-balance entry from SIE #UB movement

getOpeningBalances() returns obEntryId so callers can exclude the OB
entry from period queries to prevent double-counting. sie-export.ts was
discarding obEntryId, so the OB entry's lines were counted in both
openingBalancesByAccount and calculateBalances. The double-count
cancelled the real net movement, leaving #UB = #IB for any account
that was zeroed out during the year (e.g. a closed bank account).

Fix: filter the OB entry out into periodEntries before the #VER loop
and calculateBalances, matching the pattern already used by
trial-balance.ts and general-ledger.ts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Signed-off-by: Jonas Flodén <jonas@floden.nu>

* test(reports): add regression test for SIE #UB double-count via OB entry

Adds a test that exercises the exact scenario that was broken: the OB
entry returned by the journal_entries query being included in both
getOpeningBalances (#IB) and calculateBalances (movement), leaving
#UB = #IB for an account zeroed out during the year.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Signed-off-by: Jonas Flodén <jonas@floden.nu>

---------

Signed-off-by: Jonas Flodén <jonas@floden.nu>
2026-06-29 22:13:44 +02:00
..
2026-06-16 18:22:09 +02:00
2026-06-10 13:52:24 +02:00
2026-06-18 11:49:33 +02:00
2026-06-29 16:34:51 +02:00
2026-03-21 00:47:54 +01:00
2026-06-16 18:22:09 +02:00
2026-02-24 16:06:36 +01:00
2026-05-26 22:29:41 +02:00
2026-06-29 16:34:51 +02:00
2026-06-12 16:35:30 +02:00
2026-06-12 16:35:30 +02:00
2026-04-22 18:14:01 +02:00
2026-06-29 16:34:51 +02:00
2026-06-18 11:49:33 +02:00
2026-05-28 15:43:48 +02:00
2026-05-26 22:29:41 +02:00
2026-05-06 11:12:02 +02:00
2026-05-28 15:43:48 +02:00
2026-04-29 16:32:26 +02:00