Japan qualified invoice (適格請求書)
BodyLines are grouped into the 10% and reduced 8% bands, every reduced line is marked ※ with the legend 「※は軽減税率対象」, and each band prints its total and its tax. Tax is worked once per rate per invoice, never summed from rounded lines, which the NTA forbids, and is rounded the way the issuer chooses: floor, ceil or half-up. Tax-inclusive prices are taxed at 10/110 and 8/108, not 10% and 8%. The registration number is T and 13 digits with a check digit, and a wrong one fails the build. A simplified qualified invoice drops only the buyer's name, never the T-number, the date or the reduced-rate marker. A seller with no registration gets a plain invoice with no T-number and no stated tax, plus a note of the share the buyer may still deduct, taken from the transaction date under the FY2026 schedule: 80%, then 70%, 50% and 30%, then nothing after September 2031. All of it is one deriver.
npx dxcl add japan-qualified-invoice jpInvoice.rounding Preview data
the JSON this preview was built with{
"jpInvoice": {
"registrationNumber": "T9234567890123",
"simplified": false,
"rounding": "floor",
"basis": "exclusive",
"transactionDate": "2026-11-30",
"buyerName": "株式会社みちのく総合食品流通ホールディングス 仙台第二物流センター 御中",
"lines": [
{
"description": "宮城県産ササニシキ 精米 30kg袋(特別栽培米・JAS有機認証)",
"amountYen": 46980000,
"rate": "8"
},
{
"description": "業務用冷凍ショーケース(多段式・幅3,600mm)据付工事一式 仙台第二物流センター北棟",
"amountYen": 128450000,
"rate": "10"
},
{
"description": "三陸産冷凍ほたて貝柱 Lサイズ 1kg×10袋入りケース",
"amountYen": 27315750,
"rate": "8"
},
{
"description": "配送用折りたたみコンテナ(大型・蓋付き)リース料 2026年11月分",
"amountYen": 3862500,
"rate": "10"
},
{
"description": "国産若鶏もも肉 正肉 2kg×6パック入りケース",
"amountYen": 18642300,
"rate": "8"
},
{
"description": "コールドチェーン温度管理システム保守料 2026年11月分",
"amountYen": 1275000,
"rate": "10"
},
{
"description": "業務用ミネラルウォーター 2L×6本入りケース",
"amountYen": 4215615,
"rate": "8"
}
]
}
} {
"jpInvoice": {
"registrationNumber": "T9234567890123",
"simplified": false,
"rounding": "ceil",
"basis": "exclusive",
"transactionDate": "2026-11-30",
"buyerName": "株式会社みちのく総合食品流通ホールディングス 仙台第二物流センター 御中",
"lines": [
{
"description": "宮城県産ササニシキ 精米 30kg袋(特別栽培米・JAS有機認証)",
"amountYen": 46980000,
"rate": "8"
},
{
"description": "業務用冷凍ショーケース(多段式・幅3,600mm)据付工事一式 仙台第二物流センター北棟",
"amountYen": 128450000,
"rate": "10"
},
{
"description": "三陸産冷凍ほたて貝柱 Lサイズ 1kg×10袋入りケース",
"amountYen": 27315750,
"rate": "8"
},
{
"description": "配送用折りたたみコンテナ(大型・蓋付き)リース料 2026年11月分",
"amountYen": 3862500,
"rate": "10"
},
{
"description": "国産若鶏もも肉 正肉 2kg×6パック入りケース",
"amountYen": 18642300,
"rate": "8"
},
{
"description": "コールドチェーン温度管理システム保守料 2026年11月分",
"amountYen": 1275000,
"rate": "10"
},
{
"description": "業務用ミネラルウォーター 2L×6本入りケース",
"amountYen": 4215615,
"rate": "8"
}
]
}
} {
"jpInvoice": {
"registrationNumber": "T9234567890123",
"simplified": false,
"rounding": "half-up",
"basis": "exclusive",
"transactionDate": "2026-11-30",
"buyerName": "株式会社みちのく総合食品流通ホールディングス 仙台第二物流センター 御中",
"lines": [
{
"description": "宮城県産ササニシキ 精米 30kg袋(特別栽培米・JAS有機認証)",
"amountYen": 46980000,
"rate": "8"
},
{
"description": "業務用冷凍ショーケース(多段式・幅3,600mm)据付工事一式 仙台第二物流センター北棟",
"amountYen": 128450000,
"rate": "10"
},
{
"description": "三陸産冷凍ほたて貝柱 Lサイズ 1kg×10袋入りケース",
"amountYen": 27315750,
"rate": "8"
},
{
"description": "配送用折りたたみコンテナ(大型・蓋付き)リース料 2026年11月分",
"amountYen": 3862500,
"rate": "10"
},
{
"description": "国産若鶏もも肉 正肉 2kg×6パック入りケース",
"amountYen": 18642300,
"rate": "8"
},
{
"description": "コールドチェーン温度管理システム保守料 2026年11月分",
"amountYen": 1275000,
"rate": "10"
},
{
"description": "業務用ミネラルウォーター 2L×6本入りケース",
"amountYen": 4215615,
"rate": "8"
}
]
}
} Rendered preview
each arrangement, rendered on its ownarrangement="table" default arrangement="stacked" arrangement="table" default arrangement="stacked" arrangement="table" default arrangement="stacked" Resolved nodes
what a renderer receives — 1 nodesjp-invoice section jp-invoice section jp-invoice section The files
what installing writes; the selected file is the componentnodes/japan-qualified-invoice.node.tsx import { arrange, Section, type Section as SectionComponent, useDeriver, useState } from "docxcelerate/template";
import type { JapanQualifiedInvoiceLines } from "../arrangements/japan-qualified-invoice/lines.ts";
import { stacked } from "../arrangements/japan-qualified-invoice/stacked.arrangement.tsx";
import { table } from "../arrangements/japan-qualified-invoice/table.arrangement.tsx";
import japanQualifiedInvoice from "../derivers/japan-qualified-invoice.deriver.ts";
/**
* The tax part of a Japanese invoice under the qualified invoice system
* (インボイス制度, from 1 October 2023): the lines, the totals per tax rate, the
* tax per rate, the grand total, the registration number and the transaction
* date. The issuer's name is a required item too, but the letterhead prints it.
*
* Tax is worked once per rate per invoice, never per line: the NTA forbids
* summing tax that was rounded line by line. The issuer chooses the rounding,
* and there is no default, because a silent one could be one yen out from the
* issuer's books.
*
* The basis is respected: tax-inclusive prices are taxed at 10/110 and 8/108,
* never at 10% or 8%.
*
* Every reduced-rate line carries ※, and the legend 「※は軽減税率対象」 is
* printed whenever one does, on a simplified invoice too.
*
* The registration number must be valid: T and 13 digits, with its check digit
* verified. A wrong number fails the build instead of printing.
*
* A simplified qualified invoice (適格簡易請求書) only drops the buyer's name.
* It keeps the T-number, the date, the marker, the rate and the tax. The
* caller vouches that the business may issue one.
*
* A seller with no registration number gets a plain 「請求書」: no T-number, no
* 適格 wording, no stated consumption tax. It does carry a note of the share
* of tax the buyer may still deduct under the transitional measure. That share
* comes from a date table, not a constant, because the FY2026 reform replaced
* the old 80% then 50% schedule with 80, 70, 50 and 30.
*
* All of this is decided in one deriver, because it is arithmetic, grouping
* and date work on request data, and a publish build refuses all three. The
* node prints what the deriver returns. It is 18 branches: 10 slots plus
* registration, buyer, standard total, standard tax, reduced total, reduced
* tax, legend and note, against the default `branchLimit` of 32.
*
* Words: Japanese only, with no `defineMessages`. This is statutory wording,
* and a translation would not be a qualified invoice.
*
* Not covered: qualified return invoices (a negative band throws), billing
* periods (one transaction date only), lines that are not taxable at 10% or 8%
* (非課税, 不課税 and 免税 throw), more than 10 lines (throws), whether a
* simplified invoice is allowed for the business, and whether the T-number is
* live on the NTA site. Only its format and check digit are verified.
*
* Arrangement: where the lines sit is a separate choice from what they say.
* This file decides every line; each arrangement, in
* `arrangements/japan-qualified-invoice/`, only places them.
*
* Installed by `dxcl add japan-qualified-invoice`, which also installs its deriver.
*/
/** What this component reads. Add these fields to your document data type. */
export interface JapanQualifiedInvoiceData {
jpInvoice: {
/**
* The seller's qualified invoice issuer registration number (登録番号):
* "T" and 13 digits, e.g. "T9234567890123". Spaces and hyphens are
* ignored and a lower-case "t" is accepted. It is printed normalised.
* The first digit is a check digit, which is verified. A wrong format or
* a wrong check digit throws.
* Missing, empty or blank means the seller is not registered. The
* component then prints 「請求書」 with no T-number and no stated
* consumption tax, plus the transitional-measure note.
*/
registrationNumber?: string;
/**
* True for a simplified qualified invoice (適格簡易請求書). Only retail,
* restaurants, taxis, parking and travel businesses may issue one. The
* caller vouches for that, because the component cannot check it.
* The only effect is that `buyerName` becomes optional. The T-number,
* date, ※ marker, rate and tax are all still printed.
* Missing means false. Throws when true and there is no registration
* number: a simplified invoice without a T-number is not one.
*/
simplified?: boolean;
/**
* How the per-rate tax is rounded to whole yen, applied once per rate on
* this invoice: "floor" (切捨て), "ceil" (切上げ) or "half-up" (四捨五入,
* .5 rounds up).
* Required when registered: missing or anything else throws, because a
* silent default could be ¥1 out from the issuer's books. Ignored when
* not registered.
*/
rounding: "floor" | "ceil" | "half-up";
/**
* Whether `amountYen` is before tax ("exclusive": tax = total × rate/100)
* or includes it ("inclusive": tax = total × 10/110 or 8/108).
* Required when registered: missing or anything else throws. Ignored when
* not registered, where amounts are simply the prices charged.
*/
basis: "exclusive" | "inclusive";
/**
* The transaction date (取引年月日), ISO 8601 "YYYY-MM-DD". Anything after
* the tenth character is ignored. Printed as 「2026年11月30日」. When the
* seller is not registered, it also selects the transitional deduction
* share. Required: throws when missing, not a real calendar date, or
* before 2023-10-01 (the start of the system).
*/
transactionDate: string;
/**
* The buyer's name, printed exactly as given, honorific included:
* "株式会社〇〇 御中", "山田太郎 様". The component never adds one,
* because 御中 and 様 are not interchangeable.
* Required on a full qualified invoice (registered, not simplified):
* missing or blank throws. Otherwise it is printed when given and omitted
* when missing.
*/
buyerName?: string;
/**
* The items, in any order, 1 to 10 of them. They are printed 10% lines
* first, then 8% lines, each group in input order.
* Required: missing, empty, or more than 10 throws.
*/
lines: Array<{
/**
* What was supplied, as printed. A reduced-rate line gets " ※"
* appended. Required: a missing or blank description throws.
*/
description: string;
/**
* The amount in whole yen, on the `basis` above. A negative value is a
* discount line inside its rate band. Throws when it is not a safe
* integer or when its magnitude exceeds 1,000,000,000,000.
*/
amountYen: number;
/**
* "10" for the standard rate, "8" for the reduced rate (food and
* drink, newspapers). Anything else throws, including 非課税 and 不課税
* lines, which are out of scope.
*/
rate: "10" | "8";
}>;
};
}
/** The placements `arrangement` chooses between. The first is the default. */
export type JapanQualifiedInvoiceArrangement = "table" | "stacked";
/** Props for {@linkcode JapanQualifiedInvoice}. */
export interface JapanQualifiedInvoiceProps {
/** Where the lines sit. Missing means "table". */
arrangement?: JapanQualifiedInvoiceArrangement;
}
/** Prints the heading as the Section title, then the invoice lines placed by `arrangement`. */
export const JapanQualifiedInvoice: SectionComponent<JapanQualifiedInvoiceProps> = async ({ arrangement }) => {
const [jpInvoice] = useState((data: JapanQualifiedInvoiceData) => data.jpInvoice);
const inv = await useDeriver(japanQualifiedInvoice, [jpInvoice]);
// shortcut: ten fixed slots because a published loop ignores the derived scope;
// switch to .map() once commit 70cafb6 (registry/india-gst-split) is on main.
const lines: JapanQualifiedInvoiceLines = {
buyer: jpInvoice.buyerName,
date: inv.date,
registration: inv.registration,
amountHeader: inv.amountHeader,
items: inv.items,
standard: inv.standard,
reduced: inv.reduced,
totalLabel: inv.totalLabel,
total: inv.total,
legend: inv.legend,
note: inv.note,
};
return (
<Section id="jp-invoice" title={inv.heading}>
{arrange(arrangement, {
table: () => table(lines),
stacked: () => stacked(lines),
})}
</Section>
);
}; derivers/japan-qualified-invoice.deriver.ts import { deriver } from "docxcelerate/template";
/**
* Decides everything a Japanese qualified invoice has to get right: the
* heading, the checked registration number, the grouping by rate, the tax once
* per rate, the totals and the transitional note. Installed by
* `dxcl add japan-qualified-invoice`.
*
* 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 step
* table, the patterns and the formatters are all declared inside `run`.
*/
export default deriver({
name: "japanQualifiedInvoice",
run: (jpInvoice: unknown) => {
const fail = (message: string): never => {
throw new Error("japanQualifiedInvoice: " + message);
};
// deno-lint-ignore no-explicit-any
const inv = jpInvoice as any;
if (inv === null || typeof inv !== "object") fail("jpInvoice must be an object");
const yen = (n: number) => n.toLocaleString("ja-JP") + "円";
const longDate = new Intl.DateTimeFormat("ja-JP", { dateStyle: "long", timeZone: "UTC" });
const formatDate = (iso: string) => longDate.format(new Date(iso + "T00:00:00Z"));
// Dates.
if (typeof inv.transactionDate !== "string" || !/^\d{4}-\d{2}-\d{2}/.test(inv.transactionDate)) {
fail("jpInvoice.transactionDate must be an ISO 8601 date");
}
const date: string = inv.transactionDate.slice(0, 10);
const parsed = new Date(date + "T00:00:00Z");
if (isNaN(parsed.getTime()) || parsed.toISOString().slice(0, 10) !== date) {
fail("jpInvoice.transactionDate is not a real calendar date");
}
if (date < "2023-10-01") fail("jpInvoice.transactionDate is before 2023-10-01, when the system began");
// Lines.
const rawLines = inv.lines;
if (!Array.isArray(rawLines) || rawLines.length < 1) fail("jpInvoice.lines must have at least one item");
if (rawLines.length > 10) fail("jpInvoice.lines has more than 10 items, the limit of this component");
for (const [i, line] of rawLines.entries()) {
const at = "jpInvoice.lines[" + i + "]";
if (typeof line?.description !== "string" || line.description.trim() === "") {
fail(at + ".description is required");
}
if (!Number.isSafeInteger(line.amountYen) || Math.abs(line.amountYen) > 1e12) {
fail(at + ".amountYen must be a whole number of yen no larger than 1,000,000,000,000");
}
if (line.rate !== "10" && line.rate !== "8") fail(at + '.rate must be "10" or "8"');
}
// Registration.
const rawNumber = typeof inv.registrationNumber === "string" ? inv.registrationNumber.trim() : "";
const registered = rawNumber !== "";
const registration: string | null = registered ? rawNumber.replace(/[\s-]/g, "").toUpperCase() : null;
if (registration !== null) {
if (!/^T\d{13}$/.test(registration)) fail("jpInvoice.registrationNumber must be T and 13 digits");
const digits = registration.slice(2).split("").reverse().map(Number);
const sum = digits.reduce((acc, d, i) => acc + d * (i % 2 === 0 ? 1 : 2), 0);
if (Number(registration[1]) !== 9 - (sum % 9)) fail("jpInvoice.registrationNumber check digit is wrong");
}
// Kind.
const simplified = inv.simplified === true;
if (!registered && simplified) fail("jpInvoice.simplified needs a registrationNumber");
if (registered && !simplified && (typeof inv.buyerName !== "string" || inv.buyerName.trim() === "")) {
fail("jpInvoice.buyerName is required on a qualified invoice");
}
if (registered) {
if (!["floor", "ceil", "half-up"].includes(inv.rounding)) {
fail('jpInvoice.rounding must be "floor", "ceil" or "half-up"');
}
if (!["exclusive", "inclusive"].includes(inv.basis)) {
fail('jpInvoice.basis must be "exclusive" or "inclusive"');
}
}
const inclusive = registered && inv.basis === "inclusive";
// Group: 10% first, then 8%, each in input order.
// deno-lint-ignore no-explicit-any
const band = (rate: string) => rawLines.filter((l: any) => l.rate === rate);
const standardLines = band("10");
const reducedLines = band("8");
const items = [
// deno-lint-ignore no-explicit-any
...standardLines.map((l: any) => ({ description: l.description.trim(), amount: yen(l.amountYen) })),
// deno-lint-ignore no-explicit-any
...reducedLines.map((l: any) => ({ description: l.description.trim() + " ※", amount: yen(l.amountYen) })),
];
while (items.length < 10) items.push({ description: "", amount: "" });
// Tax once per band, in integers, never per line.
// deno-lint-ignore no-explicit-any
const sum = (ls: any[]) => ls.reduce((acc: number, l: any) => acc + l.amountYen, 0);
const taxOf = (total: number, r: number): number => {
const n = total * r;
const d = inclusive ? 100 + r : 100;
const rem = n % d;
const q = (n - rem) / d;
if (inv.rounding === "floor") return q;
if (inv.rounding === "ceil") return q + (rem > 0 ? 1 : 0);
return q + (2 * rem >= d ? 1 : 0);
};
const summarise = (ls: unknown[], r: number) => {
const total = ls.length === 0 ? null : sum(ls);
if (total !== null && total < 0) {
fail(r + "% lines total below zero: a return needs a 適格返還請求書, which this component does not produce");
}
const tax = total === null || !registered ? null : taxOf(total, r);
const basisLabel = !registered ? "" : inclusive ? "(税込)" : "(税抜)";
return {
total,
tax,
out: {
label: r + "%対象" + basisLabel,
total: total === null ? null : yen(total),
taxLabel: (inclusive ? "内消費税(" : "消費税(") + r + "%)",
tax: tax === null ? null : yen(tax),
},
};
};
const standard = summarise(standardLines, 10);
const reduced = summarise(reducedLines, 8);
const bands = [standard, reduced];
const net = (standard.total ?? 0) + (reduced.total ?? 0);
const grand = registered && !inclusive ? net + (standard.tax ?? 0) + (reduced.tax ?? 0) : net;
// Transitional deduction share, from the date, for a seller not registered.
const steps = [
{ to: "2026-09-30", share: 80, cap: "10億円" },
{ to: "2028-09-30", share: 70, cap: "1億円" },
{ to: "2030-09-30", share: 50, cap: "1億円" },
{ to: "2031-09-30", share: 30, cap: "1億円" },
];
const step = registered ? undefined : steps.find((s) => s.to >= date);
const note = step
? "経過措置により、買手は本取引の仕入税額相当額の" + step.share + "%を控除できます(" + formatDate(step.to) +
"までの取引。同一の売手からの課税仕入れが年" + step.cap + "を超える部分は対象外)。"
: null;
return {
heading: !registered ? "請求書" : simplified ? "適格簡易請求書" : "適格請求書",
registration,
date: formatDate(date),
amountHeader: !registered ? "金額" : inclusive ? "金額(税込)" : "金額(税抜)",
items,
standard: bands[0].out,
reduced: bands[1].out,
totalLabel: registered ? "合計(税込)" : "合計",
total: yen(grand),
legend: reducedLines.length > 0 ? "※は軽減税率対象" : null,
note,
};
},
}); arrangements/japan-qualified-invoice/lines.ts /**
* What the Japanese qualified invoice hands each of its arrangements: the
* deriver's output, already final text, plus the buyer. An arrangement places
* these and decides nothing, so both print the same lines under the same
* conditions.
*
* A `null` field is a line this invoice does not carry. Test it in the JSX,
* `{lines.standard.tax && …}`, so the test is compiled into a condition the
* engine settles per document.
*
* Installed by `dxcl add japan-qualified-invoice`, with the arrangements.
*/
export interface JapanQualifiedInvoiceLines {
/** The buyer's name as given, honorific included; missing on some simplified invoices. */
buyer?: string;
/** The transaction date, "2026年11月30日". */
date: string;
/** The normalised T-number, or null when the seller is not registered. */
registration: string | null;
/** The amount column's header: "金額(税抜)", "金額(税込)" or "金額". */
amountHeader: string;
/** Always ten slots; an unused one is `{ description: "", amount: "" }`. */
items: Array<{ description: string; amount: string }>;
/** The 10% band. `total` and `tax` are null when it has no lines or no tax is stated. */
standard: { label: string; total: string | null; taxLabel: string; tax: string | null };
/** The 8% band, the same shape. */
reduced: { label: string; total: string | null; taxLabel: string; tax: string | null };
/** "合計(税込)" or "合計". */
totalLabel: string;
/** The grand total, "251,872,208円". */
total: string;
/** "※は軽減税率対象" when any reduced-rate line is present. */
legend: string | null;
/** The transitional-measure note, for an unregistered seller. */
note: string | null;
} arrangements/japan-qualified-invoice/table.arrangement.tsx import { Cell, Paragraph, Row, Table, type Yield } from "docxcelerate/template";
import type { JapanQualifiedInvoiceLines } from "./lines.ts";
/**
* Items and band totals in one two-column table, amounts lined up on the
* right, so the per-rate totals can be checked by eye. The conventional
* business invoice.
*/
export const table = (lines: JapanQualifiedInvoiceLines): Yield => (
<>
{lines.buyer && <Paragraph id="jp-invoice-buyer">{lines.buyer}</Paragraph>}
<Paragraph id="jp-invoice-date">取引年月日:{lines.date}</Paragraph>
{lines.registration && <Paragraph id="jp-invoice-registration">登録番号:{lines.registration}</Paragraph>}
<Table id="jp-invoice-lines" columns={[{ width: "auto" }, { width: 40, align: "right" }]}>
<Row id="jp-invoice-lines-header" header>
<Cell>品名</Cell>
<Cell>{lines.amountHeader}</Cell>
</Row>
{lines.items[0].description && (
<Row id="jp-invoice-line-1">
<Cell>{lines.items[0].description}</Cell>
<Cell>{lines.items[0].amount}</Cell>
</Row>
)}
{lines.items[1].description && (
<Row id="jp-invoice-line-2">
<Cell>{lines.items[1].description}</Cell>
<Cell>{lines.items[1].amount}</Cell>
</Row>
)}
{lines.items[2].description && (
<Row id="jp-invoice-line-3">
<Cell>{lines.items[2].description}</Cell>
<Cell>{lines.items[2].amount}</Cell>
</Row>
)}
{lines.items[3].description && (
<Row id="jp-invoice-line-4">
<Cell>{lines.items[3].description}</Cell>
<Cell>{lines.items[3].amount}</Cell>
</Row>
)}
{lines.items[4].description && (
<Row id="jp-invoice-line-5">
<Cell>{lines.items[4].description}</Cell>
<Cell>{lines.items[4].amount}</Cell>
</Row>
)}
{lines.items[5].description && (
<Row id="jp-invoice-line-6">
<Cell>{lines.items[5].description}</Cell>
<Cell>{lines.items[5].amount}</Cell>
</Row>
)}
{lines.items[6].description && (
<Row id="jp-invoice-line-7">
<Cell>{lines.items[6].description}</Cell>
<Cell>{lines.items[6].amount}</Cell>
</Row>
)}
{lines.items[7].description && (
<Row id="jp-invoice-line-8">
<Cell>{lines.items[7].description}</Cell>
<Cell>{lines.items[7].amount}</Cell>
</Row>
)}
{lines.items[8].description && (
<Row id="jp-invoice-line-9">
<Cell>{lines.items[8].description}</Cell>
<Cell>{lines.items[8].amount}</Cell>
</Row>
)}
{lines.items[9].description && (
<Row id="jp-invoice-line-10">
<Cell>{lines.items[9].description}</Cell>
<Cell>{lines.items[9].amount}</Cell>
</Row>
)}
{lines.standard.total && (
<Row id="jp-invoice-standard-total">
<Cell>{lines.standard.label}</Cell>
<Cell>{lines.standard.total}</Cell>
</Row>
)}
{lines.standard.tax && (
<Row id="jp-invoice-standard-tax">
<Cell>{lines.standard.taxLabel}</Cell>
<Cell>{lines.standard.tax}</Cell>
</Row>
)}
{lines.reduced.total && (
<Row id="jp-invoice-reduced-total">
<Cell>{lines.reduced.label}</Cell>
<Cell>{lines.reduced.total}</Cell>
</Row>
)}
{lines.reduced.tax && (
<Row id="jp-invoice-reduced-tax">
<Cell>{lines.reduced.taxLabel}</Cell>
<Cell>{lines.reduced.tax}</Cell>
</Row>
)}
<Row id="jp-invoice-total">
<Cell>{lines.totalLabel}</Cell>
<Cell>{lines.total}</Cell>
</Row>
</Table>
{lines.legend && <Paragraph id="jp-invoice-legend">{lines.legend}</Paragraph>}
{lines.note && <Paragraph id="jp-invoice-note">{lines.note}</Paragraph>}
</>
); arrangements/japan-qualified-invoice/stacked.arrangement.tsx import { Paragraph, type Yield } from "docxcelerate/template";
import type { JapanQualifiedInvoiceLines } from "./lines.ts";
/**
* One Paragraph per item, band line and total down the text column. The
* receipt layout simplified invoices from shops and restaurants are usually
* printed in, and it reads at any width.
*/
export const stacked = (lines: JapanQualifiedInvoiceLines): Yield => (
<>
{lines.buyer && <Paragraph id="jp-invoice-buyer">{lines.buyer}</Paragraph>}
<Paragraph id="jp-invoice-date">取引年月日:{lines.date}</Paragraph>
{lines.registration && <Paragraph id="jp-invoice-registration">登録番号:{lines.registration}</Paragraph>}
{lines.items[0].description && (
<Paragraph id="jp-invoice-line-1">
{lines.items[0].description} {lines.items[0].amount}
</Paragraph>
)}
{lines.items[1].description && (
<Paragraph id="jp-invoice-line-2">
{lines.items[1].description} {lines.items[1].amount}
</Paragraph>
)}
{lines.items[2].description && (
<Paragraph id="jp-invoice-line-3">
{lines.items[2].description} {lines.items[2].amount}
</Paragraph>
)}
{lines.items[3].description && (
<Paragraph id="jp-invoice-line-4">
{lines.items[3].description} {lines.items[3].amount}
</Paragraph>
)}
{lines.items[4].description && (
<Paragraph id="jp-invoice-line-5">
{lines.items[4].description} {lines.items[4].amount}
</Paragraph>
)}
{lines.items[5].description && (
<Paragraph id="jp-invoice-line-6">
{lines.items[5].description} {lines.items[5].amount}
</Paragraph>
)}
{lines.items[6].description && (
<Paragraph id="jp-invoice-line-7">
{lines.items[6].description} {lines.items[6].amount}
</Paragraph>
)}
{lines.items[7].description && (
<Paragraph id="jp-invoice-line-8">
{lines.items[7].description} {lines.items[7].amount}
</Paragraph>
)}
{lines.items[8].description && (
<Paragraph id="jp-invoice-line-9">
{lines.items[8].description} {lines.items[8].amount}
</Paragraph>
)}
{lines.items[9].description && (
<Paragraph id="jp-invoice-line-10">
{lines.items[9].description} {lines.items[9].amount}
</Paragraph>
)}
{lines.standard.total && (
<Paragraph id="jp-invoice-standard-total">
{lines.standard.label} {lines.standard.total}
</Paragraph>
)}
{lines.standard.tax && (
<Paragraph id="jp-invoice-standard-tax">
{lines.standard.taxLabel} {lines.standard.tax}
</Paragraph>
)}
{lines.reduced.total && (
<Paragraph id="jp-invoice-reduced-total">
{lines.reduced.label} {lines.reduced.total}
</Paragraph>
)}
{lines.reduced.tax && (
<Paragraph id="jp-invoice-reduced-tax">
{lines.reduced.taxLabel} {lines.reduced.tax}
</Paragraph>
)}
<Paragraph id="jp-invoice-total">
{lines.totalLabel} {lines.total}
</Paragraph>
{lines.legend && <Paragraph id="jp-invoice-legend">{lines.legend}</Paragraph>}
{lines.note && <Paragraph id="jp-invoice-note">{lines.note}</Paragraph>}
</>
);