Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
acf8bbd
docs(window): write the design rules for a finance screen
nodemode-ai Nov 27, 2026
ebb9abe
feat(parts): add shared page, bar, badge, field and growing table cla…
nodemode-ai Nov 27, 2026
0b22509
fix(docform): flag a line with no item instead of dropping it
nodemode-ai Nov 27, 2026
470f7eb
feat(table): render status tones as badges, add grow and mono options
nodemode-ai Nov 27, 2026
d0d1ec4
feat(export): add the csv writer for lists and reports
nodemode-ai Nov 27, 2026
090a7b6
feat(snapshot): write a plain read-only sqlite snapshot for formcel
nodemode-ai Nov 27, 2026
e456a61
feat(export): serve every list and report as csv
nodemode-ai Nov 27, 2026
97b84db
feat(masters): lay setup fields on a grid with short and wide spans
nodemode-ai Nov 27, 2026
b11a607
feat(snapshot): add the report snapshot command line verb
nodemode-ai Nov 27, 2026
1caafb3
feat(parts): let a fill page inside a view body fill the sheet
nodemode-ai Nov 27, 2026
2af5f15
feat(doclists): lay the document lists out to the design rules
nodemode-ai Nov 27, 2026
5c01a61
fix(shell): place the person on the trailing side of the top bar
nodemode-ai Nov 27, 2026
7ed38b2
fix(shell): scroll the sidebar and mark the current screen with the a…
nodemode-ai Nov 27, 2026
b1f388e
feat(cli): add the export verb that writes the same csv bytes
nodemode-ai Nov 27, 2026
551e118
feat(views): give every screen a title row with an actions slot
nodemode-ai Nov 27, 2026
4e3b550
feat(web): ledger screens fill the window with one bar
nodemode-ai Nov 27, 2026
1beb52a
docs(snapshot): document the snapshot schema and example pivots
nodemode-ai Nov 27, 2026
ae6759b
fix(export): split digits from letters in column names
nodemode-ai Nov 27, 2026
d5e5b34
docs(internal): log how the snapshot reads, writes and refuses
nodemode-ai Nov 27, 2026
d6c0f5c
feat(home): make home a working page with balances and last invoices
nodemode-ai Nov 27, 2026
d693161
feat(docform): title row with status badge, header grid and trailing …
nodemode-ai Nov 27, 2026
878d434
feat(grid): fill the window with a pinned header and totals under amount
nodemode-ai Nov 27, 2026
911b67a
docs(export): name every export, its columns and the csv rules
nodemode-ai Nov 27, 2026
fa81f82
fix(doclists): widen the date column so dates never clip
nodemode-ai Nov 27, 2026
08f55c0
feat(masters): fill the window with the list and pin the form actions
nodemode-ai Nov 27, 2026
17f7dc0
docs(internal): log how the export reuses each json route
nodemode-ai Nov 27, 2026
b41d44e
fix(grid): mark only the item cell and clear it once an item is picked
nodemode-ai Nov 27, 2026
7e86df7
feat(web): statements read as statements
nodemode-ai Nov 27, 2026
daf5499
docs(cli): list report snapshot in the top level help
nodemode-ai Nov 27, 2026
0cc56b3
docs(web): log the badge tones, growing table and fill page
nodemode-ai Nov 27, 2026
ce6327d
feat(grid): show each line's net amount as it is typed
nodemode-ai Nov 27, 2026
dd8e0c0
docs(web): log the ledger table box and statement sheet
nodemode-ai Nov 27, 2026
cf24bf5
docs(web): log the window-filling document form
nodemode-ai Nov 27, 2026
9a224d0
fix(home): fit document numbers and dates and align tile amounts
nodemode-ai Nov 27, 2026
99a1748
fix(views): keep the current screen visible in the sidebar
nodemode-ai Nov 27, 2026
7049d21
fix(snapshot): give a journal reversal the number of the entry it rev…
nodemode-ai Nov 27, 2026
f33cd6b
docs(snapshot): add sales by customer by month and the reversal number
nodemode-ai Nov 27, 2026
7b6de7d
docs(web): log the home page, page head and top bar choices
nodemode-ai Nov 27, 2026
ac27ff4
feat(payments): fill the list and order the form actions
nodemode-ai Nov 27, 2026
05f336a
docs(web): log the setup panel and payment list layout
nodemode-ai Nov 27, 2026
f6a48a6
feat(payments): put the list primary action in the title row
nodemode-ai Nov 27, 2026
afd0289
feat(doclists): put the new button in the shell title row actions
nodemode-ai Nov 27, 2026
8f93e18
fix(table): size a growing table with totals from its own container
nodemode-ai Nov 27, 2026
f18898e
fix(docform): one title row in the shell head and level header fields
nodemode-ai Nov 27, 2026
8d9d3cc
fix(docform): give the status badge a fixed box
nodemode-ai Nov 27, 2026
f53d1fc
fix(docform): hold the status badge at one width so post moves nothing
nodemode-ai Nov 27, 2026
303290b
fix(docform): give the title row its own width for the badge and work…
nodemode-ai Nov 27, 2026
ac8201c
chore(release): 0.9.0
nodemode-ai Nov 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,39 @@
# Changelog

