Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
e85f781
feat(web): format and read money, quantities and rates as integers
nodemode-ai Nov 27, 2026
336c9e0
feat(web): a table part that writes rows and cells in place
nodemode-ai Nov 27, 2026
f7ba0f9
feat(web): let views reach the api and name their own routes
nodemode-ai Nov 27, 2026
6e0e067
feat(web): declare the picker and line grid parts
nodemode-ai Nov 27, 2026
2a9bef5
feat(web): a registry of views with navigation by address
nodemode-ai Nov 27, 2026
7df6ac2
build(web): take the dev ports from the environment
nodemode-ai Nov 27, 2026
adda38e
feat(reports): profit and loss and balance sheet builders
nodemode-ai Nov 27, 2026
5f466e9
feat(reports): profit and loss and balance sheet routes
nodemode-ai Nov 27, 2026
0c2b47c
feat(web): typed reads for the ledger and position screens
nodemode-ai Nov 27, 2026
1c5cc3d
feat(doclists): one spec table and typed list calls for every documen…
nodemode-ai Nov 27, 2026
49102e4
feat(web): setup list specs and typed calls
nodemode-ai Nov 27, 2026
424ddb3
feat(web/payments): typed calls for payments received and made
nodemode-ai Nov 27, 2026
5dc26ff
feat(web): setup list layout styles
nodemode-ai Nov 27, 2026
bd495cd
feat(web): cache party and item lookups per kind
nodemode-ai Nov 27, 2026
5fec447
feat(web): a working picker with a floating list
nodemode-ai Nov 27, 2026
e8df9b5
feat(docform): typed calls and specs for sales and purchase documents
nodemode-ai Nov 27, 2026
53f7394
feat(web/payments): calls for delivery notes and goods receipts
nodemode-ai Nov 27, 2026
b1ba1a6
feat(web): setup list views read their rows
nodemode-ai Nov 27, 2026
c6342b9
feat(web): fixed-size filter bar styles for the ledger screens
nodemode-ai Nov 27, 2026
c2e5417
feat(web): trial balance, general ledger, ageing and stock screens
nodemode-ai Nov 27, 2026
99fee70
feat(doclists): a keyed list view per document type with status filter
nodemode-ai Nov 27, 2026
5f84d0f
feat(doclists): fixed bar, footer and column widths for the lists
nodemode-ai Nov 27, 2026
33a74e4
feat(cli): statement pl and bs verbs
nodemode-ai Nov 27, 2026
37ea46a
feat(web): setup form panel with fixed fields
nodemode-ai Nov 27, 2026
86169e4
feat(web): setup forms create and update one row
nodemode-ai Nov 27, 2026
888b4ae
feat(web/payments): lists of payments received and made
nodemode-ai Nov 27, 2026
9f31b8d
feat(web): typed calls for profit and loss and balance sheet
nodemode-ai Nov 27, 2026
d483b7d
feat(web): a line grid with fixed rows and keyboard movement
nodemode-ai Nov 27, 2026
ecd5c88
feat(web): fixed column widths and reserved totals for the grid
nodemode-ai Nov 27, 2026
490f554
fix(docform): let an item line keep the item's description, price and…
nodemode-ai Nov 27, 2026
40403c5
feat(docform): one form for sales and purchase documents built once
nodemode-ai Nov 27, 2026
fdbd4d4
feat(web): fixed-size styles for the statement screens
nodemode-ai Nov 27, 2026
a8a8cd0
feat(web): profit and loss and balance sheet views
nodemode-ai Nov 27, 2026
c8dd398
feat(web/payments): payment form with allocation table
nodemode-ai Nov 27, 2026
2f82398
fix(doclists): read customer names again when a delivery note names a…
nodemode-ai Nov 27, 2026
5ec6f0d
feat(docform): fixed sizes for the header, error line and action bar
nodemode-ai Nov 27, 2026
0c1ff23
fix(doclists): tie the status label to its filter
nodemode-ai Nov 27, 2026
f877cda
docs(doclists): log the list specs and the view's update rules
nodemode-ai Nov 27, 2026
e5bff69
feat(web/payments): delivery note and goods receipt views
nodemode-ai Nov 27, 2026
81285e5
feat(web/payments): styles for payment and stock document views
nodemode-ai Nov 27, 2026
32cc405
docs(ledger): profit and loss and balance sheet page
nodemode-ai Nov 27, 2026
a0ec777
docs(web): log why the ledger screens are built as they are
nodemode-ai Nov 27, 2026
c4a8a3b
refactor(reports): use strings.Replace for the type placeholder
nodemode-ai Nov 27, 2026
bdbbeb1
docs(reports): log the statement builders and routes
nodemode-ai Nov 27, 2026
efd06c7
docs(web): log the statement views
nodemode-ai Nov 27, 2026
da350eb
fix(web): balance sheet empty lines speak of a day
nodemode-ai Nov 27, 2026
8a88884
fix(web): plain total label when the form gives no currency
nodemode-ai Nov 27, 2026
8a023a5
feat(web): let the form set the grid currency after mount
nodemode-ai Nov 27, 2026
83c0a10
fix(web/payments): keep allocation rows in invoice order
nodemode-ai Nov 27, 2026
c3ba6a4
fix(web/payments): reserve the width of the document number
nodemode-ai Nov 27, 2026
6e07ae8
fix(web): keep the picker list beside its input
nodemode-ai Nov 27, 2026
5718767
docs(web): log the picker, lookups and line grid decisions
nodemode-ai Nov 27, 2026
649c34e
fix(web/payments): show item codes on delivery note lines
nodemode-ai Nov 27, 2026
7d3053e
docs(web/payments): log the payment and stock view decisions
nodemode-ai Nov 27, 2026
23a837f
fix(docform): let a new draft be posted in one step
nodemode-ai Nov 27, 2026
31d1d6f
docs(web): log why the setup lists are spec driven
nodemode-ai Nov 27, 2026
d27ada4
fix(doclists): keep the count and load more above the rows
nodemode-ai Nov 27, 2026
665625e
refactor(doclists): drop the footer rules the lists no longer use
nodemode-ai Nov 27, 2026
f628786
docs(window): describe the screens for a person
nodemode-ai Nov 27, 2026
b5997cb
docs(agents): say where the web client's views, parts and logic live
nodemode-ai Nov 27, 2026
eae3c0d
docs: add the screens to the readme
nodemode-ai Nov 27, 2026
c2c64ac
fix(web): resolve a typed code on enter even before the list paints
nodemode-ai Nov 27, 2026
3b2d0cf
chore(release): 0.7.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
2 changes: 1 addition & 1 deletion .claude/skills/formledger-harness/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ metadata:

