UNPKG

@fin.cx/skr

Version:

SKR03 and SKR04 German accounting standards for double-entry bookkeeping

96 lines (95 loc) 2.45 kB
import type { ITransactionData, IJournalEntry, IJournalEntryLine } from './skr.types.js'; export interface ITransactionDataExport extends ITransactionData { _id?: string; postingDate?: Date; currency?: string; createdAt?: Date | string; modifiedAt?: Date | string; reversalOf?: string; reversedBy?: string; taxCode?: string; project?: string; vatAccount?: string; } export interface IJournalEntryExport extends IJournalEntry { _id?: string; postingDate?: Date; currency?: string; journal?: string; createdAt?: Date | string; modifiedAt?: Date | string; reversalOf?: string; reversedBy?: string; } export interface IJournalEntryLineExport extends IJournalEntryLine { taxCode?: string; project?: string; } export interface ILedgerEntry { schema_version: string; entry_id: string; booking_date: string; posting_date: string; period?: string; currency: string; journal: string; description: string; reference?: string; lines: ILedgerLine[]; document_refs?: IDocumentRef[]; created_at: string; modified_at?: string; user?: string; reversal_of?: string; reversed_by?: string; } export interface ILedgerLine { posting_id: string; account_code: string; debit: string; credit: string; tax_code?: string; cost_center?: string; project?: string; description?: string; } export interface IDocumentRef { content_hash: string; doc_role: 'invoice' | 'receipt' | 'contract' | 'bank-statement' | 'other'; doc_mime: string; doc_original_name?: string; } export declare class LedgerExporter { private exportPath; private stream; private entryCount; constructor(exportPath: string); /** * Initializes the NDJSON export stream */ initialize(): Promise<void>; /** * Exports a transaction as a ledger entry */ exportTransaction(transaction: ITransactionDataExport): Promise<void>; /** * Exports a journal entry */ exportJournalEntry(journalEntry: IJournalEntryExport): Promise<void>; /** * Writes a single NDJSON line */ private writeLine; /** * Formats a date to ISO date string */ private formatDate; /** * Closes the export stream */ close(): Promise<number>; /** * Gets the number of exported entries */ getEntryCount(): number; }