• Mahmoud Aglan's avatar
    feat(accounting): one split, applied across any scope of revenue · c95a8dd4
    Mahmoud Aglan authored
    The wizard could only ever rewire one stream at a time, so making a policy
    ("this is how we split membership money") meant repeating the same work per
    stream — 97 streams across 14 categories. The split is now written once and
    pushed onto whatever it should govern.
    
    Scopes: this stream, a whole category, a hand-picked set, everything not yet
    mapped, or all of it. The screen shows the resolved target list and the count
    before anything is written, and each target still gets its own versioned rule
    — nothing is shared and nothing is retroactive.
    
    AllocationPlanService is the guard rail. Every save runs resolveTargets ->
    validate -> apply, apply() re-validates on its own (there is no FK on
    account_id, so an unvalidated write would point rules at accounts that do not
    exist), and the whole batch is one transaction — a single bad target rolls
    back all of it rather than leaving the chart half-rewired.
    
    Refused before a row is written, all verified against a clone of production:
    header accounts, missing/archived accounts, no remainder line, two remainder
    lines, percentages over 100, zero and negative values, a line type that does
    not match its account's type, an expense line on a collection, mixing inflow
    and outflow streams in one scope, an effective date inside a closed period,
    a deferred line with no recognition account, and a stage the category cannot
    produce (skipped with a reason rather than written).
    
    Also:
    - Direction now drives which line types exist at all, and is editable per
      stream from the wizard. Phase_106_001 corrects 11 payroll/procurement
      streams seeded as 'inflow' — a salary expense and a supplier payment are
      debits, and the screen was offering revenue accounts for them.
    - parseLines() accepted 5 of the 12 line types the schema allows, which made
      outflow streams impossible to configure at all. It now accepts all of them.
    - Deferred revenue is configurable from the wizard (months + recognition
      account, filtered to revenue accounts).
    - The entry preview inverts for outflow: split lines debit, cash credits.
    
    Arithmetic verified against RevenueAllocator at 0.03, 1.00, 150,000.00 and
    999,999.99 EGP, and with 14% inclusive VAT — balanced in every case.
    Co-Authored-By: 's avatarClaude Opus 5 (1M context) <noreply@anthropic.com>
    c95a8dd4
Name
Last commit
Last update
..
Academies Loading commit data...
AcademyContracts Loading commit data...
AccessMatrix Loading commit data...
Accounting Loading commit data...
Achievements Loading commit data...
ActivitySubscriptions Loading commit data...
Alerts Loading commit data...
Archive Loading commit data...
Audit Loading commit data...
Auth Loading commit data...
Branches Loading commit data...
Carnets Loading commit data...
Cashier Loading commit data...
Children Loading commit data...
Coaches Loading commit data...
Dashboard Loading commit data...
Death Loading commit data...
Disciplines Loading commit data...
Divorce Loading commit data...
Documents Loading commit data...
Facilities Loading commit data...
FacilityDashboards Loading commit data...
FacilityGrids Loading commit data...
Fines Loading commit data...
Foreign Loading commit data...
Forms Loading commit data...
HR Loading commit data...
Honorary Loading commit data...
Installments Loading commit data...
Interviews Loading commit data...
Inventory Loading commit data...
MatchCenter Loading commit data...
MedicalBoard Loading commit data...
Members Loading commit data...
News Loading commit data...
Notifications Loading commit data...
ParentPortal Loading commit data...
Payments Loading commit data...
PlayerAffairs Loading commit data...
PlayerApi Loading commit data...
PlayerAuth Loading commit data...
PlaygroundAdmin Loading commit data...
PoolManagement Loading commit data...
Pricing Loading commit data...
Procurement Loading commit data...
Receipts Loading commit data...
Rentals Loading commit data...
Reports Loading commit data...
Reservations Loading commit data...
Roles Loading commit data...
Rules Loading commit data...
Sales Loading commit data...
Scheduling Loading commit data...
Seasonal Loading commit data...
ServiceCatalog Loading commit data...
Sessions Loading commit data...
Settings Loading commit data...
Sports Loading commit data...
SportsActivity Loading commit data...
SportsDashboard Loading commit data...
Spouses Loading commit data...
Subscriptions Loading commit data...
Support Loading commit data...
Temporary Loading commit data...
Tournaments Loading commit data...
TrainerPortal Loading commit data...
Training Loading commit data...
TrainingGroups Loading commit data...
Transfers Loading commit data...
Treasury Loading commit data...
Tutorials Loading commit data...
Users Loading commit data...
Waiver Loading commit data...
Workflow Loading commit data...