@fin.cx/skr 1.1.0 → 1.2.1
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.
- package/dist_ts/00_commitinfo_data.d.ts +8 -0
- package/dist_ts/00_commitinfo_data.js +9 -0
- package/dist_ts/index.d.ts +6 -0
- package/dist_ts/index.js +7 -1
- package/dist_ts/plugins.d.ts +8 -1
- package/dist_ts/plugins.js +10 -2
- package/dist_ts/skr.api.d.ts +70 -0
- package/dist_ts/skr.api.js +348 -1
- package/dist_ts/skr.classes.account.d.ts +28 -0
- package/dist_ts/skr.classes.account.js +87 -4
- package/dist_ts/skr.classes.journalentry.js +56 -4
- package/dist_ts/skr.classes.ledger.js +5 -1
- package/dist_ts/skr.export.accounts.d.ts +53 -0
- package/dist_ts/skr.export.accounts.js +111 -0
- package/dist_ts/skr.export.balances.d.ts +59 -0
- package/dist_ts/skr.export.balances.js +205 -0
- package/dist_ts/skr.export.d.ts +110 -0
- package/dist_ts/skr.export.js +315 -0
- package/dist_ts/skr.export.ledger.d.ts +95 -0
- package/dist_ts/skr.export.ledger.js +164 -0
- package/dist_ts/skr.export.pdf.d.ts +82 -0
- package/dist_ts/skr.export.pdf.js +548 -0
- package/dist_ts/skr.invoice.adapter.d.ts +98 -0
- package/dist_ts/skr.invoice.adapter.js +476 -0
- package/dist_ts/skr.invoice.booking.d.ts +102 -0
- package/dist_ts/skr.invoice.booking.js +578 -0
- package/dist_ts/skr.invoice.entity.d.ts +287 -0
- package/dist_ts/skr.invoice.entity.js +2 -0
- package/dist_ts/skr.invoice.mapper.d.ts +69 -0
- package/dist_ts/skr.invoice.mapper.js +401 -0
- package/dist_ts/skr.invoice.storage.d.ts +140 -0
- package/dist_ts/skr.invoice.storage.js +529 -0
- package/dist_ts/skr.postingkeys.d.ts +56 -0
- package/dist_ts/skr.postingkeys.js +196 -0
- package/dist_ts/skr.security.d.ts +65 -0
- package/dist_ts/skr.security.js +319 -0
- package/dist_ts/skr.types.d.ts +19 -0
- package/dist_ts/skr03.data.js +3 -1
- package/dist_ts/skr04.data.js +3 -1
- package/package.json +17 -12
- package/readme.hints.md +54 -1
- package/readme.md +207 -16
- package/ts/00_commitinfo_data.ts +8 -0
- package/ts/index.ts +6 -0
- package/ts/plugins.ts +22 -1
- package/ts/skr.api.ts +485 -0
- package/ts/skr.classes.account.ts +106 -3
- package/ts/skr.classes.journalentry.ts +78 -3
- package/ts/skr.classes.ledger.ts +4 -0
- package/ts/skr.export.accounts.ts +154 -0
- package/ts/skr.export.balances.ts +270 -0
- package/ts/skr.export.ledger.ts +249 -0
- package/ts/skr.export.pdf.ts +601 -0
- package/ts/skr.export.ts +443 -0
- package/ts/skr.invoice.adapter.ts +581 -0
- package/ts/skr.invoice.booking.ts +760 -0
- package/ts/skr.invoice.entity.ts +351 -0
- package/ts/skr.invoice.mapper.ts +486 -0
- package/ts/skr.invoice.storage.ts +710 -0
- package/ts/skr.postingkeys.ts +252 -0
- package/ts/skr.security.ts +405 -0
- package/ts/skr.types.ts +27 -0
- package/ts/skr03.data.ts +2 -0
- package/ts/skr04.data.ts +2 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { JournalEntry } from './skr.classes.journalentry.js';
|
|
2
|
+
import type { TSKRType } from './skr.types.js';
|
|
3
|
+
import type { IInvoice, IBookingRules, IBookingInfo, IPaymentInfo } from './skr.invoice.entity.js';
|
|
4
|
+
/**
|
|
5
|
+
* Options for booking an invoice
|
|
6
|
+
*/
|
|
7
|
+
export interface IBookingOptions {
|
|
8
|
+
autoBook?: boolean;
|
|
9
|
+
confidenceThreshold?: number;
|
|
10
|
+
bookingDate?: Date;
|
|
11
|
+
bookingReference?: string;
|
|
12
|
+
skipValidation?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Result of booking an invoice
|
|
16
|
+
*/
|
|
17
|
+
export interface IBookingResult {
|
|
18
|
+
success: boolean;
|
|
19
|
+
journalEntry?: JournalEntry;
|
|
20
|
+
bookingInfo?: IBookingInfo;
|
|
21
|
+
confidence: number;
|
|
22
|
+
warnings?: string[];
|
|
23
|
+
errors?: string[];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Automatic booking engine for invoices
|
|
27
|
+
* Creates journal entries from invoice data based on SKR mapping rules
|
|
28
|
+
*/
|
|
29
|
+
export declare class InvoiceBookingEngine {
|
|
30
|
+
private logger;
|
|
31
|
+
private skrType;
|
|
32
|
+
private mapper;
|
|
33
|
+
constructor(skrType: TSKRType);
|
|
34
|
+
/**
|
|
35
|
+
* Book an invoice to the ledger
|
|
36
|
+
*/
|
|
37
|
+
bookInvoice(invoice: IInvoice, bookingRules?: Partial<IBookingRules>, options?: IBookingOptions): Promise<IBookingResult>;
|
|
38
|
+
/**
|
|
39
|
+
* Build journal entry from invoice
|
|
40
|
+
*/
|
|
41
|
+
private buildJournalEntry;
|
|
42
|
+
/**
|
|
43
|
+
* Build AP (Accounts Payable) journal entry lines
|
|
44
|
+
*/
|
|
45
|
+
private buildAPEntry;
|
|
46
|
+
/**
|
|
47
|
+
* Build AR (Accounts Receivable) journal entry lines
|
|
48
|
+
*/
|
|
49
|
+
private buildAREntry;
|
|
50
|
+
/**
|
|
51
|
+
* Build VAT lines
|
|
52
|
+
*/
|
|
53
|
+
private buildVATLines;
|
|
54
|
+
/**
|
|
55
|
+
* Calculate VAT amount from taxable amount and rate
|
|
56
|
+
*/
|
|
57
|
+
private calculateVAT;
|
|
58
|
+
/**
|
|
59
|
+
* Calculate effective VAT rate for the invoice (weighted average)
|
|
60
|
+
*/
|
|
61
|
+
private calculateEffectiveVATRate;
|
|
62
|
+
/**
|
|
63
|
+
* Build reverse charge VAT lines (§13b UStG)
|
|
64
|
+
*/
|
|
65
|
+
private buildReverseChargeVATLines;
|
|
66
|
+
/**
|
|
67
|
+
* Group invoice lines by account
|
|
68
|
+
*/
|
|
69
|
+
private groupLinesByAccount;
|
|
70
|
+
/**
|
|
71
|
+
* Book payment for an invoice
|
|
72
|
+
*/
|
|
73
|
+
bookPayment(invoice: IInvoice, payment: IPaymentInfo, rules: IBookingRules): Promise<IBookingResult>;
|
|
74
|
+
/**
|
|
75
|
+
* Validate invoice before booking
|
|
76
|
+
*/
|
|
77
|
+
private validateInvoice;
|
|
78
|
+
/**
|
|
79
|
+
* Generate warnings for the booking
|
|
80
|
+
*/
|
|
81
|
+
private generateWarnings;
|
|
82
|
+
/**
|
|
83
|
+
* Build description for journal entry
|
|
84
|
+
*/
|
|
85
|
+
private buildDescription;
|
|
86
|
+
/**
|
|
87
|
+
* Get account description for a group of lines
|
|
88
|
+
*/
|
|
89
|
+
private getAccountDescription;
|
|
90
|
+
/**
|
|
91
|
+
* Get used expense accounts
|
|
92
|
+
*/
|
|
93
|
+
private getUsedExpenseAccounts;
|
|
94
|
+
/**
|
|
95
|
+
* Get used revenue accounts
|
|
96
|
+
*/
|
|
97
|
+
private getUsedRevenueAccounts;
|
|
98
|
+
/**
|
|
99
|
+
* Get used VAT accounts
|
|
100
|
+
*/
|
|
101
|
+
private getUsedVATAccounts;
|
|
102
|
+
}
|