Josan platform — Phase 10, batch 2 verification log General Ledger, journal management, accounting periods Run on 2026-11-20 10:17 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_phase5.py 59/59 checks passed == separation_test All 229 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. == money_test All 34 money tests passed. == ip_test All 23 IP tests passed. == integrity_check Checked 10 invoices, 7 payments, 26 expenses, 4 attachments, 7 journal entries, 517 accounts, 24 accounting periods. No problems found. == php errors: 0 bytes Totals: browser tests 688 checks (phases 3-10), PHP tests 451 checks (separation 229, stale-check 10, restore 10, accounting batch 1 75, ledger and periods 70, money 34, IP 23), integrity clean, 0 bytes of PHP errors. ================ tests/ledger_periods_test.php Accounting periods: PASS monthly periods generated for the fiscal year (12, Jan 1 – Dec 31, no gaps, all open) PASS generating again adds nothing and changes nothing PASS the next fiscal year is added on demand (Jan – Dec 2027) PASS period labels and fiscal numbering PASS the database refuses a period that is not a whole calendar month PASS the database refuses a second period for the same month General Ledger: PASS bank: opening $0, running balance after every line, closing $10,850.00 Dr PASS bank: debits and credits total ($11,299.00 / $449.00) and closing = opening + debits − credits PASS lines in date order, each linked to its journal entry PASS date range: opening = everything before (Jan) $10,000.00 Dr; only Feb–Mar lines; closing $10,850.00 Dr PASS a range with no lines shows opening = closing PASS credit-normal accounts read as Cr (equity $10,000.00 Cr, revenue $1,200.00 Cr), not flagged unusual PASS a balance on the unusual side is flagged (bank in credit, revenue in debit) PASS a reversed entry and its reversal both show and net to zero PASS include sub-accounts: Vehicle expenses with Fuel (6710) = $100.00 Dr; on its own $19.60 Dr PASS all accounts: only accounts with activity, in chart order, total debits = total credits PASS Business B's entry is not in A's ledger (and B's ledger has only its own) PASS the ledger reads posted entries only: an entry refused for being unbalanced leaves no line PASS export: opening row, one row per line, closing in the total row PASS CSV: amounts are numbers, balances signed (debit positive) PASS CSV cells are formula-safe PASS PDF: renders (landscape) with the closing balance Journal management: PASS search by journal reference finds exactly that entry PASS filter by date range / period (March: 3 entries) PASS filter by account PASS filter by source document number and by source type PASS unlimited list for exports includes every entry PASS journal export: entries and lines tables; debits = credits PASS original ↔ reversal relationship both ways PASS audit history of an entry includes its posting and its reversal PASS no duplicate reversal, no reversing a reversal, reason required PASS posted entries stay immutable (database refuses update and delete) Closing and posting restrictions: PASS periods close in date order (February before January refused) PASS January closed: status, who and when, history event PASS closing changed no journal entry and no line PASS closing does not change the General Ledger (every account, every line and balance) PASS closing twice refused PASS posting dated in a closed period refused by the application PASS posting_date_problem explains it PASS posting dated in a closed period refused by the database (direct insert) PASS the database still accepts a direct insert in an open period (the trigger is selective) PASS a reversal dated in a closed period refused PASS a closed-period entry can still be reversed into an open period PASS posting in an open period still works PASS the fiscal year start cannot change once a period is closed Reopening: PASS reopening needs a reason PASS the database refuses a reopen event without a reason PASS reopened with the reason recorded (who, when, reason) PASS posting in the reopened period works PASS period history, newest first: closed, reopened, closed PASS history cannot be changed or deleted (database) PASS period dates and business cannot change; periods cannot be deleted (database) Lock dates: PASS an open period cannot be locked PASS periods lock in date order (February before January refused) PASS January and February locked: lock date Feb 28 PASS a locked period cannot be reopened PASS posting on or before the lock date refused (application) PASS the database refuses a posting on or before the lock date even if the period row says open PASS unlocking starts from the latest locked period, and needs a reason PASS February unlocked: back to closed, lock date moves back to Jan 31, reason recorded PASS journal entries unchanged by every close, reopen, lock and unlock Permissions: PASS administrator may close and lock PASS staff with view and manage but not accounting.close may not close or reopen PASS staff with accounting.close may close and reopen, never lock PASS an owner may not close or lock Business separation: PASS closing A's periods did not touch B's PASS B can still post in January PASS A cannot close, reopen or lock B's period by id PASS a period event cannot point at another business's period (database) PASS A's period list and history contain only A's periods All 70 ledger and period tests passed. ================ e2e test_phase10b.py (screens, permissions, exports, phone) PASS sample entries posted for the run PASS Chart of Accounts: the balance opens that account's ledger PASS General Ledger (all accounts, this fiscal year): one card per account with activity PASS all accounts: total debits equal total credits PASS bank, Feb 1 – Mar 31: opening = everything before Feb 1, closing = opening + debits − credits PASS only lines in the range, in date order PASS running balance on the last line equals the closing balance PASS rent and fuel lines show on the bank ledger with their journal numbers PASS a ledger line opens its journal entry PASS owner's equity (credit normal) reads Cr PASS Vehicle expenses with sub-accounts includes the Fuel (6710) line PASS period filter (March 2026) sets the dates PASS Print button PASS ledger CSV: file, opening and closing rows, signed balances PASS ledger PDF PASS ledger exports are logged PASS a bad date range is handled (swapped, no error) PASS journal search by reference PASS journal filter by accounting period PASS journal filter by source document number PASS journal filter by account PASS journal filter by date range PASS journal CSV of the filter: entries and lines PASS journal PDF PASS journal list has Print PASS entry detail: period and status, posting key, line breakdown PASS entry detail: history card with the posting PASS entry PDF and Print PASS periods page: 12 monthly periods of FY 2026, all open PASS only the earliest open period can be closed PASS January closed on screen and in the database PASS posting into closed January refused on screen PASS reversal dated in closed January refused on screen PASS reopen without a reason refused PASS reopened with a reason; reason in the history PASS closing and reopening changed no journal entry PASS lock only the earliest unlocked closed period PASS January locked: lock date shown, no Reopen for a locked period PASS a locked period cannot be reopened (direct post) PASS staff without accounting permission: ledger and periods refused (403) PASS view-only staff: periods read-only (no Close, Reopen, Lock or Add year) PASS view-only staff: closing by direct post refused (403) PASS view-only staff: General Ledger opens PASS staff with accounting.close closes March PASS staff with accounting.close: no Lock or Unlock buttons PASS staff cannot lock or unlock by direct post (403) PASS another business's period by id: not found PASS staff: unassigned business's ledger and periods not found PASS owner accounting menu: General Ledger, no Periods or Settings PASS owner: own General Ledger with balances PASS owner: ledger CSV PASS owner: periods page and staff ledger not found PASS owner: another business's account ledger not found PASS admin unlocks January with a reason: closed again, books no longer locked PASS all periods open again PASS every close, reopen, lock and unlock is in the activity history (4 closes, 1 lock, 1 unlock, 4 reopens) PASS journal entries unchanged throughout PASS phone: ledger, periods and journal pages fit the screen 58/58 checks passed ================ tests/separation_test.php (229 checks; new ledger and period checks included) PASS no Business B data: admin/dashboard.php?period=year PASS no Business B data: admin/dashboard.php?period=year&biz=27 PASS no Business B data: admin/reports.php?report=cash_summary&period=year PASS no Business B data: admin/reports.php?report=cash_summary&period=year&biz=27 PASS no Business B data: admin/reports.php?report=cash_summary&period=year&biz=27&format=csv PASS no Business B data: admin/reports.php?report=sales_tax&period=year PASS no Business B data: admin/reports.php?report=sales_tax&period=year&biz=27 PASS no Business B data: admin/reports.php?report=sales_tax&period=year&biz=27&format=csv PASS no Business B data: admin/reports.php?report=ar_aging&period=year PASS no Business B data: admin/reports.php?report=ar_aging&period=year&biz=27 PASS no Business B data: admin/reports.php?report=ar_aging&period=year&biz=27&format=csv PASS no Business B data: admin/reports.php?report=payments&period=year PASS no Business B data: admin/reports.php?report=payments&period=year&biz=27 PASS no Business B data: admin/reports.php?report=payments&period=year&biz=27&format=csv PASS no Business B data: admin/reports.php?report=expenses&period=year PASS no Business B data: admin/reports.php?report=expenses&period=year&biz=27 PASS no Business B data: admin/reports.php?report=expenses&period=year&biz=27&format=csv PASS no Business B data: admin/reports.php?report=job_profit&period=year PASS no Business B data: admin/reports.php?report=job_profit&period=year&biz=27 PASS no Business B data: admin/reports.php?report=job_profit&period=year&biz=27&format=csv PASS no Business B data: admin/reports.php?report=customer_balances&period=year PASS no Business B data: admin/reports.php?report=customer_balances&period=year&biz=27 PASS no Business B data: admin/reports.php?report=customer_balances&period=year&biz=27&format=csv PASS blocked: GET admin/ledger.php?business=27 PASS blocked: GET admin/ledger.php?business=26&account=1177 PASS blocked: GET admin/ledger.php?business=27&format=csv PASS blocked: GET admin/ledger.php?business=27&format=pdf PASS blocked: GET admin/accounting_periods.php?business=27 PASS A's page has no Business B entry: admin/ledger.php?business=26 PASS A's page has no Business B entry: admin/ledger.php?business=26&format=csv PASS A's page has no Business B entry: admin/accounting_periods.php?business=26 PASS A's ledger PDF opens (B's entry cannot be in it: B has its own journal numbering) PASS blocked: close B's period through business=27 PASS blocked: close B's period through business=26 PASS blocked: staff cannot lock a period (administrators only) PASS owner report has no Business B data: owner/reports.php?report=cash_summary&period=year&biz=27 PASS owner report has no Business B data: owner/reports.php?report=cash_summary&period=year&biz=27&business=27&format=csv PASS owner report has no Business B data: owner/reports.php?report=sales_tax&period=year&biz=27 PASS owner report has no Business B data: owner/reports.php?report=sales_tax&period=year&biz=27&business=27&format=csv PASS owner report has no Business B data: owner/reports.php?report=ar_aging&period=year&biz=27 PASS owner report has no Business B data: owner/reports.php?report=ar_aging&period=year&biz=27&business=27&format=csv PASS owner report has no Business B data: owner/reports.php?report=payments&period=year&biz=27 PASS owner report has no Business B data: owner/reports.php?report=payments&period=year&biz=27&business=27&format=csv PASS owner report has no Business B data: owner/reports.php?report=expenses&period=year&biz=27 PASS owner report has no Business B data: owner/reports.php?report=expenses&period=year&biz=27&business=27&format=csv PASS owner report has no Business B data: owner/reports.php?report=job_profit&period=year&biz=27 PASS owner report has no Business B data: owner/reports.php?report=job_profit&period=year&biz=27&business=27&format=csv PASS owner report has no Business B data: owner/reports.php?report=customer_balances&period=year&biz=27 PASS owner report has no Business B data: owner/reports.php?report=customer_balances&period=year&biz=27&business=27&format=csv PASS owner General Ledger ignores ?business=B (own entries only) PASS owner General Ledger CSV is their own PASS blocked: owner GET owner/ledger.php?account=1177 PASS blocked: owner GET admin/ledger.php?business=26 PASS blocked: owner GET admin/accounting_periods.php?business=26 PASS blocked: owner GET owner/accounting_periods.php PASS redirected to sign in: admin/ledger.php?business=26 PASS redirected to sign in: admin/ledger.php?business=26&format=csv PASS redirected to sign in: owner/ledger.php PASS redirected to sign in: admin/accounting_periods.php?business=26 All 229 separation checks passed. ================ Database triggers installed (12) trg_periods_no_delete DELETE accounting_periods trg_periods_protect_update UPDATE accounting_periods trg_period_events_no_delete DELETE accounting_period_events trg_period_events_no_update UPDATE accounting_period_events trg_accounts_protect_delete DELETE accounts trg_accounts_protect_update UPDATE accounts trg_journal_entries_no_delete DELETE journal_entries trg_journal_entries_no_update UPDATE journal_entries trg_journal_entries_open_period INSERT journal_entries trg_journal_lines_closed INSERT journal_lines trg_journal_lines_no_delete DELETE journal_lines trg_journal_lines_no_update UPDATE journal_lines ================ database/golive_check.php (protection line) PASS Database protection for the books installed (12 triggers) ================ tests/integrity_check.php Checked 10 invoices, 7 payments, 26 expenses, 4 attachments, 11 journal entries, 517 accounts, 24 accounting periods. No problems found. ================ integrity_check mutation test (deliberate damage, then restored) lock_date set with no locked period, and February marked closed before its entries were posted: - business 22 lock date: is 2026-03-31 but the last locked period ends (none) - journal HPP-JE-00003: was posted after its period (2026-02-01) was closed (and 4 more) After restoring: No problems found.