/** * Booking recipes of an expense claim — pure builders, like `core.recipes.ts`: * (input, policy) => IJournalDraft, integer cents. An employee or a guest laid * money out for the business (Auslagenersatz, Reisekostenabrechnung), and the * business owes it back: the claim books against the person's own creditor * account, or, where the books keep no account per person, against the Lohn- * und Gehaltsverrechnungskonto (@fin.cx/chartdata payroll role `clearing`: * SKR 03 1755, SKR 04 3790), always under the claim's number as Belegfeld 1, * the key of its open item. They book what the claim decided — the * allowances, the receipts, a business meal's part that is not deductible, as * @fin.cx/expenses computes them — on the accounts of the expense roles * (@fin.cx/chartdata `TExpenseRole`, `expenseAccountOf`): the account DATEV's * chart keeps for the role (DATEV Kontenrahmen SKR 03, Art.-Nr. 11174, and * SKR 04, Art.-Nr. 11175, gültig für 2026), which every role has in both * charts. * * A receipt books through `bookVendorDocument`, with the person in the place * of the supplier; the payout and the private use of a company card through * `bookBankPayment`. Every recipe takes the day the caller books on. */ import * as plugins from './core.plugins.js'; import type { IJournalDraft, TCents, TTaxScenario } from './core.types.js'; import type { IAccountPolicy } from './core.accountpolicy.js'; /** What an account books of the expenses a person lays out and claims back (@fin.cx/chartdata `TExpenseRole`). */ export type TExpenseRole = plugins.chartdata.TExpenseRole; /** * The account the books book an expense role on: the account DATEV's chart * keeps for it (`booksChartOf`; an individual account takes no expense role). * Refuses a role the chart keeps no account for (`expense_account_missing`), * which no role of a chart of this package's data is. */ export declare function expenseAccountOf(policy: IAccountPolicy, role: TExpenseRole): string; /** * Whom a claim is settled with: the person's own creditor account (a * Kreditor per person, in `policy.creditorRange`), or the books' Lohn- und * Gehaltsverrechnungskonto, which keeps no open items. */ export type TExpenseClaimSettlement = { kind: 'person'; account: string; } | { kind: 'payroll_clearing'; }; /** * The account a claim settles on: the person's creditor account, refused * where it is none (`personal_account_required`), or the account of the * payroll role `clearing` (`payrollAccountOf`). */ export declare function expenseClaimSettlementAccountOf(policy: IAccountPolicy, settlement: TExpenseClaimSettlement): string; /** An allowance of a claim, a line of its own rather than a receipt: per diems, mileage, a lodging flat. */ export type TExpenseClaimAllowanceKind = 'per_diem' | 'mileage' | 'lodging_flat'; /** The expense role of each allowance: Verpflegungsmehraufwand, Kilometergelderstattung, Übernachtungsaufwand of employees. */ export declare const EXPENSE_CLAIM_ALLOWANCE_ROLES: Readonly>; /** One allowance of a claim, as @fin.cx/expenses computed it, with the cost centre and project of its line. */ export interface IExpenseClaimAllowance { kind: TExpenseClaimAllowanceKind; /** positive integer cents */ amountCents: TCents; /** KOST1, the cost centre */ costCenter1?: string; /** KOST2, the project */ costCenter2?: string; } /** What every booking of a claim states. */ export interface IExpenseClaimBookingBase { /** the booking day: of the allowances the day the claim was approved, of a receipt its voucher's day */ date: Date; description: string; /** the claim's number: Belegfeld 1 of every line and the entry's reference, the key of the claim's open item */ claimNumber: string; settlement: TExpenseClaimSettlement; /** the Beleg: of the allowances the claim's Eigenbeleg, of a receipt the receipt */ docLink?: string; } export interface IExpenseClaimAllowancesInput extends IExpenseClaimBookingBase { allowances: IExpenseClaimAllowance[]; } /** * A claim's allowances on its Eigenbeleg: each on the account of its role * (`EXPENSE_CLAIM_ALLOWANCE_ROLES`: SKR03 4664, 4668, 4666; SKR04 6664, 6668, * 6660) against the settlement account, one booking per allowance in the * order given, with its cost centres on both lines, without a key: a flat * amount carries no input tax. Refuses no allowance, an unknown kind * (`expense_claim_input_invalid`), an amount of no positive whole cents * (`amount_not_positive`, `amount_not_whole_cents`) and a claim without its * number. */ export declare function bookExpenseClaimAllowances(input: IExpenseClaimAllowancesInput, policy: IAccountPolicy): IJournalDraft; /** The roles a receipt of a claim books on; the allowances' own roles, the non-deductible meals and the card's clearing are none. */ export type TExpenseClaimReceiptRole = Exclude; export declare const EXPENSE_CLAIM_RECEIPT_ROLES: readonly TExpenseClaimReceiptRole[]; /** * The scenarios of a receipt a person brings: German VAT at 19 or 7 %, or none * (`domestic_tax_free`: a receipt without German VAT, such as a hotel abroad, * whose foreign tax is cost). */ export type TExpenseClaimReceiptScenario = Extract; /** One VAT group of a receipt, as its voucher states it (`IDocumentVatGroup`, positive). */ export interface IExpenseClaimReceiptGroup { /** the group's gross, positive integer cents; 0 books nothing */ amountCents: TCents; vatRatePercent?: number; /** `domestic_standard` where unset */ scenario?: TExpenseClaimReceiptScenario; /** the tax as the receipt states it (`IDocumentVatGroup.vatCents`) */ vatCents?: TCents; } /** * A business meal's split (§ 4 Abs. 5 Satz 1 Nr. 2 EStG), as `businessMealOf` * of @fin.cx/expenses computes it: the part of the meal's expense that is not * deductible, the tip included. */ export interface IExpenseClaimBusinessMeal { /** the non-deductible 30 % of the expense, positive integer cents */ nondeductibleCents: TCents; /** a tip paid on top of the invoice, which bears no VAT and is part of the expense; 0 where absent */ tipCents?: TCents; } export interface IExpenseClaimReceiptInput extends IExpenseClaimBookingBase { role: TExpenseClaimReceiptRole; groups: IExpenseClaimReceiptGroup[]; /** whether the receipt's input tax may be deducted (`inputVatOf` of @fin.cx/expenses); not: all of it is cost */ inputVat: 'deductible' | 'not_deductible'; /** * With `inputVat: 'deductible'`, for a receipt whose supply serves both * taxable and exempt sales: the key of § 15 Abs. 4 UStG, the deductible * part in percent, above 0 and below 100 with up to two places (62.5). Of * each group's tax only that part is deducted (`deductibleVatCentsOf`), the * rest is cost with its base. Absent: all of it is deducted. */ deductiblePercent?: number; /** a business meal's split: required on `business_meals`, refused on another role */ businessMeal?: IExpenseClaimBusinessMeal; /** KOST1, the cost centre */ costCenter1?: string; /** KOST2, the project */ costCenter2?: string; } /** * A receipt of a claim, booked as the vendor document it is * (`bookVendorDocument`) with the person's settlement account in the place of * the supplier's and the claim's number as the open item's: each VAT group on * the account of the receipt's role, its input tax by key; a tax that may not * be deducted as cost with its base (`nonDeductibleVatCents` of all of it), and * one deducted in part by a key (`deductiblePercent`) the rest of it. * A business meal books the part of its expense that is not deductible on * `business_meals_nondeductible` (SKR03 4654, SKR04 6644) beside * `business_meals` (4650, 6640), split over its groups and its tip, which is * a group without VAT of its own; its input tax is deducted in full as a * booking of its own, without a key (`IVendorDocumentInput.nondeductibleExpense`). * Returns the entries in the order of the groups, the tip's last. * * Refused (`expense_claim_input_invalid`): a role no receipt takes, a business * meal without its split or a split on another role, a group that is negative * or of another scenario, a negative tip, an unknown `inputVat`, a key beside * `inputVat: 'not_deductible'` and a claim without its number; a key that is * not above 0 and below 100 with up to two places (`non_deductible_vat_invalid`); a receipt without groups (`document_groups_missing`: a * tip alone is none); and whatever `bookVendorDocument` refuses. */ export declare function bookExpenseClaimReceipt(input: IExpenseClaimReceiptInput, policy: IAccountPolicy): IJournalDraft[]; /** A payment by a company card that the holder made for themselves, which the holder owes back. */ export interface IPersonReceivableInput { /** the card payment's day */ date: Date; /** the holder's account, or the payroll clearing account */ settlement: TExpenseClaimSettlement; /** * the account the card payment left: a credit card's own account, or its * clearing account (`expenseAccountOf(policy, 'credit_card_settlement')`: * SKR03 1730, SKR04 3610), or for a debit card the bank account it pays from */ cardAccount: string; /** positive integer cents */ amountCents: TCents; description: string; /** Belegfeld 1: the receivable's own number, the key of its open item, never a claim's */ reference: string; } /** * Private use of a company card (not the books' Privatentnahme): the holder's * account debited — a receivable, which a payout sets off * (`bookPersonalAccountOffset`) or the holder repays — against the card's * account, through `bookBankPayment` (an outgoing payment of the amount to the * settlement account, from the card's account). Refused * (`expense_claim_input_invalid`): a card account that is blank or the * settlement account itself, a blank reference; an amount of no positive * whole cents (`amount_not_positive`, `amount_not_whole_cents`). */ export declare function bookPersonReceivable(input: IPersonReceivableInput, policy: IAccountPolicy): IJournalDraft;