feat(accounting): payment and receipt vouchers, and fix the instrument seed
VOUCHERS (سندات الصرف والقبض)
Pay an expense without thinking in debits and credits. The clerk says "صرف ٥٬٠٠٠
دعاية نقدي" — picks a type, the cash account, and what it was for — and the double
entry is derived and previewed live before saving.
outflow (صرف) Dr each expense line Cr cash / bank
inflow (قبض) Dr cash / bank Cr each revenue line
Voucher TYPES are rows, not code: a club adds "سند صرف كهرباء" with its account
pre-selected from the screen. Seeded with general, advertising, maintenance,
utilities, bank, and two receipt types.
Handled deliberately:
- Input VAT splits out per line, so a supplier invoice with 14% recoverable tax
records the expense net and the tax in its own asset account without the clerk
doing the arithmetic. Inclusive and exclusive are both correct.
- Every account is checked postable before saving; a header or inactive account is
named in the error rather than failing at post time.
- A line pointing at the cash account itself is refused — the entry would cancel
to nothing.
- Posting is idempotent: a voucher that already carries a journal entry is refused.
- Cancelling a POSTED voucher reverses its entry rather than deleting it; a posted
entry is answered with an opposite entry, never erased.
- Voucher numbers retry on collision so two clerks saving at once cannot take the
same number.
- A type in use deactivates instead of deleting, so its vouchers keep their type.
- Approval is optional per type and blocks posting until granted.
INSTRUMENT SEED FIX
Phase_104_003 died on a duplicate key and never recorded: its existence check
filtered on is_header = 0, so it missed 230602 أوراق الدفع قصيرة الأجل — which
exists as a header — and tried to insert it. Existence is now checked by code
alone, and notes payable hangs at 23060201 underneath it.
Account codes for the seeded voucher types were read off the live chart rather
than guessed: 3303/3304/3305 are all headers, and 3305 is stationery, not
advertising. They now point at 330702 دعاية و إعلان, 33061 صيانة مباني, and
330401 كهرباء.
Co-Authored-By:
Claude Opus 5 (1M context) <noreply@anthropic.com>
Showing
Please register or sign in to comment