# formledger-harness

FormLedger is a local-first business app that is the system of record for a small company. Apache-2.0, Copyright 2026 NodeAgentc, Inc. Repository `nodemode-dev/formledger`. Status: accounts, roles, the audit trail and the ledger core exist (chart of accounts, fiscal periods, journal, posting, reports, a command line) and the selling chain (customers, items, tax rates, quotes, orders, invoices, payments, receivables), the buying chain (suppliers, purchase orders, goods receipts, purchase invoices, payments made, payables) and stock (warehouses, an append-only stock ledger at moving average cost, delivery notes), with no screens for any of it yet; read the current version number from the binary's `version` command, not from this pack.
FormLedger is a local-first business app that is the system of record for a small company. Apache-2.0, Copyright 2026 NodeAgentc, Inc. Repository `nodemode-dev/formledger`. Status: accounts, roles, the audit trail and the ledger core exist (chart of accounts, fiscal periods, journal, posting, reports, a command line) and the selling chain (customers, items, tax rates, quotes, orders, invoices, payments, receivables), the buying chain (suppliers, purchase orders, goods receipts, purchase invoices, payments made, payables) and stock (warehouses, an append-only stock ledger at moving average cost, delivery notes), and a web client with a first set of screens for all of it (`web/src/ui/views.ts` is the registry a view joins; `web/src/ui/parts/` holds the table, picker and line grid; logic sits in `web/src/engine/`, never in a view); read the current version number from the binary's `version` command, not from this pack.

This pack is for agents who change the repository. It is not about using the app. `docs/BEHAVIOURS.md` is the specification: every phase's exit criterion traces to a behaviour there, and nothing outside the repo is a source of behaviour. Outside reference products are never opened or copied.

Expand Down
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
# Changelog

## 0.7.0

The web client gets its first screens. Until now everything was done from the command line or the server's routes. This is a first pass: it has been run in a browser in parts, not yet as a whole.

