ztechno_core 0.0.112 → 0.0.113
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -636,6 +636,7 @@ class InvoiceService {
|
|
|
636
636
|
});
|
|
637
637
|
// === COMPANY LOGO (left-aligned) ===
|
|
638
638
|
const logoPath = path_1.default.join(process.cwd(), '../zwebsite/public/img/invoice/invoice-logo.png');
|
|
639
|
+
const certPath = path_1.default.join(process.cwd(), '../zwebsite/public/img/invoice/invoice-certificates.png');
|
|
639
640
|
if (fs_1.default.existsSync(logoPath)) {
|
|
640
641
|
doc.image(logoPath, 50, 50, { width: 150 }); // Left side of A4 page
|
|
641
642
|
}
|
|
@@ -798,28 +799,44 @@ class InvoiceService {
|
|
|
798
799
|
P.bold();
|
|
799
800
|
P.row('Totaal incl. BTW:', 370, this.formatMoney(grandTotal, invoice.currency), col5, 20);
|
|
800
801
|
P.normal();
|
|
801
|
-
// ===
|
|
802
|
+
// === TWO-COLUMN FOOTER: Description & Terms (left) | Bank details (right) ===
|
|
803
|
+
const footerStartY = P.y + 10;
|
|
804
|
+
// LEFT COLUMN: Description + Payment terms
|
|
805
|
+
P.y = footerStartY;
|
|
802
806
|
if (invoice.description) {
|
|
803
807
|
P.size(10).bold();
|
|
804
|
-
P.
|
|
808
|
+
P.text('Omschrijving:', 50, {}, 12);
|
|
805
809
|
P.normal();
|
|
806
|
-
P.text(invoice.description, 50, {}, 12);
|
|
810
|
+
P.text(invoice.description, 50, { width: 260 }, 12);
|
|
811
|
+
P.skip(4);
|
|
807
812
|
}
|
|
808
|
-
// === PAYMENT TERMS (Dutch law recommended) ===
|
|
809
813
|
if (invoice.payment_terms) {
|
|
810
814
|
P.size(10).bold();
|
|
811
|
-
P.
|
|
815
|
+
P.text('Betalingsvoorwaarden:', 50, {}, 12);
|
|
812
816
|
P.normal();
|
|
813
|
-
P.text(invoice.payment_terms, 50, {}, 12);
|
|
817
|
+
P.text(invoice.payment_terms, 50, { width: 260 }, 12);
|
|
814
818
|
}
|
|
815
|
-
|
|
819
|
+
const leftColEndY = P.y;
|
|
820
|
+
// RIGHT COLUMN: Bank details
|
|
821
|
+
P.y = footerStartY;
|
|
822
|
+
const bankCol = 340;
|
|
816
823
|
P.size(10).bold();
|
|
817
|
-
P.
|
|
824
|
+
P.text('Betalingsgegevens:', bankCol, { width: 220 }, 14);
|
|
818
825
|
P.normal();
|
|
819
|
-
P.text(`IBAN: ${cfg.company.iban}`,
|
|
820
|
-
if (cfg.company.bankName) P.text(`Bank: ${cfg.company.bankName}`,
|
|
821
|
-
P.text(`T.n.v.: ${cfg.company.company}`,
|
|
822
|
-
P.text(`O.v.v.: ${invoice.invoice_number}`,
|
|
826
|
+
P.text(`IBAN: ${cfg.company.iban}`, bankCol, { width: 220 });
|
|
827
|
+
if (cfg.company.bankName) P.text(`Bank: ${cfg.company.bankName}`, bankCol, { width: 220 });
|
|
828
|
+
P.text(`T.n.v.: ${cfg.company.company}`, bankCol, { width: 220 });
|
|
829
|
+
P.text(`O.v.v.: ${invoice.invoice_number}`, bankCol, { width: 220 });
|
|
830
|
+
const rightColEndY = P.y;
|
|
831
|
+
P.y = Math.max(leftColEndY, rightColEndY);
|
|
832
|
+
// === CERTIFICATES (bottom of page) ===
|
|
833
|
+
if (fs_1.default.existsSync(certPath)) {
|
|
834
|
+
const certWidth = 180; // scaled from 360x100 original
|
|
835
|
+
const certHeight = certWidth * (100 / 360);
|
|
836
|
+
P.skip(20);
|
|
837
|
+
doc.image(certPath, 50, P.y, { width: certWidth, height: certHeight });
|
|
838
|
+
P.skip(certHeight);
|
|
839
|
+
}
|
|
823
840
|
doc.end();
|
|
824
841
|
return await done;
|
|
825
842
|
}
|