UNPKG

@fin.cx/skr

Version:

SKR03 and SKR04 German accounting standards for double-entry bookkeeping

103 lines (102 loc) 2.65 kB
import { JournalEntry } from './skr.classes.journalentry.js'; import type { TSKRType } from './skr.types.js'; import type { IInvoice, IBookingRules, IBookingInfo, IPaymentInfo } from './skr.invoice.entity.js'; /** * Options for booking an invoice */ export interface IBookingOptions { autoBook?: boolean; confidenceThreshold?: number; bookingDate?: Date; bookingReference?: string; skipValidation?: boolean; } /** * Result of booking an invoice */ export interface IBookingResult { success: boolean; journalEntry?: JournalEntry; bookingInfo?: IBookingInfo; confidence: number; warnings?: string[]; errors?: string[]; } /** * Automatic booking engine for invoices * Creates journal entries from invoice data based on SKR mapping rules */ export declare class InvoiceBookingEngine { private logger; private skrType; private mapper; constructor(skrType: TSKRType); /** * Book an invoice to the ledger */ bookInvoice(invoice: IInvoice, bookingRules?: Partial<IBookingRules>, options?: IBookingOptions): Promise<IBookingResult>; /** * Build journal entry from invoice */ private buildJournalEntry; /** * Build AP (Accounts Payable) journal entry lines */ private buildAPEntry; /** * Build AR (Accounts Receivable) journal entry lines */ private buildAREntry; /** * Build VAT lines */ private buildVATLines; /** * Calculate VAT amount from taxable amount and rate */ private calculateVAT; /** * Calculate effective VAT rate for the invoice (weighted average) */ private calculateEffectiveVATRate; /** * Build reverse charge VAT lines (§13b UStG) */ private buildReverseChargeVATLines; /** * Group invoice lines by account */ private groupLinesByAccount; /** * Book payment for an invoice */ bookPayment(invoice: IInvoice, payment: IPaymentInfo, rules: IBookingRules): Promise<IBookingResult>; /** * Validate invoice before booking */ private validateInvoice; /** * Generate warnings for the booking */ private generateWarnings; /** * Build description for journal entry */ private buildDescription; /** * Get account description for a group of lines */ private getAccountDescription; /** * Get used expense accounts */ private getUsedExpenseAccounts; /** * Get used revenue accounts */ private getUsedRevenueAccounts; /** * Get used VAT accounts */ private getUsedVATAccounts; }