@fin.cx/skr 1.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.
Files changed (44) hide show
  1. package/dist_ts/index.d.ts +10 -0
  2. package/dist_ts/index.js +11 -0
  3. package/dist_ts/plugins.d.ts +5 -0
  4. package/dist_ts/plugins.js +7 -0
  5. package/dist_ts/skr.api.d.ts +181 -0
  6. package/dist_ts/skr.api.js +402 -0
  7. package/dist_ts/skr.classes.account.d.ts +34 -0
  8. package/dist_ts/skr.classes.account.js +224 -0
  9. package/dist_ts/skr.classes.chartofaccounts.d.ts +99 -0
  10. package/dist_ts/skr.classes.chartofaccounts.js +377 -0
  11. package/dist_ts/skr.classes.journalentry.d.ts +33 -0
  12. package/dist_ts/skr.classes.journalentry.js +296 -0
  13. package/dist_ts/skr.classes.ledger.d.ts +61 -0
  14. package/dist_ts/skr.classes.ledger.js +363 -0
  15. package/dist_ts/skr.classes.reports.d.ts +55 -0
  16. package/dist_ts/skr.classes.reports.js +514 -0
  17. package/dist_ts/skr.classes.transaction.d.ts +37 -0
  18. package/dist_ts/skr.classes.transaction.js +263 -0
  19. package/dist_ts/skr.database.d.ts +5 -0
  20. package/dist_ts/skr.database.js +28 -0
  21. package/dist_ts/skr.types.d.ts +126 -0
  22. package/dist_ts/skr.types.js +2 -0
  23. package/dist_ts/skr03.data.d.ts +18 -0
  24. package/dist_ts/skr03.data.js +890 -0
  25. package/dist_ts/skr04.data.d.ts +18 -0
  26. package/dist_ts/skr04.data.js +912 -0
  27. package/npmextra.json +17 -0
  28. package/package.json +61 -0
  29. package/readme.hints.md +3 -0
  30. package/readme.md +409 -0
  31. package/readme.plan.md +243 -0
  32. package/ts/index.ts +10 -0
  33. package/ts/plugins.ts +7 -0
  34. package/ts/skr.api.ts +533 -0
  35. package/ts/skr.classes.account.ts +238 -0
  36. package/ts/skr.classes.chartofaccounts.ts +508 -0
  37. package/ts/skr.classes.journalentry.ts +318 -0
  38. package/ts/skr.classes.ledger.ts +528 -0
  39. package/ts/skr.classes.reports.ts +721 -0
  40. package/ts/skr.classes.transaction.ts +300 -0
  41. package/ts/skr.database.ts +39 -0
  42. package/ts/skr.types.ts +154 -0
  43. package/ts/skr03.data.ts +901 -0
  44. package/ts/skr04.data.ts +923 -0
