Dutch collection costs
BodyCollection costs under Dutch law are all or nothing: one mistake voids the claim. A consumer owes them only after a veertiendagenbrief that states the exact figure, and the fourteen days run from the day after receipt, so the letter prints a payment date fifteen days after the expected receipt, rolled past weekends and public holidays. The staffel is applied once to every invoice the letter names, with interest that has run a year added first, and rounded to the cent once. btw is added only when the creditor cannot reclaim it. A consumer's low instalments get EUR 40 and then EUR 20 in a six-month window. A business owes the staffel or EUR 40 per invoice, whichever is more, or what its contract says, with no letter. A later letter claims costs only once the earlier deadline has passed and it stated an amount; otherwise nothing is printed. An agency prints its Wki number. All of it is one deriver.
npx dxcl add nl-collection-costs collection.debtorType Voorbeelddata
de JSON waarmee dit voorbeeld is gebouwd{
"collection": {
"debtorType": "consumer",
"creditorCanReclaimVat": false,
"sendDate": "2026-11-19",
"channel": "post",
"invoices": [
{
"number": "VF-2025-0004817-ENERGIE-NOORD",
"principal": 7845.32,
"dueDate": "2025-09-30"
},
{
"number": "VF-2025-0005129-ENERGIE-NOORD",
"principal": 6912.75,
"dueDate": "2025-10-31"
},
{
"number": "VF-2026-0000318-EINDAFREKENING",
"principal": 3991.93,
"dueDate": "2026-01-31"
}
],
"interestAccrued": 612.48,
"interestRunningSince": "2025-10-01",
"agency": {
"name": "Incassobureau Noord-Holland Gerechtsdeurwaarders en Juridische Dienstverlening B.V.",
"registrationNumber": "2024-0048176"
}
}
} {
"collection": {
"debtorType": "business",
"creditorCanReclaimVat": false,
"sendDate": "2026-11-19",
"channel": "post",
"invoices": [
{
"number": "VF-2025-0004817-ENERGIE-NOORD",
"principal": 7845.32,
"dueDate": "2025-09-30"
},
{
"number": "VF-2025-0005129-ENERGIE-NOORD",
"principal": 6912.75,
"dueDate": "2025-10-31"
},
{
"number": "VF-2026-0000318-EINDAFREKENING",
"principal": 3991.93,
"dueDate": "2026-01-31"
}
],
"interestAccrued": 612.48,
"interestRunningSince": "2025-10-01",
"agency": {
"name": "Incassobureau Noord-Holland Gerechtsdeurwaarders en Juridische Dienstverlening B.V.",
"registrationNumber": "2024-0048176"
}
}
} Gerenderd voorbeeld
elke opstelling op zichzelf gerenderdOpgeloste nodes
wat een renderer krijgt — 2 nodesnl-collection-costs section nl-collection-costs-agency paragraph · static Incassobureau Noord-Holland Gerechtsdeurwaarders en Juridische Dienstverlening B.V. is ingeschreven in het register incassodienstverlening onder nummer 2024-0048176. nl-collection-costs section nl-collection-costs-agency paragraph · static Incassobureau Noord-Holland Gerechtsdeurwaarders en Juridische Dienstverlening B.V. is ingeschreven in het register incassodienstverlening onder nummer 2024-0048176. De bestanden
wat installeren schrijft; het gekozen bestand is de componentnodes/nl-collection-costs.node.tsx import {
arrange,
type Nodes,
Paragraph,
Section,
useDeriver,
useState,
} from "docxcelerate/template";
import type { NlCollectionCostsLines } from "../arrangements/nl-collection-costs/lines.ts";
import { stacked } from "../arrangements/nl-collection-costs/stacked.arrangement.tsx";
import { table } from "../arrangements/nl-collection-costs/table.arrangement.tsx";
import nlCollectionCosts from "../derivers/nl-collection-costs.deriver.ts";
/**
* The statement of Dutch out-of-court collection costs (buitengerechtelijke
* incassokosten), printed only when the law lets this letter claim them. Each
* mistake below voids the whole claim in court, so the component decides them.
*
* A consumer owes costs only after a veertiendagenbrief that states the exact
* figure; a business owes them from the day after the due date, with no
* letter. The fourteen days run from the day after receipt (HR 2016:2704), so
* the letter prints a payment date, never a period: fifteen days after the
* expected receipt (post four days, e-mail one), rolled past weekends and
* Algemene termijnenwet holidays. It can be a day late, never too short.
*
* The staffel is applied once to everything the letter names (Besluit BIK
* art. 2), on integer cents, with statutory interest added first once it has
* run a year. btw is added only when the creditor is known not to reclaim it:
* understating the figure keeps the letter valid, overstating does not. A
* consumer's low instalments are capped (art. 2a). A later letter claims the
* stated figure only once the earlier deadline has passed and that letter
* stated one; otherwise no costs are printed at all.
*
* A collection agency's Wki registration number prints in every outcome, none
* included, because the duty is on the letter and not on the costs. That is
* why this is `Nodes`: the section, and the agency line outside it.
*
* All of it is decided in one deriver, because every step is arithmetic, a
* comparison or a date on request data, which publishing refuses. The node
* computes nothing and branches with inline tests so a publish build keeps
* each arm. It publishes 7 branches here (the section, five arms, the agency line) and
* 2 more in whichever arrangement is used (interest, btw): 9 against the default
* `branchLimit` of 32.
*
* Arrangement: where the figures sit is a separate choice from what the
* statement says, made with the `arrangement` prop. Both arrangements, in
* `arrangements/nl-collection-costs/`, print the same lines.
*
* Installed by `dxcl add nl-collection-costs`, which also installs its deriver.
*/
/** What this component reads. Add these fields to your document data type. */
export interface NlCollectionCostsData {
collection: {
/**
* Who owes the money. `consumer` is a natural person not acting in a trade
* or profession: the veertiendagenbrief rules apply. `business` is
* everyone else: no letter is needed and a contract clause may set the
* costs. Required: the deriver throws on anything else, because the two
* rules give different answers for every other field.
*/
debtorType: "consumer" | "business";
/**
* Whether the creditor can reclaim the VAT on the collection costs.
* `false` (a private person, a VAT-exempt business) adds 21% btw to the
* costs. Missing means `true`, so no btw is added: on a consumer letter the
* stated figure must be right, and understating it keeps the letter
* valid where overstating does not.
*/
creditorCanReclaimVat?: boolean;
/**
* The date this document is sent, ISO 8601 (`2026-11-19`). Anything after
* the tenth character is ignored. Required: throws when missing or not
* YYYY-MM-DD. Every invoice must already be overdue on this date.
*/
sendDate: string;
/**
* How this document reaches a consumer. It sets the expected receipt:
* `post` is `sendDate` plus `postDeliveryDays`, `email` is the next day.
* Required for a consumer when `previousLetter` is missing (this
* document is then the veertiendagenbrief), and throws when missing
* there. Ignored otherwise.
*/
channel?: "post" | "email";
/**
* Calendar days a posted letter is assumed to take. Missing means 4,
* which covers PostNL's two-delivery-day service whichever weekday the
* letter is posted. Throws when given and not a non-negative integer.
*/
postDeliveryDays?: number;
/**
* Every invoice the letter claims, at least one. Their principals are
* added together before the staffel. Required: throws when missing or
* empty.
*/
invoices: Array<{
/** The invoice number, printed as given. Throws when missing or blank. */
number: string;
/**
* What is still owed on it, in euros (`7845.32`). Throws when it is
* not a finite number above 0: a credit or a paid invoice does not
* belong in a collection letter.
*/
principal: number;
/**
* When it fell due, ISO 8601. Throws when missing, not a date, or not
* before `sendDate`. The debtor is in default only from the day after
* the due date, and a letter sent earlier is invalid.
*/
dueDate: string;
}>;
/**
* Statutory interest already due, in euros. Added to the principal before
* the staffel only when `interestRunningSince` is at least one calendar
* year before `sendDate`. Missing, 0, or interest that has not yet run
* a year adds nothing. Throws when given and negative or not finite.
*/
interestAccrued?: number;
/**
* The day the interest started to run, ISO 8601. Missing means the
* interest is never added. Throws when given and not a date.
*/
interestRunningSince?: string;
/**
* For a consumer's instalment debt (art. 2a Besluit BIK). The letter must
* then name exactly one invoice, the instalment, and the deriver throws
* otherwise. Ignored for a business debtor. Missing means not an
* instalment.
*/
instalment?: {
/**
* How many earlier instalments of the same contract were already
* charged collection costs in the current six-month window. 0 means
* this is the first. Throws when not a non-negative integer.
*/
priorCharged: number;
/**
* The day the first charged instalment of the window was sent, ISO 8601.
* The window ends six calendar months later; a `sendDate` on or after
* that starts a new window, and this instalment is the first again.
* Required when `priorCharged` is above 0, and throws when missing there.
*/
windowStart?: string;
};
/**
* For a business debtor: the costs, in euros excluding btw, that the
* contract's own clause gives. They replace the staffel and the EUR 40
* per invoice. Missing or 0 means no clause. Ignored for a consumer,
* because the staffel cannot be contracted out of to a consumer's cost.
* Throws when negative or not finite.
*/
contractualCosts?: number;
/**
* For a consumer: the veertiendagenbrief that was already sent, when this
* document is the later letter that claims the costs. Missing means this
* document IS the veertiendagenbrief. Ignored for a business debtor.
*/
previousLetter?: {
/**
* The payment date that letter stated, ISO 8601. Costs are due only when
* `sendDate` is after it. Required: throws when missing or not a date.
*/
deadline: string;
/**
* The cost amount that letter stated, in euros including any btw. It
* is what is claimed now, and it is not recomputed. Missing or 0 means
* the letter stated no amount, so no costs are due and none are printed.
* Throws when negative.
*/
statedCosts?: number;
/**
* When the consumer actually received it, ISO 8601, if known. When
* given, costs are also not due until fourteen days after it have passed
* (Atw-extended). Throws when given and not a date.
*/
receivedDate?: string;
};
/**
* Set when a collection agency sends the letter, not the creditor. Both
* fields are printed, and both are required: throws when either is
* missing or blank. Missing means the creditor sends it.
*/
agency?: {
/** The agency's name as registered. */
name: string;
/** Its number in the Wki register (register incassodienstverlening). */
registrationNumber: string;
};
};
}
/**
* Where the figures sit. `stacked`: labelled lines. `table`: labels left,
* amounts right-aligned.
*/
export type NlCollectionCostsArrangement = "stacked" | "table";
/** Props for {@linkcode NlCollectionCosts}. */
export interface NlCollectionCostsProps {
/** Where the figures sit. Defaults to `"stacked"`. */
arrangement?: NlCollectionCostsArrangement;
}
export const NlCollectionCosts: Nodes<NlCollectionCostsProps> = async ({ arrangement }) => {
const [collection] = useState((data: NlCollectionCostsData) => data.collection);
const c = await useDeriver(nlCollectionCosts, [collection]);
const lines: NlCollectionCostsLines = {
invoices: c.invoices,
principal: c.principal,
interest: c.interest,
costs: c.costs,
vat: c.vat,
total: c.total,
totalLabel: c.totalLabel,
};
return (
<>
{c.outcome !== "none" && (
<Section id="nl-collection-costs" title="Incassokosten">
{c.outcome === "consumer-notice" && (
<Paragraph id="nl-collection-costs-notice">
Wij verzoeken u {c.payNow} voor {c.invoices} uiterlijk op {c.deadline} te betalen. Betaalt u niet
uiterlijk op die datum, dan bent u daarnaast incassokosten verschuldigd van {c.costsPhrase}, berekend
volgens het Besluit vergoeding voor buitengerechtelijke incassokosten.
</Paragraph>
)}
{c.outcome === "consumer-due" && (
<Paragraph id="nl-collection-costs-due">
De betalingstermijn uit onze eerdere brief is op {c.previousDeadline} verstreken zonder dat {c.payNow}{" "}
is betaald. U bent daarom de in die brief aangekondigde incassokosten van {c.costsPhrase} verschuldigd.
</Paragraph>
)}
{c.outcome === "business-staffel" && (
<Paragraph id="nl-collection-costs-business-staffel">
Omdat {c.invoices} niet op tijd is betaald, bent u incassokosten verschuldigd van {c.costsPhrase},
berekend volgens het Besluit vergoeding voor buitengerechtelijke incassokosten (artikel 6:96 BW).
</Paragraph>
)}
{c.outcome === "business-fixed" && (
<Paragraph id="nl-collection-costs-business-fixed">
Omdat {c.invoices} niet op tijd is betaald, bent u de vaste vergoeding van € 40 per factuur
verschuldigd (artikel 6:96 lid 4 BW): {c.costsPhrase} voor {c.invoiceCount} facturen.
</Paragraph>
)}
{c.outcome === "business-contract" && (
<Paragraph id="nl-collection-costs-business-contract">
Omdat {c.invoices} niet op tijd is betaald, bent u de incassokosten verschuldigd die in de overeenkomst
zijn afgesproken: {c.costsPhrase}.
</Paragraph>
)}
{arrange(arrangement, { stacked: () => stacked(lines), table: () => table(lines) })}
</Section>
)}
{collection.agency && (
<Paragraph id="nl-collection-costs-agency">
{collection.agency.name} is ingeschreven in het register incassodienstverlening onder nummer{" "}
{collection.agency.registrationNumber}.
</Paragraph>
)}
</>
);
}; derivers/nl-collection-costs.deriver.ts // deno-lint-ignore-file no-explicit-any
import { deriver } from "docxcelerate/template";
/**
* Decides every figure and date of a Dutch collection-costs statement.
* Installed by `dxcl add nl-collection-costs`.
*
* 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. The
* thresholds are named locals at the top of `run` so an owner can correct them
* without reading the rest.
*/
export default deriver({
name: "nlCollectionCosts",
run: (collection: unknown) => {
const col = collection as any;
// Thresholds, in cents unless stated. Not checked against primary sources.
const FIXED_PER_INVOICE = 4000; // art. 6:96 lid 4 BW, business debtors
const INSTALMENT_CEILING = 26667; // art. 2a Besluit BIK: below this, capped
const INSTALMENT_FIRST = 4000;
const INSTALMENT_LATER = 2000;
const INSTALMENT_WINDOW_MONTHS = 6;
const POST_DAYS_DEFAULT = 4;
const NOTICE_DAYS = 15; // fourteen days plus the day after receipt
const RECEIVED_DAYS = 14;
const VAT_PERCENT = 21;
const STAFFEL_MIN = 4000;
const STAFFEL_CAP = 677500;
const fail = (field: string, why: string): never => {
throw new Error("collection." + field + " " + why);
};
const isoOf = (value: unknown, field: string): string => {
if (typeof value !== "string" || !/^\d{4}-\d{2}-\d{2}/.test(value)) {
return fail(field, "must be an ISO 8601 date");
}
return value.slice(0, 10);
};
// UTC day indexes, so a day does not shift with the engine's time zone.
const dayOf = (iso: string) => {
const [y, m, d] = iso.split("-").map(Number);
return Date.UTC(y, m - 1, d) / 86_400_000;
};
const dateOf = (value: unknown, field: string) => dayOf(isoOf(value, field));
const euros = (value: unknown, field: string, min: number): number => {
if (typeof value !== "number" || !Number.isFinite(value) || value < min) {
return fail(field, min > 0 ? "must be a finite number above 0" : "must be a finite number, not negative");
}
return Math.round(value * 100);
};
const named = (value: unknown, field: string): string => {
if (typeof value !== "string" || value.trim() === "") return fail(field, "is required");
return value;
};
const money = new Intl.NumberFormat("nl-NL", { style: "currency", currency: "EUR" });
const fmtMoney = (cents: number) => money.format(cents / 100);
const dates = new Intl.DateTimeFormat("nl-NL", { dateStyle: "full", timeZone: "UTC" });
const fmtDay = (day: number) => dates.format(new Date(day * 86_400_000));
const half = (n: number, d: number) => Math.floor((n + d / 2) / d);
// Anonymous Gregorian algorithm (Meeus/Jones/Butcher).
const easter = (year: number) => {
const a = year % 19;
const b = Math.floor(year / 100);
const c = year % 100;
const d = Math.floor(b / 4);
const e = b % 4;
const f = Math.floor((b + 8) / 25);
const g = Math.floor((b - f + 1) / 3);
const h = (19 * a + b - d - g + 15) % 30;
const i = Math.floor(c / 4);
const k = c % 4;
const 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 dayOfMonth = ((h + l - 7 * m + 114) % 31) + 1;
return Date.UTC(year, month - 1, dayOfMonth) / 86_400_000;
};
// Algemene termijnenwet holidays. Koningsdag on a Sunday moves to a
// Saturday, which is rolled anyway.
const isHoliday = (day: number) => {
const date = new Date(day * 86_400_000);
const year = date.getUTCFullYear();
const at = (month: number, dom: number) => Date.UTC(year, month - 1, dom) / 86_400_000;
const e = easter(year);
return [at(1, 1), e + 1, e + 39, e + 50, at(4, 27), at(5, 5), at(12, 25), at(12, 26)].includes(day);
};
const roll = (from: number) => {
let day = from;
while ([0, 6].includes(new Date(day * 86_400_000).getUTCDay()) || isHoliday(day)) day += 1;
return day;
};
// The staffel in thousandths of a cent, so nothing is floating.
const staffel = (p: number) => {
const band = (from: number, width: number) => Math.min(Math.max(p - from, 0), width);
const raw = band(0, 250000) * 150 + band(250000, 250000) * 100 + band(500000, 500000) * 50 +
band(1000000, 19000000) * 10 + Math.max(p - 20000000, 0) * 5;
return Math.min(STAFFEL_CAP, Math.max(STAFFEL_MIN, Math.floor((raw + 500) / 1000)));
};
// Validate first: every rule gives different answers if a field is wrong.
if (col === null || typeof col !== "object") fail("", "is required");
const debtor = col.debtorType;
if (debtor !== "consumer" && debtor !== "business") fail("debtorType", 'must be "consumer" or "business"');
const consumer = debtor === "consumer";
const sendIso = isoOf(col.sendDate, "sendDate");
const send = dayOf(sendIso);
if (!Array.isArray(col.invoices) || col.invoices.length === 0) fail("invoices", "must list at least one invoice");
const numbers: string[] = [];
let principalCents = 0;
col.invoices.forEach((invoice: any, i: number) => {
const at = "invoices[" + i + "]";
numbers.push(named(invoice?.number, at + ".number"));
principalCents += euros(invoice?.principal, at + ".principal", 1e-9);
if (dateOf(invoice?.dueDate, at + ".dueDate") >= send) fail(at + ".dueDate", "must be before sendDate");
});
const postDays = col.postDeliveryDays ?? POST_DAYS_DEFAULT;
if (!Number.isInteger(postDays) || postDays < 0) fail("postDeliveryDays", "must be a non-negative integer");
const prev = consumer ? col.previousLetter : undefined;
if (consumer && !prev && col.channel !== "post" && col.channel !== "email") {
fail("channel", 'must be "post" or "email" on a veertiendagenbrief');
}
const hasValue = (v: unknown) => v !== undefined && v !== null;
const interestInput = hasValue(col.interestAccrued) ? euros(col.interestAccrued, "interestAccrued", 0) : 0;
const sinceDay = hasValue(col.interestRunningSince)
? dateOf(col.interestRunningSince, "interestRunningSince")
: undefined;
const instalment = consumer ? col.instalment : undefined;
let windowEnd = 0;
if (instalment) {
if (col.invoices.length !== 1) fail("instalment", "needs exactly one invoice");
const prior = instalment.priorCharged;
if (!Number.isInteger(prior) || prior < 0) fail("instalment.priorCharged", "must be a non-negative integer");
if (prior > 0) {
const [y, m, d] = isoOf(instalment.windowStart, "instalment.windowStart").split("-").map(Number);
windowEnd = Date.UTC(y, m - 1 + INSTALMENT_WINDOW_MONTHS, d) / 86_400_000;
}
}
const contractCents = !consumer && hasValue(col.contractualCosts)
? euros(col.contractualCosts, "contractualCosts", 0)
: 0;
let previousDeadline = 0;
let statedCents = 0;
let receivedEnd = 0;
if (prev) {
previousDeadline = dateOf(prev.deadline, "previousLetter.deadline");
if (hasValue(prev.statedCosts)) statedCents = euros(prev.statedCosts, "previousLetter.statedCosts", 0);
if (hasValue(prev.receivedDate)) {
receivedEnd = roll(dateOf(prev.receivedDate, "previousLetter.receivedDate") + RECEIVED_DAYS);
}
}
const agency = col.agency;
if (agency) {
named(agency.name, "agency.name");
named(agency.registrationNumber, "agency.registrationNumber");
}
// Interest joins the base only once it has run a full calendar year.
let interestCents = 0;
if (interestInput > 0 && sinceDay !== undefined) {
const since = new Date(sinceDay * 86_400_000);
const anniversary = Date.UTC(since.getUTCFullYear() + 1, since.getUTCMonth(), since.getUTCDate()) / 86_400_000;
if (anniversary <= send) interestCents = interestInput;
}
const baseCents = principalCents + interestCents;
let outcome = "none";
let costsCents = 0;
let deadline = 0;
if (consumer && !prev) {
outcome = "consumer-notice";
if (instalment && baseCents < INSTALMENT_CEILING) {
costsCents = instalment.priorCharged > 0 && send < windowEnd ? INSTALMENT_LATER : INSTALMENT_FIRST;
} else {
costsCents = staffel(baseCents);
}
deadline = roll(send + (col.channel === "post" ? postDays : 1) + NOTICE_DAYS);
} else if (consumer) {
const due = send > previousDeadline && (receivedEnd === 0 || send > receivedEnd);
if (due && statedCents > 0) {
outcome = "consumer-due";
costsCents = statedCents;
}
} else if (contractCents > 0) {
outcome = "business-contract";
costsCents = contractCents;
} else {
const fixed = FIXED_PER_INVOICE * col.invoices.length;
const s = staffel(baseCents);
outcome = fixed > s ? "business-fixed" : "business-staffel";
costsCents = fixed > s ? fixed : s;
}
// The stated figure of an earlier letter already includes any btw.
const vatCents = col.creditorCanReclaimVat === false && outcome !== "consumer-due" && outcome !== "none"
? half(costsCents * VAT_PERCENT, 100)
: 0;
const costsTotalCents = costsCents + vatCents;
const totalCents = baseCents + costsTotalCents;
const none = outcome === "none";
const deadlineText = outcome === "consumer-notice" ? fmtDay(deadline) : "";
return {
outcome,
invoices: new Intl.ListFormat("nl-NL", { type: "conjunction" }).format(numbers),
invoiceCount: numbers.length,
principal: fmtMoney(principalCents),
interest: none || interestCents === 0 ? "" : fmtMoney(interestCents),
payNow: none ? "" : fmtMoney(baseCents),
costs: none ? "" : fmtMoney(costsCents),
vat: vatCents === 0 ? "" : fmtMoney(vatCents),
costsPhrase: none
? ""
: vatCents === 0
? fmtMoney(costsCents)
: fmtMoney(costsTotalCents) + " (inclusief " + fmtMoney(vatCents) + " btw)",
total: none ? "" : fmtMoney(totalCents),
totalLabel: none ? "" : deadlineText ? "Totaal als u niet uiterlijk op " + deadlineText + " betaalt" : "Totaal",
deadline: deadlineText,
previousDeadline: outcome === "consumer-due" ? fmtDay(previousDeadline) : "",
baseCents,
costsCents,
vatCents,
totalCents,
};
},
}); arrangements/nl-collection-costs/lines.ts /**
* What the Dutch collection-costs component hands each of its arrangements:
* every figure it may print, already decided and formatted. An arrangement
* places these and decides nothing, so both print the same lines under the
* same conditions.
*
* An empty `interest` or `vat` is a line this letter does not carry. Test it
* in the JSX, `{lines.interest && …}`, so the test is compiled into a
* condition the engine settles per document.
*
* Installed by `dxcl add nl-collection-costs`, with the arrangements.
*/
export interface NlCollectionCostsLines {
/** The invoice numbers, joined: "A, B en C". */
invoices: string;
/** The sum of the invoice principals. */
principal: string;
/** Statutory interest added to the base, or "" when none is. */
interest: string;
/** The costs excluding btw. */
costs: string;
/** The btw on the costs, or "" when none is added. */
vat: string;
/** What is owed in all. */
total: string;
/** Its label, which carries the payment date on a veertiendagenbrief. */
totalLabel: string;
} arrangements/nl-collection-costs/stacked.arrangement.tsx import { Paragraph, type Yield } from "docxcelerate/template";
import type { NlCollectionCostsLines } from "./lines.ts";
/** One labelled figure under another, below the statement. The default: it reads in any width. */
export const stacked = (lines: NlCollectionCostsLines): Yield => (
<>
<Paragraph id="nl-collection-costs-invoices">Facturen: {lines.invoices}</Paragraph>
<Paragraph id="nl-collection-costs-principal">Hoofdsom: {lines.principal}</Paragraph>
{lines.interest && (
<Paragraph id="nl-collection-costs-interest">Wettelijke rente bijgeteld: {lines.interest}</Paragraph>
)}
<Paragraph id="nl-collection-costs-costs">Incassokosten: {lines.costs}</Paragraph>
{lines.vat && <Paragraph id="nl-collection-costs-vat">Btw (21%) over de incassokosten: {lines.vat}</Paragraph>}
<Paragraph id="nl-collection-costs-total">{lines.totalLabel}: {lines.total}</Paragraph>
</>
); arrangements/nl-collection-costs/table.arrangement.tsx import { Cell, Row, Table, type Yield } from "docxcelerate/template";
import type { NlCollectionCostsLines } from "./lines.ts";
/**
* Labels on the left, amounts right-aligned, so the costs and btw visibly add
* up to the total. The shape Dutch collection letters usually give the
* hoofdsom, rente and kosten.
*/
export const table = (lines: NlCollectionCostsLines): Yield => (
<Table id="nl-collection-costs-figures" columns={[{ width: "auto" }, { width: 35, align: "right" }]}>
<Row id="nl-collection-costs-invoices">
<Cell>Facturen</Cell>
<Cell>{lines.invoices}</Cell>
</Row>
<Row id="nl-collection-costs-principal">
<Cell>Hoofdsom</Cell>
<Cell>{lines.principal}</Cell>
</Row>
{lines.interest && (
<Row id="nl-collection-costs-interest">
<Cell>Wettelijke rente bijgeteld</Cell>
<Cell>{lines.interest}</Cell>
</Row>
)}
<Row id="nl-collection-costs-costs">
<Cell>Incassokosten</Cell>
<Cell>{lines.costs}</Cell>
</Row>
{lines.vat && (
<Row id="nl-collection-costs-vat">
<Cell>Btw (21%) over de incassokosten</Cell>
<Cell>{lines.vat}</Cell>
</Row>
)}
<Row id="nl-collection-costs-total">
<Cell>{lines.totalLabel}</Cell>
<Cell>{lines.total}</Cell>
</Row>
</Table>
);