Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
51e0182399 |
+20
-15
@@ -539,29 +539,28 @@ const renderInvoicePdf = async (document, invoice) => {
|
|||||||
|
|
||||||
const tableTop = document.y + 12;
|
const tableTop = document.y + 12;
|
||||||
const columns = [0, pageWidth * 0.52, pageWidth * 0.68, pageWidth * 0.82, pageWidth];
|
const columns = [0, pageWidth * 0.52, pageWidth * 0.68, pageWidth * 0.82, pageWidth];
|
||||||
const headerRowHeight = 25;
|
const rowHeight = 25;
|
||||||
const itemRowHeight = 22.5;
|
document.rect(document.page.margins.left, tableTop, pageWidth, rowHeight).fill('#eef1f3');
|
||||||
document.rect(document.page.margins.left, tableTop, pageWidth, headerRowHeight).fill('#eef1f3');
|
|
||||||
document.fillColor(navy).font(boldFont).fontSize(9);
|
document.fillColor(navy).font(boldFont).fontSize(9);
|
||||||
['Položka', 'Množství', 'MJ', 'Cena za MJ'].forEach((heading, index) => {
|
['Položka', 'Množství', 'MJ', 'Cena za MJ'].forEach((heading, index) => {
|
||||||
document.text(heading, document.page.margins.left + columns[index] + 6, tableTop + 8, {
|
document.text(heading, document.page.margins.left + columns[index] + 6, tableTop + 8, {
|
||||||
width: columns[index + 1] - columns[index] - 12
|
width: columns[index + 1] - columns[index] - 12
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
document.y = tableTop + headerRowHeight;
|
document.y = tableTop + rowHeight;
|
||||||
(data.items || []).forEach((item, index) => {
|
(data.items || []).forEach((item, index) => {
|
||||||
const rowTop = document.y;
|
const rowTop = document.y;
|
||||||
document.rect(document.page.margins.left, rowTop, pageWidth, itemRowHeight)
|
document.rect(document.page.margins.left, rowTop, pageWidth, rowHeight)
|
||||||
.fill(index % 2 ? lightBlue : warm);
|
.fill(index % 2 ? lightBlue : warm);
|
||||||
document.moveTo(document.page.margins.left, rowTop + itemRowHeight)
|
document.moveTo(document.page.margins.left, rowTop + rowHeight)
|
||||||
.lineTo(document.page.margins.left + pageWidth, rowTop + itemRowHeight)
|
.lineTo(document.page.margins.left + pageWidth, rowTop + rowHeight)
|
||||||
.strokeColor(line).lineWidth(0.7).stroke();
|
.strokeColor(line).lineWidth(0.7).stroke();
|
||||||
document.fillColor(bodyText).font(regularFont).fontSize(9);
|
document.fillColor(bodyText).font(regularFont).fontSize(9);
|
||||||
[pdfText(item.popis), formatCzechNumber(item.mnozstvi), pdfText(item.mernaJednotka), `${formatCzechNumber(item.cenaZaMj)} Kč`]
|
[pdfText(item.popis), formatCzechNumber(item.mnozstvi), pdfText(item.mernaJednotka), `${formatCzechNumber(item.cenaZaMj)} Kč`]
|
||||||
.forEach((value, columnIndex) => document.text(value, document.page.margins.left + columns[columnIndex] + 6, rowTop + 6, {
|
.forEach((value, columnIndex) => document.text(value, document.page.margins.left + columns[columnIndex] + 6, rowTop + 8, {
|
||||||
width: columns[columnIndex + 1] - columns[columnIndex] - 12
|
width: columns[columnIndex + 1] - columns[columnIndex] - 12
|
||||||
}));
|
}));
|
||||||
document.y = rowTop + itemRowHeight;
|
document.y = rowTop + rowHeight;
|
||||||
});
|
});
|
||||||
|
|
||||||
document.y += 18;
|
document.y += 18;
|
||||||
@@ -573,16 +572,22 @@ const renderInvoicePdf = async (document, invoice) => {
|
|||||||
document.y += 35;
|
document.y += 35;
|
||||||
document.moveTo(document.page.margins.left, document.y).lineTo(document.page.margins.left + pageWidth, document.y)
|
document.moveTo(document.page.margins.left, document.y).lineTo(document.page.margins.left + pageWidth, document.y)
|
||||||
.strokeColor(navy).lineWidth(1.5).stroke();
|
.strokeColor(navy).lineWidth(1.5).stroke();
|
||||||
document.y += 12;
|
const paymentCardHeight = 105;
|
||||||
const paymentTop = document.y;
|
const paymentTop = document.page.height - document.page.margins.bottom - paymentCardHeight;
|
||||||
document.roundedRect(document.page.margins.left, paymentTop, pageWidth, 165, 4).fillAndStroke('#f4f7fb', line);
|
const paymentLineHeight = 18;
|
||||||
|
const qrSize = paymentLineHeight * 3;
|
||||||
|
document.roundedRect(document.page.margins.left, paymentTop, pageWidth, paymentCardHeight, 4)
|
||||||
|
.fillAndStroke('#f4f7fb', line);
|
||||||
document.fillColor(navy).font(boldFont).fontSize(11).text('Platební údaje', document.page.margins.left + 10, paymentTop + 10);
|
document.fillColor(navy).font(boldFont).fontSize(11).text('Platební údaje', document.page.margins.left + 10, paymentTop + 10);
|
||||||
document.fillColor(bodyText).font(regularFont).fontSize(10)
|
document.fillColor(bodyText).font(regularFont).fontSize(10)
|
||||||
.text(`Číslo účtu: ${pdfText(payment.cisloUctu)}`, document.page.margins.left + 10, paymentTop + 35)
|
.text(`Číslo účtu: ${pdfText(payment.cisloUctu)}`, document.page.margins.left + 10, paymentTop + 35)
|
||||||
.text(`IBAN: ${pdfText(payment.iban)}`, document.page.margins.left + 10, paymentTop + 55)
|
.text(`IBAN: ${pdfText(payment.iban)}`, document.page.margins.left + 10, paymentTop + 35 + paymentLineHeight)
|
||||||
.text(`SWIFT: ${pdfText(payment.swift)}`, document.page.margins.left + 10, paymentTop + 75);
|
.text(`SWIFT: ${pdfText(payment.swift)}`, document.page.margins.left + 10, paymentTop + 35 + paymentLineHeight * 2);
|
||||||
if (qrBuffer) {
|
if (qrBuffer) {
|
||||||
document.image(qrBuffer, document.page.margins.left + pageWidth - 155, paymentTop + 10, { width: 145, height: 145 });
|
document.image(qrBuffer, document.page.margins.left + pageWidth - qrSize - 10, paymentTop + 30, {
|
||||||
|
width: qrSize,
|
||||||
|
height: qrSize
|
||||||
|
});
|
||||||
}
|
}
|
||||||
document.end();
|
document.end();
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user