aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/DECISIONS.md16
-rw-r--r--docs/STATE.md68
2 files changed, 75 insertions, 9 deletions
diff --git a/docs/DECISIONS.md b/docs/DECISIONS.md
index b84e7fa..a108f48 100644
--- a/docs/DECISIONS.md
+++ b/docs/DECISIONS.md
@@ -186,6 +186,22 @@ kept verbatim from the STATE.md they were pruned from (2026-09-21).
rules, attachments, bank, audit, templates, ib, bokslut, settings,
invoices). Pure move: no key, string or scene-name changes; the registry
keeps every name including the `yearinfo` alias.
+24. **Payroll (2026-09-21)**: `docs/PAYROLL.md` is the chapter. Schema v10
+ (v11 adds `employees.email`): `employees` with the personnummer encrypted
+ at rest (`secret_encrypt`, masked in every response; only `payroll.agi`
+ returns it in clear), `payroll_runs`/`payroll_run_lines`, and national
+ `tax_tables`/`tax_table_meta` without `org_id` (the one exception to the
+ tenant rule). Monthly runs post D salary (7210 default; 7010 for
+ kollektivanställda) / D 7510 / K 2710 / K 1930 / K 2731 with
+ `source:"payroll"`; `payroll.pay_tax` does D 2710 + D 2731 / K 1630.
+ Tax tables are fetched from Skatteverket's public fixed-width
+ `allmanna-tabeller-manad.txt` (one button, stale-year warning) and
+ over-80k % records are stored but refused until the rule is settled.
+ Lönebesked PDF + mail (wave 2). **User decisions**: only the owner is
+ employed now but everything is multi-employee; no semester accrual;
+ tax tables from day one; manual step-buttons (Bokför, Lönebesked,
+ AGI-underlag, Betala skatt & avgifter); bank phase 3 (`bank_rule.*`) is
+ dropped.
## Completed work formerly listed under "Pending decisions"
diff --git a/docs/STATE.md b/docs/STATE.md
index b7ed645..4425b10 100644
--- a/docs/STATE.md
+++ b/docs/STATE.md
@@ -6,11 +6,35 @@ 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; filing/year-end/payroll are not. TUI is usable and exercised
-by `make test-pty` (golden screen-text scenarios); `make test` covers the
+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.
+## 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
+ `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.
+- **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`/
+ `req_exec` (`b1956aa`), and a Makefile fix that tracks the test binaries'
+ `.d` files (a stale `smtp_check.o` hung `make test`).
+
## Open decisions
None open. Completed items that used to be listed here are archived in
@@ -27,25 +51,41 @@ None open. Completed items that used to be listed here are archived in
7. ~~Pre-migration `VACUUM INTO` snapshot~~ done.
8. ~~Docker image + compose~~ done (no registry, no systemd unit).
9. Password change, user disable, TOTP.
-10. ~~Bank import/reconciliation (CSV first)~~ phase 1 done (SEB CSV +
- matching, schema v8). Next: phase 2 prefill-from-transaction and
- `bank_rule.*`, then PSD2; invoicing/reskontra and AGI/payroll if
- employees.
+10. ~~Bank import/reconciliation (CSV first)~~ phase 1 (SEB CSV + matching,
+ schema v8) and phase 2 (Ctrl+N prefills the voucher and auto-matches it,
+ `9b1021e`) done. Phase 3 (`bank_rule.*`) **dropped by the user
+ 2026-09-21**; PSD2 only if it ever hurts.
11a. Imported history years with source P&L closings: decided, no importer
change (see DECISIONS.md).
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.
+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
+ independent scenarios (each has its own rig) and add `--only` symmetry;
+ measure first.
+16. Test fixtures (`t_fresh_org()`) + one test file per domain
+ (`tests/core_<domain>.c`) so `--only` stops cascading; pilot with one
+ domain.
Original entries for the struck items are in `docs/DECISIONS.md`.
## Environment / how to run
-- **Deployed**: `scripts/deploy.sh` (latest `v0.1.48`, healthy on nas).
+- **Deployed**: `scripts/deploy.sh` (latest `v0.1.54`, healthy on nas).
Live daemon `tls:bokf.makandra.eu:8788`, token
`~/.config/bokf/migration-token` (scopes `read,write`; owner-only actions
like closing years must be done by the human in the TUI). Git remote
`origin` is `nas:/mnt/data/git-repos/bokf.git` (push `main` and tags).
+ `sh scripts/install-hooks.sh` once per checkout points `core.hooksPath` at
+ `.githooks/`, so every push runs `make gate` (clean `-Werror` build in
+ `build-gate/`, the suite and ASan); it is installed here.
+ `deploy/Dockerfile.cross` + `deploy/cross-build.sh` produce static aarch64
+ `bokfd`/`bokfctl` in ~20 s when the host architecture differs; the image is
+ assembled on the host from `.prebuilt` (see docs/DEPLOY.md).
- **Local test rig** (transient, `/tmp`): daemon
`./build/bokfd --db /tmp/opencode/bokf-local/t.db --socket
/tmp/opencode/bokf-local/sock`, org 1, login `admin`/`testpass123`.
@@ -91,10 +131,11 @@ Original entries for the struck items are in `docs/DECISIONS.md`.
- Never commit unless the human asks.
- SQLite files must not be backed up live with restic; use
`backup.snapshot` (`VACUUM INTO`) and point restic at the snapshots.
-- Schema version is 9 (v3 moms rules; v4/v6 year info; v5 org
+- Schema version is 11 (v3 moms rules; v4/v6 year info; v5 org
description/shares + board members; v7 attachments append-only triggers;
v8 bank reconciliation; v9 invoicing + widened `vouchers.source` with a
- table rebuild); forward migrations are in `db.c`.
+ table rebuild; v10 payroll + `payroll`/`payroll_tax` sources, same
+ rebuild; v11 `employees.email`); forward migrations are in `db.c`.
## Makandra driftstatus (org 2)
@@ -122,3 +163,12 @@ Original entries for the struck items are in `docs/DECISIONS.md`.
över "Stäng"-verifikat i flerårsöversikten); utdelning bokförs vid stämman
med mallen **Utdelning** (D 2099/K 2898); pappersoriginal finns i fysisk
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
+ **ingen anställd är registrerad än** (personnummer, lön, skattetabell och
+ kolumn fylls i under 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
+ manuellt med underlaget från `payroll.agi`.