feat: invoice PDF — larger fonts, order number and date in dates column

- Base font 9pt→10pt, all sub-elements scaled proportionally
- Order number and date shown in dates column when invoice linked to order
- Uses customer_order_number with fallback to internal order_number

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
BOHA
2026-04-02 12:55:24 +02:00
parent cd25cd6ee4
commit 8a9239311d

View File

@@ -284,6 +284,7 @@ export default async function invoicesPdfRoutes(
> | null;
let orderNumber = "";
let orderDate = "";
if (invoice.order_id) {
const orderRow = await prisma.orders.findUnique({
where: { id: invoice.order_id },
@@ -299,6 +300,9 @@ export default async function invoicesPdfRoutes(
orderRow.customer_order_number || orderRow.order_number || "",
),
);
if (orderRow.created_at) {
orderDate = formatDate(orderRow.created_at);
}
}
}
@@ -496,7 +500,7 @@ export default async function invoicesPdfRoutes(
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
font-family: "Segoe UI", Tahoma, Arial, sans-serif;
font-size: 9pt;
font-size: 10pt;
color: #1a1a1a;
width: 180mm;
}
@@ -568,7 +572,7 @@ export default async function invoicesPdfRoutes(
background: #f5f5f5;
}
.address-label {
font-size: 7pt;
font-size: 8pt;
font-weight: 700;
color: #de3a3a;
text-transform: uppercase;
@@ -583,7 +587,7 @@ export default async function invoicesPdfRoutes(
margin-bottom: 1mm;
}
.address-line {
font-size: 8pt;
font-size: 9pt;
color: #444;
line-height: 1.5;
}
@@ -593,7 +597,7 @@ export default async function invoicesPdfRoutes(
.info-row {
display: flex;
align-items: baseline;
font-size: 8pt;
font-size: 9pt;
padding: 1mm 0;
border-bottom: 0.5pt solid #f0f0f0;
}
@@ -614,7 +618,7 @@ export default async function invoicesPdfRoutes(
/* VS/KS blok */
.vs-block {
font-size: 8pt;
font-size: 9pt;
line-height: 1.4;
padding-top: 2mm;
}
@@ -623,7 +627,7 @@ export default async function invoicesPdfRoutes(
.billing-label {
font-weight: 700;
color: #1a1a1a;
font-size: 9pt;
font-size: 10pt;
padding: 2mm 0 1mm 0;
border-bottom: 1.5pt solid #de3a3a;
margin-bottom: 0;
@@ -635,11 +639,11 @@ export default async function invoicesPdfRoutes(
width: 100%;
table-layout: fixed;
border-collapse: collapse;
font-size: 8pt;
font-size: 9pt;
margin-bottom: 2mm;
}
table.items thead th {
font-size: 8pt;
font-size: 9pt;
font-weight: 600;
color: #646464;
padding: 6px 8px;
@@ -663,10 +667,10 @@ export default async function invoicesPdfRoutes(
table.items tbody td.row-num {
text-align: center;
color: #969696;
font-size: 8pt;
font-size: 9pt;
}
table.items tbody td.desc {
font-size: 8pt;
font-size: 9pt;
font-weight: 600;
color: #1a1a1a;
}
@@ -688,7 +692,7 @@ export default async function invoicesPdfRoutes(
display: flex;
justify-content: space-between;
align-items: baseline;
font-size: 8.5pt;
font-size: 9.5pt;
color: #1a1a1a;
margin-bottom: 2mm;
}
@@ -700,7 +704,7 @@ export default async function invoicesPdfRoutes(
align-items: baseline;
}
.totals .grand .label {
font-size: 9.5pt;
font-size: 10.5pt;
font-weight: 400;
color: #1a1a1a;
align-self: center;
@@ -714,14 +718,14 @@ export default async function invoicesPdfRoutes(
}
.totals .currency-note {
text-align: right;
font-size: 7.5pt;
font-size: 8pt;
color: #1a1a1a;
margin-top: 2mm;
}
/* Vystavil */
.issued-by {
font-size: 8pt;
font-size: 9pt;
margin: 2mm 0;
line-height: 1.4;
}
@@ -729,7 +733,7 @@ export default async function invoicesPdfRoutes(
/* Upozorneni */
.notice {
font-size: 7pt;
font-size: 8pt;
color: #1a1a1a;
margin: 2mm 0;
line-height: 1.3;
@@ -751,11 +755,11 @@ export default async function invoicesPdfRoutes(
.recap-section table {
border-collapse: collapse;
font-size: 8pt;
font-size: 9pt;
flex: 1;
}
.recap-section table th {
font-size: 7.5pt;
font-size: 8pt;
font-weight: 600;
color: #555;
padding: 3px 6px;
@@ -769,7 +773,7 @@ export default async function invoicesPdfRoutes(
}
.recap-section table td.center { text-align: center; }
.recap-section table td.cnb-rate {
font-size: 7pt;
font-size: 8pt;
color: #888;
text-align: right;
border-bottom: none;
@@ -781,7 +785,7 @@ export default async function invoicesPdfRoutes(
display: flex;
justify-content: space-between;
margin-top: 4mm;
font-size: 8pt;
font-size: 9pt;
border-top: 0.5pt solid #aaa;
padding-top: 2mm;
min-height: 15mm;
@@ -794,13 +798,13 @@ export default async function invoicesPdfRoutes(
/* Poznamky */
.invoice-notes {
margin-top: 4mm;
font-size: 9pt;
font-size: 10pt;
line-height: 1.5;
color: #1a1a1a;
}
.invoice-notes-label {
font-weight: 600;
font-size: 8pt;
font-size: 9pt;
text-transform: uppercase;
color: #555;
margin-bottom: 1mm;
@@ -889,8 +893,7 @@ ${indentCSS}
<div class="info-row"><span class="lbl">${escapeHtml(t.account_no)}</span> <span class="val">${escapeHtml(invoice.bank_account)}</span></div>
<div class="vs-block">
${escapeHtml(t.var_symbol)} <strong>${invoiceNumber}</strong>
&nbsp;&nbsp;&nbsp; ${escapeHtml(t.const_symbol)} <strong>${escapeHtml(invoice.constant_symbol)}</strong><br>
${orderNumber ? `${escapeHtml(t.order_no)} ${orderNumber}` : ""}
&nbsp;&nbsp;&nbsp; ${escapeHtml(t.const_symbol)} <strong>${escapeHtml(invoice.constant_symbol)}</strong>
</div>
</td>
<td>
@@ -898,6 +901,8 @@ ${indentCSS}
<div class="info-row"><span class="lbl">${escapeHtml(t.due_date)}</span> <span class="val">${escapeHtml(formatDate(invoice.due_date))}</span></div>
<div class="info-row"><span class="lbl">${escapeHtml(t.tax_date)}</span> <span class="val">${escapeHtml(formatDate(invoice.tax_date))}</span></div>
<div class="info-row"><span class="lbl">${escapeHtml(t.payment_method)}</span> <span class="val">${escapeHtml(invoice.payment_method)}</span></div>
${orderNumber ? `<div class="info-row"><span class="lbl">${lang === "cs" ? "Objednávka č.:" : "Order no.:"}</span> <span class="val">${orderNumber}</span></div>` : ""}
${orderDate ? `<div class="info-row"><span class="lbl">${lang === "cs" ? "Objednávka ze dne:" : "Order date:"}</span> <span class="val">${escapeHtml(orderDate)}</span></div>` : ""}
</td>
</tr>
</table>