• DevPilot's avatar
    feat(accounting): tools for the four things that still needed a human · 5ed78ec8
    DevPilot authored
    Every item I had left as "the accountant must decide" now has a screen to decide
    it on. Nothing accounting-related is left needing code.
    
    **فئات الأصول — /inventory/asset-categories.** The screen I referenced in the
    manual and in a seed comment, and had not written. Depreciation posts through
    these three accounts per category; a category missing either depreciation
    account is silently skipped, so the asset ages in the register and the balance
    sheet never moves. The screen leads with exactly that failure — categories that
    hold assets but cannot post — offers only postable accounts, and refuses a
    half-mapped category, because one depreciation account without the other cannot
    balance an entry.
    
    **إعادة تبويب الحسابات — /accounting/reclassification.** A balance in the wrong
    account cannot be edited: the ledger is the record, and a balance that disagrees
    with the entries behind it is worse than a wrong one. So it moves by a dated,
    balanced, reversible entry. It lists what is genuinely stuck — 8 accounts here,
    including 43.9m on «مشروعات تحت التنفيذ» and 4.8m on a header — derives the
    DIRECTION from the balance rather than asking (getting that backwards doubles a
    balance instead of moving it), and refuses a header or cross-type destination.
    
    To empty a header at all, JournalService needed to allow one posted there. That
    is the only way out in double-entry, so the flag exists, is set by this service
    alone, and the service independently refuses to let a header be the destination.
    
    **رسملة مشروع تحت التنفيذ.** A finished project is not a purchase — the money
    was spent over months and sits in CIP, which deliberately does not depreciate.
    Capitalising moves the accumulated cost to the asset account so depreciation can
    start. Booking it as a purchase would credit cash for money already spent. Now a
    third option on the asset form, next to purchase and opening balance.
    
    **أرشفة سنة مالية — /accounting/fiscal-years.** Overlapping years were flagged
    but unfixable from the UI. Archiving retires one without deleting it, and is
    refused outright when the year carries entries or is the current one.
    
    The manual is rewritten around this: every wizard now has numbered UI steps, and
    a new index lists all 39 accountant-facing tools with what each does. The
    decisions section now names the tool for each item instead of describing the
    problem.
    
    Verified on a production clone with all 409 foreign keys: reclassification moves
    4,799,436 off a header and leaves it at 0.00 with all guards firing,
    capitalisation posts Dr Asset / Cr CIP and posts nothing without a CIP account,
    categories screen offers 593 postable accounts and no headers, 1,499 routes
    resolve, 254 controllers instantiate, 242 services load, trial balance diff 0.00,
    and all 56 diagrams across docs/ parse against the real mermaid parser.
    Co-Authored-By: 's avatarClaude Opus 5 <noreply@anthropic.com>
    5ed78ec8
JournalService.php 20.3 KB