@fin.cx/chartdata 2.17.0 → 3.1.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.17.0",
3
+ "version": "3.1.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
@@ -33,6 +33,11 @@ For reporting bugs, issues, or security vulnerabilities, please visit [community
33
33
  accounts), the costs of a sale, write-downs and write-ups, the taxes withheld
34
34
  from their income and the margin interest, listed per chart by
35
35
  `getAccountsBySecuritiesRole` and found one by one with `getSecuritiesAccount`
36
+ - Payroll accounts with their payroll role (`payrollRole`): the pay and the
37
+ flat wage taxes (GuV 6a), the employer's contributions (GuV 6b), the debts
38
+ of a payroll until they are paid, the company-car benefit and the levy
39
+ refunds, and the clearing account, one account per role, found with
40
+ `getPayrollAccount`
36
41
  - DATEV's mark "HB" (`commercialOnly`): an account posted in the commercial
37
42
  balance sheet only
38
43
  - The tax rule an income or expense account is kept for (`taxRule`):
@@ -159,6 +164,59 @@ compensations paid on securities sold short. Their roles (`options_held`,
159
164
  `compensation_paid`) name no account of the standard charts: the books give
160
165
  them an individual account, or book them on the account of their position.
161
166
 
167
+ ### Payroll
168
+
169
+ A payroll run finds its accounts by the payroll role; within a chart each role
170
+ names one account, and every role has its account in both standard charts.
171
+ DATEV states each account's position beside it: the pay under "Löhne und
172
+ Gehälter" (GuV 6a, § 275 Abs. 2 Nr. 6 a HGB), the employer's contributions
173
+ under "Soziale Abgaben und Aufwendungen für Altersversorgung und für
174
+ Unterstützung" (GuV 6b). DATEV's collective accounts (SKR03 4100, SKR04 6000
175
+ and 6100) keep their positions and take no role.
176
+
177
+ ```typescript
178
+ import { getPayrollAccount } from '@fin.cx/chartdata';
179
+
180
+ getPayrollAccount('SKR03', 2026, 'salaries')?.accountNumber; // '4120' Gehälter
181
+ getPayrollAccount('SKR04', 2026, 'wage_tax')?.accountNumber; // '3730' Verbindlichkeiten aus Lohn- und Kirchensteuer
182
+ getPayrollAccount('SKR04', 2026, 'company_car_benefit')?.ustva; // { kennzahl: 81, role: 'base' }
183
+ ```
184
+
185
+ | Role | What it books | SKR03 | SKR04 |
186
+ | --- | --- | --- | --- |
187
+ | `wages` | Löhne (GuV 6a) | 4110 | 6010 |
188
+ | `salaries` | Gehälter (GuV 6a) | 4120 | 6020 |
189
+ | `managing_director_salaries` | a GmbH's shareholder-managing directors (GuV 6a) | 4124 | 6024 |
190
+ | `temporary_wages` | Aushilfslöhne (GuV 6a) | 4190 | 6030 |
191
+ | `minijob_wages` | Löhne für Minijobs (GuV 6a) | 4195 | 6035 |
192
+ | `benefits_in_kind` | Sachzuwendungen und Dienstleistungen an Arbeitnehmer (GuV 6a) | 4152 | 6072 |
193
+ | `capital_formation_benefits` | vermögenswirksame Leistungen (GuV 6a) | 4170 | 6080 |
194
+ | `commuting_allowances` | Fahrtkostenerstattung Wohnung/Arbeitsstätte (GuV 6a) | 4175 | 6090 |
195
+ | `minijob_flat_tax` | the flat tax of a Minijob (GuV 6a) | 4194 | 6036 |
196
+ | `employee_flat_tax` | the flat tax for employees (GuV 6a) | 4198 | 6039 |
197
+ | `temporary_flat_tax` | the flat tax for temporary staff (GuV 6a) | 4199 | 6040 |
198
+ | `employer_social_security` | the employer's contributions and the levies U1, U2, U3 (GuV 6b) | 4130 | 6110 |
199
+ | `minijob_social_security` | the flat contributions of a Minijob (GuV 6b) | 4144 | 6171 |
200
+ | `accident_insurance` | Berufsgenossenschaft (GuV 6b) | 4138 | 6120 |
201
+ | `pension` | Aufwendungen für Altersversorgung (GuV 6b) | 4165 | 6140 |
202
+ | `pension_flat_tax` | the flat tax on such benefits, Direktversicherungen (GuV 6b) | 4167 | 6147 |
203
+ | `company_car_benefit` | the private use of a company car, 19 % VAT, UStVA Kz 81 (GuV 4) | 8611 | 4947 |
204
+ | `levy_refunds` | Erstattungen nach dem Aufwendungsausgleichsgesetz (GuV 4) | 2749 | 4972 |
205
+ | `levy_refund_claims` | the claim on the health insurer for them | 1520 | 1369 |
206
+ | `net_pay` | the net pay owed | 1740 | 3720 |
207
+ | `wage_tax` | wage tax, church tax and Solidaritätszuschlag owed | 1741 | 3730 |
208
+ | `social_security` | the contributions owed | 1742 | 3740 |
209
+ | `employee_withholdings` | what is withheld from an employee for another (a garnishment) | 1748 | 3725 |
210
+ | `capital_formation_payable` | the savings an employee's contract receives | 1750 | 3770 |
211
+ | `estimated_contributions` | the contributions estimated when due (§ 23 Abs. 1 SGB IV) | 1759 | 3759 |
212
+ | `clearing` | the Lohn- und Gehaltsverrechnungskonto | 1755 | 3790 |
213
+
214
+ In the Anlage EÜR every payroll expense is Zeile 31 (Kz 120), "einschließlich
215
+ der gezahlten Lohnsteuer (auch Pauschalsteuer nach § 37b EStG) und anderer
216
+ Nebenkosten" (Anleitung 2026); the company-car benefit is a taxable receipt
217
+ (Kz 112), the levy refunds a non-taxable one (Kz 103). An individual account
218
+ takes no payroll role: a role names the DATEV account.
219
+
162
220
  ### Individual accounts
