@fin.cx/chartdata 3.4.0 → 3.6.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": "3.4.0",
3
+ "version": "3.6.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
@@ -47,7 +47,17 @@ For reporting bugs, issues, or security vulnerabilities, please visit [community
47
47
  - The tax rule an income or expense account is kept for (`taxRule`):
48
48
  `estg_3_40_kstg_8b` on every account DATEV names "§ 3 Nr. 40 EStG bzw. § 8b …
49
49
  KStG", whose income DATEV's corporate-tax interface treats as tax-free and
50
- whose expenses as non-deductible
50
+ whose expenses as non-deductible; `estg_4_7` on the expenses § 4 Abs. 7 EStG
51
+ requires to be recorded apart that DATEV marks for no tax program (the
52
+ deductible gifts and business meals)
53
+ - DATEV's marks for its tax programs (`datevMarks`: `G` Gewerbesteuer, `K`
54
+ Körperschaftsteuer), read from the Kontenrahmen on every account, and
55
+ `hasTaxReturnFunction`: an account a tax return acts on (a mark or a tax rule)
56
+ - Period roles (`periodRole`) for a booking of a closed year's period: the
57
+ periodenfremde Aufwendungen and Erträge and the VAT of the posting year, the
58
+ previous year and the earlier years, one account per role, found with
59
+ `getPeriodAccount`; and the prior-year twins of the current-year tax accounts
60
+ (`priorYearAccounts`)
51
61
  - Account→Anlage EÜR mappings (`euer`) for the Einnahmenüberschussrechnung
52
62
  (§ 4 Abs. 3 EStG, § 60 Abs. 4 EStDV), with the lines of the 2025 and 2026
53
63
  forms (`ANLAGE_EUER_FORMS`); every account maps or is excluded with its
@@ -268,6 +278,67 @@ part (§ 8 Nr. 1 f GewStG); the books book a licence of a right there
268
278
  themselves. An individual account takes no expense role: a role names the
269
279
  DATEV account.
270
280
 
