aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/PROTOCOL.md14
-rw-r--r--docs/STATE.md37
2 files changed, 36 insertions, 15 deletions
diff --git a/docs/PROTOCOL.md b/docs/PROTOCOL.md
index 0b69d53..3ddb03b 100644
--- a/docs/PROTOCOL.md
+++ b/docs/PROTOCOL.md
@@ -465,8 +465,9 @@ closed straight to 2099 and would otherwise net to zero; the TUI
returns account blocks:
`{"fiscal_year","from","to","last_voucher":{...},"accounts":[{"account",
"name","ib_ore","debit_ore","credit_ore","ub_ore","rows":[{"series",
-"number","date","description","row_description","debit_ore","credit_ore",
-"saldo_ore"}]}]}`; accounts without IB or period movement are omitted, and
+"number","date","description","row_description","source","debit_ore",
+"credit_ore","saldo_ore"}]}]}` (`source` is the voucher's origin, e.g.
+`sie_import`); accounts without IB or period movement are omitted, and
`accounts` (array of account numbers) filters the list.
`report.voucher_list` (verifikationslista) returns `{"fiscal_year","from",
"to","last_voucher":{...},"vouchers":[{"id","series","number","date",
@@ -476,8 +477,13 @@ returns account blocks:
`INFO.SRU` (submitter, defaults to the org) and `BLANKETTER.SRU` with one
INK2, INK2R and INK2S block each. The blankett type is derived from the
fiscal year end (`<inkomstår>P1`-`P4`), the org number is written as 12
-digits, amounts are whole kronor with öre truncated and the blankett's
-printed sign, and zero fields are omitted. INK2R is mapped from the ledger
+digits, amounts are whole kronor with the blankett's printed sign, and zero
+fields are omitted. Every account is rounded to whole kronor (half away
+from zero) before it is summed into its field, the same rule as the TUI
+årsredovisning, so the two agree to the krona and the fields add up; 2099
+is replaced by the income statement's result in 7302, and the krona that
+rounding can leave between the balance sheet's sides is carried by 7302
+(a real imbalance in the ledger stays visible). INK2R is mapped from the ledger
via the official BAS ranges; INK2S takes the derived årets resultat and
skatt plus `adjustments[]{code,amount_ore}` for manual tax adjustments and
computes 7670/7770; INK2 carries 7104/7114 and the optional 8040-8045
diff --git a/docs/STATE.md b/docs/STATE.md
index 754bd9b..7fccc31 100644
--- a/docs/STATE.md
+++ b/docs/STATE.md
@@ -20,14 +20,14 @@ unit tests and the docs consistency check.
skips those vouchers (deployed in `v0.1.65`), which gives
**241 817,48 kr** resultat efter skatt för 2025/2026. In the TUI the
"Bokfört resultat" section is absent for such years (the close goes straight
- to 2099). Two **data drifts** to settle with the accountant before filing:
+ to 2099). Two **data drifts** (since resolved, see the v0.1.66 entry):
the imported FY 2022/2023 result transfer is **17 857,63 kr** short of that
year's P&L (its tax was never booked as an expense), so the derived balance
sheet does not balance by that amount; and 2099 is 1,07 kr off the P&L
result. Locked years stay locked — a correction belongs in the open year
(2026/2027). The owner can now run Bokslutshubben → Inkomstdeklaration.
-- **Deployed**: `v0.1.65`, healthy on `nas` (Alpine runtime, static aarch64
+- **Deployed**: `v0.1.67`, 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`). `v0.1.55` brought the payroll
server waves (schema v11: employees, tax tables, lönebesked) and the
@@ -50,7 +50,9 @@ unit tests and the docs consistency check.
`document_header_color`; `v0.1.64` is the TUI interaction-model spec (docs
only, no runtime change); `v0.1.65` carries earlier IB vouchers forward,
restarts P&L at each year, skips imported `Stäng` closings in the
- income statement and the momsomföring in the VAT report. The live database migrated v9 → v11 on the v0.1.55
+ income statement and the momsomföring in the VAT report; `v0.1.66`
+ ignores IB rows on P&L accounts; `v0.1.67` rounds every account to whole
+ kronor in the SRU export and the årsredovisning. The live database migrated v9 → v11 on the v0.1.55
startup and v11 → v12 on the v0.1.62 startup, each with the automatic
pre-migration snapshot in `var/db/backup/`. `main` and the tags are pushed
to `nas`.
@@ -100,13 +102,26 @@ unit tests and the docs consistency check.
a 2650 row) and SIE-imported `Stäng` closings. Makandra's 2025/26 report
was all zeros because V107 (Momsdeklaration) and V109 were counted; the
rules themselves were fine. `test_core` has `vat_settlement`.
-- **IB rows on P&L accounts (2026-09-22, not deployed)**: after `v0.1.65`,
- Makandra's 2026/27 `IB 1` (an agent's delta from 2026-09-18, computed
- against the old IB rule) showed its balancing P&L rows as P&L opening
- balances and double-counted aktiekapital (2081 −50 000, 1940 25 000).
- Reports now ignore `IB` rows on P&L accounts; the aktiekapital double
- needs the IB delta 2081 D / 1940 K 25 000 in 2026/27 (dry-run ok, awaiting
- the owner). `bokfctl --dry-run` sets the request's `dry_run`.
+- **IB rows on P&L accounts (2026-09-22, deployed in `v0.1.66`)**: reports
+ ignore `IB` rows on P&L accounts (the balancing side of an IB delta);
+ `bokfctl --dry-run` sets the request's `dry_run`. Makandra data, booked by
+ the owner: V 25 in 2021/22 (8910/2512 17 857,63 — the tax voucher missing
+ from the source's SIE export), IB 2 (2512 D / 8999 K 17 857,63) and IB 3
+ (2081 D / 1940 K 25 000) in 2026/27. Every year now balances, 2026/27 opens
+ exactly on the filed 2025/26 UB; only öre diffs remain in history (2512
+ 1,63, 2099 1,07, moms 0,56). 2021/22 was reopened for V 25 and must be
+ closed again by the owner.
+- **Whole-krona rounding (2026-09-22, deployed in `v0.1.67`)**: the SRU export and
+ the TUI årsredovisning round every account to whole kronor
+ (`util_round_kr`) and sum those, so their lines, totals and INK2 fields
+ agree to the krona (the SRU export used to truncate each field, the
+ årsredovisning rounded each line). The balance sheet's rounding krona goes
+ to Balanserat resultat / 7302, and 2099 is replaced by the year's result
+ in both. The årsredovisning's "Stäng" skip never matched (`strncmp` with 7
+ bytes for the 6-byte "Stäng"), so imported years showed a zero result; it
+ now follows the server rule (SIE-imported only) via the new `source` field
+ on `report.general_ledger` rows. The total "Summa eget kapital,
+ avsättningar och skulder" no longer counts 2099 on top of the result.
- **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)
@@ -186,7 +201,7 @@ Original entries for the struck items are in `docs/DECISIONS.md`.
## Environment / how to run
-- **Deployed**: `scripts/deploy.sh` (latest `v0.1.65`, healthy on nas).
+- **Deployed**: `scripts/deploy.sh` (latest `v0.1.67`, 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