### New
- A sidebar of screens grouped as Selling, Buying, Stock, Ledger and Setup. The address names the screen, so a reload comes back to the same place.
- A list for every kind of document, narrowed by status, with more rows loaded on request.
- One form for quotes, orders and invoices on both the selling and the buying side: pick the party and each item by typing, enter lines in a grid, save, confirm or post, cancel, amend, and make the next document in the chain.
- Payments received and made: enter the amount, spread it across the party's open invoices, and see what is left over as you type.
- Goods receipts and delivery notes, shown with their lines, with Post and Cancel.
- Setup lists for customers, suppliers, items, tax rates, warehouses and the chart of accounts, each with a small form to add or edit.
- Trial balance, general ledger, receivables and payables ageing, and stock balance with its value.
- Profit and loss over a range of dates and a balance sheet as of a day, as screens, as server routes, and as `./formledger cli statement pl` and `bs`.

### Known issues
- Entering a twenty-line invoice in the form has not been completed in a check: one run posted an invoice with nine of twenty lines, and the cause has not been confirmed.
- Small movements on screen were measured in several places and are not all traced. The largest known one: a list's totals row sits under its rows and moves once when they arrive.
- There is no year-end closing step, so the balance sheet shows the result so far as "Unclosed result" inside equity.
- Profit and loss starts on January 1 of the end date's year unless you give a start date.
- Amounts are shown with two decimal places for every currency.
- Payments use a plain list to choose the party, and the setup forms take account and tax codes as typed text.
- No icons in the sidebar, no printing, no search across documents.
- The desktop app has still not been compiled, and data is still not encrypted on disk.

### Under the hood
- `docs/window/README.md` describes the screens; `docs/ledger/statements.md` describes the two statements and names its source.
- The dev server's ports can be set with `FORMLEDGER_UI_PORT` and `FORMLEDGER_SERVER_PORT`.

## 0.6.0

Buying and stock arrive. You can order from a supplier, receive the goods into a warehouse, record the supplier's invoice, pay it, and deliver what you sold, with stock counted and valued along the way. Still from the command line and the server's routes only.
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.6.0
VERSION := v0.7.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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

A local-first business app from the FormAI family of apps: every sale, purchase, payment and stock movement is a numbered document that posts to shared ledgers for money and stock.

**Status:** early. People can sign in with a role, the owner can invite others, and an audit trail records who did what ([`docs/ROLES.md`](docs/ROLES.md)). The ledger core works from the command line and over the server's routes: a chart of accounts, fiscal periods, journal entries that post and cancel, and a trial balance ([`docs/ledger/`](docs/ledger/)). So does the selling chain: customers, items and tax rates, then a quote, an order, an invoice that posts to the ledger, payments with part payment, and receivables ageing ([`docs/selling/`](docs/selling/README.md)). And the buying chain and stock: suppliers, purchase orders, goods receipts into a warehouse, purchase invoices, payments made, payables ageing, a stock ledger valued at moving average cost, and delivery notes that take stock out and post its cost ([`docs/buying/`](docs/buying/documents.md), [`docs/stock/`](docs/stock/README.md)). The web client has no ledger, selling, buying or stock screens, and the desktop app in `src-tauri/` has not been compiled. [`docs/BEHAVIOURS.md`](docs/BEHAVIOURS.md) lists what the app commits to do.
**Status:** early. People can sign in with a role, the owner can invite others, and an audit trail records who did what ([`docs/ROLES.md`](docs/ROLES.md)). The ledger core works from the command line and over the server's routes: a chart of accounts, fiscal periods, journal entries that post and cancel, and a trial balance ([`docs/ledger/`](docs/ledger/)). So does the selling chain: customers, items and tax rates, then a quote, an order, an invoice that posts to the ledger, payments with part payment, and receivables ageing ([`docs/selling/`](docs/selling/README.md)). And the buying chain and stock: suppliers, purchase orders, goods receipts into a warehouse, purchase invoices, payments made, payables ageing, a stock ledger valued at moving average cost, and delivery notes that take stock out and post its cost ([`docs/buying/`](docs/buying/documents.md), [`docs/stock/`](docs/stock/README.md)). The web client now has screens for this: a list for every document type, one form for sales and purchase documents with a line grid, payments with allocation, the setup lists, and trial balance, general ledger, profit and loss, balance sheet, ageing and stock ([`docs/window/`](docs/window/README.md)). They are new and only partly checked in a browser; the desktop app in `src-tauri/` has not been compiled. [`docs/BEHAVIOURS.md`](docs/BEHAVIOURS.md) lists what the app commits to do.

## Run it from source

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.6.0
Current build version: v0.7.0
Last updated: 2026-11-26 (US Eastern) · skeleton port from form.md

---
Expand Down
42 changes: 42 additions & 0 deletions docs/ledger/statements.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Profit and loss and the balance sheet

