Billing: invoices, approval, receipts, statements, licence changes (1.7.0)

- Invoices drafted 14 days before each licence's invoice date and emailed
  to the alert email for approval; approved ones go out on their date from
  08:00 SA time. Drafts can be edited, recalculated, sent early, put back
  to draft or voided; one-off invoices too.
- Annual tier review from the 12-month event-income band; approving a tier
  change emails a notice of licence change, applied when the invoice goes out.
  Notices can also be sent by hand.
- Founding churches (35% off as its own line), payments with receipts,
  statements for any dates.
- Every billing email is styled HTML with a PDF (invoice / tax invoice,
  receipt, statement, licence change) and logged per customer.
- Settings -> Billing: business and bank details, VAT (off: plain invoices;
  on: VAT-inclusive tax invoices), timing and numbering.
- Migration 20261103111645_invoicing; pdfkit 0.17.2; tests/billing.test.js;
  scripts/sample-billing-pdfs.js.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-03 13:42:45 +02:00
co-authored by Claude Opus 5.5
parent cc7d62690b
commit 6fce0fe90e
33 changed files with 3579 additions and 53 deletions
+34
View File
@@ -5,6 +5,40 @@ versions follow [Semantic Versioning](https://semver.org/).
## [Unreleased]
## [1.7.0] - 2026-11-03
### Added
- **Billing** (README "Billing"; nav → Billing). Invoices are drafted automatically **14 days**
before each licence's invoice date and emailed to the alert email with the draft PDF for
**approval**; approved invoices go out **on their date from 08:00** SA time. Drafts and approved
invoices can be edited (lines, dates, recipient, notes), recalculated, sent early, put back to
draft or voided; one-off invoices too. Unapproved invoices whose date has come are emailed about
once and wait.
- **Annual tier review**: the first invoice for a period on or after a licence's review date uses
the site's 12-month event-income band (Cross Events 2.0.2+) and can move the tier up or down;
approving it emails the church a **notice of licence change**, and the tier changes when the
invoice goes out. Notices can also be sent by hand (customer page → Billing). No band reported →
the tier stays and the draft says so.
- **Founding churches** (customer page → Billing, or Billing → Churches and founding): 35% off on
every tier, as its own invoice line; since-date and a note.
- **Payments** with **receipts** (REC-…), against an invoice or on account; invoices show paid,
part paid, overdue. **Statements** for any dates, as a PDF or emailed.
- Every billing email is **styled HTML with a PDF** (invoice / tax invoice, receipt, statement,
notice of licence change), logged per customer with any send error.
- Licences: billing cycle (none, monthly, yearly at 10 months' price), billing start, next invoice
date, next review, custom monthly price. Customers: billing email, postal address, founding.
- Settings → **Billing**: on/off, business and banking details, VAT (off: plain invoices; on:
prices VAT-inclusive, tax invoices with the VAT number), draft days, send hour, payment terms,
number prefixes, invoice footer.
- Migration `20261103111645_invoicing`; dependency `pdfkit` 0.17.2. Tests `tests/billing.test.js`
(rules, dates, statements, and that the server's tiers match `frontend/src/lib/tiers.ts`);
`scripts/sample-billing-pdfs.js` writes sample PDFs.
### Changed
- `sendMail` takes `html`, `attachments`, `replyTo` and `fromName` (alerts are unchanged).
## [1.6.2] - 2026-11-03
### Added