summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorAnders Betts <anders.betts@gmail.com>2026-09-20 09:56:56 +0200
committerAnders Betts <anders.betts@gmail.com>2026-09-20 09:57:20 +0200
commit59ef95d3c1f590a05c3bea79834d424200d28250 (patch)
tree6fd26b77e3ffb10658c3e3ef029704704118dd0d /docs
parentb5349b52e757399d8ddb6325120a58e7d9e6e1f6 (diff)
downloadbokf-59ef95d3c1f590a05c3bea79834d424200d28250.tar.gz
bokf-59ef95d3c1f590a05c3bea79834d424200d28250.zip
report: per-org moms rule editor commands
Diffstat (limited to 'docs')
-rw-r--r--docs/PROTOCOL.md24
1 files changed, 24 insertions, 0 deletions
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 |