Expenses and income
Native AMB finance
Section titled “Native AMB finance”Tainan selected AMB’s own Supabase on 2026-10-08 (TG 2150): ozxwtjvcrkmlswpojmzc.
Use the existing Marques Boxing MCP and AMB user JWT. No DFL login, DFL tenant, schema PR #1008, or provisioning MCP #475 is required.
The earlier DFL finance design is superseded for AMB expenses and income. DFL’s separate database remains separate.
| Tool | Purpose |
|---|---|
record_expense | Register a paid or pending expense |
record_income | Register paid or pending income; student linkage is optional |
list_finance_entries | Paginated records with date, kind, status, and optional student filters |
get_finance_entry | Record detail, version, and actor-attributed audit history |
report_finance_totals | Paid income, paid expense, net paid, pending totals, and account groups |
correct_finance_entry | Correct fields with a reason and expected version |
void_finance_entry | Void with a reason and expected version; preserve history |
cleanup_finance_test_entry | Remove only the caller’s own voided test fixture; retain its audit |
Active owners and staff can use these tools. Teachers, inactive users, and billing automation cannot use native finance. Every query and write uses the caller’s AMB organization and RLS. A linked student must belong to that organization.
Record an expense or income
Section titled “Record an expense or income”Collect the description, positive integer amount_cents, real entry_date (YYYY-MM-DD), and status (paid or pending).
The currency is BRL. R$ 125.50 is 12550 cents. Confirm an ambiguous amount, date, or payment state with the user.
Use account_label to name the cash or bank account; it defaults to General.
Optional payment_method values are cash, pix, bank_transfer, card, or other.
A standalone income does not need student_id. Only income can link a student.
Use a unique UUID idempotency_key. Reuse it only for an exact retry of the original creation.
A different payload or a record corrected after creation causes an idempotency conflict.
Read detail after a successful write and report the entry ID and status.
Correct and void
Section titled “Correct and void”Read get_finance_entry first. Pass its version as expected_version and give a non-empty reason.
Corrections preserve before/after snapshots and the authenticated actor. Stale versions fail instead of overwriting concurrent changes.
Voided records remain visible with their history, cannot be corrected or reopened, and are excluded from money totals.
Real records cannot be deleted. The cleanup tool is restricted to is_test=true, voided records created by the caller.
Website and totals
Section titled “Website and totals”The existing transactions page supports create, detail, correction and void using the same AMB session.
The accounts page groups native records by account label.
Its result is paid income minus paid expenses, not a bank balance or an opening balance.
Pending income and expenses are reported separately. Tests are excluded by default; include_test=true explicitly includes controlled fixtures.
The website’s ?include_test=1 view is for controlled verification.
Totals read all matching pages and fail on a changed count, duplicate ID, or incomplete result; they are current-record reads, not a transaction snapshot or historical reconstruction.
Shop payments, purchase records, Woovi invoices, and student contract projections are separate sources. They are not imported or automatically counted. Before a manual entry, check whether the same payment already exists in this money register. This feature does not issue invoices, calculate taxes, synchronize databases, or create student billing.
See the native finance plan.