@tasenor/common-plugins 1.9.16

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.
Files changed (114) hide show
  1. package/.eslintrc.js +4 -0
  2. package/.turbo/turbo-fix.log +4 -0
  3. package/.turbo/turbo-lint.log +4 -0
  4. package/.turbo/turbo-version.log +5 -0
  5. package/LICENSE +21 -0
  6. package/README.md +15 -0
  7. package/data/FinnishBalanceSheetReport.mjs +9 -0
  8. package/data/FinnishBalanceSheetReportInvestment.mjs +11 -0
  9. package/data/FinnishBalanceSheetReportLite.mjs +9 -0
  10. package/data/FinnishIncomeStatementReport.mjs +9 -0
  11. package/data/FinnishIncomeStatementReportInvestment.mjs +11 -0
  12. package/data/FinnishIncomeStatementReportLite.mjs +9 -0
  13. package/data/FinnishInvestmentCompany.mjs +5 -0
  14. package/data/FinnishLimitedCompanyComplete.mjs +5 -0
  15. package/data/FinnishLimitedCompanyLite.mjs +9 -0
  16. package/data/IncomeAndExpenses.mjs +64 -0
  17. package/data/README.md +8 -0
  18. package/data/VATFinland.mjs +22 -0
  19. package/data/bin/build_all +11 -0
  20. package/data/lib/utils.mjs +314 -0
  21. package/data/src/Assets Tree - Definitions.tsv +101 -0
  22. package/data/src/Expense Tree - Definitions.tsv +99 -0
  23. package/data/src/Finland VAT - Definitions.tsv +22 -0
  24. package/data/src/FinnishBalanceSheetReport - balance-sheet-detailed-fi.tsv +215 -0
  25. package/data/src/FinnishBalanceSheetReport - balance-sheet-fi.tsv +93 -0
  26. package/data/src/FinnishBalanceSheetReportInvestment - balance-sheet-detailed-fi.tsv +100 -0
  27. package/data/src/FinnishBalanceSheetReportInvestment - balance-sheet-fi.tsv +52 -0
  28. package/data/src/FinnishBalanceSheetReportLite - balance-sheet-en.tsv +21 -0
  29. package/data/src/FinnishBalanceSheetReportLite - balance-sheet-fi.tsv +21 -0
  30. package/data/src/FinnishBalanceSheetReportLite - balance-sheet-lite-en.tsv +21 -0
  31. package/data/src/FinnishBalanceSheetReportLite - balance-sheet-lite-fi.tsv +21 -0
  32. package/data/src/FinnishIncomeStatementReport - income-statement-detailed-fi.tsv +118 -0
  33. package/data/src/FinnishIncomeStatementReport - income-statement-fi.tsv +45 -0
  34. package/data/src/FinnishIncomeStatementReportInvestment - income-statement-detailed-fi.tsv +96 -0
  35. package/data/src/FinnishIncomeStatementReportInvestment - income-statement-fi.tsv +39 -0
  36. package/data/src/FinnishIncomeStatementReportLite - income-statement-lite-en.tsv +23 -0
  37. package/data/src/FinnishIncomeStatementReportLite - income-statement-lite-fi.tsv +23 -0
  38. package/data/src/FinnishInvestmentCompany - fi-EUR.tsv +722 -0
  39. package/data/src/FinnishLimitedCompanyComplete - fi-EUR.tsv +1086 -0
  40. package/data/src/FinnishLimitedCompanyLite - en-EUR.tsv +97 -0
  41. package/data/src/FinnishLimitedCompanyLite - fi-EUR.tsv +99 -0
  42. package/data/src/Income Tree - Definitions.tsv +60 -0
  43. package/data/src/Tax Types - Definitions.tsv +11 -0
  44. package/package.json +51 -0
  45. package/src/CoinAPI/backend/index.ts +102 -0
  46. package/src/CoinbaseImport/backend/CoinbaseHandler.ts +35 -0
  47. package/src/CoinbaseImport/backend/index.ts +24 -0
  48. package/src/CoinbaseImport/backend/rules.json +64 -0
  49. package/src/DocumentCleaner/ui/index.tsx +165 -0
  50. package/src/Euro/ui/index.tsx +27 -0
  51. package/src/Finnish/ui/finnish.json +341 -0
  52. package/src/Finnish/ui/index.tsx +54 -0
  53. package/src/FinnishBalanceSheetReport/backend/balance-sheet-detailed-fi.tsv +215 -0
  54. package/src/FinnishBalanceSheetReport/backend/balance-sheet-fi.tsv +93 -0
  55. package/src/FinnishBalanceSheetReport/backend/index.ts +107 -0
  56. package/src/FinnishBalanceSheetReportInvestment/backend/balance-sheet-investment-detailed-fi.tsv +100 -0
  57. package/src/FinnishBalanceSheetReportInvestment/backend/balance-sheet-investment-fi.tsv +52 -0
  58. package/src/FinnishBalanceSheetReportInvestment/backend/index.ts +107 -0
  59. package/src/FinnishBalanceSheetReportLite/backend/balance-sheet-lite-en.tsv +21 -0
  60. package/src/FinnishBalanceSheetReportLite/backend/balance-sheet-lite-fi.tsv +21 -0
  61. package/src/FinnishBalanceSheetReportLite/backend/index.ts +121 -0
  62. package/src/FinnishIncomeStatementReport/backend/income-statement-detailed-fi.tsv +118 -0
  63. package/src/FinnishIncomeStatementReport/backend/income-statement-fi.tsv +45 -0
  64. package/src/FinnishIncomeStatementReport/backend/index.ts +212 -0
  65. package/src/FinnishIncomeStatementReportInvestment/backend/income-statement-detailed-fi.tsv +118 -0
  66. package/src/FinnishIncomeStatementReportInvestment/backend/income-statement-fi.tsv +45 -0
  67. package/src/FinnishIncomeStatementReportInvestment/backend/income-statement-investment-detailed-fi.tsv +96 -0
  68. package/src/FinnishIncomeStatementReportInvestment/backend/income-statement-investment-fi.tsv +39 -0
  69. package/src/FinnishIncomeStatementReportInvestment/backend/index.ts +212 -0
  70. package/src/FinnishIncomeStatementReportLite/backend/income-statement-lite-en.tsv +23 -0
  71. package/src/FinnishIncomeStatementReportLite/backend/income-statement-lite-fi.tsv +23 -0
  72. package/src/FinnishIncomeStatementReportLite/backend/index.ts +210 -0
  73. package/src/FinnishInvestmentCompany/backend/fi-EUR.tsv +722 -0
  74. package/src/FinnishInvestmentCompany/backend/index.ts +46 -0
  75. package/src/FinnishInvestmentCompany/ui/index.tsx +26 -0
  76. package/src/FinnishLimitedCompanyComplete/backend/fi-EUR.tsv +1086 -0
  77. package/src/FinnishLimitedCompanyComplete/backend/index.ts +46 -0
  78. package/src/FinnishLimitedCompanyComplete/ui/index.tsx +26 -0
  79. package/src/FinnishLimitedCompanyLite/backend/en-EUR.tsv +97 -0
  80. package/src/FinnishLimitedCompanyLite/backend/fi-EUR.tsv +99 -0
  81. package/src/FinnishLimitedCompanyLite/backend/index.ts +53 -0
  82. package/src/FinnishLimitedCompanyLite/ui/index.tsx +28 -0
  83. package/src/GitBackup/backend/index.ts +109 -0
  84. package/src/GitBackup/ui/index.tsx +127 -0
  85. package/src/IncomeAndExpenses/backend/assetCodes.json +126 -0
  86. package/src/IncomeAndExpenses/backend/expense.json +190 -0
  87. package/src/IncomeAndExpenses/backend/income.json +120 -0
  88. package/src/IncomeAndExpenses/backend/index.ts +354 -0
  89. package/src/IncomeAndExpenses/backend/taxTypes.json +12 -0
  90. package/src/JournalReport/backend/index.ts +157 -0
  91. package/src/KrakenImport/backend/KrakenHandler.ts +88 -0
  92. package/src/KrakenImport/backend/index.ts +24 -0
  93. package/src/KrakenImport/backend/rules.json +52 -0
  94. package/src/LedgerReport/backend/index.ts +161 -0
  95. package/src/LynxImport/backend/LynxHandler.ts +389 -0
  96. package/src/LynxImport/backend/index.ts +24 -0
  97. package/src/LynxImport/backend/rules.json +412 -0
  98. package/src/NordeaImport/backend/NordeaHandler.ts +44 -0
  99. package/src/NordeaImport/backend/index.ts +24 -0
  100. package/src/NordeaImport/backend/rules.json +4 -0
  101. package/src/NordnetImport/backend/NordnetHandler.ts +78 -0
  102. package/src/NordnetImport/backend/index.ts +24 -0
  103. package/src/NordnetImport/backend/rules.json +271 -0
  104. package/src/Rand/ui/index.tsx +27 -0
  105. package/src/RapidAPI/backend/index.ts +133 -0
  106. package/src/TITOImport/backend/TITOHandler.ts +268 -0
  107. package/src/TITOImport/backend/index.ts +24 -0
  108. package/src/TITOImport/backend/rules.json +4 -0
  109. package/src/TagEditor/ui/index.tsx +510 -0
  110. package/src/USDollar/ui/index.tsx +27 -0
  111. package/src/VAT/ui/index.tsx +572 -0
  112. package/src/VATFinland/backend/index.ts +22 -0
  113. package/src/VATFinland/backend/vat.json +23 -0
  114. package/tsconfig.json +13 -0
