@fin.cx/skr 1.3.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.smartconfig.json +33 -6
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/core/core.accountpolicy.d.ts +67 -0
- package/dist_ts/core/core.accountpolicy.js +91 -0
- package/dist_ts/core/core.bukeys.d.ts +38 -0
- package/dist_ts/core/core.bukeys.js +117 -0
- package/dist_ts/core/core.datev.captions.d.ts +7 -0
- package/dist_ts/core/core.datev.captions.js +134 -0
- package/dist_ts/core/core.datev.d.ts +47 -0
- package/dist_ts/core/core.datev.js +129 -0
- package/dist_ts/core/core.hash.d.ts +27 -0
- package/dist_ts/core/core.hash.js +72 -0
- package/dist_ts/core/core.plugins.d.ts +3 -0
- package/dist_ts/core/core.plugins.js +9 -0
- package/dist_ts/core/core.recipes.d.ts +118 -0
- package/dist_ts/core/core.recipes.js +504 -0
- package/dist_ts/core/core.taxscenario.d.ts +27 -0
- package/dist_ts/core/core.taxscenario.js +85 -0
- package/dist_ts/core/core.types.d.ts +48 -0
- package/dist_ts/core/core.types.js +2 -0
- package/dist_ts/core/core.validate.d.ts +17 -0
- package/dist_ts/core/core.validate.js +89 -0
- package/dist_ts/core/index.d.ts +15 -0
- package/dist_ts/core/index.js +16 -0
- package/dist_ts/index.d.ts +15 -0
- package/dist_ts/index.js +10 -1
- package/dist_ts/plugins.d.ts +2 -1
- package/dist_ts/plugins.js +4 -2
- package/dist_ts/skr.api.d.ts +91 -22
- package/dist_ts/skr.api.js +357 -42
- package/dist_ts/skr.balances.d.ts +28 -0
- package/dist_ts/skr.balances.js +96 -0
- package/dist_ts/skr.classes.journalentry.d.ts +19 -3
- package/dist_ts/skr.classes.journalentry.js +67 -4
- package/dist_ts/skr.classes.reports.js +49 -102
- package/dist_ts/skr.database.d.ts +2 -0
- package/dist_ts/skr.database.js +1 -1
- package/dist_ts/skr.errors.d.ts +18 -0
- package/dist_ts/skr.errors.js +34 -0
- package/dist_ts/skr.export.js +4 -7
- package/dist_ts/skr.invoice.adapter.d.ts +15 -1
- package/dist_ts/skr.invoice.adapter.js +253 -41
- package/dist_ts/skr.invoice.booking.js +14 -28
- package/dist_ts/skr.migrate.d.ts +20 -0
- package/dist_ts/skr.migrate.js +223 -0
- package/dist_ts/skr.period.d.ts +47 -0
- package/dist_ts/skr.period.js +95 -0
- package/dist_ts/skr.posting.d.ts +74 -0
- package/dist_ts/skr.posting.js +209 -0
- package/dist_ts/skr.security.d.ts +6 -9
- package/dist_ts/skr.security.js +16 -89
- package/dist_ts/skr.sequence.d.ts +32 -0
- package/dist_ts/skr.sequence.js +51 -0
- package/dist_ts/skr.txview.d.ts +46 -0
- package/dist_ts/skr.txview.js +235 -0
- package/dist_ts/skr.types.d.ts +35 -1
- package/dist_ts/skr.verify.d.ts +13 -0
- package/dist_ts/skr.verify.js +84 -0
- package/package.json +21 -24
- package/readme.hints.md +37 -0
- package/readme.md +94 -1
- package/readme.plan.md +180 -243
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/core/core.accountpolicy.ts +154 -0
- package/ts/core/core.bukeys.ts +146 -0
- package/ts/core/core.datev.captions.ts +133 -0
- package/ts/core/core.datev.ts +174 -0
- package/ts/core/core.hash.ts +76 -0
- package/ts/core/core.plugins.ts +9 -0
- package/ts/core/core.recipes.ts +659 -0
- package/ts/core/core.taxscenario.ts +156 -0
- package/ts/core/core.types.ts +74 -0
- package/ts/core/core.validate.ts +119 -0
- package/ts/core/index.ts +15 -0
- package/ts/index.ts +31 -0
- package/ts/plugins.ts +4 -0
- package/ts/skr.api.ts +432 -46
- package/ts/skr.balances.ts +127 -0
- package/ts/skr.classes.journalentry.ts +54 -5
- package/ts/skr.classes.reports.ts +54 -126
- package/ts/skr.database.ts +3 -0
- package/ts/skr.errors.ts +44 -0
- package/ts/skr.export.ts +3 -6
- package/ts/skr.invoice.adapter.ts +291 -45
- package/ts/skr.invoice.booking.ts +22 -34
- package/ts/skr.migrate.ts +268 -0
- package/ts/skr.period.ts +139 -0
- package/ts/skr.posting.ts +273 -0
- package/ts/skr.security.ts +18 -93
- package/ts/skr.sequence.ts +89 -0
- package/ts/skr.txview.ts +268 -0
- package/ts/skr.types.ts +37 -1
- package/ts/skr.verify.ts +99 -0
- /package/{license.md → license} +0 -0
package/readme.plan.md
CHANGED
|
@@ -1,243 +1,180 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
`
|
|
6
|
-
|
|
7
|
-
##
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
-
|
|
66
|
-
|
|
67
|
-
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
-
|
|
84
|
-
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
###
|
|
96
|
-
|
|
97
|
-
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
###
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
-
|
|
181
|
-
- [ ] Test API pagination
|
|
182
|
-
- [ ] Test API error handling
|
|
183
|
-
|
|
184
|
-
### Phase 9: Documentation
|
|
185
|
-
|
|
186
|
-
- [ ] Update readme.md with comprehensive documentation
|
|
187
|
-
- [ ] Installation instructions
|
|
188
|
-
- [ ] Quick start guide
|
|
189
|
-
- [ ] API reference
|
|
190
|
-
- [ ] SKR03 vs SKR04 explanation
|
|
191
|
-
- [ ] Code examples
|
|
192
|
-
- [ ] Add inline JSDoc comments to all classes and methods
|
|
193
|
-
- [ ] Create example usage files
|
|
194
|
-
- [ ] Document CSV import/export format
|
|
195
|
-
- [ ] Document DATEV compatibility
|
|
196
|
-
|
|
197
|
-
### Phase 10: Build and Quality
|
|
198
|
-
|
|
199
|
-
- [ ] Run pnpm build and fix any TypeScript errors
|
|
200
|
-
- [ ] Run pnpm test and ensure all tests pass
|
|
201
|
-
- [ ] Check for missing type definitions
|
|
202
|
-
- [ ] Optimize database indexes
|
|
203
|
-
- [ ] Add data validation and error handling
|
|
204
|
-
- [ ] Performance testing with large datasets
|
|
205
|
-
- [ ] Security review for data access
|
|
206
|
-
|
|
207
|
-
### Phase 11: Advanced Features
|
|
208
|
-
|
|
209
|
-
- [ ] Add multi-currency support
|
|
210
|
-
- [ ] Add VAT/tax calculation helpers
|
|
211
|
-
- [ ] Add cost center accounting
|
|
212
|
-
- [ ] Add budget management
|
|
213
|
-
- [ ] Add audit trail functionality
|
|
214
|
-
- [ ] Add data migration tools
|
|
215
|
-
- [ ] Add backup/restore functionality
|
|
216
|
-
|
|
217
|
-
### Phase 12: Finalization
|
|
218
|
-
|
|
219
|
-
- [ ] Final code review
|
|
220
|
-
- [ ] Update all documentation
|
|
221
|
-
- [ ] Create migration guide from other systems
|
|
222
|
-
- [ ] Prepare for npm publication
|
|
223
|
-
- [ ] Create changelog
|
|
224
|
-
- [ ] Tag version 1.0.0
|
|
225
|
-
|
|
226
|
-
## Notes
|
|
227
|
-
|
|
228
|
-
- SKR03 uses process structure principle (operating procedures)
|
|
229
|
-
- SKR04 uses financial classification principle (financial statements)
|
|
230
|
-
- Account numbers are 4-digit (0000-9999)
|
|
231
|
-
- Must maintain double-entry bookkeeping rules
|
|
232
|
-
- Use @push.rocks/smartdata for all database operations
|
|
233
|
-
- Follow existing code patterns from @push.rocks modules
|
|
234
|
-
- Test with @git.zone/tstest using expect from tapbundle
|
|
235
|
-
|
|
236
|
-
## Success Criteria
|
|
237
|
-
|
|
238
|
-
- [ ] All account classes (0-9) implemented for both SKR03 and SKR04
|
|
239
|
-
- [ ] Double-entry bookkeeping validation working
|
|
240
|
-
- [ ] Reports generating correctly
|
|
241
|
-
- [ ] All tests passing
|
|
242
|
-
- [ ] TypeScript compilation successful
|
|
243
|
-
- [ ] Documentation complete
|
|
1
|
+
# fin.cx Accounting Program — "No External Tax Accountant"
|
|
2
|
+
|
|
3
|
+
Program-level plan anchored in @fin.cx/skr. Supersedes the original build checklist
|
|
4
|
+
(that scaffold was stale; the package is long past it — see changelog).
|
|
5
|
+
Status source of truth for current findings: `readme.hints.md`.
|
|
6
|
+
|
|
7
|
+
## Context
|
|
8
|
+
|
|
9
|
+
Run German company books end-to-end — bookkeeping, VAT filings, year-end — without an
|
|
10
|
+
external Steuerberater for the mechanical work. skr v1.x is a solid bookkeeping core but
|
|
11
|
+
not filing-grade: float money with 0.01-epsilon balance checks, non-atomic 3-write
|
|
12
|
+
posting, no GoBD Festschreibung (mutable docs, non-gapless numbering, no audit trail),
|
|
13
|
+
6 BU keys, ~110-account chart subsets, non-importable DATEV export stub, no stateless
|
|
14
|
+
booking API, and zero filing coverage (ELSTER/E-Bilanz/HGB statements/OPOS/
|
|
15
|
+
Anlagenbuchhaltung/bank reconciliation).
|
|
16
|
+
|
|
17
|
+
**Critical path:** skr v2 hardening → complete FiBu → UStVA via ELSTER (removes monthly
|
|
18
|
+
StB dependency) → E-Bilanz + HGB year-end (removes annual dependency).
|
|
19
|
+
|
|
20
|
+
## Decisions (assumptions where user confirmation pending)
|
|
21
|
+
|
|
22
|
+
1. Full program roadmap; each milestone gets its own detailed plan when it starts.
|
|
23
|
+
2. Own company books first; APIs product-grade; multi-tenant/RBAC deferred.
|
|
24
|
+
3. ELSTER owned: ERiC native lib via @git.zone/tsrust + @push.rocks/smartrust →
|
|
25
|
+
`@fin.cx/elster`.
|
|
26
|
+
4. Full SKR03/04 + E-Bilanz taxonomy mapping from public sources (no DATEV license);
|
|
27
|
+
legal review before public release.
|
|
28
|
+
5. Payroll OUT of scope (integrate provider, import GL postings).
|
|
29
|
+
6. Statutory WP audit (§316 HGB) out of scope by law. Goal = "StB consulted on judgment
|
|
30
|
+
calls only".
|
|
31
|
+
|
|
32
|
+
## Calendar anchors (from 2026-07-09, FY = calendar year)
|
|
33
|
+
|
|
34
|
+
UStVA parallel-run 09–11/2026 → first live self-filed UStVA 12/2026 or 01/2027 →
|
|
35
|
+
FY2026 Jahresabschluss self-prepared H1 2027 (one paid StB review as backstop;
|
|
36
|
+
KSt/GewSt/UStJE deadline ~31 Jul 2027; Offenlegung 31 Dec 2027) → fully solo from FY2027.
|
|
37
|
+
|
|
38
|
+
**Week-0 actions (hard external clocks, user):**
|
|
39
|
+
1. ELSTER developer registration (Bayerisches LfSt) → Hersteller-ID + ERiC access
|
|
40
|
+
(days–4 wks).
|
|
41
|
+
2. Confirm/obtain ELSTER Organisationszertifikat for TVC GmbH (post, 1–2 wks).
|
|
42
|
+
3. Bundesanzeiger/Unternehmensregister publisher registration.
|
|
43
|
+
|
|
44
|
+
## Milestones
|
|
45
|
+
|
|
46
|
+
### M0 — skr v2.0.0 core hardening (foundation; blocks B, C2, D, E1)
|
|
47
|
+
|
|
48
|
+
After **@fin.cx/calculation v1.1.0** (cents module — RELEASED 2026-07-09 ✓).
|
|
49
|
+
|
|
50
|
+
- **Money:** ledger amounts = integer cents (`TCents`); exact `===` balance checks.
|
|
51
|
+
Fractional math via calculation cents module (`vatFromNetCents`, `splitGrossCents`
|
|
52
|
+
with net+vat===gross guarantee, `allocateCents` largest-remainder, `convertCents`,
|
|
53
|
+
`centsFromFloat` with drift guard). ROUND_HALF_UP = kaufmännisches Runden.
|
|
54
|
+
- **Stateless core `ts/core/`** (imports only @fin.cx/calculation + each other):
|
|
55
|
+
`core.types.ts` (IJournalDraft/IJournalLineDraft with explicit per-line Gegenkonto;
|
|
56
|
+
TBuKey as string union; TTaxScenario), `core.bukeys.ts` (full BU table from official
|
|
57
|
+
DATEV Steuerschlüssel docs — v1 table + finance.plus logic both suspect, do not copy
|
|
58
|
+
blind), `core.taxscenario.ts` (confidence-scored cascade), `core.accountpolicy.ts`
|
|
59
|
+
(IAccountPolicy + SKR03/04 defaults incl. Geldtransit, FX gain/loss, rounding-diff),
|
|
60
|
+
`core.recipes.ts` (pure builders: vendor/customer invoice incl. reverse-charge +
|
|
61
|
+
intra-EU paired VAT, bank payment clearing with Skonto, internal transfer via
|
|
62
|
+
Geldtransit, suspense book/resolve, FX difference lines), `core.validate.ts`,
|
|
63
|
+
`core.datev.ts` (full Buchungsstapel row model, EXTF 700, buSchluessel on every row),
|
|
64
|
+
`core.hash.ts` (canonical serialization + SHA-256 chain).
|
|
65
|
+
- **Atomic posting:** smartdata 7.1.7 sessions (verified supported). Mongo MUST be a
|
|
66
|
+
replica set; `SkrApi.initialize()` probes and fails hard. `JournalPoster`
|
|
67
|
+
(skr.posting.ts): pre-flight → withTransaction: period-lock re-check, gapless sequence
|
|
68
|
+
via $inc findOneAndUpdate, hash chain CAS on head. JournalEntry = single source of
|
|
69
|
+
truth (v1 Transaction explosion removed; collection frozen as legacy read model).
|
|
70
|
+
Balances recomputed via aggregation (skr.balances.ts); Account.updateBalance deleted
|
|
71
|
+
from posting path.
|
|
72
|
+
- **Festschreibung:** posted == immutable (corrections via Storno only). JournalEntry +=
|
|
73
|
+
sequenceNumber (gapless per skrType+fiscalYear), prevHash/entryHash, finalizedAt,
|
|
74
|
+
status posted|finalized, schemaVersion 2. beforeSave()/delete() throw on mutation of
|
|
75
|
+
hashed docs; reversedBy derived (not stored). LedgerPeriod doc + festschreibePeriod();
|
|
76
|
+
closePeriod() posts P&L-zero entries then festschreibt. verifyHashChain() in
|
|
77
|
+
skr.verify.ts. SecurityManager: keep CAdES-B; RFC-3161 stub → loud NotImplementedError;
|
|
78
|
+
fix require('crypto') ESM bug in skr.export.ts.
|
|
79
|
+
- **Migration** (idempotent, offline, float fields kept): M001 cents backfill (abort on
|
|
80
|
+
drift > 0.5 cent) → M002 unify legacy Transactions into synthesized JournalEntries →
|
|
81
|
+
M003 sequence + chain assignment + operator-confirmed festschreiben. JSON report.
|
|
82
|
+
- **Phases (status 2026-07-09):** (0) replica-set env ✓ (gitzone services ≥2.23.0),
|
|
83
|
+
EXTF-700/v13 layout ✓ (verified vs DATEV-importable reference; official
|
|
84
|
+
Steuerschlüssel doc 0904313 portal-gated → manual import check per RC remains) →
|
|
85
|
+
(1) calculation v1.1.1 ✓ released → (2) stateless core ✓ → (3) persistence
|
|
86
|
+
hardening ✓ → (4) facade/reports rewiring + security descope ✓ →
|
|
87
|
+
(5) migrations + docs + v2.0.0 release ✓. **M0 COMPLETE** except the standing
|
|
88
|
+
per-RC manual DATEV import validation.
|
|
89
|
+
- **Tests:** recipe goldens (both charts, exact cents), byte-exact EXTF files, property
|
|
90
|
+
tests (seeded PRNG), concurrency (N parallel posts → gapless, chain verifies, exact
|
|
91
|
+
trial balance), locked-period race, immutability throws, txn-abort no-partials,
|
|
92
|
+
migration round-trip; existing 65 tests green minus documented divergences; manual
|
|
93
|
+
DATEV import check per RC.
|
|
94
|
+
|
|
95
|
+
### M-A — `@fin.cx/chartdata` (new pkg; parallel to M0)
|
|
96
|
+
|
|
97
|
+
Year-versioned full SKR03/04: account master, Automatikkonto functions + allowed BU keys,
|
|
98
|
+
UStVA-Kennzahl / HGB §266/§275 / E-Bilanz (de-gaap-ci) mappings. Pure data + lookup API;
|
|
99
|
+
`getMappingCoverage()` fails loudly. Pipeline in unpublished tools/ (public sources,
|
|
100
|
+
provenance per record). A1 chart+Automatik+Kennzahlen → A2 HGB → A3 E-Bilanz taxonomy
|
|
101
|
+
(esteuer.de). Own-books account coverage first. Verify: schema checks, cross-diff vs
|
|
102
|
+
Kivitendo/Odoo l10n_de (reviewed, not copied), SKR PDF spot checks, ERiC as E-Bilanz
|
|
103
|
+
oracle. Legal review before public MIT release.
|
|
104
|
+
|
|
105
|
+
### M-B — Subledgers + reconciliation
|
|
106
|
+
|
|
107
|
+
B1 `@fin.cx/camt` (CAMT.052/053/054; MT940 = legacy) + `@fin.cx/bankrec` (canonical
|
|
108
|
+
decimal bank txn with SEPA refs, adapters, balance-chain continuity, confidence-scored
|
|
109
|
+
matching, auto-post above threshold, review queue below). B2 OPOS inside skr (ts/opos/:
|
|
110
|
+
masters, open items, clearItems with Skonto+VAT correction, aging, dunning states;
|
|
111
|
+
invariant: subledger == control account). B3 `@fin.cx/assets` (AfA schedules from BMF
|
|
112
|
+
tables, GWG/degressive as year-keyed policy, Anlagespiegel → D1). B1 before live UStVA;
|
|
113
|
+
B2/B3 may trail.
|
|
114
|
+
|
|
115
|
+
### M-C — `@fin.cx/elster` (ERiC via Rust bridge) — first-win lane
|
|
116
|
+
|
|
117
|
+
Thin transport: validate / submitTest (Testmerker) / submitLive / confirmation PDF.
|
|
118
|
+
Rust binary dlopens ERiC from operator-supplied ERIC_HOME (ERiC never enters npm/repo;
|
|
119
|
+
version-compat matrix + checksum gate). Kennzahl computation in `@fin.cx/tax` (VAT module
|
|
120
|
+
ships early). C1 bridge → C2 UStVA 3-month parallel-run (3 consecutive zero/explained-diff
|
|
121
|
+
months required) → C2' live + E1 → C3 DFV/ZM/UStJE.
|
|
122
|
+
|
|
123
|
+
### M-D — Year-end (`@fin.cx/jahresabschluss` + `@fin.cx/tax`, Q1–Q2 2027)
|
|
124
|
+
|
|
125
|
+
D1 §266/§275 Gliederung + §267 size classes + Anhang skeleton + Anlagespiegel. D3 tax
|
|
126
|
+
engine (§4(5) EStG, §8b KStG, GewSt §8/§9 add-backs, loss carryforwards, KSt 15%+Soli,
|
|
127
|
+
GewSt Hebesatz Bremen 460%; provisions posted back to skr). D2 E-Bilanz XBRL writer
|
|
128
|
+
(ERiC validates locally — no heavyweight XBRL lib) via elster. D4 Offenlegung generator +
|
|
129
|
+
checklist (semi-manual upload). Verify: "re-file the past" vs StB-filed prior year +
|
|
130
|
+
Bescheide; tie-outs; paid StB review of first Abschluss.
|
|
131
|
+
|
|
132
|
+
### M-E — Operational readiness (thin, inside skr)
|
|
133
|
+
|
|
134
|
+
E1 Verfahrensdoku generator (ships WITH first live UStVA — GoBD requires from go-live).
|
|
135
|
+
E2 GDPdU/GoBD Z3 Datenträgerüberlassung (Beschreibungsstandard index.xml + IDEA CSVs, on
|
|
136
|
+
BagIt export). E3 retention (10y books, 8y Belege post-2025).
|
|
137
|
+
|
|
138
|
+
## Waves
|
|
139
|
+
|
|
140
|
+
1. **W0 (now):** registrations; A1 pipeline; M0 start. ✓ calculation v1.1.0 released.
|
|
141
|
+
2. **W1 (Jul–Sep 2026):** M0 lands; C1; tax VAT module; A1; B1 MVP; parallel-run from
|
|
142
|
+
09/2026.
|
|
143
|
+
3. **W2 (Q4 2026):** live UStVA + E1 ⇒ monthly StB dependency removed. C3 DFV. B2/B3/A2/A3.
|
|
144
|
+
4. **W3 (Q1–Q2 2027):** D1→D3→D2→D4 for FY2026; StB review ⇒ fully solo from FY2027.
|
|
145
|
+
5. **Continuous:** E2/E3; annual maintenance ~4–8 wks/yr (ERiC Nov release = hard
|
|
146
|
+
calendar item; taxonomy bump; form-year schemas; year-keyed tax parameters).
|
|
147
|
+
|
|
148
|
+
## Top risks
|
|
149
|
+
|
|
150
|
+
1. Incorrect live filing → parallel-run gate, re-file-the-past regression, ERiC+Testmerker
|
|
151
|
+
CI, human sign-off, StB review yr 1.
|
|
152
|
+
2. ERiC licensing/platform (non-redistributable; ARM64 TBD) → ERIC_HOME + compat matrix;
|
|
153
|
+
x86_64 first.
|
|
154
|
+
3. DATEV database rights on chart data → multi-source, provenance, legal review.
|
|
155
|
+
4. Completeness failures → balance-chain continuity as monthly-close gate; OPOS
|
|
156
|
+
invariants.
|
|
157
|
+
5. Regulatory churn → year-keyed data concentrated in chartdata+elster; DATEV export as
|
|
158
|
+
permanent escape hatch.
|
|
159
|
+
|
|
160
|
+
## Open questions (user)
|
|
161
|
+
|
|
162
|
+
1. Location of `fin-accountingbackend` repo (not on this machine; finance.plus used as
|
|
163
|
+
reference).
|
|
164
|
+
2. ELSTER Organisationszertifikat present? Dauerfristverlängerung in place?
|
|
165
|
+
3. **Ist- oder Soll-Versteuerung (§20 UStG)?** Blocks Wave-1 VAT engine design.
|
|
166
|
+
4. Intra-EU B2B supplies (ZM needed)?
|
|
167
|
+
5. elster deployment host architecture (ERiC aarch64 TBD)?
|
|
168
|
+
6. chartdata public MIT immediately or after legal review?
|
|
169
|
+
7. Beleg archival: doclake vs skr export bundles?
|
|
170
|
+
8. StB cooperation for parallel-run (filed Kennzahlen + prior-year working papers)?
|
|
171
|
+
9. Festschreibung: posted==immutable OK, or correction window until UStVA submission?
|
|
172
|
+
10. RFC-3161 descope in M0 OK (loud failure instead of fake stub)?
|
|
173
|
+
11. One company per DB confirmed (sequences keyed skrType+fiscalYear)?
|
|
174
|
+
|
|
175
|
+
## Program gates
|
|
176
|
+
|
|
177
|
+
- **Gate 1 (before live UStVA):** 3 zero/explained-diff parallel months + B1 continuity
|
|
178
|
+
green + E1 published.
|
|
179
|
+
- **Gate 2 (before FY2026 self-filing):** re-file-the-past matches StB filings +
|
|
180
|
+
Bescheide; ERiC-valid E-Bilanz; StB review sign-off.
|
package/ts/00_commitinfo_data.ts
CHANGED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Account policy: which accounts a booking recipe uses for a given SKR chart.
|
|
3
|
+
* Defaults reflect the DATEV standard charts; entries marked PROVISIONAL are
|
|
4
|
+
* pattern-derived and get verified against the full chart data in M-A
|
|
5
|
+
* (@fin.cx/chartdata). Everything is overridable per call.
|
|
6
|
+
*/
|
|
7
|
+
import type { TSKRType } from './core.types.js';
|
|
8
|
+
|
|
9
|
+
export interface IAccountPolicy {
|
|
10
|
+
skrType: TSKRType;
|
|
11
|
+
bank: string;
|
|
12
|
+
cash: string;
|
|
13
|
+
/** Sammelkonten — direct postings are blocked; use personal accounts. */
|
|
14
|
+
debtorsControl: string;
|
|
15
|
+
creditorsControl: string;
|
|
16
|
+
/** Suspense for unclear payments (Durchlaufende Posten). */
|
|
17
|
+
clearing: string;
|
|
18
|
+
/** Interim account for bank-to-bank transfers. */
|
|
19
|
+
geldtransit: string;
|
|
20
|
+
vat: {
|
|
21
|
+
outputStandard: string;
|
|
22
|
+
outputReduced: string;
|
|
23
|
+
inputStandard: string;
|
|
24
|
+
inputReduced: string;
|
|
25
|
+
intraEuAcqInput: string;
|
|
26
|
+
intraEuAcqOutput: string;
|
|
27
|
+
reverseChargeInput: string;
|
|
28
|
+
reverseChargeOutput: string;
|
|
29
|
+
};
|
|
30
|
+
revenue: {
|
|
31
|
+
domesticStandard: string;
|
|
32
|
+
domesticReduced: string;
|
|
33
|
+
intraEuSupply: string;
|
|
34
|
+
export: string;
|
|
35
|
+
reverseCharge: string;
|
|
36
|
+
};
|
|
37
|
+
expenseDefault: string;
|
|
38
|
+
skonto: {
|
|
39
|
+
/** erhaltene Skonti (purchases) — Automatikkonten with VSt correction */
|
|
40
|
+
receivedStandard: string;
|
|
41
|
+
receivedReduced: string;
|
|
42
|
+
/** gewährte Skonti (sales) — Automatikkonten with USt correction */
|
|
43
|
+
grantedStandard: string;
|
|
44
|
+
grantedReduced: string;
|
|
45
|
+
};
|
|
46
|
+
fx: { gain: string; loss: string };
|
|
47
|
+
/** Small payment-difference write-offs (PROVISIONAL: generic sonstige Erträge/Aufwendungen). */
|
|
48
|
+
roundingDiff: { gain: string; loss: string };
|
|
49
|
+
debtorRange: [number, number];
|
|
50
|
+
creditorRange: [number, number];
|
|
51
|
+
/**
|
|
52
|
+
* Accounts with built-in DATEV tax automatism. Lines on these accounts must
|
|
53
|
+
* carry no BU key ('' — automatism applies) or key 40 (automatism cancelled).
|
|
54
|
+
*/
|
|
55
|
+
automatikkonten: string[];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export const SKR03_DEFAULT_POLICY: IAccountPolicy = {
|
|
59
|
+
skrType: 'SKR03',
|
|
60
|
+
bank: '1200',
|
|
61
|
+
cash: '1000',
|
|
62
|
+
debtorsControl: '1400',
|
|
63
|
+
creditorsControl: '1600',
|
|
64
|
+
clearing: '1590',
|
|
65
|
+
geldtransit: '1360',
|
|
66
|
+
vat: {
|
|
67
|
+
outputStandard: '1776',
|
|
68
|
+
outputReduced: '1771',
|
|
69
|
+
inputStandard: '1576',
|
|
70
|
+
inputReduced: '1571',
|
|
71
|
+
intraEuAcqInput: '1574',
|
|
72
|
+
intraEuAcqOutput: '1784',
|
|
73
|
+
reverseChargeInput: '1577',
|
|
74
|
+
reverseChargeOutput: '1787',
|
|
75
|
+
},
|
|
76
|
+
revenue: {
|
|
77
|
+
domesticStandard: '8400',
|
|
78
|
+
domesticReduced: '8300',
|
|
79
|
+
intraEuSupply: '8125',
|
|
80
|
+
export: '8120',
|
|
81
|
+
reverseCharge: '8337',
|
|
82
|
+
},
|
|
83
|
+
expenseDefault: '4980',
|
|
84
|
+
skonto: {
|
|
85
|
+
receivedStandard: '3736',
|
|
86
|
+
receivedReduced: '3731', // PROVISIONAL
|
|
87
|
+
grantedStandard: '8736',
|
|
88
|
+
grantedReduced: '8731', // PROVISIONAL
|
|
89
|
+
},
|
|
90
|
+
fx: { gain: '2660', loss: '2150' },
|
|
91
|
+
roundingDiff: { gain: '2700', loss: '2300' }, // PROVISIONAL
|
|
92
|
+
debtorRange: [10000, 69999],
|
|
93
|
+
creditorRange: [70000, 99999],
|
|
94
|
+
automatikkonten: ['8400', '8300', '8125', '8120', '3400', '3300', '3736', '3731', '8736', '8731'],
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export const SKR04_DEFAULT_POLICY: IAccountPolicy = {
|
|
98
|
+
skrType: 'SKR04',
|
|
99
|
+
bank: '1800',
|
|
100
|
+
cash: '1600',
|
|
101
|
+
debtorsControl: '1200',
|
|
102
|
+
creditorsControl: '3300',
|
|
103
|
+
clearing: '3290',
|
|
104
|
+
geldtransit: '1460',
|
|
105
|
+
vat: {
|
|
106
|
+
outputStandard: '3806',
|
|
107
|
+
outputReduced: '3801',
|
|
108
|
+
inputStandard: '1406',
|
|
109
|
+
inputReduced: '1401',
|
|
110
|
+
intraEuAcqInput: '1404',
|
|
111
|
+
intraEuAcqOutput: '3804',
|
|
112
|
+
reverseChargeInput: '1407',
|
|
113
|
+
reverseChargeOutput: '3837',
|
|
114
|
+
},
|
|
115
|
+
revenue: {
|
|
116
|
+
domesticStandard: '4400',
|
|
117
|
+
domesticReduced: '4300',
|
|
118
|
+
intraEuSupply: '4125',
|
|
119
|
+
export: '4120',
|
|
120
|
+
reverseCharge: '4337',
|
|
121
|
+
},
|
|
122
|
+
expenseDefault: '6980',
|
|
123
|
+
skonto: {
|
|
124
|
+
receivedStandard: '5736',
|
|
125
|
+
receivedReduced: '5731', // PROVISIONAL
|
|
126
|
+
grantedStandard: '4736',
|
|
127
|
+
grantedReduced: '4731', // PROVISIONAL
|
|
128
|
+
},
|
|
129
|
+
fx: { gain: '4840', loss: '6880' },
|
|
130
|
+
roundingDiff: { gain: '4830', loss: '6300' }, // PROVISIONAL
|
|
131
|
+
debtorRange: [10000, 69999],
|
|
132
|
+
creditorRange: [70000, 99999],
|
|
133
|
+
automatikkonten: ['4400', '4300', '4125', '4120', '5400', '5300', '5736', '5731', '4736', '4731'],
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
export function getDefaultPolicy(skrType: TSKRType): IAccountPolicy {
|
|
137
|
+
return skrType === 'SKR03' ? SKR03_DEFAULT_POLICY : SKR04_DEFAULT_POLICY;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export function isAutomatikAccount(policy: IAccountPolicy, accountNumber: string): boolean {
|
|
141
|
+
return policy.automatikkonten.includes(accountNumber);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export function isDebtorAccount(policy: IAccountPolicy, accountNumber: string): boolean {
|
|
145
|
+
const parsed = Number.parseInt(accountNumber, 10);
|
|
146
|
+
return Number.isInteger(parsed) && parsed >= policy.debtorRange[0] && parsed <= policy.debtorRange[1];
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export function isCreditorAccount(policy: IAccountPolicy, accountNumber: string): boolean {
|
|
150
|
+
const parsed = Number.parseInt(accountNumber, 10);
|
|
151
|
+
return (
|
|
152
|
+
Number.isInteger(parsed) && parsed >= policy.creditorRange[0] && parsed <= policy.creditorRange[1]
|
|
153
|
+
);
|
|
154
|
+
}
|