From bbdbb32c28a7b37da8caee60cd3756720fe88f4f Mon Sep 17 00:00:00 2001 From: Anders Betts Date: Tue, 22 Sep 2026 21:53:13 +0200 Subject: reports: ignore IB rows on P&L accounts; bokfctl --dry-run Co-Authored-By: Claude Opus 5.5 --- src/reports.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/reports.h b/src/reports.h index 82c29e5..3b0e479 100644 --- a/src/reports.h +++ b/src/reports.h @@ -8,14 +8,15 @@ /* SQL condition: voucher row `r` of voucher `v` on account `a` belongs to the opening balance of fiscal year ?4 (org ?1) for a period starting ?2; ?5 is - the configured IB series. Balance accounts carry all earlier history, - including earlier years' IB vouchers; P&L accounts restart at the year - start, so only this year's IB vouchers and movements before ?2 count. */ + the configured IB series. Balance accounts carry all earlier history plus + the IB vouchers of this and earlier years; P&L accounts restart at the year + start, so only this year's movements before ?2 count and IB rows on them + (the balancing side of an IB adjustment) are ignored. */ #define REPORT_IB_ROW_SQL \ - "((v.series = 'IB' OR v.series = ?5) AND (v.fiscal_year_id = ?4" \ - " OR (v.date < (SELECT f.start_date FROM fiscal_years f" \ - " WHERE f.org_id = ?1 AND f.id = ?4)" \ - " AND a.type NOT IN ('revenue','expense'))))" \ + "((v.series = 'IB' OR v.series = ?5)" \ + " AND a.type NOT IN ('revenue','expense')" \ + " AND (v.fiscal_year_id = ?4 OR v.date < (SELECT f.start_date" \ + " FROM fiscal_years f WHERE f.org_id = ?1 AND f.id = ?4)))" \ " OR (v.series <> 'IB' AND v.series <> ?5 AND v.date < ?2" \ " AND (a.type NOT IN ('revenue','expense') OR v.date >=" \ " (SELECT f.start_date FROM fiscal_years f" \ -- cgit v1.3