@fin.cx/chartdata 2.12.1 → 2.13.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.12.1",
3
+ "version": "2.13.0",
4
4
  "private": false,
5
5
  "description": "Year-versioned German SKR03/SKR04 chart-of-accounts datasets with Automatikkonto functions, BU-key rules, and UStVA-Kennzahl mappings",
6
6
  "main": "dist_ts/index.js",
@@ -28,10 +28,10 @@
28
28
  },
29
29
  "homepage": "https://code.foss.global/fin.cx/chartdata#readme",
30
30
  "devDependencies": {
31
- "@git.zone/tsbuild": "^5.0.0",
31
+ "@git.zone/tsbuild": "^5.1.2",
32
32
  "@git.zone/tsrun": "^3.0.2",
33
- "@git.zone/tstest": "^6.3.2",
34
- "@types/node": "^26.6.2"
33
+ "@git.zone/tstest": "^7.2.0",
34
+ "@types/node": "^26.6.3"
35
35
  },
36
36
  "files": [
37
37
  "ts/**/*",
package/readme.md CHANGED
@@ -23,6 +23,10 @@ For reporting bugs, issues, or security vulnerabilities, please visit [community
23
23
  Bemessungsgrundlagen that cannot be derived from a single account: Kz 46/47
24
24
  (§13b Abs. 1), Kz 73/74 (§13b Abs. 2 Nr. 3, under the GrEStG) and Kz 84/85
25
25
  (the other §13b Abs. 2 supplies)
26
+ - Account roles (`accountRole`) where an account's type and HGB position do
27
+ not tell it apart from the others of its position: a fixed asset's sale
28
+ proceeds (`asset_sale_proceeds`) and the book value of a disposed fixed
29
+ asset (`disposal_book_value`), listed per chart by `getAccountsByRole`
26
30
  - Coverage introspection that fails loudly on mapping gaps
27
31
  - Provenance on every record
28
32
 
@@ -38,6 +42,7 @@ pnpm add @fin.cx/chartdata
38
42
  import {
39
43
  getChart,
40
44
  getAccount,
45
+ getAccountsByRole,
41
46
  getMappingCoverage,
42
47
  USTVA_SCENARIO_KENNZAHLEN,
43
48
  } from '@fin.cx/chartdata';
@@ -55,6 +60,15 @@ if (coverage.missing.length > 0 || coverage.unknown.length > 0) {
55
60
  }
56
61
 
57
62
  USTVA_SCENARIO_KENNZAHLEN.intraEuAcquisitionBaseStandard; // 89
63
+
64
+ // a fixed asset's disposal: DATEV states a book gain net under GuV 4 and a
65
+ // book loss under GuV 8, so the role tells the proceeds and the book value
66
+ // apart from the other income and expenses there
67
+ getAccount('SKR03', 2026, '8820')?.accountRole; // 'asset_sale_proceeds'
68
+ getAccount('SKR04', 2026, '6895')?.accountRole; // 'disposal_book_value'
69
+ getAccount('SKR03', 2026, '8400')?.accountRole; // undefined
70
+ getAccountsByRole('SKR04', 2026, 'disposal_book_value').map((account) => account.accountNumber);
71
+ // ['4855', '4856', '4857', '4858', '6895', '6896', '6897', '6898']
58
72
  ```
59
73
 
60
74
  ## Data Provenance and Verification
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@fin.cx/chartdata',
6
- version: '2.12.1',
6
+ version: '2.13.0',
7
7
  description: 'Year-versioned German SKR03/SKR04 chart-of-accounts datasets with Automatikkonto functions, BU-key rules, and UStVA-Kennzahl mappings'
8
8
  }
@@ -3,6 +3,7 @@ import type {
3
3
  IChartAccount,
4
4
  IMappingCoverage,
5
5
  IScenarioKennzahlen,
6
+ TAccountRole,
6
7
  TChartName,
7
8
  TMappingDimension,
8
9
  } from './chartdata.types.js';
@@ -68,6 +69,18 @@ export function getAccount(
68
69
  );
69
70
  }
70
71
 
72
+ /**
73
+ * The accounts of a chart with the role (`IChartAccount.accountRole`), in the
74
+ * chart's order. Throws for unknown chart/year combinations, as `getChart`.
75
+ */
76
+ export function getAccountsByRole(
77
+ chart: TChartName,
78
+ year: number,
79
+ role: TAccountRole,
80
+ ): IChartAccount[] {
81
+ return getChart(chart, year).accounts.filter((account) => account.accountRole === role);
82
+ }
83
+
71
84
  function hasMapping(account: IChartAccount, dimension: TMappingDimension): boolean {
72
85
  switch (dimension) {
73
86
  case 'ustva':
@@ -2,6 +2,20 @@ export type TChartName = 'SKR03' | 'SKR04';
2
2
 
3
3
  export type TAccountType = 'asset' | 'liability' | 'equity' | 'revenue' | 'expense';
4
4
 
5
+ /**
6
+ * What an account is for where its type and HGB position do not tell it apart
7
+ * from the other accounts of its position. A fixed asset's disposal: DATEV
8
+ * states a sale's book gain net under the other operating income (GuV 4) and
9
+ * a book loss under the other operating expenses (GuV 8), the proceeds
10
+ * against the book value, beside the other income and expenses there.
11
+ * - 'asset_sale_proceeds': what a fixed asset fetched when it was sold
12
+ * ("Erlöse aus Verkäufen Sachanlagevermögen", immaterieller
13
+ * Vermögensgegenstände, Finanzanlagen), a revenue account;
14
+ * - 'disposal_book_value': the book value a disposed fixed asset leaves the
15
+ * books with ("Anlagenabgänge … (Restbuchwert …)"), an expense account.
16
+ */
17
+ export type TAccountRole = 'asset_sale_proceeds' | 'disposal_book_value';
18
+
5
19
  /**
6
20
  * Built-in DATEV tax automatism of an account. Lines on automatik accounts
7
21
  * must carry no BU key (automatism applies) or key 40 (automatism cancelled).
@@ -26,6 +40,8 @@ export interface IChartAccount {
26
40
  accountName: string;
27
41
  accountClass: number;
28
42
  accountType: TAccountType;
43
+ /** what the account is for beyond its type and HGB position; unset = they say it all */
44
+ accountRole?: TAccountRole;
29
45
  description?: string;
30
46
  automatikFunction?: TAutomatikFunction;
31
47
  /** BU keys allowed on lines of this account ('' = none). Unset = all. */