@fin.cx/skr
Version:
SKR03 and SKR04 German accounting standards for double-entry bookkeeping
66 lines (65 loc) • 2.12 kB
TypeScript
import { Transaction } from './skr.classes.transaction.js';
import { JournalEntry } from './skr.classes.journalentry.js';
import type { TSKRType, ITransactionData, IJournalEntry, IAccountBalance } from './skr.types.js';
export declare class Ledger {
private skrType;
private logger;
constructor(skrType: TSKRType);
/**
* Post a transaction with validation
*/
postTransaction(transactionData: ITransactionData): Promise<Transaction>;
/**
* Post a journal entry with validation
*/
postJournalEntry(journalData: IJournalEntry): Promise<JournalEntry>;
/**
* Validate that accounts exist and are active
*/
private validateAccounts;
/**
* Validate journal entry balance
*/
private validateJournalBalance;
/**
* Validate accounts against SKR standard data
*/
private validateAccountsAgainstSKR;
/**
* Reverse a transaction
*/
reverseTransaction(transactionId: string): Promise<Transaction>;
/**
* Reverse a journal entry
*/
reverseJournalEntry(journalId: string): Promise<JournalEntry>;
/**
* Get account history (all transactions for an account)
*/
getAccountHistory(accountNumber: string, dateFrom?: Date, dateTo?: Date): Promise<Transaction[]>;
/**
* Get account balance at a specific date
*/
getAccountBalance(accountNumber: string, asOfDate?: Date): Promise<IAccountBalance>;
/**
* Close accounting period (create closing entries)
*/
closeAccountingPeriod(period: string, // Format: YYYY-MM
closingAccountNumber?: string): Promise<JournalEntry[]>;
/**
* Calculate account balance for a specific set of transactions
*/
private getAccountBalanceForPeriod;
/**
* Validate double-entry rules
*/
validateDoubleEntry(debitAmount: number, creditAmount: number): boolean;
/**
* Get unbalanced transactions (for audit)
*/
getUnbalancedTransactions(): Promise<Transaction[]>;
/**
* Recalculate all account balances
*/
recalculateAllBalances(): Promise<void>;
}