281
+ ### Closed years: period accounts, prior-year twins and tax-return functions
282
+
283
+ A booking of a period whose year is closed is carried forward into an open year.
284
+ The accounts it may land on carry a period role (`periodRole`); within a chart
285
+ each role names one account, and every role has its account in both standard
286
+ charts (DATEV Kontenrahmen SKR 03 pp. 11, 13, 16; SKR 04 pp. 14, 18, 25, gültig
287
+ für 2026). None of them carries a tax function, and an individual account takes
288
+ no period role.
289
+
290
+ ```typescript
291
+ import { getPeriodAccount, getAccount, hasTaxReturnFunction } from '@fin.cx/chartdata';
292
+
293
+ getPeriodAccount('SKR03', 2026, 'out_of_period_expense')?.accountNumber; // '2020' Periodenfremde Aufwendungen
294
+ getPeriodAccount('SKR04', 2026, 'vat_previous_year')?.accountNumber; // '3841'
295
+ getAccount('SKR03', 2026, '2200')?.priorYearAccounts; // { expense: '2203', income: '2204' }
296
+ hasTaxReturnFunction(getAccount('SKR03', 2026, '4320')!); // true: DATEV marks it G and K
297
+ ```
298
+
299
+ | Role | What it books | SKR03 | SKR04 |
300
+ | --- | --- | --- | --- |
301
+ | `out_of_period_expense` | Periodenfremde Aufwendungen (GuV 8, BWA-neutral) | 2020 | 6960 |
302
+ | `out_of_period_income` | Periodenfremde Erträge (GuV 4, BWA-neutral) | 2520 | 4960 |
303
+ | `vat_posting_year` | Umsatzsteuer laufendes Jahr: an earlier period's VAT of the posting date's calendar year (a fiscal year that is no calendar year); nets with the current VAT | 1789 | 3840 |
304
+ | `vat_previous_year` | Umsatzsteuerverbindlichkeiten Vorjahr | 1790 | 3841 |
305
+ | `vat_earlier_years` | Umsatzsteuerverbindlichkeiten frühere Jahre | 1791 | 3845 |
306
+
307
+ The out-of-period accounts have no Anlage EÜR line (`euerExclusion:
308
+ 'out_of_period'`): a cash-basis book has no such category (§ 4 Abs. 3 with
309
+ § 11 EStG: a late payment for an earlier year is income or expense of the
310
+ year paid, on the account for what it is); an amount a cash-basis book posts
311
+ there is the caller's to refuse or move, never to leave out silently. The VAT accounts split what was paid to and refunded by the
312
+ tax office (Kz 186, Kz 141).
313
+
314
+ The current-year tax accounts name the accounts DATEV keeps for their amounts
315
+ of earlier years (`priorYearAccounts`): an additional payment on `expense`, a
316
+ refund on `income`, both on one account where DATEV keeps one; the books pick
317
+ the twin by the amount's sign. Each twin is an expense account, the refunds
318
+ too (a refund reduces the taxes on income, an expense item of § 275 Abs. 2
319
+ Nr. 14 HGB), of the same chart with a DATEV mark, under the statement line of
320
+ the account naming it (GuV 14), on the Anlage EÜR line of its current year's
321
+ account (Kz 168), and names no twins of its own. An individual account inherits its
322
+ parent's twins.
323
+
324
+ | Current year | SKR03 | twins (expense / income) | SKR04 | twins (expense / income) |
325
+ | --- | --- | --- | --- | --- |
326
+ | Körperschaftsteuer | 2200 | 2203 / 2204 | 7600 | 7603 / 7604 |
327
+ | Solidaritätszuschlag | 2208 | 2209 / 2210 | 7608 | 7609 / 7607 |
328
+ | Gewerbesteuer | 4320 | 2281 / 2281 | 7610 | 7641 / 7641 |
329
+
330
+ A tax return acts on an account beyond its type and position where DATEV marks
331
+ it for its trade or corporate income tax program (`datevMarks`, "G" and "K" in
332
+ the column Programmverbindung, Erläuterungen S. 37) or where it is kept for a
333
+ rule of the income tax law (`taxRule`): `hasTaxReturnFunction`. The marks are
334
+ parsed from the text of the DATEV Kontenrahmen for every account
335
+ (`tools/datev-marks.ts`); a page read by eye wins over the parse (SKR03 4289
336
+ carries G on p. 23, SKR04 6349 none). An individual account inherits its
337
+ parent's marks, and no override changes them; an override may add a tax rule
338
+ but never drop the one that is its parent's only return function
339
+ (`override_invalid`). No account whose UStVA figure is a tax amount
340
+ (`ustva.role: 'tax'`) has a return function.
341
+
271
342
  ### Capital accounts
272
343
 
273
344
  The charts hold these capital accounts (Eigenkapitalkonten), with DATEV's
@@ -350,11 +421,13 @@ S. 37). So an individual account belongs to the account it follows, its
350
421
  parent, and is what the parent is: its type, its HGB position, its UStVA and
351
422
  Anlage EÜR mapping, its account role, its tax rule and DATEV's mark "HB".
