German Mahnung fee and Verzug status
BodyFor each invoice in a German dunning letter, states since when the debtor is in Verzug and why: a contractual payment date, 30 days after due date and receipt of the invoice (for a consumer only if the invoice warned of it; for a business, from receipt of the goods when the invoice date is unknown), or the first Mahnung after the due date. Deadlines that end on a weekend or public holiday move to the next working day under § 193 BGB, nationwide holidays included. The Mahnung that causes Verzug is free and says so; later ones carry material costs once per letter, capped for consumers with the § 309 Nr. 5 proof clause. A business debtor gets the EUR 40 Pauschale once per invoice, with Mahnung fees credited against it so only the excess is charged; a consumer never does. All of it is one deriver.
npx dxcl add de-mahnung-fee Voorbeelddata
de JSON waarmee dit voorbeeld is gebouwd{
"mahnung": {
"debtorType": "business",
"date": "2026-11-19",
"fee": 6.5,
"holidays": [
"2026-11-18"
],
"invoices": [
{
"number": "RE-2026-006233-WARTUNG-Q4-STANDORT-LEIPZIG",
"amount": 92840.1,
"dueDate": "2026-10-19",
"invoiceReceivedDate": "2026-10-19"
},
{
"number": "RE-2026-004817/TEILLIEFERUNG-3-RAHMENVERTRAG-NORD",
"amount": 1284750,
"dueDate": "2026-08-31",
"contractPaymentDate": "2026-08-31",
"mahnungen": [
{
"date": "2026-09-15",
"feeCharged": 6.5
},
{
"date": "2026-09-29",
"feeCharged": 6.5
},
{
"date": "2026-10-13",
"feeCharged": 6.5
},
{
"date": "2026-10-27",
"feeCharged": 6.5
},
{
"date": "2026-11-03",
"feeCharged": 6.5
},
{
"date": "2026-11-10",
"feeCharged": 6.5
}
]
},
{
"number": "RE-2026-005102-ERSATZTEILE-HYDRAULIK",
"amount": 486320.75,
"dueDate": "2026-09-01",
"invoiceReceivedDate": "2026-09-03"
}
]
}
} Gerenderd voorbeeld
elke opstelling op zichzelf gerenderdOpgeloste nodes
wat een renderer krijgt — 1 nodesde-mahnung-fee section De bestanden
wat installeren schrijft; het gekozen bestand is de componentnodes/de-mahnung-fee.node.tsx import { arrange, Section, type Section as SectionComponent, useDeriver, useState } from "docxcelerate/template";
import type { DeMahnungFeeLines } from "../arrangements/de-mahnung-fee/lines.ts";
import { stacked } from "../arrangements/de-mahnung-fee/stacked.arrangement.tsx";
import { table } from "../arrangements/de-mahnung-fee/table.arrangement.tsx";
import deMahnungFee from "../derivers/de-mahnung-fee.deriver.ts";
/**
* The part of a German Mahnung that says, per open invoice, since when the
* debtor has been in Verzug and why, and what this letter may charge. The
* component makes the legal decision so the reader does not have to.
*
* Verzug starts on the earliest of: a contractual payment date (§ 286 Abs. 2),
* 30 days after due date and receipt of the invoice (§ 286 Abs. 3), or the
* first Mahnung after the due date (§ 286 Abs. 1). The 30-day rule binds a
* consumer only when the invoice warned of it, and a business whose invoice
* date is unknown counts from receipt of the goods. A deadline ending on a
* weekend or public holiday moves to the next working day (§ 193 BGB), the
* nationwide holidays included, so the letter never claims Verzug a day early.
*
* The Mahnung that itself causes Verzug is free, and says so: its cost was not
* caused by the delay. A later one carries material costs only, once per
* letter, on the invoice that has been in Verzug longest. A consumer's fee is
* held under a ceiling and the letter allows proof of lower damage; no
* Pauschale is charged. A business owes the EUR 40 Pauschale once per invoice
* and Mahnung fees are credited against it, so only the excess is charged.
*
* All of it is one deriver, because it is date arithmetic, sorting and money
* on request data, which publishing refuses. The node prints what it returns.
* Which arm prints is chosen once, outside the loops, so no loop body holds a
* condition. The loops run over the deriver's rows, which the resolver reads
* by scope, so any number of invoices is printed.
*
* Out of scope: Verzugszinsen, a Mahnung that sets its own payment deadline,
* the Land holiday calendar (pass `holidays`), collection and lawyer fees, and
* any totals. The wording is fixed German legal text.
*
* Arrangement: where the lines sit is a separate choice from what they say.
* This file decides every line; each arrangement, in
* `arrangements/de-mahnung-fee/`, only places them.
*
* Installed by `dxcl add de-mahnung-fee`, which also installs its deriver.
*/
/** What this component reads. Add these fields to your document data type. */
export interface DeMahnungFeeData {
mahnung: {
/**
* Who owes the money. `consumer` is a Verbraucher (§ 13 BGB): no EUR 40
* Pauschale, the 30-day rule only with a warning on the invoice, and a
* fee of at most EUR 2.50. `business` is everyone else. Required:
* anything else throws, because guessing either way puts an unlawful
* charge on the letter.
*/
debtorType: "consumer" | "business";
/**
* The date of this Mahnung, ISO 8601 (`2026-11-19`). It is taken as the
* day the letter reaches the debtor. Anything after the tenth character is
* ignored. Required: throws when missing or not YYYY-MM-DD.
*/
date: string;
/**
* The material cost of this letter in euros (postage, print, registered
* mail), never staff time. It is charged once for the whole letter, not once
* per invoice. Missing means 0: nothing is charged. Throws when negative or
* not finite. Throws above 2.50 when `debtorType` is `consumer`.
*/
fee?: number;
/**
* Extra public holidays for the § 193 shift, ISO 8601. Use the holidays of
* the debtor's Land, such as Reformationstag or Buß- und Bettag. The nine
* nationwide holidays are always applied and need not be listed. Missing
* means only weekends and the nationwide holidays. Throws when an entry is
* not an ISO date.
*/
holidays?: string[];
/**
* Every invoice this Mahnung covers, in any order. They are printed oldest
* due date first. Required and non-empty: throws otherwise, because a
* Mahnung with no invoice is not a letter.
*/
invoices: Array<{
/** The invoice number, printed as given. Required: throws when missing or blank. */
number: string;
/**
* The amount still open on this invoice, in euros. It is printed and
* never computed with. Required: throws when not finite or not above 0.
*/
amount: number;
/**
* When payment fell due (Fälligkeit), ISO 8601. Required: throws when
* missing or not a date. Also throws when `mahnung.date` is not after
* this date shifted under § 193, because the invoice is not overdue yet.
*/
dueDate: string;
/**
* When the debtor received the invoice, ISO 8601. Starts the § 286 Abs. 3
* 30 days. Missing: a consumer gets no 30-day route at all, and a business
* falls back to `goodsReceivedDate`. Throws when present but not a date.
*/
invoiceReceivedDate?: string;
/**
* When the debtor received the goods or service, ISO 8601. Used only for a
* business debtor, and only when `invoiceReceivedDate` is missing
* (§ 286 Abs. 3 S. 2). Missing then means no 30-day route. Throws when
* present but not a date.
*/
goodsReceivedDate?: string;
/**
* A payment date fixed by contract, ISO 8601: either a calendar date
* (§ 286 Abs. 2 Nr. 1), or a date the caller computed from an agreed event
* such as "14 days after delivery" (Nr. 2; set `contractPaymentFromEvent`).
* Missing means no Abs. 2 route. Throws when not a date or when it is
* before `dueDate`.
*/
contractPaymentDate?: string;
/**
* True when `contractPaymentDate` was computed from an event (Nr. 2)
* rather than fixed in the calendar (Nr. 1). Changes only the wording.
* Missing means false.
*/
contractPaymentFromEvent?: boolean;
/**
* Whether the invoice warned that the debtor falls into Verzug 30 days
* after due date and receipt. Read only for a consumer, for whom the
* 30-day route applies only when this is true. Missing means false.
*/
verzugWarningOnInvoice?: boolean;
/**
* The Mahnungen sent before this one for this invoice, in any order.
* Missing or empty means this is the first.
*/
mahnungen?: Array<{
/**
* The day it reached the debtor, ISO 8601. Throws when not a date, or
* when it is not before `mahnung.date`. A Mahnung dated on or before the
* shifted due date has no legal effect: it does not start Verzug, but
* its fee still counts as charged.
*/
date: string;
/**
* What it charged this invoice, in euros. Missing means 0. Throws when
* negative or not finite. For a business debtor it is credited against
* the Pauschale.
*/
feeCharged?: number;
}>;
}>;
};
}
/**
* Where the lines sit.
*
* - `stacked`: each invoice as a heading with its lines beneath. The default.
* - `table`: one row per invoice, for a letter covering many.
*/
export type DeMahnungFeeArrangement = "stacked" | "table";
/** Props for {@linkcode DeMahnungFee}. */
export interface DeMahnungFeeProps {
/** Where the lines sit. Defaults to `"stacked"`. */
arrangement?: DeMahnungFeeArrangement;
}
export const DeMahnungFee: SectionComponent<DeMahnungFeeProps> = async ({ arrangement }) => {
const [mahnung] = useState((data: DeMahnungFeeData) => data.mahnung);
const result = await useDeriver(deMahnungFee, [mahnung]);
const lines: DeMahnungFeeLines = {
business: result.business,
proofLine: result.proofLine,
invoices: result.invoices,
};
return (
<Section id="de-mahnung-fee" title="Verzug und Mahnkosten">
{arrange(arrangement, {
stacked: () => stacked(lines),
table: () => table(lines),
})}
</Section>
);
}; derivers/de-mahnung-fee.deriver.ts // deno-lint-ignore-file no-explicit-any
import { deriver } from "docxcelerate/template";
/**
* Decides, for each invoice of a German Mahnung, since when the debtor is in
* Verzug, why, and what this letter may charge. Installed by
* `dxcl add de-mahnung-fee`.
*
* It is self-contained on purpose: it travels to the engine as source text, so
* a module-level constant or helper would be a ReferenceError there. Every
* helper, the Easter computation and both ceilings are declared inside `run`.
*/
export default deriver({
name: "deMahnungFee",
run: (input: unknown) => {
const mahnung = input as any;
type Route = "contract" | "event" | "invoice-30" | "goods-30" | "earlier-mahnung" | "this-mahnung";
// § 288 Abs. 5 BGB, in cents.
const PAUSCHALE = 4000;
// The component's own conservative bound for "modest" postage and print
// under § 309 Nr. 5 a) BGB. It is not a figure in the statute.
const CONSUMER_FEE_CEILING = 250;
const dates = new Intl.DateTimeFormat("de-DE", { day: "2-digit", month: "2-digit", year: "numeric", timeZone: "UTC" });
const money = new Intl.NumberFormat("de-DE", { style: "currency", currency: "EUR" });
const fmtDay = (day: number) => dates.format(new Date(day * 86_400_000));
const fmtMoney = (cents: number) => money.format(cents / 100);
const isoOf = (day: number) => new Date(day * 86_400_000).toISOString().slice(0, 10);
// UTC day indexes, so a day does not shift with the engine's time zone.
const isoDay = (value: unknown, field: string): string => {
const text = typeof value === "string" ? value.slice(0, 10) : "";
const d = new Date(text + "T00:00:00Z");
// getTime() first: toISOString throws a bare RangeError on "2026-13-01".
const ok = /^\d{4}-\d{2}-\d{2}$/.test(text) && !Number.isNaN(d.getTime()) && d.toISOString().slice(0, 10) === text;
if (!ok) throw new Error(field + " must be an ISO 8601 date");
return text;
};
const dayIndex = (iso: string) => {
const [y, m, d] = iso.split("-").map(Number);
return Date.UTC(y, m - 1, d) / 86_400_000;
};
// Through toPrecision so 2.005 is the 200.5 it was written as, not the
// 200.49999999999997 a float multiplication leaves.
const centsOf = (value: unknown, field: string, positive = false): number => {
if (typeof value !== "number" || !Number.isFinite(value) || value < 0 || (positive && value === 0)) {
throw new Error(field + (positive ? " must be a finite number above 0" : " must be a finite number of 0 or more"));
}
return Math.round(Number((value * 100).toPrecision(15)));
};
// ---- validation, before any arithmetic ----
if (mahnung?.debtorType !== "consumer" && mahnung?.debtorType !== "business") {
throw new Error('mahnung.debtorType must be "consumer" or "business"');
}
const business = mahnung.debtorType === "business";
const dateIso = isoDay(mahnung.date, "mahnung.date");
const today = dayIndex(dateIso);
const feeCents = mahnung.fee === undefined || mahnung.fee === null ? 0 : centsOf(mahnung.fee, "mahnung.fee");
if (!business && feeCents > CONSUMER_FEE_CEILING) {
throw new Error("mahnung.fee must not exceed " + fmtMoney(CONSUMER_FEE_CEILING) + " for a consumer");
}
const rawHolidays: unknown[] = mahnung.holidays === undefined || mahnung.holidays === null ? [] : mahnung.holidays;
if (!Array.isArray(rawHolidays)) throw new Error("mahnung.holidays must be an array of ISO 8601 dates");
const extra = new Set(rawHolidays.map((h, i) => dayIndex(isoDay(h, "mahnung.holidays[" + i + "]"))));
if (!Array.isArray(mahnung.invoices) || mahnung.invoices.length === 0) {
throw new Error("mahnung.invoices must be a non-empty array");
}
// ---- § 193 BGB ----
const nationwide = new Map<number, Set<number>>();
const holidaysOf = (year: number) => {
let set = nationwide.get(year);
if (!set) {
// Anonymous Gregorian algorithm (Meeus/Jones/Butcher).
const a = year % 19, b = Math.floor(year / 100), c = year % 100;
const d = Math.floor(b / 4), e = b % 4, f = Math.floor((b + 8) / 25);
const g = Math.floor((b - f + 1) / 3), h = (19 * a + b - d - g + 15) % 30;
const i = Math.floor(c / 4), k = c % 4, l = (32 + 2 * e + 2 * i - h - k) % 7;
const m = Math.floor((a + 11 * h + 22 * l) / 451);
const month = Math.floor((h + l - 7 * m + 114) / 31);
const easter = Date.UTC(year, month - 1, ((h + l - 7 * m + 114) % 31) + 1) / 86_400_000;
const fixed = (mo: number, dd: number) => Date.UTC(year, mo - 1, dd) / 86_400_000;
set = new Set([
fixed(1, 1), easter - 2, easter + 1, fixed(5, 1), easter + 39, easter + 50,
fixed(10, 3), fixed(12, 25), fixed(12, 26),
]);
nationwide.set(year, set);
}
return set;
};
const nonWorking = (day: number) => {
const when = new Date(day * 86_400_000);
const weekday = when.getUTCDay();
return weekday === 0 || weekday === 6 || extra.has(day) || holidaysOf(when.getUTCFullYear()).has(day);
};
const shift = (day: number) => {
while (nonWorking(day)) day += 1;
return day;
};
// ---- per invoice ----
const parsed = (mahnung.invoices as any[]).map((inv, i) => {
const at = "mahnung.invoices[" + i + "]";
if (typeof inv?.number !== "string" || inv.number.trim() === "") throw new Error(at + ".number is required");
const amountCents = centsOf(inv.amount, at + ".amount", true);
const dueIso = isoDay(inv.dueDate, at + ".dueDate");
const optional = (value: unknown, field: string) => value === undefined || value === null ? undefined : isoDay(value, at + "." + field);
const received = optional(inv.invoiceReceivedDate, "invoiceReceivedDate");
const goods = optional(inv.goodsReceivedDate, "goodsReceivedDate");
const contract = optional(inv.contractPaymentDate, "contractPaymentDate");
if (contract !== undefined && contract < dueIso) {
throw new Error(at + ".contractPaymentDate must not be before " + at + ".dueDate");
}
const due = shift(dayIndex(dueIso));
if (today <= due) {
throw new Error("mahnung.date must be after " + at + ".dueDate, which is due through " + fmtDay(due));
}
const earlier: Array<{ day: number; fee: number }> = [];
const rawEarlier: unknown[] = inv.mahnungen === undefined || inv.mahnungen === null ? [] : inv.mahnungen;
if (!Array.isArray(rawEarlier)) throw new Error(at + ".mahnungen must be an array");
rawEarlier.forEach((m: any, j) => {
const field = at + ".mahnungen[" + j + "]";
const day = dayIndex(isoDay(m?.date, field + ".date"));
if (day >= today) throw new Error(field + ".date must be before mahnung.date");
earlier.push({ day, fee: m.feeCharged === undefined || m.feeCharged === null ? 0 : centsOf(m.feeCharged, field + ".feeCharged") });
});
// Each candidate is the first day of Verzug by that route; ties go to the
// lower rank, so statutory Verzug beats a Mahnung on the same day.
const candidates: Array<{ day: number; rank: number; route: Route; original?: number; last?: number }> = [];
if (contract !== undefined) {
const original = dayIndex(contract);
const last = shift(original);
candidates.push({ day: last + 1, rank: 0, route: inv.contractPaymentFromEvent === true ? "event" : "contract", original, last });
}
const thirty = (basis: string, route: Route) => {
const start = Math.max(dayIndex(dueIso), dayIndex(basis)); // § 187 Abs. 1: the start day is not counted
const last = shift(start + 30);
candidates.push({ day: last + 1, rank: 1, route, original: start, last });
};
if (received !== undefined) {
if (business || inv.verzugWarningOnInvoice === true) thirty(received, "invoice-30");
} else if (business && goods !== undefined) thirty(goods, "goods-30");
const firstEarlier = earlier.filter((m) => m.day > due).sort((x, y) => x.day - y.day)[0];
if (firstEarlier) candidates.push({ day: firstEarlier.day, rank: 2, route: "earlier-mahnung" });
candidates.push({ day: today, rank: 3, route: "this-mahnung" });
candidates.sort((x, y) => x.day - y.day || x.rank - y.rank);
return {
number: inv.number as string,
amountCents,
dueIso,
winner: candidates[0],
before: earlier.reduce((sum, m) => sum + m.fee, 0),
};
});
// Print order: oldest due date first, input order on a tie (sort is stable).
const ordered = [...parsed].sort((x, y) => (x.dueIso < y.dueIso ? -1 : x.dueIso > y.dueIso ? 1 : 0));
// The letter's one fee goes to the chargeable invoice in Verzug longest.
let carrier: (typeof ordered)[number] | undefined;
if (feeCents > 0) {
for (const inv of ordered) {
if (inv.winner.route === "this-mahnung") continue;
if (!carrier || inv.winner.day < carrier.winner.day) carrier = inv;
}
}
const invoices = ordered.map((inv) => {
const { winner, before } = inv;
const route = winner.route;
const since = fmtDay(winner.day);
const now = inv === carrier ? feeCents : 0;
const after = before + now;
const excessAfter = Math.max(0, after - PAUSCHALE);
const feeNowMinor = business ? excessAfter - Math.max(0, before - PAUSCHALE) : now;
const costsMinor = business ? PAUSCHALE + excessAfter : after;
let verzugLine: string;
if (route === "contract" || route === "event") {
const term = route === "event" ? "Der aus dem vereinbarten Ereignis berechnete Zahlungstermin " : "Der vertraglich bestimmte Zahlungstermin ";
const moved = winner.last !== winner.original
? "; da er auf einen Samstag, Sonntag oder Feiertag fiel, lief er nach § 193 BGB bis " + fmtDay(winner.last as number)
: "";
verzugLine = "In Verzug seit " + since + ": " + term + fmtDay(winner.original as number) + " ist verstrichen" + moved +
" (§ 286 Abs. 2 Nr. " + (route === "event" ? "2" : "1") + " BGB).";
} else if (route === "invoice-30" || route === "goods-30") {
const moved = winner.last !== (winner.original as number) + 30
? "; das Fristende fiel auf einen Samstag, Sonntag oder Feiertag und verschob sich nach § 193 BGB auf " + fmtDay(winner.last as number)
: "";
verzugLine = "In Verzug seit " + since + ": 30 Tage nach Fälligkeit und " +
(route === "invoice-30" ? "Zugang der Rechnung am " : "Empfang der Leistung am ") + fmtDay(winner.original as number) + moved +
(route === "invoice-30" ? " (§ 286 Abs. 3 BGB)." : " (§ 286 Abs. 3 Satz 2 BGB).");
} else if (route === "earlier-mahnung") {
verzugLine = "In Verzug seit " + since + ": durch unsere Mahnung vom " + since + " (§ 286 Abs. 1 BGB).";
} else {
verzugLine = "Mit Zugang dieses Schreibens geraten Sie in Verzug (§ 286 Abs. 1 BGB).";
}
let feeLine: string;
if (route === "this-mahnung") {
feeLine = "Für dieses Schreiben berechnen wir keine Mahngebühr, weil erst dieses Schreiben den Verzug begründet.";
} else if (carrier && inv !== carrier) {
feeLine = "Die Kosten dieses Schreibens sind bei Rechnung " + carrier.number + " berechnet.";
} else if (now === 0) {
feeLine = "Für dieses Schreiben berechnen wir keine Mahngebühr.";
} else {
feeLine = "Mahngebühr für dieses Schreiben: " + fmtMoney(now) + " (Porto und Druck).";
if (business) {
if (after <= PAUSCHALE) feeLine += " Sie wird auf die Verzugspauschale angerechnet und nicht zusätzlich berechnet.";
else if (before < PAUSCHALE) feeLine += " Davon berechnen wir " + fmtMoney(feeNowMinor) + " zusätzlich; der Rest ist durch die Verzugspauschale abgegolten.";
else feeLine += " Sie wird zusätzlich berechnet, weil die Mahngebühren die Verzugspauschale bereits übersteigen.";
}
}
let pauschaleLine = "";
if (business) {
pauschaleLine = route === "this-mahnung"
? "Mit Eintritt des Verzugs entsteht die Verzugspauschale nach § 288 Abs. 5 BGB von " + fmtMoney(PAUSCHALE) + "."
: "Verzugspauschale nach § 288 Abs. 5 BGB: " + fmtMoney(PAUSCHALE) + ".";
if (after > 0) {
pauschaleLine += " Mahngebühren von insgesamt " + fmtMoney(after) + " sind darauf angerechnet (§ 288 Abs. 5 Satz 3 BGB)";
pauschaleLine += after > PAUSCHALE ? "; berechnet wird nur der übersteigende Betrag von " + fmtMoney(after - PAUSCHALE) + "." : ".";
}
}
return {
number: inv.number,
heading: "Rechnung " + inv.number + " über " + fmtMoney(inv.amountCents) + ", fällig am " + fmtDay(dayIndex(inv.dueIso)),
verzugLine,
feeLine,
pauschaleLine,
route,
verzugSince: isoOf(winner.day),
feeNowMinor,
costsMinor,
};
});
return {
business,
proofLine: !business && feeCents > 0 && carrier
? "Ihnen bleibt der Nachweis gestattet, dass uns ein Schaden nicht entstanden oder wesentlich niedriger ist als die berechnete Mahngebühr."
: "",
invoices,
};
},
}); arrangements/de-mahnung-fee/lines.ts /**
* What the Mahnung fee hands each of its arrangements: every line, already
* decided. An arrangement places these and decides nothing, so both print the
* same lines under the same conditions.
*
* Installed by `dxcl add de-mahnung-fee`, with the arrangements.
*/
export interface DeMahnungFeeLines {
/** Whether the debtor is a business: only then is there a Pauschale line. */
business: boolean;
/** The proof-of-lower-damage clause, or "" when this letter charges a consumer nothing. */
proofLine: string;
/** One entry per invoice, oldest due date first. */
invoices: Array<{
/** The invoice number as given. */
number: string;
/** "Rechnung … über …, fällig am …", with the due date as given, not shifted. */
heading: string;
/** Since when the invoice is in default, and why. */
verzugLine: string;
/** What this letter charges for this invoice. */
feeLine: string;
/** "" for a consumer. */
pauschaleLine: string;
}>;
} arrangements/de-mahnung-fee/stacked.arrangement.tsx import { Paragraph, type Yield } from "docxcelerate/template";
import type { DeMahnungFeeLines } from "./lines.ts";
/**
* Each invoice as a heading with its lines beneath, as letter prose. The
* business and consumer arms are chosen once, outside the loop, so no body
* holds a condition and every string in one is always non-empty.
*/
export const stacked = (lines: DeMahnungFeeLines): Yield => (
<>
{lines.business
? lines.invoices.map((invoice) => (
<>
<Paragraph id="de-mahnung-fee-business-invoice">{invoice.heading}</Paragraph>
<Paragraph id="de-mahnung-fee-business-verzug">{invoice.verzugLine}</Paragraph>
<Paragraph id="de-mahnung-fee-business-fee">{invoice.feeLine}</Paragraph>
<Paragraph id="de-mahnung-fee-business-pauschale">{invoice.pauschaleLine}</Paragraph>
</>
))
: lines.invoices.map((invoice) => (
<>
<Paragraph id="de-mahnung-fee-consumer-invoice">{invoice.heading}</Paragraph>
<Paragraph id="de-mahnung-fee-consumer-verzug">{invoice.verzugLine}</Paragraph>
<Paragraph id="de-mahnung-fee-consumer-fee">{invoice.feeLine}</Paragraph>
</>
))}
{lines.proofLine && <Paragraph id="de-mahnung-fee-proof">{lines.proofLine}</Paragraph>}
</>
); arrangements/de-mahnung-fee/table.arrangement.tsx import { Cell, Paragraph, Row, Table, type Yield } from "docxcelerate/template";
import type { DeMahnungFeeLines } from "./lines.ts";
/**
* One row per invoice, so a letter covering many invoices can be scanned down
* a column. A consumer has no Pauschale, so gets no column for it.
*/
export const table = (lines: DeMahnungFeeLines): Yield => (
<>
{lines.business
? (
// 40mm holds an invoice heading in a few lines; the prose columns share the rest.
<Table
id="de-mahnung-fee-business-table"
columns={[{ width: 40 }, { width: "auto" }, { width: "auto" }, { width: "auto" }]}
>
<Row id="de-mahnung-fee-business-header" header>
<Cell>Rechnung</Cell>
<Cell>Verzug</Cell>
<Cell>Mahngebühr</Cell>
<Cell>Verzugspauschale</Cell>
</Row>
{lines.invoices.map((invoice) => (
<Row id="de-mahnung-fee-business-row">
<Cell>{invoice.heading}</Cell>
<Cell>{invoice.verzugLine}</Cell>
<Cell>{invoice.feeLine}</Cell>
<Cell>{invoice.pauschaleLine}</Cell>
</Row>
))}
</Table>
)
: (
<Table id="de-mahnung-fee-consumer-table" columns={[{ width: 40 }, { width: "auto" }, { width: "auto" }]}>
<Row id="de-mahnung-fee-consumer-header" header>
<Cell>Rechnung</Cell>
<Cell>Verzug</Cell>
<Cell>Mahngebühr</Cell>
</Row>
{lines.invoices.map((invoice) => (
<Row id="de-mahnung-fee-consumer-row">
<Cell>{invoice.heading}</Cell>
<Cell>{invoice.verzugLine}</Cell>
<Cell>{invoice.feeLine}</Cell>
</Row>
))}
</Table>
)}
{lines.proofLine && <Paragraph id="de-mahnung-fee-proof">{lines.proofLine}</Paragraph>}
</>
);