From 227d0422da0062410c85529bc999d7e509d9de78 Mon Sep 17 00:00:00 2001 From: Anders Betts Date: Tue, 22 Sep 2026 09:04:27 +0200 Subject: documents: org name in the invoice and payslip headers, document_header_color --- docs/DECISIONS.md | 11 +++++++++++ docs/INVOICING.md | 17 ++++++++++++----- docs/PAYROLL.md | 8 +++++--- docs/PROTOCOL.md | 14 ++++++++++---- docs/STATE.md | 9 +++++++++ 5 files changed, 47 insertions(+), 12 deletions(-) (limited to 'docs') diff --git a/docs/DECISIONS.md b/docs/DECISIONS.md index 125d19b..6b3467b 100644 --- a/docs/DECISIONS.md +++ b/docs/DECISIONS.md @@ -227,6 +227,17 @@ kept verbatim from the STATE.md they were pruned from (2026-09-21). show `betald `. SMTP: `smtp_from`/`smtp_reply_to` are validated as e-mail addresses (settings.set and mail config), with the sender's display name taken from the org name. +27. **Document header (2026-09-22)**: the invoice header bar no longer + draws the `MAKANDRA AB` Comfortaa outline; it prints the organization + name (`orgs.name`) in Helvetica-Bold, scaled down and truncated with + `...` if it would reach the `FAKTURA` wordmark, which stays. The shared + setting `document_header_color` (`#rrggbb`, default `#314c59`) colours + the header bar of **every** generated document — currently the invoice + and the lönebesked; `settings.set` refuses other values and the + renderers fall back to the default if a stored value is invalid. The + lönebesked prints the employer name in its header too, so the + `MAKANDRA AB` outlines are unused at runtime (kept in the generated + header). Images remain out of scope. ## Completed work formerly listed under "Pending decisions" diff --git a/docs/INVOICING.md b/docs/INVOICING.md index a04c869..de584cf 100644 --- a/docs/INVOICING.md +++ b/docs/INVOICING.md @@ -14,7 +14,8 @@ the generated PDF reproduces the existing document. - Customer register (name, address, momsreg.nr, e-mail, er referens, payment terms), owner-editable and audited. - One-page invoice document generated by bokfd, visually matching the - existing Google Sheets export (same grid, colours and wordmark). + existing Google Sheets export (same grid, colours and `FAKTURA` wordmark; + the header shows the organization name). - A configurable, always-increasing invoice number series per org, plus an OCR reference that Bankgiro accepts. - Issue in one action: number + PDF (stored as an immutable attachment) + @@ -49,13 +50,19 @@ Colours: | Body text | `#314c59` | | Header/table text on the bar | `#ffffff` | +The header bar's colour is the shared document setting +`document_header_color` (`#rrggbb`, default `#314c59`, also used by the +lönebesked). + Fonts: - Body: Helvetica (PDF base-14, metrically compatible with Arial); no embedding. -- Wordmark `MAKANDRA AB` and `FAKTURA`: Comfortaa Bold (SIL OFL) as - pre-generated vector outlines, drawn as filled paths. No font file or - TrueType machinery at runtime. +- Wordmark `FAKTURA`: Comfortaa Bold (SIL OFL) as pre-generated vector + outlines, drawn as filled paths; no font file or TrueType machinery at + runtime. The header's left side prints the organization `name` in + Helvetica-Bold, scaled down and truncated with `...` if it would reach + `FAKTURA`. Grid (points, origin top-left; refined against the originals in `tests/` golden comparisons): @@ -63,7 +70,7 @@ Grid (points, origin top-left; refined against the originals in | Element | x | y | |---|---|---| | Header bar (x 17.3–577.7) | 17.3 | 53.3–75.7 | -| Wordmark `MAKANDRA AB` (ink left/baseline) | 21.74 | 69.14 | +| Header name (org `name`, ink left/baseline) | 21.74 | 69.14 | | `FAKTURA` (ink right/baseline) | 576.87 | 69.14 | | Info labels (bold 7.285 pt), right-aligned | 113.98 | 101.11 + 14.71/row | | Info values (9.107 pt), left-aligned | 118.87 | same rows | diff --git a/docs/PAYROLL.md b/docs/PAYROLL.md index b78aeba..ebf9272 100644 --- a/docs/PAYROLL.md +++ b/docs/PAYROLL.md @@ -216,9 +216,11 @@ the base is the gross. ## 6. Documents and TUI - **Lönebesked** (wave 2, done): `payroll.payslip` renders one A4 page per - employee and run with the invoice's visual language — dark `#314c59` - header bar, employer and employee blocks, gross, preliminary tax (shown - negative), net and the employer-contribution note; the personnummer is + employee and run with the invoice's visual language — the employer name in + a header bar in the shared document colour `document_header_color` + (default `#314c59`), employer and employee blocks, gross, preliminary tax + (shown negative), net and the employer-contribution note; the personnummer + is masked except the last four. `payroll.payslip_mail` stores the PDF as an `application/pdf` attachment on the run's voucher, links it with `voucher_attachments` and e-mails it through the org's `smtp_*` settings diff --git a/docs/PROTOCOL.md b/docs/PROTOCOL.md index 75f1990..081eb6a 100644 --- a/docs/PROTOCOL.md +++ b/docs/PROTOCOL.md @@ -374,7 +374,7 @@ resolved rows in a dry run. | Command | Args | Notes | |---|---|---| | `settings.get` | — | effective org settings (defaults included); secret values replaced by `_set` flags | -| `settings.set` | `key`, `value?` | known keys: `default_series`, `series_voucher`, `series_invoice`, `series_payroll`, `series_bokslut`, `series_ib`, `attachment_dir`, `bank_account`, `invoice_receivable_account`, `invoice_revenue_account`, `invoice_bankgiro`, `invoice_our_ref`, `smtp_host`, `smtp_port`, `smtp_user`, `smtp_from`, `smtp_reply_to`, `smtp_security`, `smtp_password` | +| `settings.set` | `key`, `value?` | known keys: `default_series`, `series_voucher`, `series_invoice`, `series_payroll`, `series_bokslut`, `series_ib`, `attachment_dir`, `bank_account`, `invoice_receivable_account`, `invoice_revenue_account`, `invoice_bankgiro`, `invoice_our_ref`, `document_header_color`, `smtp_host`, `smtp_port`, `smtp_user`, `smtp_from`, `smtp_reply_to`, `smtp_security`, `smtp_password` | `series_voucher`, `series_invoice`, `series_payroll`, `series_bokslut` and `series_ib` (1–8 characters, e.g. `A`, `V-`, `Å`) are the number series each @@ -391,7 +391,10 @@ only, up to 10 characters, default `1930`) is the account `bank.import` uses when the request carries no `account`. `invoice_receivable_account` (default `1510`) and `invoice_revenue_account` (default `3001`) are the receivable and default revenue account of invoice postings, digits only, up to 10 -characters. Verification ids are the concatenation of series and number +characters. `document_header_color` (`#rrggbb`, default `#314c59`) is the +background colour of the generated documents' header bars (invoice and +lönebesked); the invoice prints the org name on it. Verification ids are the +concatenation of series and number (`V-8`), and series are free-form: only an unbroken numbering per series is required. @@ -644,7 +647,9 @@ is the idempotency key). `invoice.sequence_set` and `invoice.issue` are audited; `invoice.issue` supports `dry_run`, which validates and renders but takes no number and writes nothing. `invoice.pdf` returns the stored document as base64 -(`JVBERi0` after decoding is the PDF magic). When the setting +(`JVBERi0` after decoding is the PDF magic). The document's header bar +prints the organization `name` and is coloured by `document_header_color` +(default `#314c59`; invalid stored values fall back to it). When the setting `invoice_bankgiro` is present it is printed in the document's Bankgiro field; `invoice_our_ref` (up to 64 characters) prefills the invoice form's "Vår referens". @@ -756,7 +761,8 @@ given date (default: today) and sets the run's `status` to `paid` with `payment_voucher_id`; paying twice is a `CONFLICT`. `payroll.payslip` renders one A4 lönebesked for an employee line of a posted -run: the employer header and footer, the employee name, the masked +run: the employer name in the header bar (coloured by +`document_header_color`), the employer footer, the employee name, the masked personnummer (`********-1234`, or `********` when the key is unavailable), period, pay date, tax table and column, then Bruttolön, the negative Preliminärskatt, a rule and Nettolön, and the note `Arbetsgivaravgifter diff --git a/docs/STATE.md b/docs/STATE.md index b08471a..0102f54 100644 --- a/docs/STATE.md +++ b/docs/STATE.md @@ -42,6 +42,15 @@ unit tests and the docs consistency check. validation. `test_core` has `invoice_extras`; the pty suite has `invoice-duplicate` and `invoice-pay`. Remaining invoice work is in the backlog (credit notes, per-row account, kundreskontra, partial payments). +- **Document header (2026-09-22)**: the invoice header bar prints the + organization name instead of the hard-coded `MAKANDRA AB` outline (scaled + down and truncated with `...` if long). The shared document setting + `document_header_color` (`#rrggbb`, default `#314c59`, editable in + Bolaget → Fakturauppgifter) colours the header bar of both the invoice + and the lönebesked, and the lönebesked prints the employer name there too + (it previously used the Comfortaa wordmark). The invoice's `FAKTURA` + outline is unchanged; the `MAKANDRA AB` outlines in `src/wordmark.h` are + now unused at runtime. - **Mail configuration**: Makandra AB (org 2) has **no** `smtp_*` settings in bokf, so `invoice.send` there is `SMTP_NOT_CONFIGURED` (fine if invoices are sent elsewhere — set them up when wanted). Mock AB (org 1) -- cgit v1.3