From 59ef95d3c1f590a05c3bea79834d424200d28250 Mon Sep 17 00:00:00 2001 From: Anders Betts Date: Sun, 20 Sep 2026 09:56:56 +0200 Subject: report: per-org moms rule editor commands --- docs/PROTOCOL.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'docs') diff --git a/docs/PROTOCOL.md b/docs/PROTOCOL.md index 00f5200..8405ca5 100644 --- a/docs/PROTOCOL.md +++ b/docs/PROTOCOL.md @@ -448,6 +448,30 @@ the moms boxes (`10`,`11`,`12`,`30`,`31`,`32`,`48`,`60`,`61`,`62`), so box 48 is signed like the blankett (ingående moms negative); underlag boxes do not change what is payable. +### 7.6.1 Reporting rules (moms mapping) + +`report_rules` maps accounts to blankett boxes. The rules are per-org +configuration, not part of the ledger, and owners edit them when +Skatteverket changes the blankett; only `report` `vat` is consumed today +(`report.vat` and `report.vat_eskd`), other report values are reserved. +Several rules may target the same box and `report.vat` sums them into one +entry. + +| Command | Args | Notes | +|---|---|---| +| `report.rule_list` | `report?` | ordered by report, sort_order, box, id | +| `report.rule_create` | `report`, `box`, `match_type`, `pattern`, `sign?`, `sort_order?` | owner; audited (`report_rule.create`) | +| `report.rule_update` | `id`, plus any of `box`, `match_type`, `pattern`, `sign`, `sort_order` | owner; audited (`report_rule.update`) | +| `report.rule_delete` | `id` | owner; audited (`report_rule.delete`) | + +`box` is 1–3 digits. An `account` pattern is 1–10 digits; a `range` pattern +is `LO-HI` with digits and `LO` ≤ `HI`; a `type` pattern is one of `asset`, +`liability`, `equity`, `revenue`, `expense` and matches `accounts.type`. +`sign` is `1` or `-1`; each matched account contributes +`(debit − credit) × sign` to the box. `report.rule_update` merges the given +fields into the existing row and validates the effective rule. All mutations +support `dry_run`, which validates without writing. + ### 7.7 SIE 4 | Command | Args | Result | -- cgit v1.3