mirror of
https://github.com/we-promise/sure.git
synced 2026-09-08 16:14:23 +00:00
#3404 added DailyExpenseTotals with scoping SQL that mirrored Totals, and the same fragments (classification CASE, currency-converted amount, entries/accounts/exchange-rates joins, budget-excluded kinds, tax-advantaged and finance-account scoping) were already duplicated in FamilyStats and CategoryStats. This extracts them into IncomeStatement::ScopedTransactionsQuery so every income statement number is computed from one definition of what counts as a reportable transaction. No behavior change: only whitespace in the generated SQL differs. A new equivalence test runs each refactored class against a verbatim legacy copy (test/support/legacy_income_statement_*.rb) over the class's full option matrix (trade inclusion, account scoping, stats interval) on a dataset that exercises every scoping rule, and asserts identical rows.