package/readme.plan.md ADDED
@@ -0,0 +1,243 @@
1
+ # @fin.cx/skr Implementation Plan
2
+
3
+ ## Command to reread CLAUDE.md
4
+
5
+ `cat /home/philkunz/.claude/CLAUDE.md`
6
+
7
+ ## Project Overview
8
+
9
+ TypeScript module implementing SKR03 and SKR04 German accounting standards for double-entry bookkeeping with MongoDB persistence via @push.rocks/smartdata.
10
+
11
+ ## Implementation Tasks
12
+
13
+ ### Phase 1: Project Setup
14
+
15
+ - [ ] Initialize npm project with pnpm
16
+ - [ ] Create package.json with proper metadata (@fin.cx/skr)
17
+ - [ ] Install core dependencies
18
+ - [ ] @push.rocks/smartdata
19
+ - [ ] @git.zone/tstest (dev dependency)
20
+ - [ ] Create tsconfig.json based on @push.rocks/smarthash pattern
21
+ - [ ] Create npmextra.json for additional configuration
22
+ - [ ] Create .gitignore file
23
+ - [ ] Create directory structure
24
+ - [ ] ts/ directory for source code
25
+ - [ ] test/ directory for tests
26
+ - [ ] .vscode/ for VS Code settings
27
+ - [ ] Create initial readme.md with project description
28
+
29
+ ### Phase 2: Core Infrastructure
30
+
31
+ - [ ] Create ts/index.ts with main exports
32
+ - [ ] Create ts/plugins.ts for dependency management
33
+ - [ ] Import and export @push.rocks/smartdata
34
+ - [ ] Import and export @push.rocks/smartunique for ID generation
35
+ - [ ] Import and export @push.rocks/smarttime for date handling
36
+ - [ ] Set up database connection helper in ts/skr.database.ts
37
+ - [ ] Create type definitions in ts/skr.types.ts
38
+ - [ ] Define AccountType enum
39
+ - [ ] Define SKRType enum
40
+ - [ ] Define TransactionStatus enum
41
+ - [ ] Define report interfaces
42
+
43
+ ### Phase 3: Data Models
44
+
45
+ - [ ] Create ts/skr.classes.account.ts
46
+ - [ ] Define Account class extending SmartDataDbDoc
47
+ - [ ] Add accountNumber field with unique index
48
+ - [ ] Add accountName with searchable decorator
49
+ - [ ] Add accountClass (0-9)
50
+ - [ ] Add accountType (asset/liability/equity/revenue/expense)
51
+ - [ ] Add skrType (SKR03/SKR04)
52
+ - [ ] Add balance field
53
+ - [ ] Add validation methods
54
+ - [ ] Add helper methods for balance updates
55
+ - [ ] Create ts/skr.classes.transaction.ts
56
+ - [ ] Define Transaction class extending SmartDataDbDoc
57
+ - [ ] Add transactionId with unique index
58
+ - [ ] Add date field with index
59
+ - [ ] Add debitAccount and creditAccount fields
60
+ - [ ] Add amount field
61
+ - [ ] Add description with searchable decorator
62
+ - [ ] Add reference field
63
+ - [ ] Add validation for double-entry rules
64
+ - [ ] Add beforeSave hook for validation
65
+ - [ ] Create ts/skr.classes.journalentry.ts
66
+ - [ ] Define JournalEntry class for multi-line entries
67
+ - [ ] Support split transactions
68
+ - [ ] Add validation for balanced entries
69
+
70
+ ### Phase 4: SKR Account Definitions
71
+
72
+ - [ ] Create ts/skr03.data.ts
73
+ - [ ] Define account class 0 (Capital accounts)
74
+ - [ ] Define account class 1 (Fixed assets)
75
+ - [ ] Define account class 2 (Current assets)
76
+ - [ ] Define account class 3 (Equity and liabilities)
77
+ - [ ] Define account class 4 (Operating income)
78
+ - [ ] Define account class 5 (Operating expenses - materials)
79
+ - [ ] Define account class 6 (Operating expenses - personnel)
80
+ - [ ] Define account class 7 (Operating expenses - other)
81
+ - [ ] Define account class 8 (Financial accounts)
82
+ - [ ] Define account class 9 (Closing accounts)
83
+ - [ ] Create ts/skr04.data.ts
84
+ - [ ] Define account class 0 (Capital accounts)
85
+ - [ ] Define account class 1 (Financial accounts)
86
+ - [ ] Define account class 2 (Expenses)
87
+ - [ ] Define account class 3 (Expenses continued)
88
+ - [ ] Define account class 4 (Revenues)
89
+ - [ ] Define account class 5 (Revenues continued)
90
+ - [ ] Define account class 6 (Special accounts)
91
+ - [ ] Define account class 7 (Cost accounting)
92
+ - [ ] Define account class 8 (Free for use)
93
+ - [ ] Define account class 9 (Closing accounts)
94
+
95
+ ### Phase 5: Business Logic
96
+
97
+ - [ ] Create ts/skr.classes.chartofaccounts.ts
98
+ - [ ] Implement initializeSKR03() method
99
+ - [ ] Implement initializeSKR04() method
100
+ - [ ] Implement getAccountByNumber() method
101
+ - [ ] Implement getAccountsByClass() method
102
+ - [ ] Implement createCustomAccount() method
103
+ - [ ] Implement validateAccountNumber() method
104
+ - [ ] Implement importFromCSV() method
105
+ - [ ] Implement exportToCSV() method
106
+ - [ ] Create ts/skr.classes.ledger.ts
107
+ - [ ] Implement postTransaction() method
108
+ - [ ] Implement postJournalEntry() method
109
+ - [ ] Implement validateDoubleEntry() method
110
+ - [ ] Implement updateAccountBalances() method
111
+ - [ ] Implement reverseTransaction() method
112
+ - [ ] Implement getAccountHistory() method
113
+ - [ ] Implement closeAccountingPeriod() method
114
+
115
+ ### Phase 6: Reporting
116
+
117
+ - [ ] Create ts/skr.classes.reports.ts
118
+ - [ ] Implement getTrialBalance() method
119
+ - [ ] Implement getIncomeStatement() for SKR03
120
+ - [ ] Implement getIncomeStatement() for SKR04
121
+ - [ ] Implement getBalanceSheet() for SKR03
122
+ - [ ] Implement getBalanceSheet() for SKR04
123
+ - [ ] Implement getGeneralLedger() method
124
+ - [ ] Implement getAccountStatement() method
125
+ - [ ] Implement getCashFlowStatement() method
126
+ - [ ] Add DATEV export format support
127
+
128
+ ### Phase 7: API Layer
129
+
130
+ - [ ] Create ts/skr.api.ts
131
+ - [ ] Implement REST-style account methods
132
+ - [ ] createAccount()
133
+ - [ ] getAccount()
134
+ - [ ] updateAccount()
135
+ - [ ] deleteAccount()
136
+ - [ ] listAccounts()
137
+ - [ ] Implement transaction methods
138
+ - [ ] postTransaction()
139
+ - [ ] getTransaction()
140
+ - [ ] listTransactions()
141
+ - [ ] reverseTransaction()
142
+ - [ ] Implement report methods
143
+ - [ ] generateTrialBalance()
144
+ - [ ] generateIncomeStatement()
145
+ - [ ] generateBalanceSheet()
146
+ - [ ] Implement search methods
147
+ - [ ] searchAccounts()
148
+ - [ ] searchTransactions()
149
+ - [ ] Add pagination support
150
+ - [ ] Add filtering support
151
+
152
+ ### Phase 8: Testing
153
+
154
+ - [ ] Create test/test.basic.ts
155
+ - [ ] Test database connection
156
+ - [ ] Test basic model creation
157
+ - [ ] Create test/test.skr03.ts
158
+ - [ ] Test SKR03 account initialization
159
+ - [ ] Test SKR03 specific account structure
160
+ - [ ] Test process-oriented organization
161
+ - [ ] Test SKR03 reporting
162
+ - [ ] Create test/test.skr04.ts
163
+ - [ ] Test SKR04 account initialization
164
+ - [ ] Test SKR04 specific account structure
165
+ - [ ] Test financial statement organization
166
+ - [ ] Test SKR04 reporting
167
+ - [ ] Create test/test.transactions.ts
168
+ - [ ] Test simple transaction posting
169
+ - [ ] Test complex journal entries
170
+ - [ ] Test double-entry validation
171
+ - [ ] Test balance updates
172
+ - [ ] Test transaction reversal
173
+ - [ ] Create test/test.reports.ts
174
+ - [ ] Test trial balance generation
175
+ - [ ] Test income statement
176
+ - [ ] Test balance sheet
177
+ - [ ] Test report accuracy
178
+ - [ ] Create test/test.api.ts
179
+ - [ ] Test API CRUD operations
180
+ - [ ] Test API search functionality
181
+ - [ ] Test API pagination
182
+ - [ ] Test API error handling
183
+
184
+ ### Phase 9: Documentation
185
+
186
+ - [ ] Update readme.md with comprehensive documentation
187
+ - [ ] Installation instructions
188
+ - [ ] Quick start guide
189
+ - [ ] API reference
190
+ - [ ] SKR03 vs SKR04 explanation
191
+ - [ ] Code examples
192
+ - [ ] Add inline JSDoc comments to all classes and methods
193
+ - [ ] Create example usage files
194
+ - [ ] Document CSV import/export format
195
+ - [ ] Document DATEV compatibility
196
+
197
+ ### Phase 10: Build and Quality
198
+
199
+ - [ ] Run pnpm build and fix any TypeScript errors
200
+ - [ ] Run pnpm test and ensure all tests pass
201
+ - [ ] Check for missing type definitions
202
+ - [ ] Optimize database indexes
203
+ - [ ] Add data validation and error handling
204
+ - [ ] Performance testing with large datasets
205
+ - [ ] Security review for data access
206
+
207
+ ### Phase 11: Advanced Features
208
+
209
+ - [ ] Add multi-currency support
210
+ - [ ] Add VAT/tax calculation helpers
211
+ - [ ] Add cost center accounting
212
+ - [ ] Add budget management
213
+ - [ ] Add audit trail functionality
214
+ - [ ] Add data migration tools
215
+ - [ ] Add backup/restore functionality
216
+
217
+ ### Phase 12: Finalization
218
+
219
+ - [ ] Final code review
220
+ - [ ] Update all documentation
221
+ - [ ] Create migration guide from other systems
222
+ - [ ] Prepare for npm publication
223
+ - [ ] Create changelog
224
+ - [ ] Tag version 1.0.0
225
+
226
+ ## Notes
227
+
228
+ - SKR03 uses process structure principle (operating procedures)
229
+ - SKR04 uses financial classification principle (financial statements)
230
+ - Account numbers are 4-digit (0000-9999)
231
+ - Must maintain double-entry bookkeeping rules
232
+ - Use @push.rocks/smartdata for all database operations
233
+ - Follow existing code patterns from @push.rocks modules
234
+ - Test with @git.zone/tstest using expect from tapbundle
235
+
236
+ ## Success Criteria
237
+
238
+ - [ ] All account classes (0-9) implemented for both SKR03 and SKR04
239
+ - [ ] Double-entry bookkeeping validation working
240
+ - [ ] Reports generating correctly
241
+ - [ ] All tests passing
242
+ - [ ] TypeScript compilation successful
243
+ - [ ] Documentation complete
package/ts/index.ts ADDED
@@ -0,0 +1,10 @@
1
+ export * from './skr.types.js';
2
+ export * from './skr.classes.account.js';
3
+ export * from './skr.classes.transaction.js';
4
+ export * from './skr.classes.journalentry.js';
5
+ export * from './skr.classes.chartofaccounts.js';
6
+ export * from './skr.classes.ledger.js';
7
+ export * from './skr.classes.reports.js';
8
+ export * from './skr.api.js';
9
+ export * from './skr03.data.js';
10
+ export * from './skr04.data.js';
package/ts/plugins.ts ADDED
@@ -0,0 +1,7 @@
1
+ // @push.rocks scope
2
+ import * as smartdata from '@push.rocks/smartdata';
3
+ import * as smartunique from '@push.rocks/smartunique';
4
+ import * as smarttime from '@push.rocks/smarttime';
5
+ import * as smartlog from '@push.rocks/smartlog';
6
+
7
+ export { smartdata, smartunique, smarttime, smartlog };