Two statements built from the same journal lines as the trial balance: every line of an entry whose status is `posted` or `cancelled` (a cancelled entry stays counted because its reversal, also posted, cancels it out). Drafts are never counted. Both routes need the right `reports.read`.

## Profit and loss

`GET /api/reports/profit-and-loss?from=YYYY-MM-DD&to=YYYY-MM-DD`

- `to` defaults to today in US Eastern time; `from` defaults to the first of January of the year of `to`. A `from` later than `to` is refused with 400 `bad_range`.
- Lines dated from `from` to `to`, both included, on accounts of type `income` and `expense`, summed per account. An account whose movement in the range nets to zero is left out.
- Income amounts are credit minus debit; expense amounts are debit minus credit, so both are positive in the usual case.
- Answer: `{from, to, income: {type, title, lines: [{accountId, code, name, currency, amount}], total}, expenses: {...}, netProfit}` where `netProfit` is income total minus expenses total. All amounts are integers in minor units.

## Balance sheet

`GET /api/reports/balance-sheet?as_of=YYYY-MM-DD`

- `as_of` defaults to today in US Eastern time. All lines dated on or before `as_of`.
- Sections `assets` (debit minus credit), `liabilities` and `equity` (credit minus debit), in the same section shape as above.
- `unclosedResult` is income minus expenses over every line up to `as_of`, the same sum the profit and loss gives from the first entry to `as_of`. `totalEquity` is the equity section total plus `unclosedResult`, and `totalLiabilitiesAndEquity` is liabilities plus `totalEquity`. `balanced` is true when assets equal that sum.

### How the year's result reaches the balance sheet

FormLedger has no year-end closing entry yet: income and expense accounts are never moved to retained earnings by a posting. So the balance sheet carries the result itself. Every income and expense line ever posted up to `as_of` is summed into one line, "Unclosed result", shown inside equity. Since every posted entry balances, assets always equal liabilities plus equity plus that result. When a closing step is added later, the closing entry moves the result into retained earnings (`3200` in the starter chart) and this line falls to the result of the years not yet closed. Nothing in this route has to change for that.

## Accounting source for the layout

The split into a statement of financial position at the end of the period and a statement of profit or loss for the period follows IAS 1 Presentation of Financial Statements, as described on the IFRS Foundation's page for the standard (https://www.ifrs.org/issued-standards/list-of-standards/ias-1-presentation-of-financial-statements/, fetched 2026-11-27). That page lists the two statements as part of a complete set and says profit or loss may be shown alone or with other comprehensive income. It does not list the line items, and FormLedger does not yet split current from non-current items or show other comprehensive income: sections follow the five account types of the chart.

## Command line

- `./formledger cli statement pl [--from D] [--to D] [--currency XXX]`
- `./formledger cli statement bs [--as-of D] [--currency XXX]`

## In the window

Two views in the Ledger group, "Profit and loss" (a From and To date) and "Balance sheet" (an As of date). Each section is a table of fixed height with its totals row; the summary underneath shows the net profit or loss, or the unclosed result, total equity and total liabilities and equity. The dates are kept in the address, so a reload shows the same statement.

## Defaults to confirm

- One currency: amounts of accounts in different currencies are added together as they are. Every account in the starter chart is in `USD`.
- The profit and loss starts on the first of January of the end date's year by default, not the start of the fiscal year.
45 changes: 45 additions & 0 deletions docs/window/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# The window

The web client is the same app as the command line and the server's routes, shown as screens. Everything it does goes through the routes described in `docs/selling/`, `docs/buying/`, `docs/stock/` and `docs/ledger/`; it keeps no numbers of its own. This page says what is on each screen as of v0.7.0 and what is not there yet.

## Getting around

The sidebar groups the screens: Selling, Buying, Stock, Ledger and Setup. The address in the browser names the screen, for example `#/quotes?status=posted`, so a reload or a bookmark comes back to the same place. A screen shows only the actions your role allows.

## Lists

There is one list for each kind of document: quotes, sales orders, sales invoices, delivery notes, payments received, purchase orders, goods receipts, purchase invoices and payments made. Each shows the number, date, party, status and total, can be narrowed by status, and loads more rows on request. A draft that has no number yet reads "Draft". Open a row with a click or with Enter.

## The document form

Quotes, sales orders, sales invoices, purchase orders and purchase invoices share one form: who it is for, the dates, and a grid of lines. A line is an item, a description, a quantity, a unit price and a tax rate. Pick the party and each item by typing part of its code or name.

