aboutsummaryrefslogtreecommitdiff
path: root/docs/PROTOCOL.md
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/PROTOCOL.md
parente9fc91dbc8314a25a0d71b7ee4344d3fc4ccfd5e (diff)
downloadbokf-0.1.30.tar.gz
bokf-0.1.30.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/PROTOCOL.md')
-rw-r--r--docs/PROTOCOL.md25
1 files changed, 23 insertions, 2 deletions
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