From 49e44668c14abacef17f0f11be39cbd0faa7ecb9 Mon Sep 17 00:00:00 2001 From: Anders Betts Date: Fri, 18 Sep 2026 23:41:59 +0200 Subject: bokslut, INK2/SRU export and attachment markers - 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. --- docs/PROTOCOL.md | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'docs/PROTOCOL.md') 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 (`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 -- cgit v1.3