aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorAnders Betts <anders.betts@gmail.com>2026-09-18 23:41:59 +0200
committerAnders Betts <anders.betts@gmail.com>2026-09-18 23:41:59 +0200
commit49e44668c14abacef17f0f11be39cbd0faa7ecb9 (patch)
treedd8248143def675fd033abf390c06567f78d5c4c /docs
parente9fc91dbc8314a25a0d71b7ee4344d3fc4ccfd5e (diff)
downloadbokf-49e44668c14abacef17f0f11be39cbd0faa7ecb9.tar.gz
bokf-49e44668c14abacef17f0f11be39cbd0faa7ecb9.zip
bokslut, INK2/SRU export and attachment markersv0.1.30
- bokslut.post: year-end bookings (manual entries, periodiseringsfond, skatt at a given rate, resultatdisposition) with a dry-run plan through the normal ledger path; the resultatrapport separates bokslutsdispositioner and skatt per K2. - sru.export: INFO.SRU + BLANKETTER.SRU (INK2/INK2R/INK2S) from the official 2025P4 field tables and the BAS mapping, with manual INK2S adjustments, submitter defaults and unmapped-account detection; the TUI writes both files from Rapporter -> Inkomstdeklaration. - voucher.list carries attachment_count and the voucher list marks vouchers with underlag with an x column. - date_prompt restores the cursor state so it stops blinking at the bottom after the report date prompts.
Diffstat (limited to 'docs')
-rw-r--r--docs/COMPLIANCE.md3
-rw-r--r--docs/PROTOCOL.md25
-rw-r--r--docs/STATE.md18
3 files changed, 38 insertions, 8 deletions
diff --git a/docs/COMPLIANCE.md b/docs/COMPLIANCE.md
index abc6247..c318b7f 100644
--- a/docs/COMPLIANCE.md
+++ b/docs/COMPLIANCE.md
@@ -155,6 +155,7 @@ approval by any authority — none exists.
Fortnox/Visma/BL.
3. ~~eSKD file for momsdeklaration~~ (`report.vat_eskd`, upload in
Skatteverket's e-service); AGI file for payroll.
-4. K2 årsredovisning document generation + SRU files for INK2.
+4. K2 årsredovisning document generation; ~~SRU files for INK2~~
+ (`sru.export`, INFO.SRU + BLANKETTER.SRU).
5. Invoicing and reskontra; bank import (CSV, then PSD2).
6. Peppol e-invoicing, if still relevant when it is due.
diff --git a/docs/PROTOCOL.md b/docs/PROTOCOL.md
index 75f384f..b864d10 100644
--- a/docs/PROTOCOL.md
+++ b/docs/PROTOCOL.md
@@ -300,11 +300,19 @@ Years with status `closed` reject all postings.
|---|---|---|
| `voucher.post` | `date`, `description?`, `rows[]` **or** `template`+`x`, `series?`, `corrects_voucher?`, `attachment_ids?`, `client_ref?` | dry-run supported |
| `voucher.get` | `id` | |
-| `voucher.list` | `fiscal_year?`, `from?`, `to?`, `series?`, `account?`, `text?`, `limit`, `cursor` | |
+| `voucher.list` | `fiscal_year?`, `from?`, `to?`, `series?`, `account?`, `text?`, `limit`, `cursor` | items carry `row_count` and `attachment_count` |
| `voucher.correct` | `voucher`, `description`, `date?`, `client_ref?` | creates ändringsverifikat |
+| `bokslut.post` | `fiscal_year`, `entries[]{debit_account,credit_account,amount_ore,description?}`, `periodiseringsfond_ore?`, `tax_rate?`, `dispose?`, `date?` | year-end bookings; `dry_run` shows the plan |
A row is `{"account":"1930","debit_ore":125000,"credit_ore":0,"description":"..."}`.
Exactly one of `debit_ore`/`credit_ore` may be non-zero; at least two rows;
+`bokslut.post` computes the result before tax (3xxx-88xx movements), adds
+the given entries (avskrivningar etc.; each entry names its debit and credit
+account and must be positive), computes `tax_rate` (default 20.6 %, öre
+truncated) and posts one voucher per part: dispositions, "Skatt på årets
+resultat" (8910/2512) and "Resultatdisposition" (8999/2099, reversed for a
+loss). `dry_run:true` validates and returns the plan without writing.
+
sum debit = sum credit. `voucher.correct` mirrors the original rows, links the
new voucher to the original via `corrects_voucher`, and posts it as a normal
immutable voucher. The original is never touched.
@@ -374,6 +382,7 @@ key is the voucher/attachment pair); linking the same pair twice is a
| `report.voucher_list` | `fiscal_year`, `series?` | grundbok/verifikationslista |
| `report.vat` | `from`, `to`, `period_type?` | momsdeklaration ruta för ruta |
| `report.vat_eskd` | `from`, `to`, `upplysning?` | eSKD XML (ISO-8859-1) as `content_base64` |
+| `sru.export` | `fiscal_year`, `adjustments?`, `submitter?`, `assisted?`, `audited?`, `ignore_unmapped?` | `INFO.SRU` + `BLANKETTER.SRU` (ISO-8859-1, base64) |
All reports are pure reads, respect locks, and return JSON rows. Amounts are
öre. `report.general_ledger` (huvudbok) returns account blocks:
@@ -386,7 +395,19 @@ All reports are pure reads, respect locks, and return JSON rows. Amounts are
"to","last_voucher":{...},"vouchers":[{"id","series","number","date",
"description","rows":[{"account","name","debit_ore","credit_ore",
"description"}]}],"totals":{"debit_ore","credit_ore"}}` and takes an
-`series` filter. `report.vat_eskd` builds Skatteverket's `eSKDUpload`
+`series` filter. `sru.export` builds the two SRU files for Skatteverket's filöverföring:
+`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
+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
+flags. Non-zero accounts without a mapping abort with `INVALID_ARGS`
+unless `ignore_unmapped:true`.
+
+`report.vat_eskd` builds Skatteverket's `eSKDUpload`
Version 6.0 XML for the period ending at `to` (whole kronor, öre truncated
like the blankett; box 48 positive as filed) and returns `{"org_nr",
"period","from","to","filename","sha256","size","content_base64"}`; the
diff --git a/docs/STATE.md b/docs/STATE.md
index 517e62a..5be11e7 100644
--- a/docs/STATE.md
+++ b/docs/STATE.md
@@ -86,8 +86,8 @@ server/protocol/ledger only.
SHA-256 verified, text inline), attach to an existing voucher (`^F`),
remove a link (`d` in the `f` picker) and link an inbox item to a voucher
(`k`).
-- Next backend milestone: **bokslut automation** vs **K2/SRU** (eSKD is
- done: `report.vat_eskd` + `s = spara eSKD` in the momsrapport).
+- Next backend milestone: **K2/SRU** (INK2/INK2R/INK2S + årsredovisning);
+ bokslut.post is done server-side, its TUI screen pending.
- Moms `report_rules` seed is a corrected starter mapping (schema v3), but
there is still no command/TUI to edit rules per org; add one before filing
if the mapping needs adjustments (SCHEMA.md §10 promises owner editing).
@@ -96,9 +96,13 @@ server/protocol/ledger only.
1. ~~eSKD file generation for momsdeklaration.~~ `report.vat_eskd` (eSKDUpload
6.0, ISO-8859-1, whole kronor) with a save action in the TUI momsrapport.
-2. Bokslut automation (avskrivningar, periodiseringsfond, skatt,
- resultatdisposition).
-3. K2 årsredovisning document + SRU files (INK2/INK2R/INK2S).
+2. Bokslut automation: `bokslut.post` is in (entries/avskrivningar,
+ periodiseringsfond, skatt at a given rate, resultatdisposition, dry-run
+ plan, audited) and the resultatrapport separates bokslutsdispositioner
+ and skatt per K2. TUI screen still to do.
+3. K2 årsredovisning document; ~~SRU files (INK2/INK2R/INK2S)~~ done as
+ `sru.export` (official 2025P4 field tables, BAS mapping, TUI save in
+ Rapporter -> Inkomstdeklaration).
4. `audit.verify` must also verify the **voucher** hash chain (today only the
audit chain is verified).
5. ~~`report.general_ledger` and `report.voucher_list`~~ implemented
@@ -113,6 +117,10 @@ server/protocol/ledger only.
9. Password change, user disable, TOTP.
10. Bank import/reconciliation (CSV first, then PSD2), invoicing/reskontra,
AGI/payroll if employees.
+11a. Imported history years whose SIE contains the source's P&L closings
+ ("Stäng intäktskonton/kostnadskonton") net to zero in the income
+ statement (Kapitas 2022-2026). The importer should skip those closing
+ verifications (keeping the resultatdisposition) or mark them; decide.
11. ~~SIE import only into an empty fiscal year; consider broader import.~~
Chronological multi-year import works (CRLF, `#RAR 0`, zero rows, `#IB`
rule handled); each year must still target an empty fiscal year. Note: