@fin.cx/chartdata 2.14.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fin.cx/chartdata",
3
- "version": "2.14.0",
3
+ "version": "2.15.0",
4
4
  "private": false,
5
5
  "description": "Year-versioned German SKR03/SKR04 chart-of-accounts datasets with Automatikkonto functions, BU-key rules, UStVA-Kennzahl and Anlage EÜR mappings",
6
6
  "main": "dist_ts/index.js",
package/readme.md CHANGED
@@ -27,6 +27,16 @@ For reporting bugs, issues, or security vulnerabilities, please visit [community
27
27
  not tell it apart from the others of its position: a fixed asset's sale
28
28
  proceeds (`asset_sale_proceeds`) and the book value of a disposed fixed
29
29
  asset (`disposal_book_value`), listed per chart by `getAccountsByRole`
30
+ - Securities accounts (Wertpapiere) with their securities role
31
+ (`securitiesRole`): the holdings of fixed and current assets, their income,
32
+ their sale (net for current assets, gross on a Finanzanlage's disposal
33
+ accounts), the costs of a sale, write-downs and write-ups, the taxes withheld
34
+ from their income and the margin interest, listed per chart by
35
+ `getAccountsBySecuritiesRole` and found one by one with `getSecuritiesAccount`
36
+ - The tax rule an income or expense account is kept for (`taxRule`):
37
+ `estg_3_40_kstg_8b` on every account DATEV names "§ 3 Nr. 40 EStG bzw. § 8b …
38
+ KStG", whose income DATEV's corporate-tax interface treats as tax-free and
39
+ whose expenses as non-deductible
30
40
  - Account→Anlage EÜR mappings (`euer`) for the Einnahmenüberschussrechnung
31
41
  (§ 4 Abs. 3 EStG, § 60 Abs. 4 EStDV), with the lines of the 2025 and 2026
32
42
  forms (`ANLAGE_EUER_FORMS`); every account maps or is excluded with its
@@ -75,6 +85,52 @@ getAccountsByRole('SKR04', 2026, 'disposal_book_value').map((account) => account
75
85
  // ['4855', '4856', '4857', '4858', '6895', '6896', '6897', '6898']
76
86
  ```
77
87
 
88
+ ### Securities
89
+
90
+ A booking of securities finds its account by the securities role and the tax
91
+ rule; within a chart no two accounts share both. DATEV keeps an account under
92
+ § 3 Nr. 40 EStG / § 8b KStG beside most ordinary ones (`taxRule:
93
+ 'estg_3_40_kstg_8b'`); whether a dividend or a gain belongs there is the
94
+ booking's decision, not the account's: a holding of less than 10 % at the start
95
+ of the calendar year receives taxable dividends (§ 8b Abs. 4 KStG), while a
96
+ share's sale gain falls under § 8b Abs. 2 KStG whatever the holding.
97
+
98
+ ```ts
99
+ import { getSecuritiesAccount, getAccountsBySecuritiesRole } from '@fin.cx/chartdata';
100
+
101
+ getSecuritiesAccount('SKR04', 2026, 'holding_current')?.accountNumber; // '1510' Sonstige Wertpapiere
102
+ getSecuritiesAccount('SKR04', 2026, 'sale_gain_current', 'estg_3_40_kstg_8b')?.accountNumber; // '4906'
103
+ getSecuritiesAccount('SKR03', 2026, 'income_current')?.accountNumber; // '2654'
104
+ getSecuritiesAccount('SKR03', 2026, 'income_current', 'estg_3_40_kstg_8b')?.accountNumber; // '2655'
105
+ getSecuritiesAccount('SKR03', 2026, 'sale_costs_gain'); // null: DATEV keeps the costs of a sale only under § 8b
106
+ getAccountsBySecuritiesRole('SKR03', 2026, 'sale_proceeds_fixed_gain').map((account) => account.accountNumber);
107
+ // ['8838', '8839']: a Finanzanlage's sale stated gross, on the accounts of a fixed asset's disposal
108
+ ```
109
+
110
+ | Role | What it books | SKR03 | SKR04 |
111
+ | --- | --- | --- | --- |
112
+ | `holding_fixed`, `holding_fixed_shares`, `holding_fixed_bonds` | Wertpapiere des Anlagevermögens (A.III.5) | 0525, 0530, 0535 | 0900, 0910, 0920 |
113
+ | `holding_current` | Sonstige Wertpapiere (B.III.2) | 1348 | 1510 |
114
+ | `income_fixed` / `income_current` | dividends, distributions, coupons (GuV 10 / 11) | 2620 (§ 8b 2625) / 2654 (§ 8b 2655) | 7010 (§ 8b 7014) / 7115 (§ 8b 7103) |
115
+ | `sale_gain_current` / `sale_loss_current` | a current asset's sale, net (GuV 4 / 8) | 2725 (§ 8b 2726) / 2325 (§ 8b 2326) | 4905 (§ 8b 4906) / 6905 (§ 8b 6906) |
116
+ | `sale_proceeds_fixed_*`, `book_value_fixed_*` | a Finanzanlage's sale, gross | 8838/8818, 2317/2312 (§ 8b 8839/8819, 2318/2313) | 4851/6891, 4857/6897 (§ 8b 4852/6892, 4858/6898) |
117
+ | `sale_costs_gain` / `sale_costs_loss` | the costs of a sale under § 8b KStG | 4976 / 4977 | 6857 / 6858 |
118
+ | `writedown_fixed_lasting`, `writedown_fixed_temporary`, `writedown_current` | write-downs (GuV 12) | 4870 (§ 8b 4871), 4866, 4875 (§ 8b 4876) | 7200 (§ 8b 7204), 7201, 7210 (§ 8b 7214) |
119
+ | `writeup_fixed`, `writeup_current`, `writeup` | write-ups (GuV 4) | 2712, 2715, § 8b 2714 | 4912, 4915, § 8b 4914 |
120
+ | `capital_gains_tax`, `capital_gains_tax_soli` | Kapitalertragsteuer and its Solidaritätszuschlag (GuV 14) | 2213, 2216 | 7630, 7633 |
121
+ | `foreign_withholding_tax`, `foreign_tax_exempt_income` | foreign tax to credit or deduct; on income exempt at home (GuV 14) | 2219, 2218 | 7639, 7638 |
122
+ | `foreign_tax_refund` | a foreign tax to be refunded (B.II.4) | 1542 | 1440 |
123
+ | `margin_interest` | interest on a short-term debt (GuV 13) | 2110 | 7310 |
124
+
125
+ None of them carries a tax function or a UStVA figure. In the Anlage EÜR the
126
+ holdings are no part of the form (fixed assets reach it by their residual book
127
+ value, current ones of § 4 Abs. 3 Satz 4 EStG by their cost when sold:
128
+ `deferred_current_asset`); income and gains on sale are receipts free of VAT or
129
+ not taxable for VAT (Kz 103), a loss on sale is cost at the sale (Kz 100), the costs of a
130
+ sale other expenses (Kz 183), write-downs and write-ups values at a closing date
131
+ (`valuation`), the margin interest other debt interest (Kz 234), and the taxes
132
+ on income a withdrawal (Kz 122, § 12 Nr. 3 EStG).
133
+
78
134
  ### Anlage EÜR
79
135
 
80
136
  Every account of a chart either maps to the Anlage EÜR or is excluded from it
@@ -112,7 +168,9 @@ getMappingCoverage('SKR04', 2026, usedAccountNumbers, 'euer').missing; // []
112
168
  `pass_through` (§ 4 Abs. 3 Satz 2 EStG), `reverse_charge` (the tax of an
113
169
  intra-Community acquisition or under § 13b UStG: such invoices contain no
114
170
  input tax, Anleitung zur Anlage EÜR, Zeile 58, and the tax is no receipt;
115
- what a return leaves to pay counts as paid VAT, Kz 186) and `closing`.
171
+ what a return leaves to pay counts as paid VAT, Kz 186), `closing` and
172
+ `deferred_current_asset` (shares, securities, land and buildings held as
173
+ current assets, whose cost counts at their sale, § 4 Abs. 3 Satz 4 EStG).
116
174
  - A line's `sign` says how it enters its section's sum: 1 adds, -1 subtracts
117
175
  (Zeilen 73 and 75), 0 not at all (a "davon" line, the column "nicht
118
176
  abziehbar", the Entnahmen and Einlagen).
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@fin.cx/chartdata',
6
- version: '2.14.0',
6
+ version: '2.15.0',
7
7
  description: 'Year-versioned German SKR03/SKR04 chart-of-accounts datasets with Automatikkonto functions, BU-key rules, UStVA-Kennzahl and Anlage EÜR mappings'
8
8
  }
@@ -7,6 +7,8 @@ import type {
7
7
  TChartName,
8
8
  TEuerAccountLines,
9
9
  TMappingDimension,
10
+ TSecuritiesRole,
11
+ TTaxRule,
10
12
  } from './chartdata.types.js';
11
13
  import { euerLinesOf, type IEuerLinesOptions } from './chartdata.euer.js';
12
14
  import { SKR03_2026 } from './data/skr03.2026.js';
@@ -83,6 +85,34 @@ export function getAccountsByRole(
83
85
  return getChart(chart, year).accounts.filter((account) => account.accountRole === role);
84
86
  }
85
87
 
88
+ /**
89
+ * The accounts of a chart with the securities role (`IChartAccount.securitiesRole`),
90
+ * in the chart's order: one without a tax rule and, where DATEV keeps one apart,
91
+ * one under § 3 Nr. 40 EStG / § 8b KStG. Throws for unknown chart/year
92
+ * combinations, as `getChart`.
93
+ */
94
+ export function getAccountsBySecuritiesRole(
95
+ chart: TChartName,
96
+ year: number,
97
+ role: TSecuritiesRole,
98
+ ): IChartAccount[] {
99
+ return getChart(chart, year).accounts.filter((account) => account.securitiesRole === role);
100
+ }
101
+
102
+ /**
103
+ * The one account of a chart that books the securities role under the tax rule
104
+ * (`taxRule`; none: the account without one), or `null` where the chart keeps
105
+ * none for it. Throws for unknown chart/year combinations, as `getChart`.
106
+ */
107
+ export function getSecuritiesAccount(
108
+ chart: TChartName,
109
+ year: number,
110
+ role: TSecuritiesRole,
111
+ taxRule?: TTaxRule,
112
+ ): IChartAccount | null {
113
+ return getAccountsBySecuritiesRole(chart, year, role).find((account) => account.taxRule === taxRule) ?? null;
114
+ }
115
+
86
116
  function hasMapping(account: IChartAccount, dimension: TMappingDimension): boolean {
87
117
  switch (dimension) {
88
118
  case 'ustva':
@@ -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).
@@ -69,7 +146,12 @@ export type TEuerMapping = { kennzahl: number } | { debitKennzahl: number; credi
69
146
  * return: no receipt and no payment of its own (Anleitung zur Anlage EÜR,
70
147
  * Zeile 58); what a return leaves to pay counts as paid VAT (Kz 186);
71
148
  * - 'closing': a carry-forward, closing or statistical account, which records
72
- * no business transaction.
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.
73
155
  */
74
156
  export type TEuerExclusion =
75
157
  | 'balance_sheet'
@@ -78,7 +160,8 @@ export type TEuerExclusion =
78
160
  | 'valuation'
79
161
  | 'pass_through'
80
162
  | 'reverse_charge'
81
- | 'closing';
163
+ | 'closing'
164
+ | 'deferred_current_asset';
82
165
 
83
166
  /**
84
167
  * The part of the Anlage EÜR a line belongs to: Betriebseinnahmen (Zeilen
@@ -137,6 +220,10 @@ export interface IChartAccount {
137
220
  accountType: TAccountType;
138
221
  /** what the account is for beyond its type and HGB position; unset = they say it all */
139
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;
140
227
  description?: string;
141
228
  automatikFunction?: TAutomatikFunction;
142
229
  /** BU keys allowed on lines of this account ('' = none). Unset = all. */