nx_stmt_lib.nx
buildroot/runtime/nx_stmt_lib.nx
about
nx_stmt_lib.nx -- F985: FINANCIAL STATEMENTS, DERIVED FROM THE LEDGER. Never typed, never stored.
Every figure below is computed from ledger transfers at read time via the chart of accounts. There
is no place to enter a balance-sheet number, so a statement CANNOT disagree with the books -- the
classic failure where the reported balance sheet and the underlying ledger drift apart is not a bug
to guard against here, it is structurally impossible.
WHAT IT DERIVES:
trial balance -- total debits vs total credits across a set of accounts
balance sheet -- assets = liabilities + equity (the accounting equation, CHECKED not assumed)
income statement-- revenue - expenses = net income
★FAIL-CLOSED ON A PARTIAL PICTURE (the property that matters): if ANY account in the requested set
has no registered kind or no registered side, the statement is REFUSED outright (returns 0) rather
than silently omitting that account. A balance sheet that quietly drops an account it did not
understand is worse than no balance sheet -- it looks authoritative and is wrong. Omission is the
most dangerous error in financial reporting, so it is the one thing this refuses to do.
SCALE ENVELOPE (declared): each figure walks the caller's account list and calls coa_natural per
account, which walks the transfer index -- O(accounts x transfers). Same rung as nx_ledger_lib.
license_tier: ORIGINAL No hw writes (Rule 26). LIB (no main).
dependencies 1 imports · 2 importers
imports: nx_coa_lib.nx
imported by: nx_fin_spine_gate.nxnx_stmt_gate.nx
structs
| none |
consts
| none |
functions
| 27 | func stmt_trial_balance(ledger_prefix: *u8, accts: *i64, n: i64, out: *i64) -> i64 |
| 45 | func stmt_by_kind(ledger_prefix: *u8, coa_prefix: *u8, accts: *i64, n: i64, kind: *u8, out: *i64) -> i64 |
| 65 | func stmt_balance_sheet(ledger_prefix: *u8, coa_prefix: *u8, accts: *i64, n: i64, out: *i64) -> i64 |
| 80 | func stmt_income(ledger_prefix: *u8, coa_prefix: *u8, accts: *i64, n: i64, out: *i64) -> i64 |