@@ -0,0 +1,45 @@
1
+ # accounts title flags
2
+ 3000-3600 LIIKEVAIHTO REQUIRED BOLD
3
+ 3600-3630 Valmiiden ja keskeneräisten tuotteiden varastojen muutos
4
+ 3630-3650 Valmistus omaan käyttöön
5
+ 3650-4000 Liiketoiminnan muut tuotot
6
+ 4000-5000 Materiaalit ja palvelut HIDE_TOTAL
7
+ 4000-4450 _Aineet, tarvikkeet ja tavarat HIDE_TOTAL
8
+ 4000-4400 __Ostot tilikauden aikana
9
+ 4400-4450 __Varastojen muutos
10
+ 4450-5000 _Ulkopuoliset palvelut
11
+ 4000-5000 Materiaalit ja palvelut yhteensä
12
+ 5000-6800 Henkilöstökulut HIDE_TOTAL
13
+ 5000-6000 _Palkat ja palkkiot
14
+ 6000-6800 _Henkilösivukulut HIDE_TOTAL
15
+ 6000-6300 __Eläkekulut
16
+ 6300-6800 __Muut henkilösivukulut
17
+ 5000-6800 Henkilöstökulut yhteensä
18
+ 6800-7000 Poistot ja arvonalentumiset HIDE_TOTAL
19
+ 6800-6900 _Suunnitelman mukaiset poistot
20
+ 6900-6990 _Arvonalentumiset pysyvien vastaavien hyödykkeistä
21
+ 6990-7000 _Vaihtuvien vastaavien poikkeukselliset arvonalentumiset
22
+ 6800-7000 Poistot ja arvonalentumiset yhteensä
23
+ 7000-8990 Liiketoiminnan muut kulut
24
+ 3000-9000 LIIKEVOITTO (-TAPPIO) REQUIRED BOLD
25
+ 9000-9700 Rahoitustuotot ja -kulut HIDE_TOTAL
26
+ 9000-9040 _Tuotot osuuksista saman konsernin yrityksissä
27
+ 9040-9070 _Tuotot osuuksista omistusyhteysyrityksissä
28
+ 9080-9150 _Tuotot muista pysyvien vastaavien sijoituksista
29
+ 9150-9300 _Muut korko- ja rahoitustuotot
30
+ 9300-9370 _Arvonalentumiset pysyvien vastaavien sijoituksista
31
+ 9370-9420 _Arvonalentumiset vaihtuvien vastaavien rahoitusarvopapereista
32
+ 9420-9700 _Korkokulut ja muut rahoituskulut
33
+ 9000-9700 Rahoitustuotot ja -kulut yhteensä
34
+ 3000-9700 VOITTO (TAPPIO) ENNEN SATUNNAISIA ERIÄ REQUIRED BOLD
35
+ 9700-9800 Satunnaiset erät HIDE_TOTAL
36
+ 9700-9740 _Satunnaiset tuotot
37
+ 9740-9780 _Satunnaiset kulut
38
+ 9700-9800 Satunnaiset erät yhteensä
39
+ 3000-9800 VOITTO (TAPPIO) ENNEN TILINPÄÄTÖSSIIRTOJA JA VEROJA REQUIRED BOLD
40
+ 9800-9900 Tilinpäätössiirrot
41
+ 9800-9840 _Poistoeron muutos
42
+ 9840-9900 _Vapaaehtoisten varausten muutos
43
+ 9900-9980 Tuloverot
44
+ 9980-9990 Muut välittömät verot
45
+ 3000-9999 TILIKAUDEN VOITTO (TAPPIO) REQUIRED BOLD
@@ -0,0 +1,96 @@
1
+ # accounts title flags
2
+ 5000-5110 LIIKEVAIHTO DETAILS
3
+ BREAK
4
+ 5000-5110 LIIKEVAIHTO REQUIRED BOLD
5
+ BREAK
6
+ 5110-5300 Liiketoiminnan muut tuotot HIDE_TOTAL BOLD
7
+ 5110-5300 _Liiketoiminnan muut tuotot DETAILS
8
+ 5110-5300 Liiketoiminnan muut tuotot yhteensä BOLD
9
+ BREAK
10
+ 5300-5400 Materiaalit ja palvelut HIDE_TOTAL BOLD
11
+ 5300-5360 _Aineet, tarvikkeet ja tavarat HIDE_TOTAL BOLD
12
+ 5300-5360 __Ostot tilikauden aikana HIDE_TOTAL BOLD
13
+ 5300-5360 ___Ostot tilikauden aikana DETAILS
14
+ 5300-5360 __Ostot tilikauden aikana yhteensä BOLD
15
+ 5360-5360 __Varastojen muutos HIDE_TOTAL BOLD
16
+ 5360-5360 ___Varastojen muutos DETAILS
17
+ 5360-5360 __Varastojen muutos yhteensä BOLD
18
+ 5300-5360 _Aineet, tarvikkeet ja tavarat yhteensä BOLD
19
+ 5360-5400 _Ulkopuoliset palvelut HIDE_TOTAL BOLD
20
+ 5360-5400 __Ulkopuoliset palvelut DETAILS
21
+ 5360-5400 _Ulkopuoliset palvelut yhteensä BOLD
22
+ 5300-5400 Materiaalit ja palvelut yhteensä BOLD
23
+ BREAK
24
+ 5400-6800 Henkilöstökulut HIDE_TOTAL BOLD
25
+ 5400-6000 _Palkat ja palkkiot HIDE_TOTAL BOLD
26
+ 5400-6000 __Palkat ja palkkiot DETAILS
27
+ 5400-6000 _Palkat ja palkkiot yhteensä BOLD
28
+ 6000-6800 _Henkilösivukulut HIDE_TOTAL BOLD
29
+ 6000-6300 __Eläkekulut HIDE_TOTAL BOLD
30
+ 6000-6300 ___Eläkekulut DETAILS
31
+ 6000-6300 __Eläkekulut yhteensä BOLD
32
+ 6300-6800 __Muut henkilösivukulut HIDE_TOTAL BOLD
33
+ 6300-6800 ___Muut henkilösivukulut DETAILS
34
+ 6300-6800 __Muut henkilösivukulut yhteensä BOLD
35
+ 6000-6800 _Henkilösivukulut yhteensä BOLD
36
+ 5400-6800 Henkilöstökulut yhteensä BOLD
37
+ BREAK
38
+ 6800-7000 Poistot ja arvonalentumiset HIDE_TOTAL BOLD
39
+ 6800-6900 _Suunnitelman mukaiset poistot HIDE_TOTAL BOLD
40
+ 6800-6900 __Suunnitelman mukaiset poistot DETAILS
41
+ 6800-6900 _Suunnitelman mukaiset poistot yhteensä BOLD
42
+ 6900-6990 _Arvonalentumiset pysyvien vastaavien hyödykkeistä HIDE_TOTAL BOLD
43
+ 6900-6990 __Arvonalentumiset pysyvien vastaavien hyödykkeistä DETAILS
44
+ 6900-6990 _Arvonalentumiset pysyvien vastaavien hyödykkeistä yht. BOLD
45
+ 6990-7000 _Vaihtuvien vastaavien poikkeukselliset arvonalentumiset HIDE_TOTAL BOLD
46
+ 6990-7000 __Vaihtuvien vastaavien poikkeukselliset arvonalentumiset DETAILS
47
+ 6990-7000 _Vaihtuvien vastaavien poik. arvonalentumiset yht. BOLD
48
+ 6800-7000 Poistot ja arvonalentumiset yhteensä BOLD
49
+ BREAK
50
+ 7000-8990 Liiketoiminnan muut kulut HIDE_TOTAL BOLD
51
+ 7000-8990 _Liiketoiminnan muut kulut DETAILS
52
+ 7000-8990 Liiketoiminnan muut kulut yhteensä BOLD
53
+ BREAK
54
+ 5000-9000 LIIKEVOITTO (-TAPPIO) REQUIRED BOLD
55
+ 9000-9700 Rahoitustuotot ja -kulut HIDE_TOTAL BOLD
56
+ 9150-9300 _Muut korko- ja rahoitustuotot HIDE_TOTAL BOLD
57
+ 9150-9300 __Muut korko- ja rahoitustuotot DETAILS
58
+ 9150-9300 _Muut korko- ja rahoitustuotot yhteensä BOLD
59
+ 9300-9370 _Arvonalentumiset pysyvien vastaavien sijoituksista HIDE_TOTAL BOLD
60
+ 9300-9370 __Arvonalentumiset pysyvien vastaavien sijoituksista DETAILS
61
+ 9300-9370 _Arvonalentumiset pys. vastaavien sijoituksista yht. BOLD
62
+ 9370-9420 _Arvonalentumiset vaihtuvien vastaavien rahoitusarvopapereista HIDE_TOTAL BOLD
63
+ 9370-9420 __Arvonalentumiset vaihtuvien vastaavien rahoitusarvopapereista DETAILS
64
+ 9370-9420 _Arvonalentumiset vaiht. vast. rahoitusarvopap. yht. BOLD
65
+ 9420-9700 _Korkokulut ja muut rahoituskulut HIDE_TOTAL BOLD
66
+ 9420-9700 __Korkokulut ja muut rahoituskulut DETAILS
67
+ 9420-9700 _Korkokulut ja muut rahoituskulut yhteensä BOLD
68
+ 9000-9700 Rahoitustuotot ja -kulut yhteensä BOLD
69
+ BREAK
70
+ 5000-9700 VOITTO (TAPPIO) ENNEN SATUNNAISIA ERIÄ REQUIRED BOLD
71
+ 9700-9800 Satunnaiset erät HIDE_TOTAL BOLD
72
+ 9700-9740 _Satunnaiset tuotot HIDE_TOTAL BOLD
73
+ 9700-9740 __Satunnaiset tuotot DETAILS
74
+ 9700-9740 _Satunnaiset tuotot yhteensä BOLD
75
+ 9740-9780 _Satunnaiset kulut HIDE_TOTAL BOLD
76
+ 9740-9780 __Satunnaiset kulut DETAILS
77
+ 9740-9780 _Satunnaiset kulut yhteensä BOLD
78
+ 9700-9800 Satunnaiset erät yhteensä BOLD
79
+ BREAK
80
+ 5000-9800 VOITTO (TAPPIO) ENNEN TILINPÄÄTÖSSIIRTOJA JA VEROJA REQUIRED BOLD
81
+ 9800-9900 Tilinpäätössiirrot HIDE_TOTAL BOLD
82
+ 9800-9840 _Poistoeron muutos HIDE_TOTAL BOLD
83
+ 9800-9840 __Poistoeron muutos DETAILS
84
+ 9800-9840 _Poistoeron muutos yhteensä BOLD
85
+ 9840-9900 _Vapaaehtoisten varausten muutos HIDE_TOTAL BOLD
86
+ 9840-9900 __Vapaaehtoisten varausten muutos DETAILS
87
+ 9840-9900 _Vapaaehtoisten varausten muutos yhteensä BOLD
88
+ 9800-9900 Tilinpäätössiirrot BOLD
89
+ 9900-9980 Tuloverot HIDE_TOTAL BOLD
90
+ 9900-9980 _Tuloverot DETAILS
91
+ 9900-9980 Tuloverot yhteensä BOLD
92
+ 9980-9990 Muut välittömät verot HIDE_TOTAL BOLD
93
+ 9980-9990 _Muut välittömät verot DETAILS
94
+ 9980-9990 Muut välittömät verot yhteensä BOLD
95
+ BREAK
96
+ 5000-9999 TILIKAUDEN VOITTO (TAPPIO) REQUIRED BOLD
@@ -0,0 +1,39 @@
1
+ # accounts title flags
2
+ 5000-5110 LIIKEVAIHTO REQUIRED BOLD
3
+ 5110-5300 Liiketoiminnan muut tuotot
4
+ 5300-5400 Materiaalit ja palvelut HIDE_TOTAL
5
+ 5300-5360 _Aineet, tarvikkeet ja tavarat HIDE_TOTAL
6
+ 5300-5360 __Ostot tilikauden aikana
7
+ 5360-5400 _Ulkopuoliset palvelut
8
+ 5300-5400 Materiaalit ja palvelut yhteensä
9
+ 5400-6800 Henkilöstökulut HIDE_TOTAL
10
+ 5400-6000 _Palkat ja palkkiot
11
+ 6000-6800 _Henkilösivukulut HIDE_TOTAL
12
+ 6000-6300 __Eläkekulut
13
+ 6300-6800 __Muut henkilösivukulut
14
+ 5400-6800 Henkilöstökulut yhteensä
15
+ 6800-7000 Poistot ja arvonalentumiset HIDE_TOTAL
16
+ 6800-6900 _Suunnitelman mukaiset poistot
17
+ 6900-6990 _Arvonalentumiset pysyvien vastaavien hyödykkeistä
18
+ 6990-7000 _Vaihtuvien vastaavien poikkeukselliset arvonalentumiset
19
+ 6800-7000 Poistot ja arvonalentumiset yhteensä
20
+ 7000-8990 Liiketoiminnan muut kulut
21
+ 5000-9000 LIIKEVOITTO (-TAPPIO) REQUIRED BOLD
22
+ 9000-9700 Rahoitustuotot ja -kulut HIDE_TOTAL
23
+ 9150-9300 _Muut korko- ja rahoitustuotot
24
+ 9300-9370 _Arvonalentumiset pysyvien vastaavien sijoituksista
25
+ 9370-9420 _Arvonalentumiset vaihtuvien vastaavien rahoitusarvopapereista
26
+ 9420-9700 _Korkokulut ja muut rahoituskulut
27
+ 9000-9700 Rahoitustuotot ja -kulut yhteensä
28
+ 5000-9700 VOITTO (TAPPIO) ENNEN SATUNNAISIA ERIÄ REQUIRED BOLD
29
+ 9700-9800 Satunnaiset erät HIDE_TOTAL
30
+ 9700-9740 _Satunnaiset tuotot
31
+ 9740-9780 _Satunnaiset kulut
32
+ 9700-9800 Satunnaiset erät yhteensä
33
+ 5000-9800 VOITTO (TAPPIO) ENNEN TILINPÄÄTÖSSIIRTOJA JA VEROJA REQUIRED BOLD
34
+ 9800-9900 Tilinpäätössiirrot
35
+ 9800-9840 _Poistoeron muutos
36
+ 9840-9900 _Vapaaehtoisten varausten muutos
37
+ 9900-9980 Tuloverot
38
+ 9980-9990 Muut välittömät verot
39
+ 5000-9999 TILIKAUDEN VOITTO (TAPPIO) REQUIRED BOLD
@@ -0,0 +1,212 @@
1
+ import { AccountNumber, Language, PluginCode, ReportID, ReportOptions, Version } from '@dataplug/tasenor-common'
2
+ import { ReportPlugin } from '@dataplug/tasenor-common-node'
3
+ import dayjs from 'dayjs'
4
+ import quarterOfYear from 'dayjs/plugin/quarterOfYear'
5
+ dayjs.extend(quarterOfYear)
6
+
7
+ class FinnishIncomeStatementReportInvestment extends ReportPlugin {
8
+
9
+ constructor() {
10
+ super('income-statement-investment-detailed' as ReportID, 'income-statement-investment' as ReportID)
11
+
12
+ this.schemes = new Set(['FinnishInvestmentCompany'])
13
+
14
+ this.code = 'FinnishIncomeStatementReportInvestment' as PluginCode
15
+ this.title = 'Income Statement Report (Finnish - Investment)'
16
+ this.version = '1.0.1' as Version
17
+ this.icon = '<svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><g><path d="M0,0h24v24H0V0z" fill="none"/></g><g><g><path d="M14,5H5v14h14v-9h-5V5z M8,17c-0.55,0-1-0.45-1-1s0.45-1,1-1s1,0.45,1,1S8.55,17,8,17z M8,13 c-0.55,0-1-0.45-1-1s0.45-1,1-1s1,0.45,1,1S8.55,13,8,13z M8,9C7.45,9,7,8.55,7,8s0.45-1,1-1s1,0.45,1,1S8.55,9,8,9z" opacity=".3"/><circle cx="8" cy="8" r="1"/><path d="M15,3H5C3.9,3,3.01,3.9,3.01,5L3,19c0,1.1,0.89,2,1.99,2H19c1.1,0,2-0.9,2-2V9L15,3z M19,19H5V5h9v5h5V19z"/><circle cx="8" cy="12" r="1"/><circle cx="8" cy="16" r="1"/></g></g></svg>'
18
+ this.releaseDate = '2023-03-14'
19
+ this.use = 'backend'
20
+ this.type = 'report'
21
+ this.description = 'Investment company income statement report translated in Finnish.'
22
+
23
+ this.languages = {
24
+ en: {
25
+ 'report-income-statement-investment-detailed': 'Detailed income statement',
26
+ 'report-income-statement-investment': 'Income statement'
27
+ },
28
+ fi: {
29
+ 'report-income-statement-investment-detailed': 'Tuloslaskelma tilierittelyin',
30
+ 'report-income-statement-investment': 'Tuloslaskelma'
31
+ }
32
+ }
33
+ }
34
+
35
+ forceOptions(options) {
36
+ return {
37
+ negateAssetAndProfit: true,
38
+ addPreviousPeriod: !options.byTags
39
+ }
40
+ }
41
+
42
+ getLanguages(): Language[] {
43
+ return ['fi']
44
+ }
45
+
46
+ getReportOptions(): ReportOptions {
47
+ return {
48
+ quarter1: 'radio:1',
49
+ quarter2: 'radio:1',
50
+ quarter3: 'radio:1',
51
+ full: 'radio:1:default',
52
+ byTags: 'boolean'
53
+ }
54
+ }
55
+
56
+ /**
57
+ * Construct column title for period.
58
+ * @param formatName
59
+ * @param period
60
+ * @param settings
61
+ */
62
+ columnTitle(id, period, options) {
63
+ const start = this.time2str(period.start_date)
64
+ let end
65
+ if (options.quarter1) {
66
+ const year = dayjs(period.start_date).year()
67
+ end = dayjs(`${year}-04-01`).subtract(1, 'day').format('YYYY-MM-DD')
68
+ } else if (options.quarter2) {
69
+ const year = dayjs(period.start_date).year()
70
+ end = dayjs(`${year}-07-01`).subtract(1, 'day').format('YYYY-MM-DD')
71
+ } else if (options.quarter3) {
72
+ const year = dayjs(period.start_date).year()
73
+ end = dayjs(`${year}-10-01`).subtract(1, 'day').format('YYYY-MM-DD')
74
+ } else {
75
+ end = this.time2str(period.end_date)
76
+ }
77
+
78
+ return '{' + start + '} - {' + end + '}'
79
+ }
80
+
81
+ async getColumns(id, entries, options, settings) {
82
+ // Construct columns for each tag and extra column for non-tagged.
83
+ if (options.byTags) {
84
+ const columns = settings.tags.map((tag) => ({
85
+ type: 'numeric',
86
+ name: `tag-${tag.tag}`,
87
+ title: tag.name
88
+ }))
89
+ columns.push({
90
+ type: 'numeric',
91
+ name: 'other',
92
+ title: '{Other}'
93
+ })
94
+ columns.unshift({
95
+ name: 'title',
96
+ title: '',
97
+ type: 'name'
98
+ })
99
+ return columns
100
+ }
101
+
102
+ return super.getColumns(id, entries, options, settings)
103
+ }
104
+
105
+ preProcessByTags(id, entries, options, settings, columns) {
106
+ // Prepapre.
107
+ const columnNames = columns.map((col) => col.name)
108
+ const tagSet = new Set(settings.tags.map(t => t.tag))
109
+
110
+ // Summarize all totals from the entries.
111
+ const totals: Record<string, Record<string, number>> = {}
112
+ columnNames.forEach((column) => (totals[column] = {}))
113
+ const accountNames = {}
114
+ const accountNumbers = new Set<AccountNumber>()
115
+ const regex = /^((\[\w+\])+)/
116
+ entries.forEach((entry) => {
117
+ let shares: string[] = []
118
+ const r = regex.exec(entry.description)
119
+ if (r) {
120
+ shares = r[1].substr(1, r[1].length - 2).split('][').filter(t => tagSet.has(t))
121
+ }
122
+ let amount = entry.amount
123
+ if (shares.length) {
124
+ // Share the amount so that rounding errors are split.
125
+ const piece = amount < 0 ? Math.ceil(amount / shares.length) : Math.floor(amount / shares.length)
126
+ shares.forEach((tag) => {
127
+ const column = `tag-${tag}`
128
+ totals[column][entry.number] = totals[column][entry.number] || 0
129
+ totals[column][entry.number] += piece
130
+ amount -= piece
131
+ })
132
+ if (amount) {
133
+ // Make semi-random starting point and distribute cents.
134
+ let i = (entry.periodId) % shares.length
135
+ const delta = amount < 0 ? -1 : 1
136
+ for (let count = Math.abs(amount); count > 0; count--) {
137
+ const column = `tag-${shares[i]}`
138
+ totals[column][entry.number] += delta
139
+ amount -= delta
140
+ i = (i + 1) % shares.length
141
+ }
142
+ }
143
+ }
144
+
145
+ if (amount) {
146
+ totals.other[entry.number] = totals.other[entry.number] || 0
147
+ totals.other[entry.number] += amount
148
+ }
149
+
150
+ accountNames[entry.number] = entry.name
151
+ accountNumbers.add(entry.number)
152
+ })
153
+
154
+ return this.parseAndCombineReport([...accountNumbers], accountNames, columns, options.format, totals)
155
+ }
156
+
157
+ preProcess(id, entries, options, settings, columns) {
158
+ if (options.byTags) {
159
+ return this.preProcessByTags(id, entries, options, settings, columns)
160
+ }
161
+
162
+ const columnNames = columns.map((col) => col.name)
163
+
164
+ // Summarize all totals from the entries.
165
+ const totals = {}
166
+ columnNames.forEach((column) => (totals[column] = {}))
167
+ const accountNames = {}
168
+ const accountNumbers = new Set<AccountNumber>()
169
+ entries.forEach((entry) => {
170
+ const column = 'period' + entry.periodId
171
+ totals[column][entry.number] = totals[column][entry.number] || 0
172
+ totals[column][entry.number] += entry.amount
173
+ accountNames[entry.number] = entry.name
174
+ accountNumbers.add(entry.number)
175
+ })
176
+
177
+ return this.parseAndCombineReport([...accountNumbers], accountNames, columns, options.format, totals)
178
+ }
179
+
180
+ /**
181
+ * Remove empty columns if report made by tags.
182
+ */
183
+ postProcess(id, data, options, settings, columns) {
184
+ if (!options.byTags) {
185
+ return data
186
+ }
187
+
188
+ // Find empty columns.
189
+ const found = new Set()
190
+ for (const line of data) {
191
+ if (!line.amounts) {
192
+ continue
193
+ }
194
+ for (const [k, v] of Object.entries(line.amounts)) {
195
+ if (v !== null && !isNaN(v as number)) {
196
+ found.add(k)
197
+ }
198
+ }
199
+ }
200
+
201
+ // Remove empty columns.
202
+ for (let i = 0; i < columns.length; i++) {
203
+ if (columns[i].type === 'numeric' && !found.has(columns[i].name)) {
204
+ columns.splice(i, 1)
205
+ i--
206
+ }
207
+ }
208
+ return data
209
+ }
210
+ }
211
+
212
+ export default FinnishIncomeStatementReportInvestment
@@ -0,0 +1,23 @@
1
+ # accounts title flags
2
+ 3000-3600 NET TURNOVER REQUIRED BOLD
3
+ 3650-4000 Other Operating Income
4
+ 4000-5000 Materials and Services HIDE_TOTAL
5
+ 4000-4450 _Raw Materials and Services HIDE_TOTAL
6
+ 4000-4400 __Purchases during financial year
7
+ 4400-4450 __Variation in stocks
8
+ 4450-5000 _External services
9
+ 4000-5000 Total materials and services
10
+ 5000-6800 Social security expenses HIDE_TOTAL
11
+ 5000-6000 _Wages and salaries
12
+ 6000-6800 _Social security expenses HIDE_TOTAL
13
+ 6000-6300 __Pension expenses
14
+ 6300-6800 __Other social security expenses
15
+ 5000-6800 Total social security expenses
16
+ 6800-7000 Total depreciation and ammortization
17
+ 7000-8990 Other operating expenses
18
+ 3000-9000 NET TURNOVER (-LOSS) REQUIRED BOLD
19
+ 3000-9700 PROFIT (LOSS) BEFORE EXCEPTIONAL ITEMS REQUIRED BOLD
20
+ 3000-9800 PROFIT (LOSS) BEFORE ACCOUNTING & TAXES REQUIRED BOLD
21
+ 9900-9980 Taxes on income
22
+ 9980-9990 Other direct taxes
23
+ 3000-9999 PROFIT (LOSS) FOR THE PERIOD REQUIRED BOLD
@@ -0,0 +1,23 @@
1
+ # accounts title flags
2
+ 3000-3600 LIIKEVAIHTO REQUIRED BOLD
3
+ 3650-4000 Liiketoiminnan muut tuotot
4
+ 4000-5000 Materiaalit ja palvelut HIDE_TOTAL
5
+ 4000-4450 _Aineet, tarvikkeet ja tavarat HIDE_TOTAL
6
+ 4000-4400 __Ostot tilikauden aikana
7
+ 4400-4450 __Varastojen muutos
8
+ 4450-5000 _Ulkopuoliset palvelut
9
+ 4000-5000 Materiaalit ja palvelut yhteensä
10
+ 5000-6800 Henkilöstökulut HIDE_TOTAL
11
+ 5000-6000 _Palkat ja palkkiot
12
+ 6000-6800 _Henkilösivukulut HIDE_TOTAL
13
+ 6000-6300 __Eläkekulut
14
+ 6300-6800 __Muut henkilösivukulut
15
+ 5000-6800 Henkilöstökulut yhteensä
16
+ 6800-7000 Poistot ja arvonalentumiset yhteensä
17
+ 7000-8990 Liiketoiminnan muut kulut
18
+ 3000-9000 LIIKEVOITTO (-TAPPIO) REQUIRED BOLD
19
+ 3000-9700 VOITTO (TAPPIO) ENNEN SATUNNAISIA ERIÄ REQUIRED BOLD
20
+ 3000-9800 VOITTO (TAPPIO) ENNEN TILINPÄÄTÖSSIIRTOJA JA VEROJA REQUIRED BOLD
21
+ 9900-9980 Tuloverot
22
+ 9980-9990 Muut välittömät verot
23
+ 3000-9999 TILIKAUDEN VOITTO (TAPPIO) REQUIRED BOLD
@@ -0,0 +1,210 @@
1
+ import { AccountNumber, Language, PluginCode, ReportID, ReportOptions, Version } from '@dataplug/tasenor-common'
2
+ import { ReportPlugin } from '@dataplug/tasenor-common-node'
3
+ import dayjs from 'dayjs'
4
+ import quarterOfYear from 'dayjs/plugin/quarterOfYear'
5
+ dayjs.extend(quarterOfYear)
6
+
7
+ class FinnishIncomeStatementReportLite extends ReportPlugin {
8
+
9
+ constructor() {
10
+ super('income-statement-lite' as ReportID)
11
+
12
+ this.schemes = new Set(['FinnishLimitedCompanyLite'])
13
+
14
+ this.code = 'FinnishIncomeStatementReportLite' as PluginCode
15
+ this.title = 'Income Statement Report (Finnish - Lite)'
16
+ this.version = '1.0.17' as Version
17
+ this.icon = '<svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><g><path d="M0,0h24v24H0V0z" fill="none"/></g><g><g><path d="M14,5H5v14h14v-9h-5V5z M8,17c-0.55,0-1-0.45-1-1s0.45-1,1-1s1,0.45,1,1S8.55,17,8,17z M8,13 c-0.55,0-1-0.45-1-1s0.45-1,1-1s1,0.45,1,1S8.55,13,8,13z M8,9C7.45,9,7,8.55,7,8s0.45-1,1-1s1,0.45,1,1S8.55,9,8,9z" opacity=".3"/><circle cx="8" cy="8" r="1"/><path d="M15,3H5C3.9,3,3.01,3.9,3.01,5L3,19c0,1.1,0.89,2,1.99,2H19c1.1,0,2-0.9,2-2V9L15,3z M19,19H5V5h9v5h5V19z"/><circle cx="8" cy="12" r="1"/><circle cx="8" cy="16" r="1"/></g></g></svg>'
18
+ this.releaseDate = '2023-03-14'
19
+ this.use = 'backend'
20
+ this.type = 'report'
21
+ this.description = 'Compact version of income statement report translated in Finnish.'
22
+
23
+ this.languages = {
24
+ en: {
25
+ 'report-income-statement-lite': 'Income statement'
26
+ },
27
+ fi: {
28
+ 'report-income-statement-lite': 'Tuloslaskelma'
29
+ }
30
+ }
31
+ }
32
+
33
+ forceOptions(options) {
34
+ return {
35
+ negateAssetAndProfit: true,
36
+ addPreviousPeriod: !options.byTags
37
+ }
38
+ }
39
+
40
+ getLanguages(): Language[] {
41
+ return ['fi', 'en']
42
+ }
43
+
44
+ getReportOptions(): ReportOptions {
45
+ return {
46
+ quarter1: 'radio:1',
47
+ quarter2: 'radio:1',
48
+ quarter3: 'radio:1',
49
+ full: 'radio:1:default',
50
+ byTags: 'boolean'
51
+ }
52
+ }
53
+
54
+ /**
55
+ * Construct column title for period.
56
+ * @param formatName
57
+ * @param period
58
+ * @param settings
59
+ */
60
+ columnTitle(id, period, options) {
61
+ const start = this.time2str(period.start_date)
62
+ let end
63
+ if (options.quarter1) {
64
+ const year = dayjs(period.start_date).year()
65
+ end = dayjs(`${year}-04-01`).subtract(1, 'day').format('YYYY-MM-DD')
66
+ } else if (options.quarter2) {
67
+ const year = dayjs(period.start_date).year()
68
+ end = dayjs(`${year}-07-01`).subtract(1, 'day').format('YYYY-MM-DD')
69
+ } else if (options.quarter3) {
70
+ const year = dayjs(period.start_date).year()
71
+ end = dayjs(`${year}-10-01`).subtract(1, 'day').format('YYYY-MM-DD')
72
+ } else {
73
+ end = this.time2str(period.end_date)
74
+ }
75
+
76
+ return '{' + start + '} - {' + end + '}'
77
+ }
78
+
79
+ async getColumns(id, entries, options, settings) {
80
+ // Construct columns for each tag and extra column for non-tagged.
81
+ if (options.byTags) {
82
+ const columns = settings.tags.map((tag) => ({
83
+ type: 'numeric',
84
+ name: `tag-${tag.tag}`,
85
+ title: tag.name
86
+ }))
87
+ columns.push({
88
+ type: 'numeric',
89
+ name: 'other',
90
+ title: '{Other}'
91
+ })
92
+ columns.unshift({
93
+ name: 'title',
94
+ title: '',
95
+ type: 'name'
96
+ })
97
+ return columns
98
+ }
99
+
100
+ return super.getColumns(id, entries, options, settings)
101
+ }
102
+
103
+ preProcessByTags(id, entries, options, settings, columns) {
104
+ // Prepapre.
105
+ const columnNames = columns.map((col) => col.name)
106
+ const tagSet = new Set(settings.tags.map(t => t.tag))
107
+
108
+ // Summarize all totals from the entries.
109
+ const totals: Record<string, Record<string, number>> = {}
110
+ columnNames.forEach((column) => (totals[column] = {}))
111
+ const accountNames = {}
112
+ const accountNumbers = new Set<AccountNumber>()
113
+ const regex = /^((\[\w+\])+)/
114
+ entries.forEach((entry) => {
115
+ let shares: string[] = []
116
+ const r = regex.exec(entry.description)
117
+ if (r) {
118
+ shares = r[1].substr(1, r[1].length - 2).split('][').filter(t => tagSet.has(t))
119
+ }
120
+ let amount = entry.amount
121
+ if (shares.length) {
122
+ // Share the amount so that rounding errors are split.
123
+ const piece = amount < 0 ? Math.ceil(amount / shares.length) : Math.floor(amount / shares.length)
124
+ shares.forEach((tag) => {
125
+ const column = `tag-${tag}`
126
+ totals[column][entry.number] = totals[column][entry.number] || 0
127
+ totals[column][entry.number] += piece
128
+ amount -= piece
129
+ })
130
+ if (amount) {
131
+ // Make semi-random starting point and distribute cents.
132
+ let i = (entry.periodId) % shares.length
133
+ const delta = amount < 0 ? -1 : 1
134
+ for (let count = Math.abs(amount); count > 0; count--) {
135
+ const column = `tag-${shares[i]}`
136
+ totals[column][entry.number] += delta
137
+ amount -= delta
138
+ i = (i + 1) % shares.length
139
+ }
140
+ }
141
+ }
142
+
143
+ if (amount) {
144
+ totals.other[entry.number] = totals.other[entry.number] || 0
145
+ totals.other[entry.number] += amount
146
+ }
147
+
148
+ accountNames[entry.number] = entry.name
149
+ accountNumbers.add(entry.number)
150
+ })
151
+
152
+ return this.parseAndCombineReport([...accountNumbers], accountNames, columns, options.format, totals)
153
+ }
154
+
155
+ preProcess(id, entries, options, settings, columns) {
156
+ if (options.byTags) {
157
+ return this.preProcessByTags(id, entries, options, settings, columns)
158
+ }
159
+
160
+ const columnNames = columns.map((col) => col.name)
161
+
162
+ // Summarize all totals from the entries.
163
+ const totals = {}
164
+ columnNames.forEach((column) => (totals[column] = {}))
165
+ const accountNames = {}
166
+ const accountNumbers = new Set<AccountNumber>()
167
+ entries.forEach((entry) => {
168
+ const column = 'period' + entry.periodId
169
+ totals[column][entry.number] = totals[column][entry.number] || 0
170
+ totals[column][entry.number] += entry.amount
171
+ accountNames[entry.number] = entry.name
172
+ accountNumbers.add(entry.number)
173
+ })
174
+
175
+ return this.parseAndCombineReport([...accountNumbers], accountNames, columns, options.format, totals)
176
+ }
177
+
178
+ /**
179
+ * Remove empty columns if report made by tags.
180
+ */
181
+ postProcess(id, data, options, settings, columns) {
182
+ if (!options.byTags) {
183
+ return data
184
+ }
185
+
186
+ // Find empty columns.
187
+ const found = new Set()
188
+ for (const line of data) {
189
+ if (!line.amounts) {
190
+ continue
191
+ }
192
+ for (const [k, v] of Object.entries(line.amounts)) {
193
+ if (v !== null && !isNaN(v as number)) {
194
+ found.add(k)
195
+ }
196
+ }
197
+ }
198
+
199
+ // Remove empty columns.
200
+ for (let i = 0; i < columns.length; i++) {
201
+ if (columns[i].type === 'numeric' && !found.has(columns[i].name)) {
202
+ columns.splice(i, 1)
203
+ i--
204
+ }
205
+ }
206
+ return data
207
+ }
208
+ }
209
+
210
+ export default FinnishIncomeStatementReportLite