Add receipts, suppliers and a top navigation bar

Receipts and invoices: attach photos and PDFs to transactions, read the
supplier, date, total, GST and line items with Tesseract OCR, and match
them to bank transactions by amount and date. Receipts can have several
pages, and hand corrections survive re-reading.

Suppliers: saved suppliers that uploads are linked to by GST number or
name.

The sections (cashbook, receipts, invoices, customers, suppliers,
mileage, statements) move to a top bar, with the book controls in a row
beneath it, and the layout works on phones.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jimmyandClaude Opus 5.5 committed 2026-10-25 19:05:44 +13:00
1 parent 177dfbc0a4
commit 708ce8352e
13 files changed
+1944 -87

No files matched your search

+44 -7
View File
@@ -21,6 +21,10 @@ administrators manage who has access.
- **Export** a book as an Excel (.xlsx) or LibreOffice (.ods) cashbook spreadsheet,
with formulas, GST and category columns and the summary sheet, or as a CSV of all
transactions.
- **Receipts and invoices:** attach photos of receipts and PDF invoices to
transactions. The supplier, date, total, GST and line items are read from them on
your own server (Tesseract OCR), and they're matched to bank transactions by amount
and date (see [Receipts and invoices](#receipts-and-invoices)).
- **Accounts:** sign-in with personal accounts. Administrators invite people, reset
passwords and manage who's an administrator (see [Accounts](#accounts)).
@@ -54,7 +58,8 @@ administrator account. Stop it with `docker compose down`, and check it with
**What the compose file sets up**
- **Data:** `./data` is mounted at `/data`. It holds the database (`cashbook.db`:
books and accounts) and `statements/`, where uploads go. Back up this folder.
books and accounts), `statements/`, where uploads go, and `attachments/`, the
receipt and invoice files. Back up this folder.
- **Network:** published on `127.0.0.1:8765` only.
- **Lockdown:**
- read-only container filesystem, with scratch space only in `/tmp` (tmpfs);
@@ -111,13 +116,16 @@ services:
### Without Docker
Needs Python 3, `pdftotext` for PDF statements, and LibreOffice's UNO bridge for
spreadsheet export and migration. On Debian/Ubuntu:
Needs Python 3, `pdftotext` for PDF statements, LibreOffice's UNO bridge for
spreadsheet export and migration, and Tesseract and Pillow to read receipts. On
Debian/Ubuntu:
```bash
sudo apt install libreoffice-calc python3-uno poppler-utils pipenv
sudo apt install libreoffice-calc python3-uno poppler-utils tesseract-ocr python3-pil pipenv
```
Without Tesseract, receipts can still be attached, but their details have to be typed in.
The virtualenv needs the system site packages, so it can see LibreOffice's `uno`:
```bash
@@ -251,6 +259,35 @@ authority, partnership or trust income, and no taxable property sales.
Entered amounts are saved per book in the database. These figures are worked out
from your records and aren't tax advice.
### Receipts and invoices
Keep the paperwork behind each transaction, such as the tax invoices you need to claim GST.
- **From a transaction:** click 📎 on a row of a month's sheet and add a photo or PDF.
It's linked to that transaction straight away.
- **In bulk:** open **Receipts**, then drop files, choose them, or **take a photo** on a
phone. Each one is read, then listed with the bank transactions it probably belongs to:
the same amount, within 7 days of the receipt's date, across all books. Click **Link**
to confirm one. Receipts can wait unlinked until their statement is imported.
- **Reading the details:** photos are straightened, evened out and read with Tesseract.
PDFs use their text, or are OCR'd if they're scans. The supplier, date, total, GST,
GST number and line items are filled in. Correct any of them in place, and the
suggested matches update.
- **Several pages:** a long receipt can take more than one photo, and an invoice can be
more than one PDF. Add several files at once and choose **One receipt**, or use
**+ Add page** on a receipt later. The pages are read together and the details are
updated, except anything you corrected by hand. *Read the details again* (under the
text read from the pages) also replaces your corrections. Remove a page with its ×.
- **Updating the transaction:** when a receipt is linked, the app offers to set the
transaction to *Incl GST* if the receipt shows GST. It also suggests a category from
earlier transactions with the same reference, or from the supplier's name. Only what
you tick is changed.
JPEG, PNG, WebP and PDF files up to 20 MB are accepted. HEIC photos aren't: set an
iPhone's camera to *Most Compatible* or share the photo as JPEG. Files are stored in
`data/attachments`. Deleting a receipt removes its files. Deleting a transaction or book
leaves its receipts in the list, unlinked.
### Sending invoices
**Invoices** makes the invoices you send to customers, as PDFs.
@@ -342,8 +379,8 @@ src/
main.py app setup, security middleware, startup
config.py settings from the environment / .env
deps.py current user, admin check, database connections
routers/ auth, users, books, statements, invoices, mileage and page routes
services/ accounts, statement files, invoice PDFs, LibreOffice
routers/ auth, users, books, statements, attachments, invoices, mileage and page routes
services/ accounts, statement files, receipt OCR, invoice PDFs, LibreOffice
db/, schemas/ account tables (SQLAlchemy) and request/response models
static/ the web pages (cashbook, sign-in, register, users), invoices.js, mileage.js
ledger.py SQLite storage: books, transactions, GST and summaries
@@ -359,7 +396,7 @@ src/
anz_import.py imports statements (CLI)
template.ods blank cashbook template, used for exports
tests/ pytest suite (pipenv run test)
data/ cashbook.db and statements (git-ignored)
data/ cashbook.db, statements and attachments (git-ignored)
```
`data/` is in `.gitignore`: books, backups and bank statements are never committed.