• Mahmoud Aglan's avatar
    feat(billing): let the desk date a subscription invoice to the month it settles · a8cb5217
    Mahmoud Aglan authored
    A branch going onto the system mid-season has players who have been training —
    and paying — since before anyone typed them in. Registration could only ever
    raise an invoice dated today, so the first invoice for those players said
    September when the money it settled was August, and nothing reconciled.
    
    Both reception wizards now ask, on the payment step, whether the invoice is for
    today or for an earlier month, and offer the last twelve. The month is bounded
    at both ends: a future month is refused outright, in validation and again in the
    service, because an invoice dated ahead of today is one the renewal run raises a
    second time when that month arrives and one no "what did we bill this month"
    report shows. Inside the current month the invoice still reads as raised today —
    backdating it to the 1st only makes it look overdue the day it is created.
    
    The dating is the smaller half. GenerateRenewalInvoices skips a month only when
    it finds BOTH metadata->month and metadata->renewal_enrollment_id on a
    non-cancelled invoice, and neither wizard wrote either — so every invoice they
    raised was invisible to that check and the nightly run billed the same month
    again. Two invoices, one player, one month, nothing on either saying so. Both
    now stamp both keys, and both advance next_billing_date past the month just
    billed — forward only, so a backdated invoice can never drag the anchor back
    behind where it already sits and have the run bill the months in between.
    
    The guard resolving the month runs before the auto-invoice branch, so a bad
    month is refused identically whether or not an academy has
    auto_invoice_on_enrollment switched on.
    Co-Authored-By: 's avatarClaude Opus 5 (1M context) <noreply@anthropic.com>
    a8cb5217
Name
Last commit
Last update
..
Activities Loading commit data...
Admin Loading commit data...
Assignments Loading commit data...
Attendance Loading commit data...
Audit Loading commit data...
Auth Loading commit data...
Branches Loading commit data...
CashSessions Loading commit data...
Components Loading commit data...
Concerns Loading commit data...
Dashboard Loading commit data...
Documents Loading commit data...
Enrollments Loading commit data...
Evaluations Loading commit data...
Events Loading commit data...
Facilities Loading commit data...
Financial Loading commit data...
Groups Loading commit data...
Guardian Loading commit data...
HR Loading commit data...
Inventory Loading commit data...
Invoices Loading commit data...
Messaging Loading commit data...
Notifications Loading commit data...
POS Loading commit data...
Parent Loading commit data...
Participants Loading commit data...
People Loading commit data...
Portal Loading commit data...
Pricing Loading commit data...
Profile Loading commit data...
Programs Loading commit data...
Public Loading commit data...
Receptionist Loading commit data...
Reports Loading commit data...
Requests Loading commit data...
Roles Loading commit data...
Schedule Loading commit data...
Settings Loading commit data...
Trainer Loading commit data...
Training Loading commit data...
Users Loading commit data...
Wallets Loading commit data...
Website Loading commit data...
WhatsApp Loading commit data...
Wizards Loading commit data...
BranchSwitcher.php Loading commit data...
Dashboard.php Loading commit data...
GlobalSearch.php Loading commit data...