## 0.9.0

The window has had its first design pass, and two ways to take your figures out have arrived.

### New
- Home is a working page: what customers owe you, what you owe suppliers, cash and bank, and your last five sales and purchase invoices, each a link to its screen.
- CSV export for every list and statement, from the server and from the command line (`./formledger cli export NAME`). `docs/EXPORT.md` lists every name and its columns. The window has no export buttons yet.
- `./formledger report snapshot` writes a plain, read-only SQLite file of your books for a spreadsheet to open, with the server stopped. `docs/SNAPSHOT.md` describes every table and gives ready queries.
- The trial balance, the stock screen and the balance sheet say with a badge whether they agree.

### Changed
- Every list and ledger screen fills the window, with its filters in one bar, and its main button on the title row.
- A status is a coloured badge everywhere. Codes and document numbers use the fixed-width face; amounts line up on the right.
- The document form reads like the paper: one heading with the number and status, a tidy header block, the lines, totals under the amount column, then the buttons with the main one last. A posted document shows as read-only.
- Profit and loss and the balance sheet are laid out as statements, with the result as the one large number at the foot.
- The setup screens show the list beside a form panel that scrolls, with its buttons always in view. The chart of accounts is indented by level.
- The top bar shows where you are on the left and who you are on the right. The sidebar scrolls on a short window.
- A zero in a debit or credit column is left blank.

### Fixed
- The setup form no longer cuts off its lower fields.
- A document line with a quantity or price but no item is now pointed out when you save, where it used to be dropped without a word.

### Known issues
- The design pass followed rules written for this app on form.md's colours and type; it has not been compared with form.md's own screens side by side.
- The light theme, windows narrower than 1400 px and the purchase form were not looked at in this pass.
- Totals on a draft document show 0.00 until it is saved.
- An exported delivery note list stops at 500 notes.
- Invoice and statement PDFs are not built yet.
- The desktop app has not been built yet; the window runs in a browser against the server.

### Under the hood
- One page of design rules, `docs/window/DESIGN.md`, and shared page, bar, badge, field and table classes that every screen now uses.

## 0.8.0

The window has now been run as a whole: a twenty-line invoice typed, posted and followed through three ledger screens, with nothing on screen moving.
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION := v0.8.0
VERSION := v0.9.0
GO_BUILD := CGO_ENABLED=0 go build -trimpath -ldflags "-s -w"

.PHONY: build web server check clean
Expand Down
2 changes: 1 addition & 1 deletion cmd/HASHOUT_LOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Living log of all comment content, explainers, rationale, TODOs, & removed (hashed-out) code for the entry point, `embed.go`, `internal/server`, `internal/static` and `internal/startup`. Source files stay comment-free per dev-rules `sub-skills/hashout-log/SUB-SKILL.md`; everything they would have said lives here, indexed. Read it first, then edit code surgically.

Current build version: v0.8.0
Current build version: v0.9.0
Last updated: 2026-11-26 (US Eastern) · skeleton port from form.md

