• Mahmoud Aglan's avatar
    feat(accounting): connection centre — every money path, what it needs, and split-anything · ac28a438
    Mahmoud Aglan authored
    Answers the question the finance review will actually ask: "we know it is not
    connected — how do we connect it, from inside the system, now?"
    
    Three parts.
    
    1. مركز التوصيل (/accounting/revenue-mapping/connections)
       Every money path in the ERP in one list, split by WHAT IT NEEDS rather than by
       severity, because that decides who can close it:
    
         - تُوصَّل الآن من الشاشة — the module already fires an event carrying the
           amount, so mapping the accounts is the whole fix. Has a button.
         - تحتاج تعديل برمجي — the module writes the money to its own table and fires
           nothing. Mapping would change nothing, so there is deliberately NO button
           and the row says exactly what is missing. A button here would be a lie.
         - موصولة — with the current split shown inline and a rewire button.
    
       Each row reads the amount sitting in that module's own table live, so every gap
       is a number instead of an adjective.
    
    2. Rewire and split anything, including already-connected paths
       The connected list shows each current split and offers "قسّم على حسابات" when a
       path still posts to a single account. Any line can be a percentage, a flat
       amount, or the remainder — so "30% of the 150,000 to this fund, 10% to that one,
       the rest to membership revenue" is three lines and a save. Saving takes a new
       version with an effective date; posted entries never move.
    
    3. Create the destination account without leaving the screen
       A fund that does not exist yet used to mean leaving for the chart of accounts
       and losing the room. "+ حساب جديد" creates the leaf under a chosen header,
       takes the next free code, inherits type and nature, and drops straight into the
       line. Refuses to hang a child off a posting account, which would strand its
       balance.
    
    Also seeds the club fund accounts a distribution rule needs to point at — sports
    support, member welfare, martyrs stamp (already priced at 5 EGP in the service
    catalogue with nowhere to post it), federation share, facilities development.
    They are liabilities, not revenue: money earmarked for a fund is held on that
    fund's behalf, and posting it to revenue would overstate income.
    
    And 27 previously invisible paths are now catalogued with an honest wiring_status,
    a plain-Arabic note on what is missing, and a pointer to the table holding the
    money — so the screen shows the whole picture instead of only the working parts.
    Co-Authored-By: 's avatarClaude Opus 5 (1M context) <noreply@anthropic.com>
    ac28a438
Routes.php 23.9 KB