aboutsummaryrefslogtreecommitdiff
path: root/docs/PROTOCOL.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/PROTOCOL.md')
-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 |