feat: Enhance journal entry and transaction handling with posting keys

- Added posting key support to SKR03 and SKR04 journal entries and transactions to ensure DATEV compliance.
- Implemented validation for posting keys in journal entries, ensuring all lines have a posting key and that they are consistent across the entry.
- Introduced automatic account checks to prevent posting to accounts that cannot be directly posted to (e.g., 1400, 1600).
- Updated account validation to include checks for debtor and creditor ranges.
- Enhanced invoice booking logic to include appropriate posting keys based on VAT rates and scenarios.
- Created a new module for posting key definitions and validation rules, including functions for validating posting keys and suggesting appropriate keys based on transaction parameters.
- Updated tests to cover new posting key functionality and ensure compliance with accounting rules.
This commit is contained in:
2025-10-27 08:34:28 +00:00
parent 73b46f7857
commit 4f1066da2e
13 changed files with 758 additions and 229 deletions

View File

@@ -91,9 +91,9 @@ tap.test('should post journal entry in SKR03', async () => {
description: 'Test journal entry',
reference: 'JE-001',
lines: [
{ accountNumber: '1000', debit: 500 }, // Cash
{ accountNumber: '1200', debit: 500 }, // Bank
{ accountNumber: '4000', credit: 1000 }, // Revenue
{ accountNumber: '1000', debit: 500, postingKey: 40 }, // Cash
{ accountNumber: '1200', debit: 500, postingKey: 40 }, // Bank
{ accountNumber: '4000', credit: 1000, postingKey: 40 }, // Revenue
],
skrType: 'SKR03',
});