352
423
  Where the declaration changes one of them deliberately (`overrides`: a value
353
- replaces the parent's, `null` drops it), the provenance names it. It does not
354
- take the parent's tax automatism or BU-key rules, which DATEV applies only to
355
- the accounts it marks, nor its securities role, which names one account of a
356
- chart: an individual account books a securities role only where its
357
- declaration names one.
424
+ replaces the parent's, `null` drops it), the provenance names it. DATEV's marks
425
+ for the tax programs (`datevMarks`) and the prior-year twins
426
+ (`priorYearAccounts`) pass on as they are; no override changes them. It does
427
+ not take the parent's tax automatism or BU-key rules, which DATEV applies only
428
+ to the accounts it marks, nor its securities role or period role, each of
429
+ which names one account of a chart: an individual account books a securities
430
+ role only where its declaration names one, a period role never.
358
431
 
359
432
  The declarations are the books'; this package stores none. The validator
360
433
  refuses a declaration whose number:
@@ -374,7 +447,8 @@ refuses a declaration whose number:
374
447
  take (a balance-sheet account has a balance-sheet position, a
375
448
  profit-and-loss account an income-statement position), an Anlage EÜR line no
376
449
  form year holds or a split line on the other side, or both a line and an
377
- exclusion.
450
+ exclusion, or that drops the tax rule that is its parent's only tax-return
451
+ function.
378
452
 
379
453
  ```ts
380
454
  import { BooksChart, freeNumbersOf, individualAccountProblemsOf, type IIndividualAccountDeclaration } from '@fin.cx/chartdata';
@@ -397,7 +471,7 @@ books.getMappingCoverage(usedAccountNumbers, 'hgb275');
397
471
  A `BooksChart` is a chart (`IChart`) with the lookups of the chart over the
398
472
  DATEV accounts and the books' own: `getAccount`, `getAccountsByRole`,
399
473
  `getAccountsBySecuritiesRole`, `getSecuritiesAccount`, `getPayrollAccount`,
400
- `getExpenseAccount`, `getMappingCoverage`, `getEuerLines`.
474
+ `getExpenseAccount`, `getPeriodAccount`, `getMappingCoverage`, `getEuerLines`.
401
475
 
402
476
  `INDIVIDUAL_ACCOUNT_TEMPLATES` suggests the parent and name of the results the
403
477
  law keeps apart: the gains and losses of Termingeschäfte, which § 15 Abs. 4
@@ -447,9 +521,12 @@ getMappingCoverage('SKR04', 2026, usedAccountNumbers, 'euer').missing; // []
447
521
  `pass_through` (§ 4 Abs. 3 Satz 2 EStG), `reverse_charge` (the tax of an
448
522
  intra-Community acquisition or under § 13b UStG: such invoices contain no
449
523
  input tax, Anleitung zur Anlage EÜR, Zeile 58, and the tax is no receipt;
450
- what a return leaves to pay counts as paid VAT, Kz 186), `closing` and
451
- `deferred_current_asset` (shares, securities, land and buildings held as
452
- current assets, whose cost counts at their sale, § 4 Abs. 3 Satz 4 EStG).
524
+ what a return leaves to pay counts as paid VAT, Kz 186), `closing`,
525
+ `out_of_period` (periodenfremde Aufwendungen and Erträge, a category a
526
+ cash-basis book does not have: an amount it posts there is the caller's to
527
+ refuse or move) and `deferred_current_asset` (shares, securities, land
528
+ and buildings held as current assets, whose cost counts at their sale, § 4
529
+ Abs. 3 Satz 4 EStG).
453
530
  - A line's `sign` says how it enters its section's sum: 1 adds, -1 subtracts
454
531
  (Zeilen 73 and 75), 0 not at all (a "davon" line, the column "nicht
455
532
  abziehbar", the Entnahmen and Einlagen).
@@ -524,10 +601,12 @@ In particular, trade tax (4320/7610, GuV 14) is an income tax, not an
524
601
  operating tax merely because of its number.
525
602
 
526
603
  GuV 4 disposal-role accounts and neutral-income ranges (SKR03 2500–2699,
527
- 2710–2729; SKR04 4840–4929) go to `other_neutral_income`; remaining GuV 4
604
+ 2710–2729; SKR04 4840–4929, 4960) go to `other_neutral_income`; remaining GuV 4
528
605
  accounts go to `other_operating_income`. GuV 8 disposal-role accounts and
529
606
  neutral-expense ranges (SKR03 2000–2399, 4976–4977; SKR04 6857–6858,
530
- 6880–6909) go to `other_neutral_expense`. Remaining GuV 8 accounts use these
607
+ 6880–6909, 6960) go to `other_neutral_expense`. The periodenfremde Erträge and
608
+ Aufwendungen are neutral in both charts by this one rule (SKR03 2520/2020 inside
609
+ the class-2 ranges, SKR04 4960/6960 as single accounts). Remaining GuV 8 accounts use these
531
610
  inclusive, non-overlapping operating-cost ranges, then `other_operating_costs`:
532
611
 
533
612
  | Posting key | SKR03 | SKR04 |
@@ -565,9 +644,11 @@ therefore remains authoritative. The standard metadata specifies:
565
644
  - Current domestic VAT: `vatNetGroup: 'vat_current_year'`, the cumulative
566
645
  debit-minus-credit sum of the group at `Aktiva B.II.4` when positive and
567
646
  `Passiva C.8` when negative. SKR03 members are 1570, 1571, 1574, 1576, 1577,
568
- 1588, 1770, 1771, 1774, 1776, 1780, 1781, 1784, 1787; SKR04 members are
647
+ 1588, 1770, 1771, 1774, 1776, 1780, 1781, 1784, 1787, 1789; SKR04 members are
569
648
  1400, 1401, 1404, 1406, 1407, 1433, 3800, 3801, 3804, 3806, 3820, 3830,
570
- 3837. Do not state individual members again after netting the group.
649
+ 3834, 3837, 3840. The VAT of the posting year (1789/3840) belongs to the same
650
+ tax period (§ 16 Abs. 1 Satz 2 UStG). Do not state individual members again
651
+ after netting the group.
571
652
  - Prior-year VAT (1790/1791, 3841/3845) and foreign VAT (1728/1767/1768,
572
653
  3798/3817/3818) have sign-sensitive asset/liability rules but **no net group**:
573
654
  they remain separate from the current domestic VAT. Payroll taxes do not
@@ -641,7 +722,7 @@ designation ("AM 8400" … "-09") and the reserved ("R"). The tool checks that
641
722
  every account this package holds from the Kontenrahmen is among them.
642
723
 
643
724
  The generation pipeline lives in the unpublished `tools/` directory
644
- (`tsx tools/generate-charts.ts <oracle csvs>`, `tsx tools/generate-datev-numbers.ts <skr03 text> <skr04 text>`);
725
+ (`tsx tools/generate-charts.ts <oracle csvs> <skr03 text> <skr04 text>`, `tsx tools/generate-datev-numbers.ts <skr03 text> <skr04 text>`);
645
726
  datasets are generated files — extend the curated table in the tool, never
646
727
  edit `ts/data/*` by hand.
647
728
 
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@fin.cx/chartdata',
6
- version: '3.4.0',
6
+ version: '3.6.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
  }
@@ -12,12 +12,13 @@ import type {
12
12
  TExpenseRole,
13
13
  TMappingDimension,
14
14
  TPayrollRole,
15
+ TPeriodRole,
15
16
  TSecuritiesRole,
16
17
  TTaxRule,
17
18
  } from './chartdata.types.js';
18
19
  import { euerLinesOf, getEuerFormLine, listEuerFormYears, type IEuerLinesOptions } from './chartdata.euer.js';
19
20
  import { HGB_266_POSITIONS, HGB_275_GKV_POSITIONS } from './chartdata.hgb.js';
20
- import { getChart, mappingCoverageOf } from './chartdata.lookup.js';
21
+ import { getChart, hasTaxReturnFunction, mappingCoverageOf } from './chartdata.lookup.js';
21
22
  import { DATEV_NUMBERS_SKR03_2026, DATEV_NUMBERS_SKR04_2026 } from './data/datevnumbers.2026.js';
22
23
 
23
24
  const DATEV_NUMBERS: IDatevNumbers[] = [DATEV_NUMBERS_SKR03_2026, DATEV_NUMBERS_SKR04_2026];
@@ -203,8 +204,13 @@ export function individualAccountProblemsOf(
203
204
  }
204
205
  }
205
206
  }
207
+ // the marks pass on unchanged, so only the tax rule can be dropped: never the parent's only return function
208
+ const ownTaxRule = overrides.taxRule === undefined ? parent.taxRule : overrides.taxRule ?? undefined;
209
+ if (hasTaxReturnFunction(parent) && !hasTaxReturnFunction({ datevMarks: parent.datevMarks, taxRule: ownTaxRule })) {
210
+ add(number, 'override_invalid', `${number} drops the tax rule ${parent.taxRule} of its parent ${parent.accountNumber}, its only tax-return function`);
211
+ }
206
212
  if (declaration.securitiesRole !== undefined) {
207
- const taxRule = overrides.taxRule === undefined ? parent.taxRule : overrides.taxRule ?? undefined;
213
+ const taxRule = ownTaxRule;
208
214
  const key = `${declaration.securitiesRole}:${taxRule ?? ''}`;
209
215
  const holder = roles.get(key);
210
216
  if (holder !== undefined) add(number, 'role_taken', `${holder} already books ${declaration.securitiesRole}${taxRule ? ` under ${taxRule}` : ''}`);
@@ -243,6 +249,8 @@ function individualAccountOf(parentArg: IChartAccount, declarationArg: IIndividu
243
249
  ...(accountRole ? { accountRole } : {}),
244
250
  ...(declarationArg.securitiesRole ? { securitiesRole: declarationArg.securitiesRole } : {}),
245
251
  ...(taxRule ? { taxRule } : {}),
252
+ ...(parentArg.datevMarks ? { datevMarks: [...parentArg.datevMarks] } : {}),
253
+ ...(parentArg.priorYearAccounts ? { priorYearAccounts: { ...parentArg.priorYearAccounts } } : {}),
246
254
  ...(commercialOnly ? { commercialOnly } : {}),
247
255
  ...(ustva ? { ustva } : {}),
248
256
  ...(hgb266Position ? { hgb266Position } : {}),
@@ -322,6 +330,11 @@ export class BooksChart implements IChart {
322
330
  return this.accounts.find((account) => account.expenseRole === roleArg) ?? null;
323
331
  }
324
332
 
333
+ /** The one account of the books that books the period role, or `null`; an individual account takes none. */
334
+ public getPeriodAccount(roleArg: TPeriodRole): IChartAccount | null {
335
+ return this.accounts.find((account) => account.periodRole === roleArg) ?? null;
336
+ }
337
+
325
338
  public getMappingCoverage(usedAccountsArg: string[], dimensionArg: TMappingDimension): IMappingCoverage {
326
339
  return mappingCoverageOf(this.accounts, usedAccountsArg, dimensionArg);
327
340
  }
@@ -9,6 +9,7 @@ import type {
9
9
  TExpenseRole,
10
10
  TMappingDimension,
11
11
  TPayrollRole,
12
+ TPeriodRole,
12
13
  TSecuritiesRole,
13
14
  TTaxRule,
14
15
  } from './chartdata.types.js';
@@ -131,6 +132,22 @@ export function getExpenseAccount(chart: TChartName, year: number, role: TExpens
131
132
  return getChart(chart, year).accounts.find((account) => account.expenseRole === role) ?? null;
132
133
  }
133
134
 
135
+ /**
136
+ * The one account of a chart that books the period role (`IChartAccount.periodRole`), or `null` where the chart keeps
137
+ * none for it. Throws for unknown chart/year combinations, as `getChart`.
138
+ */
139
+ export function getPeriodAccount(chart: TChartName, year: number, role: TPeriodRole): IChartAccount | null {
140
+ return getChart(chart, year).accounts.find((account) => account.periodRole === role) ?? null;
141
+ }
142
+
143
+ /**
144
+ * Whether a tax return acts on the account's amounts beyond its type and position: DATEV marks it for its trade or
145
+ * corporate income tax program ("G", "K", `datevMarks`) or it is kept for a rule of the income tax law (`taxRule`).
146
+ */
147
+ export function hasTaxReturnFunction(account: Pick<IChartAccount, 'datevMarks' | 'taxRule'>): boolean {
148
+ return (account.datevMarks?.length ?? 0) > 0 || account.taxRule !== undefined;
149
+ }
150
+
134
151
  function hasMapping(account: IChartAccount, dimension: TMappingDimension): boolean {
135
152
  switch (dimension) {
136
153
  case 'ustva':
@@ -253,8 +253,7 @@ export type TExpenseRole =
253
253
  | 'credit_card_settlement';
254
254
 
255
255
  /**
256
- * A rule of the income tax law an income or expense account is kept for, as
257
- * its DATEV name states it:
256
+ * A rule of the income tax law an income or expense account is kept for, which the tax returns act on:
258
257
  * - 'estg_3_40_kstg_8b': income from shares and the expenses of it under the
259
258
  * Teileinkünfteverfahren (§ 3 Nr. 40, § 3c Abs. 2 EStG) or, for a
260
259
  * corporation, § 8b KStG — DATEV names these accounts "§ 3 Nr. 40 EStG bzw.
@@ -262,9 +261,51 @@ export type TExpenseRole =
262
261
  * income as 100 % tax-free and their expenses as 100 % non-deductible, its
263
262
  * interface to the trade tax 40 % each (Kontenrahmen SKR 03 and SKR 04,
264
263
  * gültig für 2026, footnote 9); the corrections are made in the return, not
265
- * in the books.
264
+ * in the books;
265
+ * - 'estg_4_7': an expense of § 4 Abs. 5 Satz 1 EStG that § 4 Abs. 7 EStG requires to be recorded apart from the
266
+ * other business expenses and that DATEV marks for no tax program (no "G" or "K", `datevMarks`): the deductible
267
+ * gifts (Nr. 1), the deductible 70 % of business meals (Nr. 2), the deductible part of other restricted expenses
268
+ * and of a home office.
269
+ * The accounts DATEV marks "G" or "K" need no tax rule for their return function: their mark is one. Each rule is
270
+ * the account's, not a booking's: which scenario applies is the books' decision.
266
271
  */
267
- export type TTaxRule = 'estg_3_40_kstg_8b';
272
+ export type TTaxRule = 'estg_3_40_kstg_8b' | 'estg_4_7';
273
+
274
+ /**
275
+ * DATEV's marks of an account for its tax programs, in the column "Programmverbindung" of the DATEV Kontenrahmen
276
+ * (SKR 03 and SKR 04, gültig für 2026, Erläuterungen, S. 37): 'G' passes the account to the Gewerbesteuer, 'K' to the
277
+ * Körperschaftsteuer (their add-backs and corrections, such as § 8 Nr. 1 GewStG or § 10 KStG). DATEV passes an
278
+ * account's marks on to the individual accounts after it, up to the next account of the standard chart.
279
+ */
280
+ export type TDatevMark = 'G' | 'K';
281
+
282
+ /**
283
+ * What an account books when a booking of an earlier period reaches the books after that period's year is closed:
284
+ * - 'out_of_period_expense', 'out_of_period_income': the periodenfremde Aufwendungen and Erträge, under the other
285
+ * operating expenses and income (§ 275 Abs. 2 Nr. 8 and Nr. 4 HGB), neutral in the BWA;
286
+ * - 'vat_posting_year': the VAT of an earlier period of the posting date's own calendar year ("Umsatzsteuer
287
+ * laufendes Jahr"; it arises only where the fiscal year is not the calendar year), with the current VAT
288
+ * (§ 16 Abs. 1 Satz 2 UStG);
289
+ * - 'vat_previous_year', 'vat_earlier_years': the VAT of the calendar year before the posting date's and of the
290
+ * years before that ("Umsatzsteuerverbindlichkeiten Vorjahr", "… frühere Jahre").
291
+ * A booking finds its account by this role: within a chart, no two accounts share one, and every role has its account
292
+ * in both standard charts (DATEV Kontenrahmen SKR 03 Art.-Nr. 11174, pp. 11, 13, 16, and SKR 04 Art.-Nr. 11175,
293
+ * pp. 14, 18, 25, gültig für 2026). None of the accounts carries a tax function.
294
+ */
295
+ export type TPeriodRole = 'out_of_period_expense' | 'out_of_period_income' | 'vat_posting_year' | 'vat_previous_year' | 'vat_earlier_years';
296
+
297
+ /**
298
+ * The accounts DATEV keeps for a current-year tax account's amounts of earlier years (SKR 03 2200 → 2203/2204,
299
+ * SKR 04 7600 → 7603/7604): `expense` for an additional payment, `income` for a refund, picked by the amount's sign;
300
+ * one account may take both ("Gewerbesteuernachzahlungen und Gewerbesteuererstattungen für Vorjahre"). Each is a
301
+ * profit-and-loss account of the same chart with a DATEV mark, under the income-statement position of the account
302
+ * naming it, and names no prior-year accounts of its own. A refund twin is an expense account like the others: a
303
+ * refund reduces the taxes on income (§ 275 Abs. 2 Nr. 14 HGB), an expense item.
304
+ */
305
+ export interface IPriorYearAccounts {
306
+ expense: string;
307
+ income: string;
308
+ }
268
309
 
269
310
  /**
270
311
  * Built-in DATEV tax automatism of an account. Lines on automatik accounts
@@ -320,6 +361,13 @@ export type TEuerMapping = { kennzahl: number } | { debitKennzahl: number; credi
320
361
  * Zeile 58); what a return leaves to pay counts as paid VAT (Kz 186);
321
362
  * - 'closing': a carry-forward, closing or statistical account, which records
322
363
  * no business transaction;
364
+ * - 'out_of_period': an earlier year's income or expense booked after that
365
+ * year is closed (periodenfremd), a category a cash-basis book does not
366
+ * have: § 4 Abs. 3 with § 11 EStG puts every receipt and payment in the
367
+ * year paid, and a late payment for an earlier year is ordinary income or
368
+ * expense of that year, on the account for what it is; an amount a
369
+ * cash-basis book posts here is for the consumer to refuse or move, never
370
+ * to leave out of the form silently;
323
371
  * - 'deferred_current_asset': a current asset named in § 4 Abs. 3 Satz 4
324
372
  * EStG — shares, securities, land and buildings —, whose cost counts only
325
373
  * when its sale's proceeds are received or it is withdrawn, as goods
@@ -334,6 +382,7 @@ export type TEuerExclusion =
334
382
  | 'pass_through'
335
383
  | 'reverse_charge'
336
384
  | 'closing'
385
+ | 'out_of_period'
337
386
  | 'deferred_current_asset';
338
387
 
339
388
  /**
@@ -463,8 +512,14 @@ export interface IChartAccount {
463
512
  payrollRole?: TPayrollRole;
464
513
  /** what the account books of the expenses an employee lays out and claims back; unset = nothing of its own */
465
514
  expenseRole?: TExpenseRole;
466
- /** the income tax rule the account is kept for, as its DATEV name states it; unset = none of its own */
515
+ /** the income tax rule the account is kept for; unset = none of its own */
467
516
  taxRule?: TTaxRule;
517
+ /** DATEV's marks of the account for its tax programs ("G", "K"), as the Kontenrahmen prints them; unset = none */
518
+ datevMarks?: TDatevMark[];
519
+ /** what the account books when a booking of a closed year's period reaches the books; unset = nothing of its own */
520
+ periodRole?: TPeriodRole;
521
+ /** the accounts DATEV keeps for this tax account's amounts of earlier years; unset = none */
522
+ priorYearAccounts?: IPriorYearAccounts;
468
523
  /**
469
524
  * DATEV's mark "HB": the account is posted in the commercial balance sheet only (Handelsbilanz), its amounts
470
525
  * are no part of the tax balance sheet; unset = both
@@ -568,10 +623,11 @@ export interface IIndividualAccountOverrides {
568
623
  * An account the books set up themselves (an Individualkonto) on a number the DATEV standard chart leaves free,
569
624
  * belonging to one of its accounts (the parent, `parentAccountNumber`): it is what its parent is — its type, its
570
625
  * balance-sheet or income-statement position, its UStVA and Anlage EÜR mapping, its account role, its tax rule
571
- * and DATEV's mark "HB" — unless `overrides` changes one deliberately. It does not take the parent's DATEV tax
572
- * automatism (DATEV applies one only to the accounts it marks) nor its securities role, which names one account of
573
- * a chart: an individual account takes one only where its declaration names it. The declarations are the books';
574
- * chartdata stores none.
626
+ * and DATEV's mark "HB" — unless `overrides` changes one deliberately. It takes the parent's DATEV marks for the tax
627
+ * programs ("G", "K") and its prior-year twins as they are: no override changes them. It does not take the parent's
628
+ * DATEV tax automatism (DATEV applies one only to the accounts it marks) nor its securities role or period role,
629
+ * each of which names one account of a chart: an individual account takes a securities role only where its
630
+ * declaration names it, a period role never. The declarations are the books'; chartdata stores none.
575
631
  */
576
632
  export interface IIndividualAccountDeclaration {
577
633
  accountNumber: string;
@@ -601,7 +657,8 @@ export interface IIndividualAccountDeclaration {
601
657
  * - `override_invalid`: an override names no balance-sheet position of § 266 HGB, no income-statement position of
602
658
  * § 275 HGB, or one the account's type does not take (a balance-sheet account has a balance-sheet position, a
603
659
  * profit-and-loss account an income-statement position); an Anlage EÜR line no form year holds, a split line on
604
- * the other side; or both a line and an exclusion.
660
+ * the other side; both a line and an exclusion; or it drops the tax rule that is its parent's only tax-return
661
+ * function (`hasTaxReturnFunction`; adding one, or replacing a tax rule by another, stays allowed).
605
662
  */
606
663
  export type TIndividualAccountProblemCode =
607
664
  | 'number_invalid'