/** * Booking recipes of a business's payroll — pure builders, like * `core.recipes.ts`: (input, policy) => IJournalDraft, integer cents. They book * what a payroll decided (a run's Buchungsbeleg: its totals per account, with * no person's line) on the accounts of the payroll roles (@fin.cx/chartdata * `TPayrollRole`), resolved for the books by `payrollAccountOf`: 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 run is booked as DATEV's payroll bookings are, through the Lohn- und * Gehaltsverrechnungskonto (role `clearing`: SKR 03 1755, SKR 04 3790): every * cost of the run on its expense account against the clearing account, and * every debt the run leaves out of it. What DATEV keeps no debt account for * (an insurer's premium for a company pension, the accident insurer's * contribution) stays on the clearing account until a payment from it settles * it; the run states that amount, so a run that does not add up is refused. * Its payments then settle the debts, one by one, from the bank account they * left. Every line pairs with its counter account (DATEV Gegenkonto). */ import * as plugins from './core.plugins.js'; import type { IJournalDraft, TCents } from './core.types.js'; import type { IAccountPolicy } from './core.accountpolicy.js'; /** What an account books of a business's payroll (@fin.cx/chartdata `TPayrollRole`). */ export type TPayrollRole = plugins.chartdata.TPayrollRole; /** * What a payroll run costs the employer, by the role of its expense account: * the pay and the flat wage taxes the employer bears (§ 275 Abs. 2 Nr. 6 a * HGB), and the employer's contributions (Nr. 6 b). */ export type TPayrollCostRole = Extract; /** What a payroll run leaves the business owing until it pays it, by the role of its debt account. */ export type TPayrollDebtRole = Extract; /** What a payment settles: a debt of a run, or what a run left on the clearing account. */ export type TPayrollPaymentRole = TPayrollDebtRole | Extract; /** The costs in the order a run's lines book them: the pay first, then the employer's contributions. */ export declare const PAYROLL_COST_ROLES: readonly TPayrollCostRole[]; /** The debts in the order a run's lines book them. */ export declare const PAYROLL_DEBT_ROLES: readonly TPayrollDebtRole[]; /** * The account the books book a payroll role on: the account DATEV's chart * keeps for it (`booksChartOf`; an individual account takes no payroll role). * Refuses a role the chart keeps no account for (`payroll_account_missing`), * which a chart of this package's data never does. */ export declare function payrollAccountOf(policy: IAccountPolicy, role: TPayrollRole): string; /** What every payroll booking states. */ export interface IPayrollBookingBase { /** the booking day: for a run, the last day of the month the pay is for; for a payment, the day it left the bank */ date: Date; description: string; /** Belegfeld 1 of the lines: the run's id, or the payment's reference */ reference?: string; /** the Beleg: the run's Buchungsbeleg, or the bank statement */ docLink?: string; } /** * A payroll run's Buchungsbeleg: its totals by account role over the people * it pays, each in whole cents (negative where the run corrects an earlier * one). What the run costs equals what it leaves owing, pays in kind and * leaves on the clearing account: `costs` = `debts` + * `companyCarBenefit.amountCents` + `leftOnClearingCents`. */ export interface IPayrollRunInput extends IPayrollBookingBase { /** what the run costs the employer, by role: the gross pay (benefits in kind included), the flat taxes, the employer's contributions */ costs: Partial>; /** what the run leaves owing, by role: the net pay, the wage and church tax with the Solidaritätszuschlag, the contributions of both sides, the rest withheld */ debts: Partial>; /** * The private use of a company car in the gross pay, a supply to the * employee with 19 % VAT (role `company_car_benefit`): `amountCents` as the * pay holds it, and of it the VAT the payroll computed on the supply, which * goes on the books' output VAT (`IAccountPolicy.vat.outputStandard`). */ companyCarBenefit?: { amountCents: TCents; vatCents: TCents; }; /** * What the run leaves on the clearing account, to be settled by a payment * from it (`bookPayrollObligationPayment` with role `clearing`): a cost * whose payee DATEV keeps no debt account for, such as an insurer's premium * for a company pension. 0 where absent. */ leftOnClearingCents?: TCents; /** the refunds of the levies U1 and U2 the run claims from the health insurers (roles `levy_refund_claims` against `levy_refunds`) */ levyRefundClaimCents?: TCents; } /** * A payment that settles a payroll debt from the bank account it left: the * net pay to the people, the wage tax to the tax office, the contributions to * the insurer that collects them, a withholding to its creditor, the savings * to an employee's contract, or what a run left on the clearing account. */ export interface IPayrollObligationPaymentInput extends IPayrollBookingBase { /** what the payment settles */ role: TPayrollPaymentRole; /** what left the bank: positive paid, negative returned (a transfer the bank sent back, a refund of an overpayment) */ amountCents: TCents; /** the bank account the payment left */ cashAccount: string; /** * With `social_security` only: the refunds of the levies U1 and U2 the * insurer set off against the contributions it collects, which settle the * books' claim for them (role `levy_refund_claims`) in place of money paid. */ levyRefundSetOffCents?: TCents; } /** * A payroll run: every cost on the account of its role against the clearing * account, every debt from the clearing account onto the account of its role, * the company-car benefit out of the clearing account onto its revenue * account net of its VAT (key 40: the VAT stands on its own line, which the * account's automatism would otherwise compute again) and onto the output VAT, * and the levy refunds claimed on the claim against the refunds. What the run * leaves on the clearing account takes no line. Refuses a run whose costs are * not its debts, its benefit in kind and what it leaves on the clearing * account (`payroll_run_unbalanced`, the difference in * `details.differenceCents`). */ export declare function bookPayrollRun(input: IPayrollRunInput, policy: IAccountPolicy): IJournalDraft; /** * A payment of a payroll debt: the debt's account (or the clearing account) * against the bank account, and with the contributions the levy refunds the * insurer set off, the debt's account against the claim for them. A negative * amount books the other way. */ export declare function bookPayrollObligationPayment(input: IPayrollObligationPaymentInput, policy: IAccountPolicy): IJournalDraft;