---
Expand Down
4 changes: 4 additions & 0 deletions cmd/formledger/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"github.com/nodemode-ai/formledger/internal/config"
"github.com/nodemode-ai/formledger/internal/nowindow"
"github.com/nodemode-ai/formledger/internal/server"
"github.com/nodemode-ai/formledger/internal/snapshot"
"github.com/nodemode-ai/formledger/internal/startup"
"github.com/nodemode-ai/formledger/internal/store"
)
Expand All @@ -36,6 +37,8 @@ func run(args []string) int {
return serve()
case "cli":
return cli.Run(args[1:], os.Stdout, os.Stderr)
case "report":
return snapshot.Main(args[1:], os.Stdout, os.Stderr)
case "version", "--version", "-v":
fmt.Println(app.Version)
return 0
Expand Down Expand Up @@ -135,6 +138,7 @@ func usage(w io.Writer) {
fmt.Fprintf(w, "%s %s\n\nUsage: formledger [command]\n\nCommands:\n", app.Product, app.Version)
fmt.Fprintln(w, " serve run the server (default)")
fmt.Fprintln(w, " cli <command> ledger commands against the running server (formledger cli --help)")
fmt.Fprintln(w, " report snapshot write a plain read-only SQLite snapshot (--out FILE, --force; server stopped)")
fmt.Fprintln(w, " version print the version")
fmt.Fprintln(w, " help show this help")
fmt.Fprintln(w, "\nEnvironment:")
Expand Down
58 changes: 58 additions & 0 deletions docs/EXPORT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# CSV export

Every list and report can be downloaded as CSV.

GET /api/export/NAME.csv?PARAM=VALUE...
./formledger cli export NAME [--out FILE] [--token-file FILE] [--PARAM VALUE]...

The command line fetches the same route with the app token (`FORMLEDGER_TOKEN` or `--token-file`, server from `FORMLEDGER_URL`) and writes the bytes unchanged, to standard output or to `--out FILE`. Every flag other than `--out` and `--token-file` is passed on as a query parameter: `--account 1110` becomes `?account=1110`.

## How it works

The export route runs the list or report's own JSON route inside the server, with the caller's own session or token. So each export takes exactly the query parameters of its JSON route and is guarded by exactly the same permission; a refusal or a bad parameter answers that route's own status and JSON error body. An unknown name answers `404` with `{"error":{"code":"not_found","message":"no such export"}}`. Without a session it answers `401`.

A list is read to the end: the export follows `nextCursor` (or `next`) page by page until it is empty, so the file holds every row, not the first page. `cursor` is ignored if given; `limit` only sets the page size.

## The file

- RFC 4180 through Go `encoding/csv`: comma separated, CRLF line ends, a field with a comma, quote or line break is quoted and its quotes doubled.
- UTF-8 with no byte order mark.
- `Content-Type: text/csv; charset=utf-8` and `Content-Disposition: attachment; filename="NAME-YYYY-MM-DD.csv"`, the date being today in US Eastern time.
- One header row of lower_snake_case names, taken from the JSON field names in their JSON order (`taxTotal` becomes `tax_total`, `days1to30` becomes `days_1_to_30`). A nested object is spread into prefixed columns (`account` in the general ledger gives `account_code`, `account_name` and so on). Nested lists (document lines, allocations) are left out.
- Report-wide values (`as_of`, `from`, `to`, `by`, the ledger's `account_*`) are repeated on every row so each row stands alone.
- Dates are YYYY-MM-DD. A time stamp field (`created_at`, `posted_at` and the like) is written as its US Eastern date; an empty one is an empty cell.
- Money is a plain decimal in major units of the row's currency, with a leading `-` when negative: never a thousands separator, never a currency sign. Every row with money carries a `currency` column. The money fields are `debit`, `credit`, `balance`, `amount`, `total`, `subtotal`, `tax_total`, `opening`, `closing`, `value`, `unit_cost`, `current`, the ageing buckets, `allocated`, `unallocated`, `outstanding` and any field ending in `price` or `amount`.
- Other numbers (`rate_bp`, `quantity_milli`, `payment_terms_days`, `line_count`) are written as the JSON integer. Booleans are `true` or `false`.
- Formula guard: a cell in a TEXT column (a JSON string, such as a name, memo or code) that starts with `=`, `+`, `-` or `@` is written with a single quote in front, so a spreadsheet shows it as text and does not run it as a formula. `=HYPERLINK("x")` is written `'=HYPERLINK("x")`. Numbers and amounts are never changed, so `-60.15` stays a number.
- A list with no rows has no field names to read, so its file is the single header `empty`.

## Names

Columns are listed in file order. `*` marks money.

| Name | JSON route | Parameters | Permission | Columns |
|---|---|---|---|---|
| quotes | `/api/sales/docs?kind=quote` | status, customer, limit | reports.read | id, kind, number, date, due_date, customer_id, customer, customer_name, currency, status, source_id, amends_id, subtotal*, tax_total*, total*, journal_entry_id, memo, created_by, created_at, posted_by, posted_at, cancelled_by, cancelled_at, line_count |
| sales-orders | `/api/sales/docs?kind=order` | as quotes | as quotes | as quotes |
| sales-invoices | `/api/sales/docs?kind=invoice` | as quotes | as quotes | as quotes |
| purchase-orders | `/api/purchase/docs?kind=order` | status, supplier, limit | as its JSON route | id, kind, number, date, due_date, supplier_id, supplier, supplier_name, currency, status, source_id, amends_id, warehouse_id, warehouse, supplier_ref, subtotal*, tax_total*, total*, journal_entry_id, memo, created_by, created_at, posted_by, posted_at, cancelled_by, cancelled_at, line_count |
| purchase-invoices | `/api/purchase/docs?kind=invoice` | as purchase-orders | as purchase-orders | as purchase-orders |
| goods-receipts | `/api/purchase/docs?kind=receipt` | as purchase-orders | as purchase-orders | as purchase-orders |
| delivery-notes | `/api/delivery/notes` | status, order, limit (default 500) | reports.read | id, number, date, sales_order_id, customer_id, warehouse_id, status, journal_entry_id, memo, created_by, created_at, posted_by, posted_at, cancelled_by, cancelled_at, value*, currency |
| payments-in | `/api/sales/payments` | as its JSON route | as its JSON route | id, number, date, customer_id, customer, currency, amount*, deposit_account_id, deposit, status, journal_entry_id, memo, created_by, created_at, posted_by, posted_at, cancelled_by, cancelled_at, allocated*, unallocated* |
| payments-out | `/api/purchase/payments` | as its JSON route | as its JSON route | id, number, date, supplier_id, supplier, currency, amount*, paid_from_account_id, paid_from, status, journal_entry_id, memo, created_by, created_at, posted_by, posted_at, cancelled_by, cancelled_at, allocated*, unallocated* |
| customers | `/api/customers` | as its JSON route | as its JSON route | id, code, name, email, phone, address, tax_id, currency, receivable_account_id, receivable_account, payment_terms_days, active, created_at, updated_at |
| suppliers | `/api/suppliers` | as its JSON route | as its JSON route | id, code, name, email, phone, address, tax_id, currency, payable_account_id, payable_account, payment_terms_days, active, created_at, updated_at |
| items | `/api/items` | as its JSON route | as its JSON route | id, code, name, description, unit, sale_price*, currency, income_account_id, income_account, tax_rate_id, tax_rate, active, created_at, updated_at |
| tax-rates | `/api/tax-rates` | as its JSON route | as its JSON route | id, code, name, rate_bp, payable_account_id, payable_account, active, created_at, updated_at |
| warehouses | `/api/warehouses` | as its JSON route | as its JSON route | id, code, name, active, created_at, updated_at |
| accounts | `/api/accounts` | as its JSON route | as its JSON route | id, code, name, type, parent_id, parent_code, is_group, currency, active, created_at, updated_at |
| trial-balance | `/api/reports/trial-balance` | asOf, groups | reports.read | as_of, account_id, code, name, type, currency, is_group, parent_id, debit*, credit* |
| general-ledger | `/api/reports/general-ledger` | account (required), from, to | reports.read | account_account_id, account_code, account_name, account_type, account_currency, account_is_group, from, to, date, number, entry_id, line_no, memo, debit*, credit*, balance*, currency |
| receivables-ageing | `/api/receivables/ageing` | as its JSON route (asOf, by) | as its JSON route | as_of, by, customer_id, code, name, currency, current*, days_1_to_30*, days_31_to_60*, days_61_to_90*, over_90*, unallocated*, total* |
| payables-ageing | `/api/payables/ageing` | as its JSON route (asOf, by) | as its JSON route | as_of, by, supplier_id, code, name, currency, current*, days_1_to_30*, days_31_to_60*, days_61_to_90*, over_90*, unallocated*, total* |
| stock-balance | `/api/stock/balances` | as its JSON route | as its JSON route | as_of, then the balance row fields |
| profit-and-loss | `/api/reports/profit-and-loss` | from, to | reports.read | from, to, section (income or expense), account_id, code, name, currency, amount* |
| balance-sheet | `/api/reports/balance-sheet` | asOf | reports.read | as_of, section (asset, liability or equity), account_id, code, name, currency, amount* |

Report totals are not written as rows: the sum of a money column over the file equals the JSON route's total (trial balance debit and credit, each statement section, each ageing currency).
Loading
Loading