Josan platform — Phase 10, batch 3 verification log Automatic posting (accrual), posting existing records, expense category accounts, opening balances Run on 2026-11-20 19:32 UTC, PHP 8.3.6, 10.11.14-MariaDB-0ubuntu0.24.04.1 ================ Full regression (fresh install from schema.sql + demo data, then every test) -- part 1 db:1 web:200 mail:1 == test_phase12.py 33/33 checks passed Remove all demo data later with: php database/demo_seed.php --remove == test_phase3.py 37/37 checks passed == test_phase4.py 34/34 checks passed == test_dashboard.py 90/90 checks passed == test_phase6.py 58/58 checks passed -- part 2 db:1 web:200 mail:1 == test_phase7.py 46/46 checks passed == test_category.py 13/13 checks passed == test_industry.py 18/18 checks passed == test_phase8.py 50/50 checks passed == test_audit_workflow.py 74/74 checks passed == test_phase9.py 57/57 checks passed == test_phase10.py 61/61 checks passed == test_phase10b.py 58/58 checks passed == test_phase10c.py 35/35 checks passed == test_phase5.py 59/59 checks passed == separation_test All 234 separation checks passed. == stale_check_test All 10 stale-check tests passed. == backup_restore_test All 10 restore checks passed. == accounting_test All 75 accounting tests passed. == ledger_periods_test All 70 ledger and period tests passed. == autopost_test All 60 automatic posting tests passed. == money_test All 34 money tests passed. == ip_test All 23 IP tests passed. == integrity_check Checked 10 invoices, 7 payments, 29 expenses, 4 attachments, 68 journal entries, 517 accounts, 60 accounting periods. No problems found. == php errors: 0 bytes Totals: browser tests 723 checks (phases 3-10), PHP tests 516 checks (separation 234, stale-check 10, restore 10, accounting batch 1 75, ledger and periods batch 2 70, automatic posting batch 3 60, money 34, IP 23), integrity clean, 0 bytes of PHP errors. ================ tests/autopost_test.php Invoices: PASS a draft invoice is not in the books PASS issued invoice: one entry dated on the invoice date, linked to the invoice PASS Dr Accounts Receivable total, Cr Revenue (after discount), Cr Sales Tax PASS syncing again posts nothing (idempotent) PASS issuing twice is refused PASS Accounts Receivable = the invoice balance PASS a $0.00 invoice is issued but has nothing to post Payments: PASS cash payment: Dr Cash on Hand, Cr Accounts Receivable, on the payment date PASS card payment goes to the bank account PASS Accounts Receivable = invoice balance due after payments PASS cancelled payment: its entry is reversed with the reason, nothing deleted PASS after the cancellation Accounts Receivable = balance due again PASS a payment cannot be cancelled twice (no second reversal) PASS cancelled invoice: entry reversed on the cancellation date with the reason PASS revenue and sales tax net to zero for the cancelled invoice Expenses: PASS expense: Dr the category account (Materials → 5010 Parts and Materials), Cr Bank (card) PASS the category got its account saved PASS cash expense credits Cash; a category with no matching account goes to Miscellaneous PASS changing only the description or vendor posts nothing PASS changing the amount: the old entry is reversed (on its own date) and the new amount posted PASS changing category, date and method moves it (6710 Fuel, Cash, Apr 7) PASS cancelled expense: entry reversed with the reason; Miscellaneous back to zero PASS an expense dated before the books start date is saved but not posted PASS moving it into the books period posts it PASS moving it back before the start date reverses it Closed periods: PASS an expense dated in closed January is refused and not saved PASS issuing an invoice dated in closed January is refused; it stays a draft without a number PASS a payment dated in a closed period is refused and not saved PASS changing the amount of an expense in closed January is refused and nothing changes PASS cancelling an expense in closed January reverses it today, not in January PASS an expense whose category account is inactive is refused and not saved PASS an account used by an expense category cannot be deleted Expense categories: PASS suggested accounts by name PASS a category cannot post to an income account or to another business's account PASS a category account can be changed (logged) PASS changing a category's account leaves expenses already posted as they are PASS changing the expense's own category re-posts it to that category's account Posting existing records: PASS records saved without posting are listed (pre-start invoice left out) PASS the integrity check reports them (but not the cancelled one) PASS posting them: 3 records, 4 entries (the cancelled expense posted and reversed), no failures PASS each posted on its own date; payment by cheque to the bank PASS the cancelled expense: posted on May 14, reversed on its cancellation date (May 20) with the reason PASS running it again posts nothing PASS Accounts Receivable = balance due of every invoice in the books PASS a record changed outside the app is detected as out of date PASS and corrected by reversal and a new entry Opening balances: PASS unpaid invoices before the start date (for the Accounts Receivable opening) PASS posted on the books start date; difference ($3,500.00) to Opening Balance Equity PASS the opening entry is the one in force PASS replacing them needs a reason PASS replaced: the old entry reversed with the reason, the new one posted PASS rejected: an income account, another business's account, debit and credit on one line PASS opening balances cannot change while the first period is closed PASS clearing them reverses the entry Whole books and separation: PASS all of A's postings balance (debits = credits) PASS B's invoice posts in B's books only PASS syncing A's record id under B does nothing PASS A's record links show only A's entries PASS nothing of A or B is out of step with the books PASS journal filter by document number finds the invoice's entries All 60 automatic posting tests passed. ================ e2e test_phase10c.py (screens, permissions, phone) PASS demo records were posted as they were created: nothing waiting PASS expense recorded on screen → posted: Dr 6710 Fuel, Cr 1000 Cash PASS expense page: In the books card links its journal entry PASS the journal entry shows its source expense with a link back PASS changing the amount: old entry reversed, new one posted PASS expense page lists both entries, the first marked reversed PASS cancelled expense: its entry reversed with the reason PASS payment recorded on screen → Dr 1010 Bank, Cr 1100 Accounts Receivable PASS payment page: In the books card PASS journal filter by receipt number finds the payment's entry PASS Accounts Receivable in the books = balance due of the invoices PASS an expense dated in closed January is refused on the form and not saved PASS settings: posting rules and a category → account row per category PASS category account changed (Fuel → 6700 Vehicle Expenses) PASS the next expense in that category posts to the new account PASS changing the category back does not touch the expense already posted to 6700 PASS live totals and the Opening Balance Equity difference PASS typing a debit clears the credit on the same line PASS opening balances posted on the books start date; difference to 3950 PASS page shows the opening entry and Opening Balance Equity $3,500.00 Cr PASS replacing without a reason is refused PASS replaced with a reason: old entry reversed, new one posted PASS a record saved without posting is listed with a link PASS staff without accounting permission: Opening Balances refused (403) PASS view-only staff: page read-only (no buttons, inputs disabled) PASS view-only staff: posting by direct request refused (403) PASS view-only staff: category accounts disabled PASS staff: an unassigned business's opening balances not found PASS admin posts it: nothing waiting, entry on its own date PASS owner invoice page: In the books card linking the owner journal PASS owner: opening balances page not found PASS opening balances cleared (reversed) PASS books balance: total debits = total credits PASS phone: opening balances, settings and expense page fit the screen PASS integrity check clean after the run 35/35 checks passed ================ Upgrade path on the batch 2 database (before this package's data was reseeded) migrate.php: Applying 010_phase10_auto_posting.sql ... done post_existing_records.php: Houston Pro Plumbing 14 records / 17 entries; Bright Spark 5/5; Summit 9/9; Fresh Start 8/8; Audit Roofing 6/8; others already in the books integrity_check.php afterwards: No problems found. ================ integrity_check mutation test (orphaned entries left by deleting records with SQL) 11 problem(s) reported, e.g. 'journal HPP-JE-00001: its invoice (#1) no longer exists in business 3' ================ tests/integrity_check.php Checked 10 invoices, 8 payments, 32 expenses, 4 attachments, 79 journal entries, 517 accounts, 60 accounting periods. No problems found.