The server works out every amount. Line totals and the document total appear after a save, in space that was already there for them.

The buttons along the bottom are always the same ones; a button that does not apply right now is greyed, not removed. From there a document is saved as a draft, confirmed or posted, cancelled or amended, and the next document in the chain is made: an order from a quote, an invoice from an order, a delivery note or a goods receipt.

When the server refuses something, for example a locked period, its own sentence is shown under the grid.

## Payments

A payment names the party, the date, the amount and the account, and lists that party's open invoices. Type an amount against each invoice the payment covers; what is left over is shown as you type and stays on account.

## Goods receipts and delivery notes

These are made from an order and shown read-only, with Post and Cancel.

## Setup

Customers, suppliers, items, tax rates, warehouses and the chart of accounts each have a list and a small form to add one or edit the opened row. Linked accounts and tax rates are typed as codes for now.

## Ledger and position screens

Trial balance (as of a day, and whether it balances), general ledger (one account over a range, with a running balance), profit and loss (over a range), balance sheet (as of a day), receivables and payables ageing, and stock balance with its value and the check against the books. `docs/ledger/statements.md` describes how profit and loss and the balance sheet are built.

## Not there yet

- Amounts are shown with two decimal places for every currency.
- Receipts and delivery notes cannot be edited before posting.
- There are no icons in the sidebar, no search across documents, and no printing.
- The setup lists have no delete, because the server has none.
- A list's totals row sits under its rows and moves once when the rows arrive.
18 changes: 16 additions & 2 deletions internal/HASHOUT_LOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

Living log of comment content, rationale and removed code for the core skeleton packages under `internal/`. Source files stay comment-free; what they would have said lives here, indexed. Read it first, then edit code surgically. Covers the packages ported in the core slice only; `internal/server`, `internal/static` and `internal/startup` are logged by their own slice.

Current build version: v0.6.0
Last updated: 2026-11-27 (US Eastern) · the buying chain and stock: suppliers, purchase documents, receipts, purchase invoices, payments made, payables, the stock ledger and delivery notes
Current build version: v0.7.0
Last updated: 2026-11-27 (US Eastern) · profit and loss and the balance sheet

---

Expand Down Expand Up @@ -1770,3 +1770,17 @@ An item line's expense account is the code in the setting `purchase.expense_acco
- logged: v0.6.0 · 2026-11-27

Copied from internal/cli/sales.go. It reuses salesLineIn, parseSalesLine, parseQuantity and milliText from sales.go rather than declaring them twice; `purchase new` adds `--warehouse` and `--ref`.

### internal/reports/statements.go · buildBalanceSheet
- refers-to: internal/reports/statements.go :: buildBalanceSheet, movements, statementSQL
- kind: rationale
- logged: v0.7.0 · 2026-11-27

There is no closing entry yet, so the balance sheet adds income minus expenses of every counted line up to `as_of` as `unclosedResult` inside equity; with balanced entries that makes assets equal liabilities plus equity by construction. The query takes the same `counted` filter as the trial balance, so a cancelled entry and its reversal both count and net to zero. The type list is spliced into the SQL as `?` placeholders, never as values. Accounts netting to zero in the range are dropped by `HAVING`. `beginning` (`0000-01-01`) stands for "from the first entry".

### internal/reports/statements_routes.go · profitAndLossRoute
- refers-to: internal/reports/statements_routes.go :: profitAndLossRoute, balanceSheetRoute; internal/reports/reports.go :: Mount (the mountStatements line)
- kind: explainer
- logged: v0.7.0 · 2026-11-27

`from` defaults to the first of January of `to`, not the fiscal year start, to keep the route free of the fiscal tables. The balance sheet query key is `as_of` as the brief names it, unlike the trial balance's `asOf`.
2 changes: 1 addition & 1 deletion internal/app/version.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package app

var Version = "v0.6.0"
var Version = "v0.7.0"

const Product = "FormLedger"
1 change: 1 addition & 0 deletions internal/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func groups() []group {
{"delivery", "delivery notes: stock out of a warehouse against a confirmed sales order", deliveryVerbs()},
{"stock", "warehouses, item stock settings, balances, the stock ledger, valuation and its tie to the ledger", stockVerbs()},
{"report", "trial balance and general ledger", reportVerbs()},
{"statement", "profit and loss and the balance sheet", statementVerbs()},
{"whoami", "the user and role behind the app token", []verb{whoamiVerb()}},
{"token", "how to make an app token", []verb{tokenVerb()}},
}
Expand Down
Loading
Loading