@davoodmehraban89 / Factor-easy / commits / 1533b9b
Fork 0

سامانه صدور فاکتور و حسابداری

Close Phase 3 double-entry accounting acceptance

davoodmehraban89 committed Sep 28, 2026 at 18:24 UTC 1533b9b7ae5342459b8a64f3a5135b1639bd8602
1 file changed +67
docs/PHASE_3_REDESIGN_VERIFICATION.md new
+67
@@ -0,0 +1,67 @@
1 +# Finora — Phase 3 Verification
2 +
3 +Date: 2026-09-28
4 +Status: COMPLETED
5 +
6 +## Scope
7 +Phase 3 introduces the first operational double-entry ledger on top of the Phase 2 accounting foundation.
8 +
9 +Implemented:
10 +- journal voucher and journal line collections
11 +- normalized journal-line dimension assignments
12 +- draft -> posted -> reversed lifecycle
13 +- balanced debit/credit validation before creation and again before posting
14 +- posting-account validation
15 +- account/dimension required/optional/unavailable validation
16 +- leaf/postable analytic-dimension validation
17 +- fiscal-year resolution and lock enforcement
18 +- sequential voucher numbering per fiscal year
19 +- source event/version uniqueness guard
20 +- immutable posted vouchers; destructive delete is draft-only
21 +- reversal by a new opposite posted voucher
22 +- manual journal-entry UI with dynamic dimension selectors
23 +- journal register and trial balance
24 +- default posting profiles for sale, purchase, receipt, payment, expense and other income
25 +- cash/credit aware sale and purchase posting
26 +- sales VAT payable split when tax exists
27 +- purchase VAT split when a recoverable-VAT account exists; otherwise gross purchase remains balanced
28 +- legacy source posting adapter with source-to-voucher reference
29 +- cloud sync, backup/import persistence for all Phase 3 ledger collections
30 +- accounting navigation integrated into the Phase 1 shell
31 +
32 +## Ledger invariants
33 +1. A voucher cannot post unless total debit equals total credit and is positive.
34 +2. A journal line cannot contain both debit and credit and cannot be zero-sided.
35 +3. Only active posting accounts are accepted.
36 +4. Required analytic dimensions must be supplied and valid terminal/postable values.
37 +5. Dimensions marked unavailable cannot be posted.
38 +6. A posted voucher cannot be destructively edited or deleted.
39 +7. Corrections to posted vouchers use reversal.
40 +8. A source event/version cannot have two active posted vouchers.
41 +9. A locked fiscal year rejects new posting.
42 +10. Trial balance is derived only from posted/reversed ledger history, never from draft lines.
43 +
44 +## Production persistence
45 +Supabase project: hcsixhqbyuhpshfwqpjx
46 +
47 +The records collection constraint was extended by migration:
48 +- postingProfiles
49 +- journalVouchers
50 +- journalLines
51 +- journalLineDimensions
52 +
53 +Existing production financial rows were not rewritten or deleted. At migration verification, production contained the existing companies, contacts, invoices, products and settings and no Phase 3 journal records yet.
54 +
55 +## Compatibility
56 +Existing Finora source documents remain operational. Phase 3 does not bulk-post historical documents automatically because that would create accounting history without an explicit reconciliation/cutover. The adapter can post source records under the configured chart; controlled historical reconciliation remains a later release/cutover responsibility.
57 +
58 +## Automated gates
59 +- JavaScript syntax check
60 +- repository application invariants
61 +- Phase 2 accounting-foundation invariants
62 +- Phase 3 double-entry invariants
63 +- CodeQL security workflow
64 +- GitHub Pages deployment
65 +
66 +## Boundary
67 +Interactive authenticated browser/device E2E is not available in the current execution environment and is not claimed. Production release acceptance is based on source verification, CI gates, Supabase schema verification/advisors and deployment status.