163
221
 
164
222
  The books may set up accounts of their own (Individualkonten) on the numbers
@@ -216,8 +274,8 @@ books.getMappingCoverage(usedAccountNumbers, 'hgb275');
216
274
 
217
275
  A `BooksChart` is a chart (`IChart`) with the lookups of the chart over the
218
276
  DATEV accounts and the books' own: `getAccount`, `getAccountsByRole`,
219
- `getAccountsBySecuritiesRole`, `getSecuritiesAccount`, `getMappingCoverage`,
220
- `getEuerLines`.
277
+ `getAccountsBySecuritiesRole`, `getSecuritiesAccount`, `getPayrollAccount`,
278
+ `getMappingCoverage`, `getEuerLines`.
221
279
 
222
280
  `INDIVIDUAL_ACCOUNT_TEMPLATES` suggests the parent and name of the results the
223
281
  law keeps apart: the gains and losses of Termingeschäfte, which § 15 Abs. 4
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@fin.cx/chartdata',
6
- version: '2.17.0',
6
+ version: '3.1.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
  }
@@ -65,7 +65,9 @@ export const HGB_275_GKV_POSITIONS: IHgbPosition[] = [
65
65
  { key: 'GuV 3', label: 'Andere aktivierte Eigenleistungen' },
66
66
  { key: 'GuV 4', label: 'Sonstige betriebliche Erträge' },
67
67
  { key: 'GuV 5', label: 'Materialaufwand' },
68
- { key: 'GuV 6', label: 'Personalaufwand' },
68
+ // Nr. 6 Personalaufwand, by its two parts
69
+ { key: 'GuV 6a', label: 'Löhne und Gehälter' },
70
+ { key: 'GuV 6b', label: 'Soziale Abgaben und Aufwendungen für Altersversorgung und für Unterstützung' },
69
71
  { key: 'GuV 7', label: 'Abschreibungen' },
70
72
  { key: 'GuV 8', label: 'Sonstige betriebliche Aufwendungen' },
71
73
  { key: 'GuV 9', label: 'Erträge aus Beteiligungen' },
@@ -10,6 +10,7 @@ import type {
10
10
  TChartName,
11
11
  TEuerAccountLines,
12
12
  TMappingDimension,
13
+ TPayrollRole,
13
14
  TSecuritiesRole,
14
15
  TTaxRule,
15
16
  } from './chartdata.types.js';
@@ -304,6 +305,11 @@ export class BooksChart implements IChart {
304
305
  return this.getAccountsBySecuritiesRole(roleArg).find((account) => account.taxRule === taxRuleArg) ?? null;
305
306
  }
306
307
 
308
+ /** The one account of the books that books the payroll role, or `null`; an individual account takes none. */
309
+ public getPayrollAccount(roleArg: TPayrollRole): IChartAccount | null {
310
+ return this.accounts.find((account) => account.payrollRole === roleArg) ?? null;
311
+ }
312
+
307
313
  public getMappingCoverage(usedAccountsArg: string[], dimensionArg: TMappingDimension): IMappingCoverage {
308
314
  return mappingCoverageOf(this.accounts, usedAccountsArg, dimensionArg);
309
315
  }
@@ -7,6 +7,7 @@ import type {
7
7
  TChartName,
8
8
  TEuerAccountLines,
9
9
  TMappingDimension,
10
+ TPayrollRole,
10
11
  TSecuritiesRole,
11
12
  TTaxRule,
12
13
  } from './chartdata.types.js';
@@ -113,6 +114,14 @@ export function getSecuritiesAccount(
113
114
  return getAccountsBySecuritiesRole(chart, year, role).find((account) => account.taxRule === taxRule) ?? null;
114
115
  }
115
116
 
117
+ /**
118
+ * The one account of a chart that books the payroll role (`IChartAccount.payrollRole`), or `null` where the chart
119
+ * keeps none for it. Throws for unknown chart/year combinations, as `getChart`.
120
+ */
121
+ export function getPayrollAccount(chart: TChartName, year: number, role: TPayrollRole): IChartAccount | null {
122
+ return getChart(chart, year).accounts.find((account) => account.payrollRole === role) ?? null;
123
+ }
124
+
116
125
  function hasMapping(account: IChartAccount, dimension: TMappingDimension): boolean {
117
126
  switch (dimension) {
118
127
  case 'ustva':
@@ -123,6 +123,81 @@ export type TSecuritiesRole =
123
123
  | 'short_sale_loss'
124
124
  | 'compensation_paid';
125
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';
200
+
126
201
  /**
127
202
  * A rule of the income tax law an income or expense account is kept for, as
128
203
  * its DATEV name states it:
@@ -266,6 +341,8 @@ export interface IChartAccount {
266
341
  accountRole?: TAccountRole;
267
342
  /** what the account books of a business's securities; unset = nothing of its own */
268
343
  securitiesRole?: TSecuritiesRole;
344
+ /** what the account books of a business's payroll; unset = nothing of its own */
345
+ payrollRole?: TPayrollRole;
269
346
  /** the income tax rule the account is kept for, as its DATEV name states it; unset = none of its own */
270
347
  taxRule?: TTaxRule;
271
348
  /**