@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.
@@ -56,8 +56,73 @@ export type TAccountRole = 'asset_sale_proceeds' | 'disposal_book_value';
56
56
  * pending transaction (§ 249 Abs. 1 HGB: a written option worth more than
57
57
  * its premium), which tax law does not allow (§ 5 Abs. 4a EStG);
58
58
  * - 'provision_release': the income of a provision released.
59
+ * The roles DATEV's standard charts hold no account of their own for: the
60
+ * books book them on the account of their position, or on an individual
61
+ * account (`IIndividualAccountDeclaration`) where they keep them apart;
62
+ * `INDIVIDUAL_ACCOUNT_TEMPLATES` suggests the parent of the results the law
63
+ * keeps apart:
64
+ * - balances: 'options_held' (options bought, at their premium),
65
+ * 'variation_margin_paid' and 'variation_margin_received' (a future's or a
66
+ * CFD's daily settlement held until it closes), 'accrued_interest_claim'
67
+ * (Stückzinsen paid, interest accrued), 'lending_claim' (securities lent:
68
+ * the claim to their return), 'written_options' (a writer's obligation at
69
+ * the premium received), 'short_sale_obligations' (securities owed after a
70
+ * short sale), 'collateral_received' (cash collateral to give back);
71
+ * - results kept apart: 'termingeschaeft_gain' and 'termingeschaeft_loss'
72
+ * (§ 15 Abs. 4 Satz 3 EStG offsets the losses only against such gains),
73
+ * 'stillhalter_income' (a writer's premium earned), 'short_sale_gain' and
74
+ * 'short_sale_loss', 'compensation_paid' (payments in place of a dividend
75
+ * on securities sold short).
59
76
  */
60
- export type TSecuritiesRole = 'holding_fixed' | 'holding_fixed_shares' | 'holding_fixed_bonds' | 'holding_current' | 'income_fixed' | 'income_current' | 'sale_gain_current' | 'sale_loss_current' | 'sale_proceeds_fixed_gain' | 'sale_proceeds_fixed_loss' | 'book_value_fixed_gain' | 'book_value_fixed_loss' | 'sale_costs_gain' | 'sale_costs_loss' | 'writedown_fixed_lasting' | 'writedown_fixed_temporary' | 'writedown_current' | 'writeup_fixed' | 'writeup_current' | 'writeup' | 'capital_gains_tax' | 'capital_gains_tax_soli' | 'foreign_withholding_tax' | 'foreign_tax_exempt_income' | 'foreign_tax_refund' | 'margin_interest' | 'borrow_fees' | 'writedown_other_current' | 'expected_loss_provision' | 'provision_release';
77
+ export type TSecuritiesRole = 'holding_fixed' | 'holding_fixed_shares' | 'holding_fixed_bonds' | 'holding_current' | 'income_fixed' | 'income_current' | 'sale_gain_current' | 'sale_loss_current' | 'sale_proceeds_fixed_gain' | 'sale_proceeds_fixed_loss' | 'book_value_fixed_gain' | 'book_value_fixed_loss' | 'sale_costs_gain' | 'sale_costs_loss' | 'writedown_fixed_lasting' | 'writedown_fixed_temporary' | 'writedown_current' | 'writeup_fixed' | 'writeup_current' | 'writeup' | 'capital_gains_tax' | 'capital_gains_tax_soli' | 'foreign_withholding_tax' | 'foreign_tax_exempt_income' | 'foreign_tax_refund' | 'margin_interest' | 'borrow_fees' | 'writedown_other_current' | 'expected_loss_provision' | 'provision_release' | 'options_held' | 'variation_margin_paid' | 'variation_margin_received' | 'accrued_interest_claim' | 'lending_claim' | 'written_options' | 'short_sale_obligations' | 'collateral_received' | 'termingeschaeft_gain' | 'termingeschaeft_loss' | 'stillhalter_income' | 'short_sale_gain' | 'short_sale_loss' | 'compensation_paid';
78
+ /**
79
+ * What an account books of a business's payroll: the pay and the employer's
80
+ * costs of it, the pay's taxes and contributions the business owes until it
81
+ * pays them, and what a payroll leaves to clear. A payroll run finds its
82
+ * account by this role: within a chart, no two accounts share one, and every
83
+ * role has its account in both standard charts (DATEV Kontenrahmen SKR 03
84
+ * Art.-Nr. 11174, pp. 8, 10, 11, 17, 22, 27, and SKR 04 Art.-Nr. 11175,
85
+ * pp. 4, 13, 18, 21, 22, gültig für 2026). DATEV's collective accounts
86
+ * ("Löhne und Gehälter", "Soziale Abgaben und Aufwendungen für
87
+ * Altersversorgung") take no role.
88
+ *
89
+ * The pay, under the wages and salaries (§ 275 Abs. 2 Nr. 6 a HGB, `GuV 6a`):
90
+ * - 'wages' (Löhne), 'salaries' (Gehälter), 'managing_director_salaries' (a
91
+ * GmbH's shareholder-managing directors), 'temporary_wages'
92
+ * (Aushilfslöhne), 'minijob_wages' (Löhne für Minijobs);
93
+ * - 'benefits_in_kind' (Sachzuwendungen und Dienstleistungen an
94
+ * Arbeitnehmer), 'capital_formation_benefits' (vermögenswirksame
95
+ * Leistungen), 'commuting_allowances' (Fahrtkostenerstattung Wohnung/
96
+ * Arbeitsstätte);
97
+ * - the flat wage tax the employer bears: 'minijob_flat_tax',
98
+ * 'employee_flat_tax', 'temporary_flat_tax'.
99
+ *
100
+ * The employer's contributions, under the social security and pensions
101
+ * (Nr. 6 b, `GuV 6b`): 'employer_social_security' (gesetzliche soziale
102
+ * Aufwendungen: the employer's share and the levies U1, U2 and U3),
103
+ * 'minijob_social_security' (the flat contributions for a Minijob),
104
+ * 'accident_insurance' (Berufsgenossenschaft), 'pension' (Aufwendungen für
105
+ * Altersversorgung) and 'pension_flat_tax' (the flat tax on such benefits,
106
+ * Direktversicherungen).
107
+ *
108
+ * What a payroll earns, under the other operating income (Nr. 4, `GuV 4`):
109
+ * 'company_car_benefit' (the private use of a company car as a supply to the
110
+ * employee, with 19 % VAT) and 'levy_refunds' (Erstattungen nach dem
111
+ * Aufwendungsausgleichsgesetz, the sick-pay and maternity refunds of U1 and
112
+ * U2); 'levy_refund_claims' is the claim on the health insurer until it pays.
113
+ *
114
+ * What the business owes (§ 266 Abs. 3 C.8 HGB): 'net_pay' (Verbindlichkeiten
115
+ * aus Lohn und Gehalt), 'wage_tax' (Lohn- und Kirchensteuer, with the
116
+ * Solidaritätszuschlag), 'social_security' (the contributions of both sides
117
+ * and the levies), 'employee_withholdings' (what is withheld from an employee
118
+ * for another, such as a garnishment), 'capital_formation_payable' (the
119
+ * savings an employee's contract receives), 'estimated_contributions' (the
120
+ * contributions estimated in the month they are due, § 23 Abs. 1 SGB IV);
121
+ * and 'clearing', the Lohn- und Gehaltsverrechnungskonto, a balance on
122
+ * either side (DATEV states it under the other assets or the other
123
+ * liabilities by its balance).
124
+ */
125
+ export type TPayrollRole = 'wages' | 'salaries' | 'managing_director_salaries' | 'temporary_wages' | 'minijob_wages' | 'benefits_in_kind' | 'capital_formation_benefits' | 'commuting_allowances' | 'minijob_flat_tax' | 'employee_flat_tax' | 'temporary_flat_tax' | 'employer_social_security' | 'minijob_social_security' | 'accident_insurance' | 'pension' | 'pension_flat_tax' | 'company_car_benefit' | 'levy_refunds' | 'levy_refund_claims' | 'net_pay' | 'wage_tax' | 'social_security' | 'employee_withholdings' | 'capital_formation_payable' | 'estimated_contributions' | 'clearing';
61
126
  /**
62
127
  * A rule of the income tax law an income or expense account is kept for, as
63
128
  * its DATEV name states it:
@@ -201,6 +266,8 @@ export interface IChartAccount {
201
266
  accountRole?: TAccountRole;
202
267
  /** what the account books of a business's securities; unset = nothing of its own */
203
268
  securitiesRole?: TSecuritiesRole;
269
+ /** what the account books of a business's payroll; unset = nothing of its own */
270
+ payrollRole?: TPayrollRole;
204
271
  /** the income tax rule the account is kept for, as its DATEV name states it; unset = none of its own */
205
272
  taxRule?: TTaxRule;
206
273
  /**
@@ -208,6 +275,8 @@ export interface IChartAccount {
208
275
  * are no part of the tax balance sheet; unset = both
209
276
  */
210
277
  commercialOnly?: true;
278
+ /** an individual account of the books (`IIndividualAccountDeclaration`): the DATEV account it belongs to; unset = a DATEV account */
279
+ parentAccountNumber?: string;
211
280
  description?: string;
212
281
  automatikFunction?: TAutomatikFunction;
213
282
  /** BU keys allowed on lines of this account ('' = none). Unset = all. */
@@ -269,3 +338,74 @@ export interface IScenarioKennzahlen {
269
338
  inputVatReverseCharge: number;
270
339
  importVat: number;
271
340
  }
341
+ /** The numbers a DATEV standard chart of a year assigns (listed accounts and headings), and of them those it reserves ("R"). */
342
+ export interface IDatevNumbers {
343
+ chart: TChartName;
344
+ year: number;
345
+ assigned: readonly string[];
346
+ reserved: readonly string[];
347
+ }
348
+ /**
349
+ * What an individual account changes deliberately of what it inherits from its parent: a value replaces the
350
+ * parent's, `null` drops it. The Anlage EÜR takes `euer` or `euerExclusion`, not both.
351
+ */
352
+ export interface IIndividualAccountOverrides {
353
+ hgb266Position?: string | null;
354
+ hgb275Position?: string | null;
355
+ ustva?: IUstvaMapping | null;
356
+ euer?: TEuerMapping;
357
+ euerExclusion?: TEuerExclusion;
358
+ accountRole?: TAccountRole | null;
359
+ taxRule?: TTaxRule | null;
360
+ commercialOnly?: true | null;
361
+ }
362
+ /**
363
+ * An account the books set up themselves (an Individualkonto) on a number the DATEV standard chart leaves free,
364
+ * belonging to one of its accounts (the parent, `parentAccountNumber`): it is what its parent is — its type, its
365
+ * balance-sheet or income-statement position, its UStVA and Anlage EÜR mapping, its account role, its tax rule
366
+ * and DATEV's mark "HB" — unless `overrides` changes one deliberately. It does not take the parent's DATEV tax
367
+ * automatism (DATEV applies one only to the accounts it marks) nor its securities role, which names one account of
368
+ * a chart: an individual account takes one only where its declaration names it. The declarations are the books';
369
+ * chartdata stores none.
370
+ */
371
+ export interface IIndividualAccountDeclaration {
372
+ accountNumber: string;
373
+ accountName: string;
374
+ parentAccountNumber: string;
375
+ securitiesRole?: TSecuritiesRole;
376
+ overrides?: IIndividualAccountOverrides;
377
+ }
378
+ /**
379
+ * Why an individual account cannot be:
380
+ * - `number_invalid`: its number is no four digits;
381
+ * - `number_assigned`: DATEV assigns or reserves the number in the chart of the year;
382
+ * - `number_duplicate`: two declarations take the number;
383
+ * - `name_missing`: the account has no name;
384
+ * - `parent_unknown`: the chart holds no account of the parent's number;
385
+ * - `parent_individual`: the parent is itself an individual account;
386
+ * - `parent_not_allowed`: the parent is a carry-forward, closing or statistical account, which records no business
387
+ * transaction;
388
+ * - `class_mismatch`: the number lies in another account class (its first digit) than the parent;
389
+ * - `not_following_parent`: the number does not follow its parent: an account of the chart stands between them.
390
+ * DATEV leaves the free numbers after an account for its individual accounts and passes the account's marks for
391
+ * the trade and corporate income tax programs ("G", "K") on to them, up to the next account of the standard chart
392
+ * (DATEV Kontenrahmen SKR 03 and SKR 04, gültig für 2026, Erläuterungen, S. 37), so an individual account
393
+ * elsewhere would be another account's in DATEV's tax programs;
394
+ * - `role_taken`: another account of the chart books the securities role under the same tax rule;
395
+ * - `override_invalid`: an override names no balance-sheet position of § 266 HGB, no income-statement position of
396
+ * § 275 HGB, or one the account's type does not take (a balance-sheet account has a balance-sheet position, a
397
+ * profit-and-loss account an income-statement position); an Anlage EÜR line no form year holds, a split line on
398
+ * the other side; or both a line and an exclusion.
399
+ */
400
+ export type TIndividualAccountProblemCode = 'number_invalid' | 'number_assigned' | 'number_duplicate' | 'name_missing' | 'parent_unknown' | 'parent_individual' | 'parent_not_allowed' | 'class_mismatch' | 'not_following_parent' | 'role_taken' | 'override_invalid';
401
+ export interface IIndividualAccountProblem {
402
+ accountNumber: string;
403
+ code: TIndividualAccountProblemCode;
404
+ message: string;
405
+ }
406
+ /** A suggestion for an individual account the books need for a securities role: the parent it belongs to and a name. */
407
+ export interface IIndividualAccountTemplate {
408
+ securitiesRole: TSecuritiesRole;
409
+ parentAccountNumber: string;
410
+ accountName: string;
411
+ }
@@ -0,0 +1,5 @@
1
+ import type { IDatevNumbers } from '../chartdata.types.js';
2
+ /** The numbers the DATEV Kontenrahmen SKR 03 (Art.-Nr. 11174), gültig für 2026, assigns, and those it reserves. */
3
+ export declare const DATEV_NUMBERS_SKR03_2026: IDatevNumbers;
4
+ /** The numbers the DATEV Kontenrahmen SKR 04 (Art.-Nr. 11175), gültig für 2026, assigns, and those it reserves. */
5
+ export declare const DATEV_NUMBERS_SKR04_2026: IDatevNumbers;