/** * The reversal (Storno) of a journal entry, in the two forms DATEV knows: * * - `generalumkehr` (Buchungsstapel field 118): the entry's lines again, on * the same accounts and sides with the same amounts, marked so that they * count negative. Each account's turnover stays as if the reversed entry * had never been booked. * - `gegenbuchung`: the lines with their sides swapped. The balances are the * same; the turnover of both sides grows by the amount. * * Both keep Belegfeld 1 and 2, the cost centres, the document link and the * VAT facts, so the reversal stays on the Beleg and on the open item of the * entry it reverses (GoBD Rz. 64: "Korrektur- bzw. Stornobuchungen müssen auf * die ursprüngliche Buchung rückbeziehbar sein"); correcting by reversal and * new entry is what GoBD Rz. 93 names ("durch Stornierungen oder * Neubuchungen"). * * Pure: the caller posts the draft. `JournalPoster.postStorno` of the * database ledger is unchanged: a Gegenbuchung whose Belegfeld 1 is replaced * by the journal number. */ import type { IJournalDraft, IJournalLineDraft } from './core.types.js'; export type TReversalForm = 'generalumkehr' | 'gegenbuchung'; /** An entry that can be reversed: a journal draft with the id it was posted under. */ export interface IReversibleEntry extends IJournalDraft { id: string; } export interface IReversalOptions { /** unset: `generalumkehr` */ form?: TReversalForm; /** the reversal's description; unset: `Storno: ` and the entry's description */ description?: string; } /** * The lines of a reversal, and whether it is marked Generalumkehr. The form * `generalumkehr` keeps sides and amounts and flips the mark (the reversal of * a Generalumkehr is a plain entry); `gegenbuchung` swaps the sides and keeps * the mark. Every other field of a line is kept; the Buchungstext becomes * `Storno: `, cut to 60 characters. The lines are taken as they are * posted: positive amounts (a negative amount is refused). */ export declare function reversalLinesOf(lines: readonly IJournalLineDraft[], generalumkehr: boolean, form: TReversalForm): { lines: IJournalLineDraft[]; generalumkehr: boolean; }; /** * The reversal of an entry: the same date (the Belegdatum of the same Beleg), * reference, chart and tax scenario, the lines of `reversalLinesOf`, linked by * `reversalOf` to the entry's id. A line the entry states negative (without * the mark) is read on its other side first, as the validator reads it. * Refuses an entry that is not valid, and one without an id. */ export declare function reversalOf(entry: IReversibleEntry, options?: IReversalOptions): IJournalDraft;