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

@@ -68,10 +68,19 @@ tap.test('should handle Class 8 as free for use in SKR04', async () => {
});
tap.test('should post complex transaction in SKR04', async () => {
// Create creditor account for supplier
await api.createAccount({
accountNumber: '70001',
accountName: 'Lieferant Test GmbH',
accountClass: 7,
accountType: 'liability',
skrType: 'SKR04',
});
const transaction = await api.postTransaction({
date: new Date(),
debitAccount: '5400', // Goods with 19% VAT
creditAccount: '1600', // Trade payables
creditAccount: '70001', // Creditor account (supplier)
amount: 119,
description: 'Purchase with VAT',
reference: 'BILL-001',