Files
skr/readme.hints.md

57 lines
2.4 KiB
Markdown
Raw Normal View History

# Project Readme Hints
## Current Status (2025-10-27)
### Test Results
**ALL 65/65 TESTS PASSING** (100%)
### Recent Fixes
#### Fixed: SKR04 Bug (Account 3300 Misclassification)
**Problem**: Account 3300 was incorrectly hardcoded as an automatic account for SKR04
**Root Cause**: Bug in `ts/skr.classes.account.ts:192` - account 3300 is "Fahrzeugkosten" (vehicle costs), NOT an automatic account
**Solution**:
1. Removed 3300 from automatic accounts list in `isAutomaticAccount()` method
2. Updated test.skr04.ts to use timestamped database names to avoid conflicts
**Files Changed**:
- `ts/skr.classes.account.ts` - Fixed automatic account detection
- `test/test.skr04.ts` - Added timestamp to database name
**Result**: ✅ All SKR04 tests now passing (jahresabschluss.skr04 + basic SKR04 tests)
### Architecture Notes
#### VAT Validation Logic (Recent Changes)
- **skr.classes.journalentry.ts:224-273**: Detects VAT lines in entries to enable smart validation
- **skr.postingkeys.ts:87-100**: Exempts VAT accounts and debtor/creditor accounts from VAT amount requirements
- **Rationale**: VAT accounts ARE the VAT; settlement transactions don't need VAT details again
#### Posting Key Usage Pattern
- **Tax-free operations** (key 40): Internal adjustments, depreciation, closing entries
- **VAT operations** (keys 3, 8, 9, 19, 94): Customer/supplier transactions
- **Best practice**: Use posting key 40 for non-VAT lines in mixed entries
#### Account Structure
- **Automatic accounts**: Cannot be posted to directly (1400 Debtors, 1600 Creditors, 3300 Bank)
- **Personal accounts**: Created in ranges 10000-69999 (debtors), 70000-99999 (creditors)
- **System enforces**: Must use personal variants instead of automatic accounts
### Validation Pipeline
1. **Line-level**: Posting key required, account exists, VAT rules
2. **Posting key level**: VAT amount requirements (with exemptions)
3. **Consistency level**: No mixing tax-free and taxed (unless intentional)
4. **Balance level**: Debits must equal credits (0.01 tolerance)
### Test Coverage
- 65 test cases covering full accounting cycle
- Complete Jahresabschluss (annual closing) workflow in SKR03
- Report generation (Trial Balance, Income Statement, Balance Sheet)
- Transaction reversal and audit trails
- DATEV posting key validation
### Dependencies
- MongoDB via @push.rocks/smartdata for persistence
- TypeScript 5.8.3 with strict mode
- @git.zone/tstest for testing framework
- @push.rocks/smartexpect for assertions