diff options
| author | Anders Betts <anders.betts@gmail.com> | 2026-09-21 11:45:54 +0200 |
|---|---|---|
| committer | Anders Betts <anders.betts@gmail.com> | 2026-09-21 11:45:54 +0200 |
| commit | e1dd7112e0346914710566660625da0f6b866e8a (patch) | |
| tree | c4b0d5c7f6f62c1c4c38245e7c001b3fd4b03e74 /docs | |
| parent | 182f0a592b6fe97fc1ff87add227f9d52a4ef902 (diff) | |
| download | bokf-e1dd7112e0346914710566660625da0f6b866e8a.tar.gz bokf-e1dd7112e0346914710566660625da0f6b866e8a.zip | |
tui: payroll screens, Företag/System menu and settings splitv0.1.55
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/PAYROLL.md | 19 | ||||
| -rw-r--r-- | docs/PROTOCOL.md | 43 | ||||
| -rw-r--r-- | docs/STATE.md | 49 | ||||
| -rw-r--r-- | docs/TUI-GUIDELINES.md | 3 |
4 files changed, 79 insertions, 35 deletions
diff --git a/docs/PAYROLL.md b/docs/PAYROLL.md index b821754..23e7fb1 100644 --- a/docs/PAYROLL.md +++ b/docs/PAYROLL.md @@ -5,7 +5,7 @@ Status: Design draft · 2026-09-21 · License: GPL-3.0-or-later Payroll for a small Swedish AB that runs monthly salaries from the books. Wave 1 is the engine and the mandatory steps; the employee is the owner but the schema and commands are multi-employee from the start. Wave 2 (the -lönebesked PDF and its delivery) is done; wave 3 is the TUI. +lönebesked PDF and its delivery) and wave 3 (the TUI) are done. ## 1. Scope @@ -227,12 +227,19 @@ the base is the gross. SMTP configuration `SMTP_NOT_CONFIGURED` and a failed delivery `SMTP_FAILED` (the stored attachment stays linked). `dry_run` validates, renders and stores nothing. See `PROTOCOL.md` §7.12. -- **TUI — Lön** (new section after Fakturering): `Lönekörningar` (list, - Ctrl+N for a new run), `Anställda` under Register, and a **Skattetabeller** - action/status that fetches and warns. +- **TUI — Lön** (done, `clients/screens_payroll.c`): `Lönekörningar` (list, + Ctrl+N for a new run) under Lön, `Anställda` under Företag, and a + **Skattetabeller** screen (System, since the tables are national) with + status, the Skatteverket fetch and the offline file import. - The run screen shows the preview (F5), posts with Ctrl+Enter after - confirmation, then offers the buttons **Lönebesked**, **AGI-underlag** and - **Betala skatt & avgifter** as manual steps. + confirmation, then offers the buttons **Lönebesked** (saves/opens the + PDF), **AGI-underlag** (`payroll.agi` in a pager, owner only) and + **Betala skatt & avgifter** (`payroll.pay_tax` with a date prompt) as + manual steps. Steps that do not apply yet are dimmed with the reason. + Posting and paying show the resulting voucher as `V-<n>`. +- The list title warns when the current year's tax tables are missing; a + new run is refused with a pointer to Anställda when nobody has a monthly + salary. ## 7. Testing diff --git a/docs/PROTOCOL.md b/docs/PROTOCOL.md index ebce8bf..01f5dd1 100644 --- a/docs/PROTOCOL.md +++ b/docs/PROTOCOL.md @@ -925,6 +925,26 @@ commands. Implemented screens (0.1.0-dev): number, e-mail, your reference, payment days, notes). Ctrl+N creates, Enter edits (F5 validates with a dry run, Ctrl+Enter saves), `d` archives/reactivates. +- **Lönekörningar** — the monthly payroll runs (`payroll.run_list`, newest + period first) with status (`bokförd`/`betald`), gross and net. Ctrl+N + starts a new run (period YYYY-MM and pay date, defaulting into the + selected fiscal year) when an active employee with a monthly salary + exists, Enter opens an existing run. The run screen shows the status and + totals, `F5` previews (`payroll.run_preview` for a new run, the stored + lines for a posted one), `Ctrl+Enter` posts after confirmation + (`payroll.run_post`, showing the voucher), and the manual steps are the + action rows **Lönebesked** (PDF via `payroll.payslip`), **AGI-underlag** + (`payroll.agi`, owner only) and **Betala skatt & avgifter** + (`payroll.pay_tax`); a disabled step names its reason. The list title + warns when the current year's tax tables are missing. +- **Anställda** — the employee register (name, masked personnummer, salary, + tax table/column, e-mail). Ctrl+N creates, Enter edits (an empty + personnummer keeps the stored one), `d` archives/reactivates; F5 + validates with a dry run and Ctrl+Enter saves. +- **Skattetabeller** (System) — stored tax table years, the current year's + status, fetch time and source. Owners fetch Skatteverket's official + monthly table (`payroll.tax_tables_fetch`) or import a file offline + (`payroll.tax_tables_import`). - **Rapporter** — saldobalans, resultaträkning, balansräkning, moms, inkomstdeklaration (INK2/SRU), årsredovisning (K2 text draft) and kontolista (all accounts with type, moms treatment, SRU and status). @@ -939,18 +959,23 @@ commands. Implemented screens (0.1.0-dev): events, AGM and payment dates, proposed dividend, employees, other notes), edited per field; a new fiscal year inherits the stable fields. The årsredovisning draft reads them without prompting. -- **Företagsuppgifter** — the org record (name, org number, VAT number, - address, e-mail, phone, moms period, framework, fiscal-year start month), - plus the invoice bankgiro and "vår referens"; editable in place, only - owners can save, others see it read-only. The accounting accounts and the - SMTP transport live in **Inställningar**. -- **Revision** — chain verification and behandlingshistorik. +- **Bolaget** — the org record (name, org number, VAT number, address, + e-mail, phone, moms period, framework, fiscal-year start month), editable + in place by owners; others see it read-only. The sub-forms + **Fakturauppgifter…** (standardserie, fordringskonto, intäktskonto, + bankgiro, vår referens) and **E-post (SMTP)…** (host, port, user, sender, + reply-to, security, password) are `settings.set` and open to bookkeepers, + and **Styrelseledamöter** lists the board. +- **Systeminställningar** (System) — bilagornas mapp, the file browser's + start directory. +- **Revision** (System) — chain verification and behandlingshistorik. **Ctrl+N is the universal "add" key**: it starts a new verifikat from the dashboard, the voucher list and the voucher detail view; a new mall from the -Mallar menu; a new fiscal year from the year picker; and maps to the editor -in Ingående balans and to file upload in Underlag. F5 is the universal -refresh. Hints show the keys per screen. +Mallar menu; a new customer or employee from their registers; a new payroll +run from Lönekörningar; a new fiscal year from the year picker; and maps to +the editor in Ingående balans and to file upload in Underlag. F5 is the +universal refresh. Hints show the keys per screen. **Ctrl+R reloads the client in place** (for hot-reloading after a rebuild): it re-execs the installed binary with `--org`, `--fy` and `--screen NAME` diff --git a/docs/STATE.md b/docs/STATE.md index 4425b10..767ed7c 100644 --- a/docs/STATE.md +++ b/docs/STATE.md @@ -6,29 +6,39 @@ Read with `AGENTS.md` (rules) and `docs/TUI-GUIDELINES.md` (UI conventions). ## Status Working self-hosted bookkeeping system, not production-proven. Backend ledger -core is complete, as are invoicing and the payroll engine; filing/year-end -work and the payroll TUI remain. TUI is usable and exercised by -`make test-pty` (golden screen-text scenarios); `make test` covers the -server/protocol/ledger, the TUI widget unit tests and the docs consistency -check. +core is complete, as are invoicing, the payroll engine and the payroll TUI; +filing/year-end work remains. TUI is usable and exercised by `make test-pty` +(golden screen-text scenarios, now including the payroll run and the +lönebesked); `make test` covers the server/protocol/ledger, the TUI widget +unit tests and the docs consistency check. ## Resume here (2026-09-21) - **Deployed**: `v0.1.54`, healthy on `nas` (Alpine runtime, static aarch64 binaries cross-compiled on this machine — ~20 s, the host only assembles the image; image 33.7 MB, no `libssl3`). `main` is ahead of the deployment: - payroll (schema v11), the query helpers and the mail fixes are **not - deployed** yet — deploy before the human tries payroll in the TUI. -- **Next task**: the **Lön** TUI section (wave 3) per `docs/PAYROLL.md` §6: - `Lönekörningar` (list + Ctrl+N), `Anställda` under Register, a - `Skattetabeller` fetch/status action, and the run screen with F5 preview, - Ctrl+Enter post and the manual buttons Bokför, Lönebesked, AGI-underlag, - Betala skatt & avgifter. -- **Follow-ups from the payroll waves**: fold `payroll.settings_get/set` into + payroll (schema v11), the query helpers, the mail fixes and the payroll + TUI are **not deployed** yet — deploy before the human tries payroll on + `nas`. +- **Next tasks (payroll follow-ups)**: fold `payroll.settings_get/set` into `settings.get/set` (cmd_settings.c was busy during wave 1); settle the over-80k % rule (SKV 433 leaves it ambiguous — currently a clear - `INVALID_ARGS`); move `invoice.send` to the shared `src/mail.c`; add a pty - scenario for the payslip. + `INVALID_ARGS`); move `invoice.send` to the shared `src/mail.c`. The TUI + has no screen for the payroll account/rate settings yet (they are + defaults and can stay server-side until the fold). +- **Done in the TUI wave**: `clients/screens_payroll.c` with Lönekörningar + (list + Ctrl+N, run screen with F5 preview, Ctrl+Enter post after + confirmation and the action rows Lönebesked, AGI-underlag, Betala skatt & + avgifter), Anställda under Företag and the Skattetabeller + fetch/import/status screen under System. A pty scenario posts a run and + fetches its lönebesked, so the payslip PDF path is exercised end to end. +- **Menyn (2026-09-21)**: dashboarden har sektionerna Bokföring (med + Mallar), Fakturering, Lön, Rapporter & bokslut, Företag (Anställda, + Kunder, Bolaget, Momsregler) och System (Skattetabeller, Revision, + Systeminställningar). Inställningar är borttagen: standardserie, + fordrings-/intäktskonto, bankgiro, vår referens och SMTP ligger nu under + Bolaget (sub-formulären Fakturauppgifter och E-post), bilagornas mapp + under System. `--screen settings` är kvar som alias för Bolaget. - **Already merged on main since the last deploy**: payroll schema v10/v11 + employees/tax tables/runs/payslip (`e692f0f`, `4488b6c`), `mail.c` + `smtp_reply_to` (`e25a8c9`), query helpers `db_row_json`/`req_list`/ @@ -60,8 +70,9 @@ None open. Completed items that used to be listed here are archived in 11. ~~SIE import only into an empty fiscal year~~ chronological multi-year import works; each year must still target an empty fiscal year. 12. TUI polish: horizontal scrolling in long text fields, bracketed paste. -13. Payroll TUI (wave 3) and the payroll follow-ups listed under "Resume - here"; payroll is server-complete but has no employee registered yet. +13. ~~Payroll TUI (wave 3)~~ done (`clients/screens_payroll.c`); the + remaining payroll follow-ups are listed under "Resume here". No + employee is registered yet in the real orgs. 14. Invoice follow-ups when needed: credit notes (`invoice.credit`), per-row account in the invoice form, kundreskontra view. 15. `make test-pty` speed if it ever exceeds ~60 s: parallelise the @@ -165,9 +176,9 @@ Original entries for the struck items are in `docs/DECISIONS.md`. pärm (får refereras i efterhand, även i stängda år). - **Lön (2026-09-21)**: bara ägaren är anställd, men schema och kommandon är fleranvändarklara. Lönemotorn (schema v11: anställda, skattetabeller, - lönekörningar, lönebesked + mejl) är klar server-side; TUI:t saknas och + lönekörningar, lönebesked + mejl) och TUI-sektionen Lön är klara, men **ingen anställd är registrerad än** (personnummer, lön, skattetabell och - kolumn fylls i under Anställda). Konton enligt historiken: + kolumn fylls i under Register → Anställda). Konton enligt historiken: 7210/7510/2710/2731/1630. Skattetabellerna hämtas med en knapp från Skatteverket (varning när året är gammalt), personnumret är krypterat i databasen. Ingen semesteruppbokning; arbetsgivardeklarationen (AGI) görs diff --git a/docs/TUI-GUIDELINES.md b/docs/TUI-GUIDELINES.md index 46982ed..7e0d404 100644 --- a/docs/TUI-GUIDELINES.md +++ b/docs/TUI-GUIDELINES.md @@ -43,7 +43,8 @@ written compactly as `^N`, `^A`, `^C`, `^R` to save width. - Rows are numbered `NN. text`, right-aligned so 2- and 3-digit numbers line up. - Verifikation ids are shown concatenated as `series+number` (`V-8`, `A8`), - using the org's `default_series` (Inställningar) for new vouchers. + using the org's `default_series` (Bolaget → Fakturauppgifter) for new + vouchers. - The last row may be an action (e.g. `+ Nytt verifikat (Ctrl+N)`); selecting it runs the action instead of opening a detail view. - Selection memory: lists remember the selected row by identity (voucher id), |
