feat(reports): what a player owes and has paid, by birth cohort
Every dues report was per invoice, so answering 'how much is on this boy'
meant adding rows up by eye, and there was no way to ask it of a cohort at
all — no report anywhere could filter on a date of birth. Two new ones:
participant_dues totals each player, participant_invoice_history is the
same money invoice by invoice. Both take a birth-year box, because that is
how a club talks about its players: مواليد 2015 is a cohort, not a search.
What is owed sums each invoice's stored due_amount floored at zero rather
than subtracting paid from billed. An overpaid invoice carries a negative
due_amount, and summing the subtraction would let it cancel another
invoice's real debt — the report would quietly forgive money.
The birth-year filter reaches invoices → participants → people through
whereHas rather than a join, so Participant's BranchScope survives the
subquery and another branch's player cannot be reached by typing their
membership number into the search box.
Filters are declared in the report config instead of special-cased, and
the CSV export builds its arguments from the same list. That closes an
existing divergence: the minimum-absences filter was wired into the page
and not the export, so filtering the absentees report and downloading it
gave you the unfiltered one.
Co-Authored-By:
Claude Opus 5 (1M context) <noreply@anthropic.com>
Showing
Please register or sign in to comment