@fin.cx/chartdata 2.16.0 → 3.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.
@@ -59,6 +59,23 @@ export type TAccountRole = 'asset_sale_proceeds' | 'disposal_book_value';
59
59
  * pending transaction (§ 249 Abs. 1 HGB: a written option worth more than
60
60
  * its premium), which tax law does not allow (§ 5 Abs. 4a EStG);
61
61
  * - 'provision_release': the income of a provision released.
62
+ * The roles DATEV's standard charts hold no account of their own for: the
63
+ * books book them on the account of their position, or on an individual
64
+ * account (`IIndividualAccountDeclaration`) where they keep them apart;
65
+ * `INDIVIDUAL_ACCOUNT_TEMPLATES` suggests the parent of the results the law
66
+ * keeps apart:
67
+ * - balances: 'options_held' (options bought, at their premium),
68
+ * 'variation_margin_paid' and 'variation_margin_received' (a future's or a
69
+ * CFD's daily settlement held until it closes), 'accrued_interest_claim'
70
+ * (Stückzinsen paid, interest accrued), 'lending_claim' (securities lent:
71
+ * the claim to their return), 'written_options' (a writer's obligation at
72
+ * the premium received), 'short_sale_obligations' (securities owed after a
73
+ * short sale), 'collateral_received' (cash collateral to give back);
74
+ * - results kept apart: 'termingeschaeft_gain' and 'termingeschaeft_loss'
75
+ * (§ 15 Abs. 4 Satz 3 EStG offsets the losses only against such gains),
76
+ * 'stillhalter_income' (a writer's premium earned), 'short_sale_gain' and
77
+ * 'short_sale_loss', 'compensation_paid' (payments in place of a dividend
78
+ * on securities sold short).
62
79
  */
63
80
  export type TSecuritiesRole =
64
81
  | 'holding_fixed'
@@ -90,7 +107,96 @@ export type TSecuritiesRole =
90
107
  | 'borrow_fees'
91
108
  | 'writedown_other_current'
92
109
  | 'expected_loss_provision'
93
- | 'provision_release';
110
+ | 'provision_release'
111
+ | 'options_held'
112
+ | 'variation_margin_paid'
113
+ | 'variation_margin_received'
114
+ | 'accrued_interest_claim'
115
+ | 'lending_claim'
116
+ | 'written_options'
117
+ | 'short_sale_obligations'
118
+ | 'collateral_received'
119
+ | 'termingeschaeft_gain'
120
+ | 'termingeschaeft_loss'
121
+ | 'stillhalter_income'
122
+ | 'short_sale_gain'
123
+ | 'short_sale_loss'
124
+ | 'compensation_paid';
125
+
126
+ /**
127
+ * What an account books of a business's payroll: the pay and the employer's
128
+ * costs of it, the pay's taxes and contributions the business owes until it
129
+ * pays them, and what a payroll leaves to clear. A payroll run finds its
130
+ * account by this role: within a chart, no two accounts share one, and every
131
+ * role has its account in both standard charts (DATEV Kontenrahmen SKR 03
132
+ * Art.-Nr. 11174, pp. 8, 10, 11, 17, 22, 27, and SKR 04 Art.-Nr. 11175,
133
+ * pp. 4, 13, 18, 21, 22, gültig für 2026). DATEV's collective accounts
134
+ * ("Löhne und Gehälter", "Soziale Abgaben und Aufwendungen für
135
+ * Altersversorgung") take no role.
136
+ *
137
+ * The pay, under the wages and salaries (§ 275 Abs. 2 Nr. 6 a HGB, `GuV 6a`):
138
+ * - 'wages' (Löhne), 'salaries' (Gehälter), 'managing_director_salaries' (a
139
+ * GmbH's shareholder-managing directors), 'temporary_wages'
140
+ * (Aushilfslöhne), 'minijob_wages' (Löhne für Minijobs);
141
+ * - 'benefits_in_kind' (Sachzuwendungen und Dienstleistungen an
142
+ * Arbeitnehmer), 'capital_formation_benefits' (vermögenswirksame
143
+ * Leistungen), 'commuting_allowances' (Fahrtkostenerstattung Wohnung/
144
+ * Arbeitsstätte);
145
+ * - the flat wage tax the employer bears: 'minijob_flat_tax',
146
+ * 'employee_flat_tax', 'temporary_flat_tax'.
147
+ *
148
+ * The employer's contributions, under the social security and pensions
149
+ * (Nr. 6 b, `GuV 6b`): 'employer_social_security' (gesetzliche soziale
150
+ * Aufwendungen: the employer's share and the levies U1, U2 and U3),
151
+ * 'minijob_social_security' (the flat contributions for a Minijob),
152
+ * 'accident_insurance' (Berufsgenossenschaft), 'pension' (Aufwendungen für
153
+ * Altersversorgung) and 'pension_flat_tax' (the flat tax on such benefits,
154
+ * Direktversicherungen).
155
+ *
156
+ * What a payroll earns, under the other operating income (Nr. 4, `GuV 4`):
157
+ * 'company_car_benefit' (the private use of a company car as a supply to the
158
+ * employee, with 19 % VAT) and 'levy_refunds' (Erstattungen nach dem
159
+ * Aufwendungsausgleichsgesetz, the sick-pay and maternity refunds of U1 and
160
+ * U2); 'levy_refund_claims' is the claim on the health insurer until it pays.
161
+ *
162
+ * What the business owes (§ 266 Abs. 3 C.8 HGB): 'net_pay' (Verbindlichkeiten
163
+ * aus Lohn und Gehalt), 'wage_tax' (Lohn- und Kirchensteuer, with the
164
+ * Solidaritätszuschlag), 'social_security' (the contributions of both sides
165
+ * and the levies), 'employee_withholdings' (what is withheld from an employee
166
+ * for another, such as a garnishment), 'capital_formation_payable' (the
167
+ * savings an employee's contract receives), 'estimated_contributions' (the
168
+ * contributions estimated in the month they are due, § 23 Abs. 1 SGB IV);
169
+ * and 'clearing', the Lohn- und Gehaltsverrechnungskonto, a balance on
170
+ * either side (DATEV states it under the other assets or the other
171
+ * liabilities by its balance).
172
+ */
173
+ export type TPayrollRole =
174
+ | 'wages'
175
+ | 'salaries'
176
+ | 'managing_director_salaries'
177
+ | 'temporary_wages'
178
+ | 'minijob_wages'
179
+ | 'benefits_in_kind'
180
+ | 'capital_formation_benefits'
181
+ | 'commuting_allowances'
182
+ | 'minijob_flat_tax'
183
+ | 'employee_flat_tax'
184
+ | 'temporary_flat_tax'
185
+ | 'employer_social_security'
186
+ | 'minijob_social_security'
187
+ | 'accident_insurance'
188
+ | 'pension'
189
+ | 'pension_flat_tax'
190
+ | 'company_car_benefit'
191
+ | 'levy_refunds'
192
+ | 'levy_refund_claims'
193
+ | 'net_pay'
194
+ | 'wage_tax'
195
+ | 'social_security'
196
+ | 'employee_withholdings'
197
+ | 'capital_formation_payable'
198
+ | 'estimated_contributions'
199
+ | 'clearing';
94
200
 
95
201
  /**
96
202
  * A rule of the income tax law an income or expense account is kept for, as
@@ -235,6 +341,8 @@ export interface IChartAccount {
235
341
  accountRole?: TAccountRole;
236
342
  /** what the account books of a business's securities; unset = nothing of its own */
237
343
  securitiesRole?: TSecuritiesRole;
344
+ /** what the account books of a business's payroll; unset = nothing of its own */
345
+ payrollRole?: TPayrollRole;
238
346
  /** the income tax rule the account is kept for, as its DATEV name states it; unset = none of its own */
239
347
  taxRule?: TTaxRule;
240
348
  /**
@@ -242,6 +350,8 @@ export interface IChartAccount {
242
350
  * are no part of the tax balance sheet; unset = both
243
351
  */
244
352
  commercialOnly?: true;
353
+ /** an individual account of the books (`IIndividualAccountDeclaration`): the DATEV account it belongs to; unset = a DATEV account */
354
+ parentAccountNumber?: string;
245
355
  description?: string;
246
356
  automatikFunction?: TAutomatikFunction;
247
357
  /** BU keys allowed on lines of this account ('' = none). Unset = all. */
@@ -307,3 +417,91 @@ export interface IScenarioKennzahlen {
307
417
  inputVatReverseCharge: number; // Kz 67 (Vorsteuer §13b)
308
418
  importVat: number; // Kz 62 (entrichtete EUSt)
309
419
  }
420
+
421
+ /** The numbers a DATEV standard chart of a year assigns (listed accounts and headings), and of them those it reserves ("R"). */
422
+ export interface IDatevNumbers {
423
+ chart: TChartName;
424
+ year: number;
425
+ assigned: readonly string[];
426
+ reserved: readonly string[];
427
+ }
428
+
429
+ /**
430
+ * What an individual account changes deliberately of what it inherits from its parent: a value replaces the
431
+ * parent's, `null` drops it. The Anlage EÜR takes `euer` or `euerExclusion`, not both.
432
+ */
433
+ export interface IIndividualAccountOverrides {
434
+ hgb266Position?: string | null;
435
+ hgb275Position?: string | null;
436
+ ustva?: IUstvaMapping | null;
437
+ euer?: TEuerMapping;
438
+ euerExclusion?: TEuerExclusion;
439
+ accountRole?: TAccountRole | null;
440
+ taxRule?: TTaxRule | null;
441
+ commercialOnly?: true | null;
442
+ }
443
+
444
+ /**
445
+ * An account the books set up themselves (an Individualkonto) on a number the DATEV standard chart leaves free,
446
+ * belonging to one of its accounts (the parent, `parentAccountNumber`): it is what its parent is — its type, its
447
+ * balance-sheet or income-statement position, its UStVA and Anlage EÜR mapping, its account role, its tax rule
448
+ * and DATEV's mark "HB" — unless `overrides` changes one deliberately. It does not take the parent's DATEV tax
449
+ * automatism (DATEV applies one only to the accounts it marks) nor its securities role, which names one account of
450
+ * a chart: an individual account takes one only where its declaration names it. The declarations are the books';
451
+ * chartdata stores none.
452
+ */
453
+ export interface IIndividualAccountDeclaration {
454
+ accountNumber: string;
455
+ accountName: string;
456
+ parentAccountNumber: string;
457
+ securitiesRole?: TSecuritiesRole;
458
+ overrides?: IIndividualAccountOverrides;
459
+ }
460
+
461
+ /**
462
+ * Why an individual account cannot be:
463
+ * - `number_invalid`: its number is no four digits;
464
+ * - `number_assigned`: DATEV assigns or reserves the number in the chart of the year;
465
+ * - `number_duplicate`: two declarations take the number;
466
+ * - `name_missing`: the account has no name;
467
+ * - `parent_unknown`: the chart holds no account of the parent's number;
468
+ * - `parent_individual`: the parent is itself an individual account;
469
+ * - `parent_not_allowed`: the parent is a carry-forward, closing or statistical account, which records no business
470
+ * transaction;
471
+ * - `class_mismatch`: the number lies in another account class (its first digit) than the parent;
472
+ * - `not_following_parent`: the number does not follow its parent: an account of the chart stands between them.
473
+ * DATEV leaves the free numbers after an account for its individual accounts and passes the account's marks for
474
+ * the trade and corporate income tax programs ("G", "K") on to them, up to the next account of the standard chart
475
+ * (DATEV Kontenrahmen SKR 03 and SKR 04, gültig für 2026, Erläuterungen, S. 37), so an individual account
476
+ * elsewhere would be another account's in DATEV's tax programs;
477
+ * - `role_taken`: another account of the chart books the securities role under the same tax rule;
478
+ * - `override_invalid`: an override names no balance-sheet position of § 266 HGB, no income-statement position of
479
+ * § 275 HGB, or one the account's type does not take (a balance-sheet account has a balance-sheet position, a
480
+ * profit-and-loss account an income-statement position); an Anlage EÜR line no form year holds, a split line on
481
+ * the other side; or both a line and an exclusion.
482
+ */
483
+ export type TIndividualAccountProblemCode =
484
+ | 'number_invalid'
485
+ | 'number_assigned'
486
+ | 'number_duplicate'
487
+ | 'name_missing'
488
+ | 'parent_unknown'
489
+ | 'parent_individual'
490
+ | 'parent_not_allowed'
491
+ | 'class_mismatch'
492
+ | 'not_following_parent'
493
+ | 'role_taken'
494
+ | 'override_invalid';
495
+
496
+ export interface IIndividualAccountProblem {
497
+ accountNumber: string;
498
+ code: TIndividualAccountProblemCode;
499
+ message: string;
500
+ }
501
+
502
+ /** A suggestion for an individual account the books need for a securities role: the parent it belongs to and a name. */
503
+ export interface IIndividualAccountTemplate {
504
+ securitiesRole: TSecuritiesRole;
505
+ parentAccountNumber: string;
506
+ accountName: string;
507
+ }