@fin.cx/chartdata 2.13.0 → 2.15.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.
@@ -16,6 +16,83 @@ export type TAccountType = 'asset' | 'liability' | 'equity' | 'revenue' | 'expen
16
16
  */
17
17
  export type TAccountRole = 'asset_sale_proceeds' | 'disposal_book_value';
18
18
 
19
+ /**
20
+ * What an account books of a business's securities (Wertpapiere): holding
21
+ * them, their income, their sale, their valuation at a closing date and the
22
+ * taxes withheld from their income. A booking of securities finds its
23
+ * account by this role together with the account's `taxRule`: within a
24
+ * chart, no two accounts share both.
25
+ * - holdings, by the balance-sheet item (§ 266 Abs. 2 HGB):
26
+ * 'holding_fixed' (Wertpapiere des Anlagevermögens, A.III.5),
27
+ * 'holding_fixed_shares' (those whose income falls under the
28
+ * Teileinkünfteverfahren, A.III.5), 'holding_fixed_bonds' (fixed-interest
29
+ * ones, A.III.5), 'holding_current' (sonstige Wertpapiere, B.III.2);
30
+ * - their income (dividends, distributions, coupons) by whether the
31
+ * securities are fixed or current assets: 'income_fixed', 'income_current';
32
+ * - the sale of current assets, stated net: 'sale_gain_current',
33
+ * 'sale_loss_current';
34
+ * - the sale of fixed assets, stated gross on the accounts of a fixed asset's
35
+ * disposal (`accountRole`): what it fetched, 'sale_proceeds_fixed_gain' and
36
+ * 'sale_proceeds_fixed_loss', and the book value it leaves the books with,
37
+ * 'book_value_fixed_gain' and 'book_value_fixed_loss', by whether the sale
38
+ * makes a book gain or a book loss;
39
+ * - the costs of a sale DATEV states apart, 'sale_costs_gain' and
40
+ * 'sale_costs_loss' (§ 8b Abs. 2 Satz 2 KStG);
41
+ * - the valuation at a closing date (§ 253 Abs. 3 to 5 HGB): a fixed asset's
42
+ * write-down for a lasting or a temporary decline,
43
+ * 'writedown_fixed_lasting' and 'writedown_fixed_temporary', a current
44
+ * asset's, 'writedown_current', and the write-ups, 'writeup_fixed',
45
+ * 'writeup_current', and 'writeup' where one account takes either;
46
+ * - the taxes withheld from their income: 'capital_gains_tax'
47
+ * (Kapitalertragsteuer) and 'capital_gains_tax_soli' (the Solidaritätszuschlag
48
+ * on it), 'foreign_withholding_tax' (a foreign tax to be credited or
49
+ * deducted), 'foreign_tax_exempt_income' (a foreign tax on income exempt at
50
+ * home), and 'foreign_tax_refund' (a foreign tax to be refunded);
51
+ * - 'margin_interest': the interest on a short-term debt, such as a broker's
52
+ * margin loan.
53
+ */
54
+ export type TSecuritiesRole =
55
+ | 'holding_fixed'
56
+ | 'holding_fixed_shares'
57
+ | 'holding_fixed_bonds'
58
+ | 'holding_current'
59
+ | 'income_fixed'
60
+ | 'income_current'
61
+ | 'sale_gain_current'
62
+ | 'sale_loss_current'
63
+ | 'sale_proceeds_fixed_gain'
64
+ | 'sale_proceeds_fixed_loss'
65
+ | 'book_value_fixed_gain'
66
+ | 'book_value_fixed_loss'
67
+ | 'sale_costs_gain'
68
+ | 'sale_costs_loss'
69
+ | 'writedown_fixed_lasting'
70
+ | 'writedown_fixed_temporary'
71
+ | 'writedown_current'
72
+ | 'writeup_fixed'
73
+ | 'writeup_current'
74
+ | 'writeup'
75
+ | 'capital_gains_tax'
76
+ | 'capital_gains_tax_soli'
77
+ | 'foreign_withholding_tax'
78
+ | 'foreign_tax_exempt_income'
79
+ | 'foreign_tax_refund'
80
+ | 'margin_interest';
81
+
82
+ /**
83
+ * A rule of the income tax law an income or expense account is kept for, as
84
+ * its DATEV name states it:
85
+ * - 'estg_3_40_kstg_8b': income from shares and the expenses of it under the
86
+ * Teileinkünfteverfahren (§ 3 Nr. 40, § 3c Abs. 2 EStG) or, for a
87
+ * corporation, § 8b KStG — DATEV names these accounts "§ 3 Nr. 40 EStG bzw.
88
+ * § 8b … KStG". DATEV's interface to the corporate income tax treats their
89
+ * income as 100 % tax-free and their expenses as 100 % non-deductible, its
90
+ * interface to the trade tax 40 % each (Kontenrahmen SKR 03 and SKR 04,
91
+ * gültig für 2026, footnote 9); the corrections are made in the return, not
92
+ * in the books.
93
+ */
94
+ export type TTaxRule = 'estg_3_40_kstg_8b';
95
+
19
96
  /**
20
97
  * Built-in DATEV tax automatism of an account. Lines on automatik accounts
21
98
  * must carry no BU key (automatism applies) or key 40 (automatism cancelled).
@@ -35,6 +112,107 @@ export interface IUstvaMapping {
35
112
  role: 'base' | 'tax';
36
113
  }
37
114
 
115
+ /**
116
+ * Where an account's movements go in the Anlage EÜR (the standardised
117
+ * Einnahmenüberschussrechnung, § 60 Abs. 4 EStDV), by the Kennzahl of the
118
+ * form's line (`ANLAGE_EUER_FORMS`; the line number itself changes with the
119
+ * form year, the Kennzahl does not):
120
+ * - `{ kennzahl }`: the movements of both sides, netted toward the line's own
121
+ * side: a line of receipts counts credits less debits (a sales deduction
122
+ * lowers the receipts), a line of expenses debits less credits (a received
123
+ * discount lowers the goods);
124
+ * - `{ debitKennzahl, creditKennzahl }`: each side on a line of its own, not
125
+ * netted: the VAT paid to the tax office (Kz 186) and the VAT it refunded
126
+ * (Kz 141) on one account.
127
+ */
128
+ export type TEuerMapping = { kennzahl: number } | { debitKennzahl: number; creditKennzahl: number };
129
+
130
+ /**
131
+ * Why an account's movements are no part of the Anlage EÜR, which counts
132
+ * receipts and expenses when paid (§ 4 Abs. 3, § 11 EStG):
133
+ * - 'balance_sheet': a payment moves between the business's own money, claims
134
+ * and debts (bank, cash, receivables, payables, loans, provisions, equity);
135
+ * - 'fixed_asset': a fixed asset's cost reaches the form through its
136
+ * depreciation and, at its disposal, its residual book value (AfA, GWG,
137
+ * Restbuchwerte), not through the asset account;
138
+ * - 'inventory': stock and its changes: goods count when paid, and a
139
+ * cash-basis book keeps no inventory;
140
+ * - 'valuation': a value at a closing date, which a cash-basis book does not
141
+ * state (currency revaluation, the valuation of the cash funds);
142
+ * - 'pass_through': durchlaufende Posten, received and spent in another's name
143
+ * and for another's account (§ 4 Abs. 3 Satz 2 EStG);
144
+ * - 'reverse_charge': the tax a recipient owes on an intra-Community
145
+ * acquisition or under § 13b UStG and deducts as input tax in the same
146
+ * return: no receipt and no payment of its own (Anleitung zur Anlage EÜR,
147
+ * Zeile 58); what a return leaves to pay counts as paid VAT (Kz 186);
148
+ * - 'closing': a carry-forward, closing or statistical account, which records
149
+ * no business transaction;
150
+ * - 'deferred_current_asset': a current asset named in § 4 Abs. 3 Satz 4
151
+ * EStG — shares, securities, land and buildings —, whose cost counts only
152
+ * when its sale's proceeds are received or it is withdrawn, as goods
153
+ * (Zeile 29, Kz 100), through the list of such assets in the Anlage AVEÜR
154
+ * (Zeilen 93 bis 96), not when it is paid.
155
+ */
156
+ export type TEuerExclusion =
157
+ | 'balance_sheet'
158
+ | 'fixed_asset'
159
+ | 'inventory'
160
+ | 'valuation'
161
+ | 'pass_through'
162
+ | 'reverse_charge'
163
+ | 'closing'
164
+ | 'deferred_current_asset';
165
+
166
+ /**
167
+ * The part of the Anlage EÜR a line belongs to: Betriebseinnahmen (Zeilen
168
+ * 12 bis 22), Betriebsausgaben (Zeilen 24 bis 76 of the 2026 form), or the
169
+ * private Entnahmen and Einlagen of a sole proprietor (Zeilen 107 and 108).
170
+ */
171
+ export type TEuerSection = 'income' | 'expense' | 'private';
172
+
173
+ /** One line of the Anlage EÜR of a form year that an account's movements can go to. */
174
+ export interface IEuerFormLine {
175
+ /**
176
+ * The line's Kennzahl on the form. Unique among the lines of a form's
177
+ * table; the form reuses some numbers in its general and closing sections,
178
+ * which the table does not hold.
179
+ */
180
+ kennzahl: number;
181
+ /** the line ("Zeile") on the year's form */
182
+ line: number;
183
+ /** the line's text on the form; a line of two columns names its column ("nicht abziehbar", "abziehbar") */
184
+ label: string;
185
+ section: TEuerSection;
186
+ /**
187
+ * How the line enters its section's sum (Zeilen 23 and 76): 1 adds, -1
188
+ * subtracts (the travel to the first place of business, Zeile 73, and the
189
+ * non-deductible amounts, Zeile 75), 0 not at all (a "davon" line, the
190
+ * column "nicht abziehbar", the Entnahmen and Einlagen).
191
+ */
192
+ sign: 1 | -1 | 0;
193
+ /** the side whose movements the line counts, net of the other: receipts and Einlagen credit, expenses and Entnahmen debit */
194
+ side: 'debit' | 'credit';
195
+ }
196
+
197
+ /** The lines of the Anlage EÜR of one form year, as the BMF published the form. */
198
+ export interface IEuerForm {
199
+ year: number;
200
+ lines: IEuerFormLine[];
201
+ /** the published form these lines were read from */
202
+ provenance: string;
203
+ }
204
+
205
+ /**
206
+ * The lines an account's movements go to in a form year:
207
+ * - 'netted': both sides, netted, on one line;
208
+ * - 'split': each side on a line of its own;
209
+ * - 'excluded': none, and why.
210
+ */
211
+ export type TEuerAccountLines =
212
+ | { kind: 'netted'; line: IEuerFormLine }
213
+ | { kind: 'split'; debitLine: IEuerFormLine; creditLine: IEuerFormLine }
214
+ | { kind: 'excluded'; exclusion: TEuerExclusion };
215
+
38
216
  export interface IChartAccount {
39
217
  accountNumber: string;
40
218
  accountName: string;
@@ -42,6 +220,10 @@ export interface IChartAccount {
42
220
  accountType: TAccountType;
43
221
  /** what the account is for beyond its type and HGB position; unset = they say it all */
44
222
  accountRole?: TAccountRole;
223
+ /** what the account books of a business's securities; unset = nothing of its own */
224
+ securitiesRole?: TSecuritiesRole;
225
+ /** the income tax rule the account is kept for, as its DATEV name states it; unset = none of its own */
226
+ taxRule?: TTaxRule;
45
227
  description?: string;
46
228
  automatikFunction?: TAutomatikFunction;
47
229
  /** BU keys allowed on lines of this account ('' = none). Unset = all. */
@@ -53,6 +235,10 @@ export interface IChartAccount {
53
235
  hgb275Position?: string;
54
236
  /** E-Bilanz de-gaap-ci taxonomy position (A3 — not yet populated) */
55
237
  ebilanzPosition?: string;
238
+ /** the Anlage EÜR line(s) the account's movements go to; every account has this or `euerExclusion` */
239
+ euer?: TEuerMapping;
240
+ /** why the account's movements are no part of the Anlage EÜR */
241
+ euerExclusion?: TEuerExclusion;
56
242
  /** where this record's facts come from (source, date) */
57
243
  provenance: string;
58
244
  /** first year this record is valid for */
@@ -66,7 +252,8 @@ export interface IChart {
66
252
  accounts: IChartAccount[];
67
253
  }
68
254
 
69
- export type TMappingDimension = 'ustva' | 'hgb266' | 'hgb275' | 'ebilanz';
255
+ /** 'euer' counts an account covered when it maps to the Anlage EÜR or is excluded from it with a reason. */
256
+ export type TMappingDimension = 'ustva' | 'hgb266' | 'hgb275' | 'ebilanz' | 'euer';
70
257
 
71
258
  export interface IMappingCoverage {
72
259
  dimension: TMappingDimension;