diff options
Diffstat (limited to 'src/reports.h')
| -rw-r--r-- | src/reports.h | 15 |
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" \ |
