@fin.cx/skr 1.0.0 → 1.2.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 (54) hide show
  1. package/dist_ts/index.d.ts +6 -0
  2. package/dist_ts/index.js +7 -1
  3. package/dist_ts/plugins.d.ts +8 -1
  4. package/dist_ts/plugins.js +10 -2
  5. package/dist_ts/skr.api.d.ts +70 -0
  6. package/dist_ts/skr.api.js +354 -3
  7. package/dist_ts/skr.classes.journalentry.d.ts +1 -0
  8. package/dist_ts/skr.classes.journalentry.js +55 -15
  9. package/dist_ts/skr.classes.ledger.d.ts +4 -0
  10. package/dist_ts/skr.classes.ledger.js +72 -1
  11. package/dist_ts/skr.classes.reports.js +56 -22
  12. package/dist_ts/skr.export.accounts.d.ts +53 -0
  13. package/dist_ts/skr.export.accounts.js +111 -0
  14. package/dist_ts/skr.export.balances.d.ts +59 -0
  15. package/dist_ts/skr.export.balances.js +205 -0
  16. package/dist_ts/skr.export.d.ts +110 -0
  17. package/dist_ts/skr.export.js +315 -0
  18. package/dist_ts/skr.export.ledger.d.ts +95 -0
  19. package/dist_ts/skr.export.ledger.js +164 -0
  20. package/dist_ts/skr.export.pdf.d.ts +82 -0
  21. package/dist_ts/skr.export.pdf.js +548 -0
  22. package/dist_ts/skr.invoice.adapter.d.ts +98 -0
  23. package/dist_ts/skr.invoice.adapter.js +476 -0
  24. package/dist_ts/skr.invoice.booking.d.ts +102 -0
  25. package/dist_ts/skr.invoice.booking.js +556 -0
  26. package/dist_ts/skr.invoice.entity.d.ts +287 -0
  27. package/dist_ts/skr.invoice.entity.js +2 -0
  28. package/dist_ts/skr.invoice.mapper.d.ts +69 -0
  29. package/dist_ts/skr.invoice.mapper.js +401 -0
  30. package/dist_ts/skr.invoice.storage.d.ts +140 -0
  31. package/dist_ts/skr.invoice.storage.js +529 -0
  32. package/dist_ts/skr.security.d.ts +65 -0
  33. package/dist_ts/skr.security.js +319 -0
  34. package/dist_ts/skr.types.d.ts +1 -0
  35. package/package.json +18 -12
  36. package/readme.md +461 -132
  37. package/ts/index.ts +6 -0
  38. package/ts/plugins.ts +22 -1
  39. package/ts/skr.api.ts +489 -2
  40. package/ts/skr.classes.journalentry.ts +63 -14
  41. package/ts/skr.classes.ledger.ts +85 -0
  42. package/ts/skr.classes.reports.ts +64 -21
  43. package/ts/skr.export.accounts.ts +154 -0
  44. package/ts/skr.export.balances.ts +270 -0
  45. package/ts/skr.export.ledger.ts +249 -0
  46. package/ts/skr.export.pdf.ts +601 -0
  47. package/ts/skr.export.ts +443 -0
  48. package/ts/skr.invoice.adapter.ts +581 -0
  49. package/ts/skr.invoice.booking.ts +738 -0
  50. package/ts/skr.invoice.entity.ts +351 -0
  51. package/ts/skr.invoice.mapper.ts +486 -0
  52. package/ts/skr.invoice.storage.ts +710 -0
  53. package/ts/skr.security.ts +405 -0
  54. package/ts/skr.types.ts +1 -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
+ }