import type { IJournalDraft, TOtherEuStateSupply, TPlaceOfSupply, IJournalLineDraft, TCents, TTaxScenario, TReverseChargeParagraph } from './core.types.js'; import type { IAccountPolicy } from './core.accountpolicy.js'; import { type TShareholderClaimForm } from './core.accountpolicy.js'; export interface IVendorInvoiceInput { date: Date; /** creditor personal account (70000-99999) */ vendorAccount: string; expenseAccount?: string; /** invoice total that becomes payable (for §13b / igE this equals net) */ grossCents: TCents; vatRatePercent?: number; scenario?: TTaxScenario; invoiceNumber?: string; /** * The part of the German tax that is excluded from the input-tax deduction * (§ 15 Abs. 2 and 4 UStG), POSITIVE integer cents, at most the tax: all of * it for a purchase used for tax-exempt sales, such as every purchase of a * Kleinunternehmer (§ 19 Abs. 1 UStG, § 15 Abs. 2 Satz 1 Nr. 1 UStG), a * part where a purchase is used for both. It is cost: booked with the base on * the expense account, and only the rest on the input-tax account. Under § * 13b and an intra-Community acquisition the base keeps the scenario's key, * so the tax is owed and deducted in full where the key declares it, and * the part excluded is taken back from the input tax as a booking of its * own without a key: Dr the expense account, Cr the scenario's input-tax * account. Absent or 0: the whole tax is deducted. Refused * beyond the tax, on a scenario without German VAT, and on an expense * account whose DATEV automatism books input tax at a rate * (`non_deductible_vat_invalid`, `automatik_account_not_allowed`). */ nonDeductibleVatCents?: TCents; /** * Under § 13b UStG (`reverse_charge_13b`): the paragraph the purchase falls * under (`TReverseChargeParagraph`), stamped on the base line with the key * of the scenario (`IJournalLineDraft.reverseChargeParagraph`), which * places the base in the UStVA (Kz 46, 73 or 84). A base whose tax is * booked as stated (`vatCents`) carries no key, so the paragraph is not * stamped there. Refused on another scenario * (`reverse_charge_paragraph_invalid`). */ reverseChargeParagraph?: TReverseChargeParagraph; description: string; costCenter1?: string; docLink?: string; } export interface ICustomerInvoiceInput { date: Date; /** debtor personal account (10000-69999) */ customerAccount: string; revenueAccount?: string; grossCents: TCents; vatRatePercent?: number; scenario?: TTaxScenario; /** `other_eu_state_taxable` only, and required there: what the sale supplies */ otherEuStateSupply?: TOtherEuStateSupply; /** `not_taxable_here` only, and required there: where the sale has its place */ placeOfSupply?: TPlaceOfSupply; invoiceNumber?: string; description: string; costCenter1?: string; docLink?: string; } /** The invoice a correction document corrects (§ 31 Abs. 5 UStDV). */ export interface ICorrectedInvoiceReference { /** the corrected invoice's number (§ 14 Abs. 4 Satz 1 Nr. 4 UStG) */ invoiceNumber: string; /** its issue date; when given, the credit note may not predate it */ date?: Date; } export interface ICustomerCreditNoteInput { /** * Date of the entry, the Belegdatum. This date decides the * Besteuerungszeitraum of the correction: § 17 Abs. 1 Satz 8 UStG corrects * the tax in the period in which the change of the tax base occurred, never * in the period of the corrected invoice. It is the credit note's own date, * unless the caller books the correction on another day (`issueDate`), which * is the caller's decision: for example books that date every row by the * payment or the settlement that books it. */ date: Date; /** * The credit note's own date, where the caller books it on another day * (`date`). A correction may not predate the invoice it corrects; that is read * from this date, from `date` where absent. Given, it must be a valid `Date` * (`credit_note_issue_date_invalid`). */ issueDate?: Date; /** debtor personal account of the corrected invoice (10000-69999) */ customerAccount: string; /** * Revenue account the corrected invoice was booked on. A cancellation or * return reverses the revenue itself, so it belongs on that account and * not on an Erlösschmälerungen account (those carry price reductions — * Skonto, Rabatt, Bonus). */ revenueAccount?: string; /** credited amount as a POSITIVE gross — the whole invoice or a part of it */ grossCents: TCents; vatRatePercent?: number; scenario?: TTaxScenario; /** `other_eu_state_taxable` only, and required there: what the corrected sale supplied */ otherEuStateSupply?: TOtherEuStateSupply; /** `not_taxable_here` only, and required there: where the corrected sale had its place */ placeOfSupply?: TPlaceOfSupply; /** * The credit note's own number (§ 14 Abs. 4 Satz 1 Nr. 4 UStG). Required: * it becomes the entry's `reference`, the only place the booking names the * document it stands for — Belegfeld 1 is taken by the clearing key. */ creditNoteNumber: string; /** what this document corrects — required, a correction must identify it */ correctedInvoice: ICorrectedInvoiceReference; description: string; costCenter1?: string; docLink?: string; } /** * One VAT group of a document: the part of it taxed under one scenario and rate. * A document's groups may carry either sign — an invoice with a credited line * at another rate, or a correction that lowers one rate and raises another. */ export interface IDocumentVatGroup { /** * The group's amount as it changes the open item of the document's * counterparty, integer cents: POSITIVE raises it (for a customer: what the * customer owes; for a vendor: what is owed to the vendor), NEGATIVE lowers * it. The gross for domestic scenarios, the net for § 13b and intra-EU * acquisitions (the invoice total there is net), zero for a group without * an amount — nothing is booked for it. */ amountCents: TCents; vatRatePercent?: number; scenario?: TTaxScenario; /** `other_eu_state_taxable` only (customer documents), and required there: what the group supplies */ otherEuStateSupply?: TOtherEuStateSupply; /** `not_taxable_here` only (customer documents), and required there: where the group's sale has its place */ placeOfSupply?: TPlaceOfSupply; /** revenue account (customer documents) or expense account (vendor documents) */ account?: string; /** * The group's tax as the document states it (or the part of it this entry * books), integer cents with the sign of `amountCents`: booked as given in * place of what the rate gives, so the parts of one document's tax add up * to the tax it states (§ 14 Abs. 4 Satz 1 Nr. 8, § 14c UStG). It may differ * from what the rate gives by one cent at most, else it is refused * (`vat_amount_off_rate`); a scenario without German VAT takes none but 0. * Where it differs, the base line carries no key that has DATEV compute the * tax (none, or 40 on an Automatikkonto), and the export books it as stated * on the tax account. */ vatCents?: TCents; /** * Vendor documents only: the part of the group's German tax excluded from * the input-tax deduction (§ 15 Abs. 2 and 4 UStG), with the sign of * `amountCents`, at most its tax (`IVendorInvoiceInput.nonDeductibleVatCents`). * A customer document refuses it (`non_deductible_vat_invalid`). */ nonDeductibleVatCents?: TCents; /** * Vendor documents only, under § 13b UStG: the paragraph the group falls * under, stamped on its keyed base line * (`IVendorInvoiceInput.reverseChargeParagraph`). Refused on another * scenario and on a customer document (`reverse_charge_paragraph_invalid`). */ reverseChargeParagraph?: TReverseChargeParagraph; } /** What a document is, and so which numbers its booking carries. */ export type TBookedDocument = /** an invoice: its number is the entry reference and Belegfeld 1, the open-item key */ { kind: 'invoice'; invoiceNumber?: string; } /** * a correction of an invoice (§ 31 Abs. 5 UStDV): its own number is the * entry reference, the corrected invoice's number Belegfeld 1, so the * correction books on that invoice's open item */ | { kind: 'credit_note'; creditNoteNumber: string; correctedInvoice: ICorrectedInvoiceReference; /** * the correction's own date, where the caller books it on another day (the input's `date`, which decides the * period of the correction); a correction may not predate the invoice it corrects, which is read from this date, * from the input's `date` where absent. Given, it must be a valid `Date` (`credit_note_issue_date_invalid`) */ issueDate?: Date; }; export interface ICustomerDocumentInput { /** * the entry's date, the Belegdatum, which decides the period (for a correction § 17 Abs. 1 Satz 8 UStG): the * document's date, or another day the caller books it on; a correction's own date is then `document.issueDate` */ date: Date; /** debtor personal account (10000-69999) */ customerAccount: string; document: TBookedDocument; groups: IDocumentVatGroup[]; /** * The document's durchlaufende Posten (§ 10 Abs. 1 Satz 6 UStG): amounts * received and spent in the name and for the account of another, which are * no part of the consideration and bear no VAT. Integer cents of either * sign, as they change the open item of the counterparty (a group's * `amountCents` convention). Booked as one entry of their own after the * groups' entries, the personal account against `policy.passThrough`, * without VAT and without a BU key, with the document's numbers. 0 or * absent books nothing; a document of durchlaufende Posten alone needs no * VAT group with an amount. */ passThroughCents?: TCents; description: string; costCenter1?: string; docLink?: string; } export interface IVendorDocumentInput { /** * the entry's date, the Belegdatum, which decides the period (for a correction § 17 Abs. 1 Satz 8 UStG): the * document's date, or another day the caller books it on; a correction's own date is then `document.issueDate` */ date: Date; /** creditor personal account (70000-99999) */ vendorAccount: string; document: TBookedDocument; groups: IDocumentVatGroup[]; /** * The document's durchlaufende Posten (§ 10 Abs. 1 Satz 6 UStG): amounts * the supplier's document asks for that are spent in the name and for the * account of another than the books (such as a fee paid on a client's * behalf), which are no expense of the books and bear no VAT. Integer cents of either * sign, as they change the open item of the counterparty (a group's * `amountCents` convention). Booked as one entry of their own after the * groups' entries, the personal account against `policy.passThrough`, * without VAT and without a BU key, with the document's numbers. 0 or * absent books nothing; a document of durchlaufende Posten alone needs no * VAT group with an amount. */ passThroughCents?: TCents; /** * The part of the document's expense the income tax does not let the * business deduct, booked on an account of its own: of a business meal 30 % * (§ 4 Abs. 5 Satz 1 Nr. 2 EStG), on the nicht abzugsfähige * Bewirtungskosten (SKR03 4654, SKR04 6644), as `businessMealOf` of * @fin.cx/expenses computes it. The expense of a group is what it costs the * books: its amount less the input tax it deducts. The part is split over the * groups in proportion to their expense, the cents the split leaves by the * largest remainder, and each group's entry books its share on the account * and the rest of its expense on the group's account. The input tax stays * deducted in full (§ 15 Abs. 1a Satz 2 UStG), as a booking of its own: no * line carries a key that has DATEV compute it, since two expense lines * share the one tax. Refused (`nondeductible_expense_invalid`): an account * that is no expense account of the chart (`isProfitAndLossAccount`) or that * books a tax itself (an Automatikkonto, one marked for the UStVA), an * amount of no positive whole cents or beyond the document's expense, a * group that lowers the document, and a group whose recipient owes the tax * (§ 13b UStG, an intra-Community acquisition). */ nondeductibleExpense?: INondeductibleExpense; description: string; costCenter1?: string; /** KOST2 of every line, the project (DATEV Buchungsstapel field 38) */ costCenter2?: string; docLink?: string; } /** The part of a purchase's expense that is not deductible, and the account it is booked on (`IVendorDocumentInput.nondeductibleExpense`). */ export interface INondeductibleExpense { account: string; /** positive integer cents, at most the document's expense */ amountCents: TCents; } /** * One part of the invoice a Skonto was granted on: the gross amount at one * VAT rate. The recipe splits the Skonto over the shares in proportion to * their gross amounts, because a Skonto of a percentage of the invoice price * lowers each part of it by that percentage — and so the Bemessungsgrundlage * of each rate by its own share (§ 17 Abs. 1 Sätze 1 und 2 UStG). */ export interface ISkontoShare { /** * 19 or 7 for a part taxed at that German rate; its share is booked on the * policy's Skonto account of the rate, or on `account` when it names one, * with the VAT correction at the rate. * 0 for a part that carries no German VAT and whose recipient self-assesses * none (a tax-free supply, a 0 % supply, a supplier under § 19 UStG); its * share is booked on `account`, without VAT. * With `selfAssessed`, 19 or 7: the German rate at which the recipient owes * the tax on the part. */ ratePercent: number; /** * the amount at this rate the Skonto was granted on, positive integer cents: * the gross of the part, or with `selfAssessed` its net, the only amount the * supplier charged */ grossCents: TCents; /** * The account the part's share reduces. For a sale an income account of * the chart, for a purchase an expense account — commonly the revenue or * expense account the part was booked on, so the correction lands on the * same UStVA Kennzahl (e.g. SKR03 8125 → Kz 41, 8400 → Kz 81). * * Required for a part at 0 %; an account whose automatism books VAT at a * rate is refused there. Optional for a part at 19 % or 7 %: unset, the * share is booked on the policy's Skonto account of the rate; named, it * reduces that account instead, with the same VAT correction. An account * whose automatism books VAT at another rate, and one the chart marks for * the UStVA without an automatism at the rate (tax-free, taxable abroad), * is refused there. */ account?: string; /** * The part is a sale taxed in another member state (`other_eu_state_taxable`): * that state's rate and the kind of supply. Its share lowers that state's * Bemessungsgrundlage and the tax owed there with it (Art. 90 Abs. 1 * MwStSystRL), so it is split at that state's rate: the net share on * `account`, the revenue account the part was booked on, and the tax on the * policy's VAT account of that state for the kind of supply * (`vat.otherEuStateGoods`, `…Services`, `…ElectronicServices`). The part * carries no German VAT (`ratePercent` 0) and is a sale's. */ otherEuState?: ISkontoOtherEuState; /** * The part is turnover not taxable here that no other member state's tax * was charged on (`not_taxable_here`, `other_eu_state_recipient_liable`), so * its share lowers the revenue alone. Required, or `otherEuState`, for a * part at 0 % on an account that takes both kinds of sale: the policy's * `revenue.otherEuStateServices` where it is also a `notTaxableHere…` * account (SKR03 8339, SKR04 4339 by default). */ notTaxableHere?: true; /** * The part is a purchase whose recipient owes its German tax: under § 13b * UStG (`reverse_charge_13b`) or as an intra-Community acquisition * (`intra_eu_acquisition`). Its Skonto lowers the Bemessungsgrundlage, and * § 17 Abs. 1 Satz 5 UStG applies Sätze 1 to 4 to it: the tax the * recipient owes is corrected and so is its input-tax deduction, each by * the tax on the reduction at `ratePercent`. The share is booked net on * `account`, the expense account the part was booked on, with the key of * the scenario (§ 13b: 94 / 91, acquisition: 19 / 18), and the invoice's * pair of tax lines swapped (`vat.reverseChargeInput` / `…Output`, * `vat.intraEuAcqInput` / `…Output`). A purchase's only, at 19 or 7 %. */ selfAssessed?: TSelfAssessedScenario; /** * With `selfAssessed`: the recipient deducts none of the tax it owes on the * part (§ 15 Abs. 2 UStG; a Kleinunternehmer, whose sales are exempt under * § 19 Abs. 1 UStG), as its invoice was booked * (`IDocumentVatGroup.nonDeductibleVatCents` of all its tax). The Skonto * corrects the tax owed (§ 17 Abs. 1 Satz 5 UStG) and, since that tax was * cost, the expense by the tax too: the share on `account` with the key of * the scenario, which lowers the tax owed and its deduction in full, and the * deduction given back by all of the tax from `account` (Dr input tax, Cr * `account`, without a key), as the invoice took it back. A part with * German VAT the recipient pays without owing it and does not deduct is * given at 0 % on its expense account instead. */ nonDeductible?: true; /** * A purchase's part whose tax the recipient deducted in part, by the key of * § 15 Abs. 4 UStG its invoice was booked by (a purchase used for both * taxable and exempt sales): the deductible part in percent, above 0 and * below 100, up to two places (62.5). The Skonto corrects the deduction * claimed (§ 17 Abs. 1 Satz 2 UStG), so of the tax on the share only the * part of the key (`deductibleVatCentsOf`) lowers the input tax; the rest * was cost and lowers `account` with the share. A domestic part at 19 or * 7 % names the expense account it was booked on, one without a DATEV * automatism at a rate, and books it without a key: the share's net and * the rest of its tax on it, the deductible part on the input-tax account * of the rate. With `selfAssessed` the share keeps the scenario's key, which * lowers the tax owed and its deduction in full, and the rest beside the * deductible part is given back to the input tax from `account`, a booking * of its own without a key (`IVendorInvoiceInput.nonDeductibleVatCents` of * the rest, as the invoice was booked). Refused on a sale, on a part * without German VAT and with `nonDeductible` (`non_deductible_vat_invalid`). */ deductiblePercent?: number; /** * With `selfAssessed: 'reverse_charge_13b'`: the paragraph of § 13b UStG the * invoice's part fell under (`TReverseChargeParagraph`), stamped on the * share's keyed base line, so the reduction lowers the UStVA field its * base stands in (Kz 46, 73 or 84). Refused on any other part * (`reverse_charge_paragraph_invalid`). */ reverseChargeParagraph?: TReverseChargeParagraph; } /** The scenarios of a purchase whose recipient owes the German tax itself (§ 13b UStG, § 1a UStG). */ export type TSelfAssessedScenario = Extract; /** The other member state's rate and the kind of supply of a Skonto part taxed there. */ export interface ISkontoOtherEuState { /** that state's rate in percent, decimals allowed; 0 for a supply it exempts with the right to deduct (Art. 98 Abs. 2 MwStSystRL) */ ratePercent: number; supply: TOtherEuStateSupply; } /** * The Skonto of a bank payment: the whole difference at one rate, or split * over the rates of the invoice. */ export type TBankPaymentSkonto = /** the whole Skonto at this rate, 19 or 7 — for an invoice at one rate */ { ratePercent: number; } /** * The Skonto split over the parts of the invoice at each rate, in * proportion to their gross amounts; the cents the split leaves go by the * largest remainder, so the parts add up to the Skonto exactly. One share * per rate; parts at 0 % one per account. */ | { shares: ISkontoShare[]; }; export interface IBankPaymentInput { date: Date; direction: 'outgoing' | 'incoming'; bankAccount?: string; /** personal debtor/creditor account being settled */ counterpartyAccount: string; /** open gross amount being settled */ expectedCents: TCents; /** amount that actually moved on the bank account */ paidCents: TCents; /** book the difference as Skonto, with the VAT correction at each rate it falls on */ skonto?: TBankPaymentSkonto; /** write off differences up to this size to rounding-diff accounts (default 0) */ diffToleranceCents?: TCents; /** * Book what moved beyond `expectedCents` to this account, without VAT and * without a BU key: a payout the payer knowingly made beyond what it owed, * or money received beyond the open item that is not the counterparty's to * keep on its account. The caller decides what the excess is; the recipe * only books it. The account must be a profit-and-loss account of the chart * in use — an expense for an outgoing excess, income for an incoming one * (`CHART_PROFIT_AND_LOSS_ACCOUNTS`, or an individual account of the books * under one: `isProfitAndLossAccount`) — and none the chart marks for the * UStVA or with a tax automatism (`CHART_VAT_ACCOUNTS`, `isVatMarkedAccount`), nor an * Automatikkonto or VAT account of the policy; everything else, every * balance-sheet account included, is refused, and so is an excess named * when nothing moved beyond the expected amount. It takes precedence over `diffToleranceCents` for * an excess. With it, `expectedCents` may be 0: a payment wholly beyond the * open item (one already settled) is all excess. */ excess?: { account: string; }; description: string; reference?: string; } export interface IInternalTransferInput { date: Date; fromBankAccount: string; toBankAccount: string; amountCents: TCents; description: string; reference?: string; } /** * A customer's open item settled by money that reached the business outside * its bank accounts: into the till, into the owner's private account, or into * a shareholder's. */ export interface IReceivableSettledOutsideInput { /** the day the money was paid */ date: Date; /** the customer's personal account that holds the open item */ debtorAccount: string; /** * the account the money went to: the till (`policy.cash`), the owner's * Privatentnahmen (`policy.privateAccounts.withdrawal`, a sole trader or a * partner) or the company's claim against a shareholder on the account of * its form (`shareholderClaimAccount(policy.skrType, shareholderForm)`) */ account: string; /** * of a payment into a shareholder's account: the company's form, and of a * KGaA who the shareholder is (`TShareholderClaimForm`), whose account * `account` must be; unset for the till and the Privatentnahmen */ shareholderForm?: TShareholderClaimForm; amountCents: TCents; description: string; /** * the invoice number: Belegfeld 1, which settles the open item. Unset for * an invoice that names none (a Kleinbetragsrechnung, § 33 UStDV), whose * open item carries none either: the payment has no Belegfeld 1, as a bank * payment of it would not (`bookBankPayment`); `docLink` leads to the Beleg */ reference?: string; docLink?: string; /** * The open item this payment settles, positive integer cents. Unset, the * payment settles exactly what it paid: all of the open item, or a part of * it whose rest stays open. Set, the customer's account is credited with * it, and the difference to `amountCents` is booked as a bank payment's is * (`bookBankPayment`): as the Skonto `skonto` names, at each rate with the * output VAT corrected (§ 17 Abs. 1 UStG), or within `diffToleranceCents` * on the rounding accounts — and refused beyond them * (`shortfall_beyond_tolerance`, `excess_beyond_tolerance`). */ expectedCents?: TCents; /** the Skonto the customer took, on the policy's gewährte Skonti; needs `expectedCents` */ skonto?: TBankPaymentSkonto; /** differences up to this size go to the rounding accounts (default 0); needs `expectedCents` */ diffToleranceCents?: TCents; } export interface ISuspenseInput { date: Date; direction: 'incoming' | 'outgoing'; amountCents: TCents; bankAccount?: string; description: string; reference?: string; } /** * The tax of a fee (`IPaymentFeeInput.scenario`): none (`domestic_tax_free`), * as on a payment or securities service exempt under § 4 Nr. 8 UStG; German * VAT at 19 or 7 % the provider charged (`domestic_standard`, * `domestic_reduced`), as on a custody fee, since § 4 Nr. 8 e UStG exempts no * Verwahrung und Verwaltung von Wertpapieren; or the tax the books owe for a * service from a provider abroad (`reverse_charge_13b`, § 13b Abs. 1 and 2 * Nr. 1 UStG), as on a market-data subscription of a broker in another member * state. A fee pays for a service, so no scenario of goods is one of them. */ export type TPaymentFeeScenario = Extract; export declare const PAYMENT_FEE_SCENARIOS: readonly TPaymentFeeScenario[]; /** * A fee a bank or a payment provider (PayPal, Wise) kept from, or gave back * to, the balance of the account it holds (`bookPaymentFee`). */ export interface IPaymentFeeInput { date: Date; /** `charged`: the fee was kept from the balance, an expense; `refunded`: a fee was given back, which reduces it */ direction: 'charged' | 'refunded'; /** * the fee, positive integer cents, as it moved the balance: the gross under * German VAT, the net under § 13b, where the provider charges no tax */ amountCents: TCents; /** the account the provider holds, where the fee moved the balance; the policy's `bank` where absent */ bankAccount?: string; /** * The account the fee is booked on, for a fee that pays for another service * than moving money: a depot's custody fee, a broker's market data, advice. * The policy's `paymentFees` where absent; named, the policy need not name * that account. Checked as a purchase's expense account: at 19 or 7 %, one * the chart ties to another rate or to no German VAT is refused * (`account_rate_mismatch`); without German VAT, one whose DATEV automatism * books input tax at a rate, and under § 13b any Automatikkonto * (`automatik_account_not_allowed`, field `expenseAccount`). */ expenseAccount?: string; /** * The fee's tax (`TPaymentFeeScenario`), booked as on a vendor invoice * (`bookVendorInvoice`) with the provider's account in the supplier's * place: at 19 or 7 % the fee net on the expense account with its input tax * by the key of the rate; under § 13b the fee on it with the tax owed and * deducted in a pair, key 94 or 91. Absent: none, as `domestic_tax_free`. * Another scenario is refused (`payment_fee_input_invalid`). */ scenario?: TPaymentFeeScenario; /** * the German rate under 19 or 7 % or § 13b, the scenario's where absent (19 * under § 13b); a fee without German VAT takes none but 0 * (`payment_fee_input_invalid`) */ vatRatePercent?: number; /** * The part of the fee's German tax excluded from the input-tax deduction * (§ 15 Abs. 2 and 4 UStG), positive integer cents, at most the tax, as * `IVendorInvoiceInput.nonDeductibleVatCents`. Books that deduct none of it, * such as books whose sales are exempt or a Kleinunternehmer's (§ 19 Abs. 1 * UStG), state `nonDeductible` instead, and books deducting by a key of * § 15 Abs. 4 UStG `deductiblePercent`: the recipe then computes the tax. * At 19 or 7 % the part is booked with the fee on the expense account; * under § 13b the fee keeps key 94 or 91 and the part is taken back from * the input tax as a booking of its own. Refused beyond the tax, on a fee * without German VAT and beside `deductiblePercent` or `nonDeductible` * (`non_deductible_vat_invalid`). */ nonDeductibleVatCents?: TCents; /** * The books deduct none of the fee's German tax (§ 15 Abs. 2 UStG: books * whose sales are exempt; a Kleinunternehmer, § 19 Abs. 1 UStG), as * `ISkontoShare.nonDeductible`. The recipe computes the tax as the scenario * books it (from the gross at 19 or 7 %, under § 13b from the net) and * excludes all of it from the deduction, as `nonDeductibleVatCents` of all * of it would: at 19 or 7 % it is booked with the fee on the expense * account; under § 13b the fee keeps key 94 or 91, the tax is owed and * deducted in a pair, and all of it is taken back from the input tax as a * booking of its own without a key (Dr the expense account, Cr the input * tax). Refused beside `deductiblePercent` and `nonDeductibleVatCents`, on a * fee without German VAT, and as any other value than `true` * (`non_deductible_vat_invalid`, field `nonDeductible`). */ nonDeductible?: true; /** * The key of § 15 Abs. 4 UStG for books whose fee serves both taxable and * exempt sales: the deductible part of the fee's German tax in percent, * above 0 and below 100 with up to two places (62.5), as * `ISkontoShare.deductiblePercent` and * `IExpenseClaimReceiptInput.deductiblePercent`. The recipe computes the * tax as the scenario books it (from the gross at 19 or 7 %, under § 13b * from the net) and excludes the rest of it from the deduction * (`deductibleVatCentsOf`), as `nonDeductibleVatCents` would. Refused * beside `nonDeductibleVatCents` or `nonDeductible`, on a fee without * German VAT, and out of range (`non_deductible_vat_invalid`). */ deductiblePercent?: number; /** * Under § 13b UStG (`reverse_charge_13b`): the paragraph the fee falls * under, Abs. 1 (`abs_1`, a provider established in another member state) * or Abs. 2 Nr. 1 (`abs_2`, a provider in a third country), stamped on the * fee's keyed base line (`IJournalLineDraft.reverseChargeParagraph`). * Refused on another scenario and as `abs_2_nr_3`, an Umsatz under the * GrEStG, which a fee is not (`reverse_charge_paragraph_invalid`). */ reverseChargeParagraph?: TReverseChargeParagraph; description: string; reference?: string; } export interface ISuspenseResolutionInput { date: Date; direction: 'incoming' | 'outgoing'; amountCents: TCents; /** the account the suspense amount really belongs to */ targetAccount: string; description: string; reference?: string; } export interface IFxDifferenceInput { kind: 'payable' | 'receivable'; /** EUR value at booking date */ bookedCents: TCents; /** EUR value actually settled */ settledCents: TCents; counterAccount: string; buchungstext: string; belegfeld1?: string; } /** * The part of a German tax that is deductible by a key of § 15 Abs. 4 UStG, * for a purchase used for both taxable and exempt sales: `vatCents` times * `deductiblePercent` / 100, rounded half up (away from zero on a half) to * the cent, with the sign of `vatCents`. The rest, `vatCents` less it, is the * part excluded from the deduction (`nonDeductibleVatCents`); a Skonto's * share by the same key (`ISkontoShare.deductiblePercent`) and a receipt of * an expense claim (`IExpenseClaimReceiptInput.deductiblePercent`) are split * by this rule too. Refused (`non_deductible_vat_invalid`): a key that is not * above 0 and below 100 with up to two places; (`amount_not_whole_cents`) a * tax of no whole cents. */ export declare function deductibleVatCentsOf(vatCents: TCents, deductiblePercent: number): TCents; /** * Eingangsrechnung (vendor invoice). * domestic: expense net + Vorsteuer + creditor gross. * §13b / igE: expense net + paired input/output VAT + creditor net. * tax-free/import: expense gross + creditor gross. */ export declare function bookVendorInvoice(input: IVendorInvoiceInput, policy: IAccountPolicy): IJournalDraft; /** * Ausgangsrechnung (customer invoice). `invoiceNumber` becomes Belegfeld 1 on * every line — DATEV's key for clearing open items, so every later payment or * credit note that repeats it settles THIS invoice. */ export declare function bookCustomerInvoice(input: ICustomerInvoiceInput, policy: IAccountPolicy): IJournalDraft; /** * Rechnungskorrektur / Stornorechnung for a customer invoice — a genuine * business event, not a correction of a wrong posting. * * Booking: revenue debit net, output VAT debit, debtor credit gross — the * invoice with both sides swapped, on the SAME revenue account. Legal basis: * - § 17 Abs. 1 Satz 1 UStG: the supplier corrects the tax he owes when the * Bemessungsgrundlage changes; Abs. 2 Nr. 3 applies that "sinngemäß" when * the supply is "rückgängig gemacht worden". * - § 17 Abs. 1 Satz 8 UStG: the correction belongs to the Besteuerungs- * zeitraum "in dem die Änderung der Bemessungsgrundlage eingetreten ist" * — the credit note's own period, so `date` is the credit note's date. * - § 31 Abs. 5 UStDV: the correction travels on "ein Dokument, das * spezifisch und eindeutig auf die Rechnung bezogen ist" — the DOCUMENT * carries the reference, so both numbers are required inputs. * - § 146 Abs. 4 AO / § 239 Abs. 3 HGB: nothing about the original entry is * touched — this is an additional entry, and `IJournalDraft.reversalOf` * stays unset because that field marks the technical reversal of a wrong * POSTING (see `SkrApi.postStorno`), not a corrected invoice. * * Which number goes where is DATEV's rule, not a preference. Belegfeld 1 is * the open-item key: "Rechnungs-/Belegnummer[.] Wird als 'Schlüssel' für den * Ausgleich offener Rechnungen genutzt" and, spelled out for the same field in * the Wiederkehrende-Buchungen format, "Bei einer Zahlung oder Gutschrift wird * der Offene Posten nur dann ausgeglichen, wenn die Belegnummer mit dem * Belegfeld 1 identisch ist" (DATEV-Format, Formatbeschreibung Buchungsstapel * field 11 / Wiederkehrende Buchungen field 10). So a credit note carries the * CORRECTED INVOICE's number in Belegfeld 1 — that is what makes it settle the * invoice's open item instead of opening a second one — and its own number in * the entry `reference`, which is persisted, hashed and shown in the ledger * views. Belegfeld 2 stays empty: DATEV defines it as a Belegnummer or OPOS * processing info, but the ledger does not persist it (docs/credit-notes.md). * * `grossCents` is the POSITIVE credited amount: the full invoice gross or the * credited part of it. Pass the revenue account of the corrected invoice. */ export declare function bookCustomerCreditNote(input: ICustomerCreditNoteInput, policy: IAccountPolicy): IJournalDraft; /** * A customer document with VAT groups of either sign — an invoice with a * credited line at another rate, or a correction that lowers one rate and * raises another — booked as one set of entries, one per group, each with its * own sign: a positive group as an invoice (debtor debit gross, revenue credit * net, output VAT credit), a negative group as a correction of it (the same * accounts, both sides swapped). The sign of the document's total does not * matter; a document whose groups offset each other books both and leaves the * open item unchanged. * * Every entry of the set carries the document's numbers (`TBookedDocument`), * so they all book on one open item: an invoice's own number, or for a * correction the corrected invoice's number in Belegfeld 1 and its own in * `reference`. One entry per group is also what keeps the DATEV export valid: * each entry consolidates into one Buchungssatz per group — the revenue * account against the debtor with the group's BU key — the way a single-group * invoice or credit note does. Each group is taxed on its own: § 17 Abs. 1 * Satz 1 UStG corrects the tax of the rate whose Bemessungsgrundlage changes, * and the UStVA reads each group on its own revenue account. * * Returns the entries in the order of `groups`; a group of zero books nothing. */ export declare function bookCustomerDocument(input: ICustomerDocumentInput, policy: IAccountPolicy): IJournalDraft[]; /** * A vendor document with VAT groups of either sign, booked as one set of * entries, one per group, each with its own sign: a positive group as a vendor * invoice (expense debit, Vorsteuer debit, creditor credit), a negative group * as a correction of it (the same accounts, both sides swapped), for every * scenario `bookVendorInvoice` books (§ 13b and intra-EU acquisitions with * their paired VAT). § 17 Abs. 1 Satz 2 UStG corrects the Vorsteuer of the * recipient, and Satz 5 applies that to intra-Community acquisitions (§ 1 * Abs. 1 Nr. 5) and to § 13b. The numbers follow * `TBookedDocument` as in `bookCustomerDocument`: a vendor's credit note names * the vendor's invoice it corrects in Belegfeld 1, so it books on that * invoice's open item. * * The part of the expense that is not deductible (`nondeductibleExpense`, * such as a business meal's 30 %) is split over the groups by their expense * and booked on its own account beside each group's account. * * Returns the entries in the order of `groups`; a group of zero books nothing. */ export declare function bookVendorDocument(input: IVendorDocumentInput, policy: IAccountPolicy): IJournalDraft[]; /** * Bank payment clearing a debtor/creditor open amount, with Skonto * (incl. VAT correction), a small-difference write-off, or an excess booked * to an account the caller names (`excess`, without VAT). * * The Skonto is booked at one rate (`skonto: { ratePercent }`) or split over * the rates of the invoice (`skonto: { shares }`) in proportion to the gross * amount at each: § 17 Abs. 1 Satz 1 UStG corrects the tax of each taxable * Umsatz by the change of its own Bemessungsgrundlage, Satz 2 the input tax * of the recipient alike, and § 22 Abs. 2 Nr. 1 Satz 2 UStG (UStAE 22.2 * Abs. 2 Satz 2) keeps the Entgelte and their later changes apart by rate. * * Direction picks the Skonto side: `outgoing` books erhaltene Skonti with an * input-VAT correction (we pay a creditor less), `incoming` books gewährte * Skonti with an output-VAT correction (a debtor pays us less). Combining a * direction with the wrong kind of counterparty — a refund paid out to a * debtor, or a payment received from a creditor — would book the opposite * VAT, so the combination is refused instead. */ export declare function bookBankPayment(input: IBankPaymentInput, policy: IAccountPolicy): IJournalDraft; /** * Bank-to-bank transfer via Geldtransit — two drafts, one per bank statement, * so each side reconciles independently. */ export declare function bookInternalTransfer(input: IInternalTransferInput, policy: IAccountPolicy): [IJournalDraft, IJournalDraft]; /** * A customer's open item settled outside the bank accounts: the account the * money went to debit, the customer's personal account credit, with the * invoice number as Belegfeld 1. The invoice booked the revenue and the VAT * already, so no line carries VAT or a BU key; under the Istversteuerung the * VAT falls due on `date`, the day of the payment. * * Only three kinds of account are allowed: the till (`policy.cash`), the * Privatentnahmen (`policy.privateAccounts.withdrawal`) and the claim against * a shareholder on the account of the company's form, which the input names * (`shareholderForm`, `SHAREHOLDER_CLAIM_ACCOUNTS`); every other account is * refused (`settlement_account_not_allowed`) — a second bank account, PayPal * and any other account of the chart or outside it belong in the books, whose * movements are booked from their statements — and so is a claim account * without its form, or with another form's (`details.field` * `shareholderForm` or `account`). Which fits the legal form is the caller's: * the till for anyone, the Privatentnahmen for a sole trader or a partner, * the claim against a shareholder for a company. The invoice number, where the invoice * names one, is Belegfeld 1, which settles the open item; without one the * payment has no Belegfeld 1, as a bank payment of the invoice would not. A * reference given but blank is refused (`settlement_reference_required`). * * With `expectedCents` the open item is settled in full, and a Skonto or a * rounding difference booked with it exactly as a bank payment of it would * be, on the account the money went to (`bookBankPayment`, `incoming`); a * Skonto or a tolerance without the open item it is measured against is * refused (`settlement_open_item_required`). */ export declare function bookReceivableSettledOutside(input: IReceivableSettledOutsideInput, policy: IAccountPolicy): IJournalDraft; /** * Book a fee a bank or a payment provider kept from the balance of the account * it holds (`charged`), or gave back (`refunded`), on the policy's account of * Nebenkosten des Geldverkehrs (`paymentFeesAccount`: SKR 03 4970, SKR 04 * 6855) or on the `expenseAccount` named. Without a scenario no input VAT and * no BU key: a payment service is exempt (§ 4 Nr. 8 UStG). With German VAT or * under § 13b (`scenario`) the fee is booked as a vendor invoice paid from the * balance, and a fee given back as its correction (§ 17 Abs. 1 UStG). The fee * is its own entry, apart from the payment it was kept from, whose open item * is settled by the payment's whole amount. */ export declare function bookPaymentFee(input: IPaymentFeeInput, policy: IAccountPolicy): IJournalDraft; /** * Park an unclear bank movement on the clearing account. */ export declare function bookToSuspense(input: ISuspenseInput, policy: IAccountPolicy): IJournalDraft; /** * Move a parked suspense amount to its real account once clarified. */ export declare function resolveSuspense(input: ISuspenseResolutionInput, policy: IAccountPolicy): IJournalDraft; /** One side of an offset between personal accounts: the account and the number of its open item. */ export interface IPersonalAccountOffsetSide { /** a personal account of a customer or a supplier (`policy.debtorRange`, `policy.creditorRange`) */ account: string; /** * the number of the open item on it the offset settles: Belegfeld 1, which * settles an open item only where it is the item's number. Unset for an item * that carries none (an invoice without a number, § 33 UStDV) */ reference?: string; } /** * What the business owes a party set off against what the party owes the * business (Aufrechnung, §§ 387–389 BGB), where the two claims stand on two * personal accounts. */ export interface IPersonalAccountOffsetInput { /** the day the offset was declared (§ 388 BGB), as the caller states it */ date: Date; /** * the claim the business owes the party, debited: a supplier's invoice on its * creditor account, or a credit the business owes a customer back on the * customer's account */ owedByBusiness: IPersonalAccountOffsetSide; /** * the claim the party owes the business, credited: an invoice to a customer * on the customer's account, or what a supplier owes back of its credit note * on its creditor account */ owedToBusiness: IPersonalAccountOffsetSide; /** what is set off, positive integer cents */ amountCents: TCents; description: string; docLink?: string; } /** * An offset between two personal accounts, or two open items of one: the * claim the business owes the party debited, the claim the party owes the * business credited, by the amount set off — Kreditor an Debitor for a party * that is customer and supplier, one account against the other of a party on * two accounts of one kind (a renamed customer, a supplier under two creditor * accounts), and one item against another on one account (a credit owed back * on the item of the invoice it corrects, set off against a later invoice). No * money moves and no line carries VAT or a BU key: each document booked its * tax, and a set-off counts as the payment of both on its day (UStAE 13.6 * Abs. 1 Satz 12), which the caller's tax timing reads, not the entry. * * Belegfeld 1 settles an open item only where it is the item's number. Where * both sides name the same number, or neither names one, the entry is one * booking between the two accounts. Otherwise each side is booked against the * clearing account (`policy.clearing`) with its own item's number, two DATEV * rows that net to 0 on the clearing account, so each item is settled by its * own number; the entry then names no reference of its own. On one account * that moves what is set off from one item to the other and leaves the * account's balance as it was. * * Refused: a side that is no personal account (`personal_account_required`), * both sides on one account and one item (`offset_same_account`: the same * number, or none on either — the claims are one open item already), a number * given but blank (`offset_reference_required`), and an amount that is not * positive whole cents (`amount_not_positive`). */ export declare function bookPersonalAccountOffset(input: IPersonalAccountOffsetInput, policy: IAccountPolicy): IJournalDraft; /** * Realized FX difference lines for a settlement whose EUR value moved between * booking and payment. Returns lines to embed into the settlement draft * (empty array when there is no difference). */ export declare function fxDifferenceLines(input: IFxDifferenceInput, policy: IAccountPolicy): IJournalLineDraft[]; /** * An advance (Anzahlung): money received or paid before the supply. * `vatRatePercent` is the rate its tax is at: for a received one the tax that * arises when it is received (§ 13 Abs. 1 Nr. 1 Buchst. a Satz 4 UStG), 0 where * none does (a supply without German VAT, UStAE 13.5 Abs. 4); for a paid one * the input tax deducted with it once the invoice for it is at hand (§ 15 * Abs. 1 Satz 1 Nr. 1 Satz 3 UStG), 0 while it is not or there is none. */ export interface IAdvanceInput { date: Date; /** gross, positive */ grossCents: TCents; vatRatePercent: 0 | 7 | 19; /** the account the money moved on; unset: the policy's bank */ bankAccount?: string; description: string; /** Belegfeld 1: the order or the invoice of the advance */ reference?: string; docLink?: string; } /** * The clearing of an advance on the final invoice, booked with the invoice at * the supply: the advance, at the rate it was booked at, against the personal * account the invoice books in full, so the account of the advance is cleared * and the tax of the invoice's month is the invoice's less the advance's * (§ 14 Abs. 5 Satz 2 UStG). */ export interface IAdvanceClearingInput { date: Date; /** a customer's personal account for a received advance, a supplier's for a paid one */ partyAccount: string; /** gross, positive: what the advance booked */ grossCents: TCents; /** the rate the advance was booked at */ vatRatePercent: 0 | 7 | 19; description: string; /** Belegfeld 1: the final invoice's number, which keys the personal account's open item */ reference?: string; docLink?: string; } /** * A received advance: the bank against the account of advances received of * its rate, and the output tax that arises with it on its own line. */ export declare function bookAdvanceReceived(input: IAdvanceInput, policy: IAccountPolicy): IJournalDraft; /** * A paid advance: the account of advances paid of its rate and the input tax * deducted with it on its own line, against the bank. */ export declare function bookAdvancePaid(input: IAdvanceInput, policy: IAccountPolicy): IJournalDraft; /** * The input tax of an advance paid without an invoice for it at hand * (`bookAdvancePaid` at 0 %), deducted once both are there. */ export interface IAdvanceDeductionInput { /** the day the advance was paid */ paidOn: Date; /** the day the invoice for it came to hand */ invoiceAtHandOn: Date; /** what was paid and stands on the account without tax, positive */ paidCents: TCents; /** what the invoice states for the advance, gross, positive; at most `paidCents` */ grossCents: TCents; vatRatePercent: 7 | 19; description: string; /** Belegfeld 1: the invoice of the advance */ reference?: string; docLink?: string; } /** * The input tax of a paid advance, deducted when it is both paid and * invoiced (§ 15 Abs. 1 Satz 1 Nr. 1 Satz 3 UStG): on the later of the two * days, so in the month that falls in, and only as far as it was paid. The * advance, or the part the invoice states, moves from the account without * tax (`bookAdvancePaid` at 0 %) to the account of its rate, with its input * tax on its own line. Refused beyond what was paid * (`advance_deduction_beyond_payment`) and at 0 % (`advance_rate_unsupported`). */ export declare function deductAdvancePaidInputTax(input: IAdvanceDeductionInput, policy: IAccountPolicy): IJournalDraft; /** * The clearing of a received advance on the final invoice: the account of the * advance and its output tax against the customer's personal account. */ export declare function clearAdvanceReceived(input: IAdvanceClearingInput, policy: IAccountPolicy): IJournalDraft; /** * The clearing of a paid advance on the final invoice: the supplier's * personal account against the account of the advance and its input tax. */ export declare function clearAdvancePaid(input: IAdvanceClearingInput, policy: IAccountPolicy): IJournalDraft;