Perbaikan layout printing js

This commit is contained in:
2026-08-03 21:42:49 +07:00
parent e7775b0eab
commit 73fff183d7
3 changed files with 28 additions and 25 deletions
View File
+27 -24
View File
@@ -232,21 +232,22 @@ function printPDF(data) {
(on.overNight || 0) + (on.onExpired || 0),
]);
doc.setFont("helvetica", "bold");
doc.setFontSize(8);
doc.text("Kendaraan yang masih menginap (Over Night)", 14, doc.lastAutoTable.finalY + 10);
// doc.setFont("helvetica", "bold");
// doc.setFontSize(8);
// doc.text("Kendaraan yang masih menginap (Over Night)", 14, doc.lastAutoTable.finalY + 10);
doc.autoTable({
head: [["Jenis Kend", "Menginap", "ON (Expired)", "Total"]],
body: onBody,
startY: doc.lastAutoTable.finalY + 13,
theme: "grid",
styles: { fontSize: 7, cellPadding: 1 },
headStyles: { fontSize: 8, fillColor: [230, 230, 230], textColor: 0 },
tableWidth: 100,
});
///===================== Print table officer ================================////
// doc.autoTable({
// head: [["Jenis Kend", "Menginap", "ON (Expired)", "Total"]],
// body: onBody,
// startY: doc.lastAutoTable.finalY + 13,
// theme: "grid",
// styles: { fontSize: 7, cellPadding: 1 },
// headStyles: { fontSize: 8, fillColor: [230, 230, 230], textColor: 0 },
// tableWidth: 100,
// });
//==================================================================
//===================== Print table officer ========================
//==================================================================
const officerStartY = doc.lastAutoTable.finalY + 15;
const officerBody = [];
let ptotalTunaiJml = 0,
@@ -402,7 +403,7 @@ function printPDF(data) {
// ===== HEADER 2 BARIS (grouping) =====
const officerHead = [
[
{ content: "Jenis Kend", rowSpan: 2, colSpan: 2 },
{ content: "Nama Petugas", rowSpan: 2, colSpan: 2 },
{ content: "Jenis Transaksi", colSpan: 2 },
{ content: "Casual", colSpan: 2 },
{ content: "Tiket Hilang", colSpan: 2 },
@@ -433,12 +434,12 @@ function printPDF(data) {
// doc.addPage();
doc.setFont("helvetica", "bold");
doc.setFontSize(11);
doc.text("Rekap Transaksi Per Petugas", pageWidth / 2, officerStartY - 5, { align: "center" });
doc.text("Rekap Transaksi Per Petugas", pageWidth / 2, officerStartY - 6, { align: "center" });
doc.setFont("helvetica", "normal");
doc.setFontSize(9);
doc.text("Tanggal : " + (data.vehicle.date ?? "-"), pageWidth / 2, 23, { align: "center" });
doc.text("By : " + (data.vehicle.reportTime ?? "-"), pageWidth - 14, 12, { align: "right" });
doc.text("Tanggal : " + (data.vehicle.date ?? "-"), pageWidth / 2, officerStartY - 2, { align: "center" });
doc.text("By : " + (data.vehicle.reportTime ?? "-"), pageWidth - 14, officerStartY - 2, { align: "right" });
doc.autoTable({
head: officerHead,
@@ -451,7 +452,9 @@ function printPDF(data) {
columnStyles: { 0: { halign: "left" } },
});
///===================== Print table payment ================================////
//====================================
//======== Print table payment =======
//====================================
const paymentStartY = doc.lastAutoTable.finalY + 15;
const paymentBody = [];
let payTotalTunaiJml = 0,
@@ -554,7 +557,7 @@ function printPDF(data) {
{ content: "Tunai", styles: { fillColor: [40, 167, 69], textColor: 255, fontStyle: "bold" } },
"",
"",
{ content: ptotalTunaiJml, styles: { fontStyle: "bold" } },
{ content: payTotalTunaiJml, styles: { fontStyle: "bold" } },
rupiah(payTotalTunaiNilai),
"",
"",
@@ -572,7 +575,7 @@ function printPDF(data) {
{ content: "NON TUNAI", styles: { fillColor: [255, 193, 7], fontStyle: "bold" } },
"",
"",
{ content: ptotalNonTunaiJml, styles: { fontStyle: "bold" } },
{ content: payTotalNonTunaiJml, styles: { fontStyle: "bold" } },
rupiah(payTotalNonTunaiNilai),
"",
"",
@@ -639,12 +642,12 @@ function printPDF(data) {
// doc.addPage();
doc.setFont("helvetica", "bold");
doc.setFontSize(11);
doc.text("Rekap Transaksi Per Pembayaran", pageWidth / 2, paymentStartY - 5, { align: "center" });
doc.text("Rekap Transaksi Per Pembayaran", pageWidth / 2, paymentStartY - 6, { align: "center" });
doc.setFont("helvetica", "normal");
doc.setFontSize(9);
doc.text("Tanggal : " + (data.vehicle.date ?? "-"), pageWidth / 2, 23, { align: "center" });
doc.text("By : " + (data.vehicle.reportTime ?? "-"), pageWidth - 14, 12, { align: "right" });
doc.text("Tanggal : " + (data.vehicle.date ?? "-"), pageWidth / 2, paymentStartY - 2, { align: "center" });
doc.text("By : " + (data.vehicle.reportTime ?? "-"), pageWidth - 14, paymentStartY - 2, { align: "right" });
doc.autoTable({
head: paymentHead,
File diff suppressed because one or more lines are too long