feat: cash flow statement PDF, pdf export format, cash flow in CPA package

The cash flow statement was computed and exportable as csv/json/xlsx but
missing from every PDF path, so the CPA package carried two of the three
financial statements. Now:

- ledger-import: cash_flow_pdf renders the indirect-method statement
  (operating with net income, depreciation add-back, working-capital
  lines; investing; financing; net change reconciled to beginning and
  ending cash) from the computed CashFlowStatement, so the period and
  cash accounts are the caller's.
- books.export gains format "pdf" for profit_and_loss, balance_sheet, and
  cash_flow (base64, like xlsx), plus financing_accounts for cash_flow.
- books.export_cpa_package adds cash-flow.pdf (fiscal year to date, like
  the P&L) and requires cash_accounts: without them the statement has
  nothing to reconcile to.
- One cash_flow_statement helper resolves codes and dates for xlsx, pdf,
  and the package.

Test: MCP stdio test exports all three statement PDFs, checks the
cash_accounts and bad-report refusals, and unzips the CPA package to find
all five files. Known report gaps are logged in plan/STATUS.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MtYEaR6M6Ybdhm6X98BWNu
This commit is contained in:
swaitsandClaude Opus 5.5 committed 2026-10-11 18:57:12 -07:00
1 parent e59e8001c6
commit 5548902f27
7 files changed
+304 -54

No files matched your search

+13 -9
View File
@@ -177,10 +177,12 @@ posting.
## Tools — export
- `books.export { format: "csv" | "json" | "xlsx" | "iif", report: "journal" |
"trial_balance" | "profit_and_loss" | "balance_sheet" | "cash_flow" }` →
`{ content, content_encoding? }`. CPA-ready output. `xlsx` is base64-encoded;
`iif` is journal-only (QuickBooks Desktop). Cash flow needs `cash_accounts`.
- `books.export { format: "csv" | "json" | "xlsx" | "pdf" | "iif", report:
"journal" | "trial_balance" | "profit_and_loss" | "balance_sheet" |
"cash_flow", start?, end?, as_of?, cash_accounts?, financing_accounts? }` →
`{ content, content_encoding? }`. CPA-ready output. `xlsx` and `pdf` are
base64-encoded; `pdf` covers the three financial statements; `iif` is
journal-only (QuickBooks Desktop). Cash flow needs `cash_accounts`.
## Tools — import
@@ -318,9 +320,11 @@ entries.
## Tools — CPA handoff
- `books.export_cpa_package { as_of? }` → `{ file_name, content_base64 }`.
A zip with `trial-balance.xlsx`, `general-ledger.xlsx` (every posted
line: date, entry, description, account, class, debit, credit),
`profit-and-loss.pdf` (fiscal year to date, per-account detail), and
`balance-sheet.pdf` (per-account detail). What the CPA needs; they never
- `books.export_cpa_package { as_of?, cash_accounts, financing_accounts? }`
→ `{ file_name, content_base64 }`. A zip with `trial-balance.xlsx`,
`general-ledger.xlsx` (every posted line: date, entry, description,
account, class, debit, credit), `profit-and-loss.pdf` (fiscal year to
date, per-account detail), `balance-sheet.pdf` (per-account detail), and
`cash-flow.pdf` (fiscal year to date, indirect method, reconciled to
`cash_accounts`). What the CPA needs; they never
log into the system.