summaryrefslogtreecommitdiff
path: root/src/reports.h
diff options
context:
space:
mode:
authorAnders Betts <anders.betts@gmail.com>2026-09-22 21:53:13 +0200
committerAnders Betts <anders.betts@gmail.com>2026-09-22 21:53:13 +0200
commitbbdbb32c28a7b37da8caee60cd3756720fe88f4f (patch)
tree296073e6ab0bacef67a6cab1660f6b64b74f3085 /src/reports.h
parent8e3ff5a7ae7cb5e43b6eed3be8d77f2997888669 (diff)
downloadbokf-0.1.66.tar.gz
bokf-0.1.66.zip
reports: ignore IB rows on P&L accounts; bokfctl --dry-runv0.1.66
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'src/reports.h')
-rw-r--r--src/reports.h15
1 files changed, 8 insertions, 7 deletions
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" \