The adjusted bank balance and the beneficiary ledgers both say $10,100.00. The trust cash book says $10,100.01. One subtraction catches the penny. A separate ledger check catches the −$20.00 client balance hiding inside the beneficiary total.
Close all three balances at the same cutoff
Use the bank statement, the posted trust cash book, and the individual beneficiary balances through November 27, 2026. Add deposits in transit to the statement balance and subtract outstanding checks. A check that clears on November 28 still belongs in the outstanding list for this close. A check that clears on November 27 is already reflected in the statement through that date. The State Bar of California's compliance review lists three-way reconciliations and their supporting schedules among the records it reviews. State Bar of California trust accounting review
| Balance | November 27 calculation | Amount |
|---|---|---|
| Adjusted bank | $10,200.00 + $500.00 deposit in transit − $600.00 outstanding checks | $10,100.00 |
| Trust cash book | Posted closing balance | $10,100.01 |
| Sum of beneficiary sub-ledgers | $10,120.00 − $20.00 | $10,100.00 |
Keep the amounts as bigint cents and report signed differences with zero tolerance. Also check each beneficiary independently. An overdrawn client can be hidden by the other balances even when all three totals match.
The sample close routes uncleared items older than 90 calendar days to review. Check 1017 is 91 days old, while check 1018 is exactly 90. The second fixture repeats check 1017 on a separate source row. The report retains the cash-book-to-ledger comparison and withholds the adjusted bank total until the duplicate is resolved. Import canonical check numbers as strings scoped to one bank account so distinct source rows can be checked against the same number.
Run the reconciliation
Save the block as trustrecon-benchmark.ts and run node --experimental-strip-types trustrecon-benchmark.ts with Node.js 24. The script needs no packages. Node.js TypeScript documentation
import assert from "node:assert/strict";
type BankItem = {
id: string;
recordedOn: string;
clearedOn: string | null;
cents: bigint;
} & ({ kind: "deposit" } | { kind: "check"; checkNumber: string });
type TrustClose = {
asOf: string;
statementCents: bigint;
cashBookCents: bigint;
ledgers: readonly { id: string; cents: bigint }[];
bankItems: readonly BankItem[];
};
function dayIndex(date: string): number {
const ms = Date.parse(`${date}T00:00:00Z`);
assert(/^\d{4}-\d{2}-\d{2}$/.test(date) && Number.isFinite(ms)
&& new Date(ms).toISOString().slice(0, 10) === date, `Invalid date: ${date}`);
return ms / 86_400_000;
}
function reconcile({ asOf, statementCents, cashBookCents, ledgers, bankItems }: TrustClose) {
const cutoff = dayIndex(asOf);
const ledgerIds = new Set<string>();
const negativeLedgers: string[] = [];
let ledgerTotalCents = 0n;
for (const { id, cents } of ledgers) {
assert(id.trim() && !ledgerIds.has(id), `Missing or repeated beneficiary ID: ${id}`);
ledgerIds.add(id);
ledgerTotalCents += cents;
if (cents < 0n) negativeLedgers.push(id);
}
const itemIds = new Set<string>();
const checkNumbers = new Set<string>();
const duplicateChecks = new Set<string>();
const staleItems: { id: string; ageDays: number }[] = [];
let bankAdjustmentCents = 0n;
for (const item of bankItems) {
assert(item.id.trim() && !itemIds.has(item.id) && item.cents > 0n, `Invalid bank item: ${item.id}`);
itemIds.add(item.id);
const recordedDay = dayIndex(item.recordedOn);
const clearedDay = item.clearedOn === null ? null : dayIndex(item.clearedOn);
assert(recordedDay <= cutoff && (clearedDay === null || clearedDay >= recordedDay),
`Invalid cutoff or clearing date: ${item.id}`);
if (item.kind === "check") {
assert(item.checkNumber.trim(), `Missing check number: ${item.id}`);
if (checkNumbers.has(item.checkNumber)) duplicateChecks.add(item.checkNumber);
checkNumbers.add(item.checkNumber);
}
if (clearedDay !== null && clearedDay <= cutoff) continue;
bankAdjustmentCents += item.kind === "deposit" ? item.cents : -item.cents;
const ageDays = cutoff - recordedDay;
if (ageDays > 90) staleItems.push({ id: item.id, ageDays });
}
const adjustedBankCents = duplicateChecks.size === 0 ? statementCents + bankAdjustmentCents : null;
const bankMinusBook = adjustedBankCents === null ? null : adjustedBankCents - cashBookCents;
const bankMinusLedgers = adjustedBankCents === null ? null : adjustedBankCents - ledgerTotalCents;
const bookMinusLedgers = cashBookCents - ledgerTotalCents;
return {
adjustedBankCents, cashBookCents, ledgerTotalCents,
differencesCents: { bankMinusBook, bankMinusLedgers, bookMinusLedgers },
negativeLedgers: negativeLedgers.sort(),
duplicateChecks: [...duplicateChecks].sort(),
staleItems: staleItems.sort((a, b) => a.id < b.id ? -1 : a.id > b.id ? 1 : 0),
readyToClose: bankMinusBook === 0n && bookMinusLedgers === 0n
&& negativeLedgers.length === 0 && staleItems.length === 0,
};
}
const close: TrustClose = {
asOf: "2026-11-27", statementCents: 1_020_000n, cashBookCents: 1_010_001n,
ledgers: [{ id: "client-a", cents: 1_012_000n }, { id: "client-b", cents: -2_000n }],
bankItems: [
{ id: "deposit-11", kind: "deposit", recordedOn: "2026-11-27", clearedOn: null, cents: 50_000n },
{ id: "check-row-17", kind: "check", checkNumber: "1017", recordedOn: "2026-08-28",
clearedOn: null, cents: 20_000n },
{ id: "check-row-18", kind: "check", checkNumber: "1018", recordedOn: "2026-08-29",
clearedOn: null, cents: 30_000n },
{ id: "check-row-19", kind: "check", checkNumber: "1019", recordedOn: "2026-11-25",
clearedOn: "2026-11-28", cents: 10_000n },
{ id: "check-row-20", kind: "check", checkNumber: "1020", recordedOn: "2026-11-25",
clearedOn: "2026-11-27", cents: 17_000n },
],
};
const result = reconcile(close);
assert.deepEqual(result, {
adjustedBankCents: 1_010_000n, cashBookCents: 1_010_001n, ledgerTotalCents: 1_010_000n,
differencesCents: { bankMinusBook: -1n, bankMinusLedgers: 0n, bookMinusLedgers: 1n },
negativeLedgers: ["client-b"], duplicateChecks: [],
staleItems: [{ id: "check-row-17", ageDays: 91 }], readyToClose: false,
});
assert.deepEqual(reconcile({ ...close, ledgers: close.ledgers.toReversed(),
bankItems: close.bankItems.toReversed() }), result);
const duplicate = reconcile({ ...close, bankItems: [...close.bankItems,
{ ...close.bankItems[1], id: "duplicate-row" }] });
assert.deepEqual(duplicate.duplicateChecks, ["1017"]);
assert.equal(duplicate.adjustedBankCents, null);
assert.deepEqual(duplicate.differencesCents,
{ bankMinusBook: null, bankMinusLedgers: null, bookMinusLedgers: 1n });
assert.equal(duplicate.readyToClose, false);
const balanced = reconcile({ ...close, cashBookCents: 1_010_000n });
assert.deepEqual(Object.values(balanced.differencesCents), [0n, 0n, 0n]);
assert.equal(balanced.readyToClose, false);
assert.equal(reconcile({ ...close, statementCents: 0n, cashBookCents: 0n,
ledgers: [], bankItems: [] }).readyToClose, true);
console.log(`Adjusted bank / cash book / beneficiary ledgers (cents): ${result.adjustedBankCents} / ${result.cashBookCents} / ${result.ledgerTotalCents}`);
console.log(`Bank minus book / bank minus ledgers / book minus ledgers (cents): ${Object.values(result.differencesCents).join(" / ")}`);
console.log(`Negative beneficiary ledgers: ${result.negativeLedgers.join(", ")}`);
console.log(`Uncleared >90 days: ${result.staleItems.map(({ id, ageDays }) => `${id} (${ageDays} days)`).join(", ")}`);
console.log(`Duplicate check fixture: ${duplicate.duplicateChecks.join(", ")}; adjusted bank withheld`);
Verified Node output
Adjusted bank / cash book / beneficiary ledgers (cents): 1010000 / 1010001 / 1010000
Bank minus book / bank minus ledgers / book minus ledgers (cents): -1 / 0 / 1
Negative beneficiary ledgers: client-b
Uncleared >90 days: check-row-17 (91 days)
Duplicate check fixture: 1017; adjusted bank withheld
Keep the statement, outstanding-item schedule, cash book, and beneficiary snapshot behind the close. The signed differences tell a reviewer which records diverge. The exception lists identify the entries to trace, even when the arithmetic ties. For the reconciliation worksheet, see TrustRecon. For related operational fixtures, see the B2B Ops and FinOps Benchmarks.
Top comments (0)