update report

This commit is contained in:
efrilm 2025-11-25 15:45:53 +07:00
parent 8e4ab5dd69
commit f434373eaf

View File

@ -32,7 +32,7 @@ const DailyPOSReport = () => {
tableContent: 12,
tableHeader: 12,
tableFooter: 12,
grandTotal: 16,
grandTotal: 14,
footer: 11
}
@ -162,10 +162,11 @@ const DailyPOSReport = () => {
['Total Pajak', formatCurrency(profitLoss?.summary.total_tax ?? 0)],
['Total', formatCurrency(profitLoss?.summary.total_revenue ?? 0)]
],
theme: 'plain',
theme: 'grid',
styles: {
fontSize: PDF_FONT_SIZES.subheading,
cellPadding: PDF_SPACING.cellPadding
cellPadding: PDF_SPACING.cellPadding,
lineColor: [0, 0, 0]
},
columnStyles: {
0: { fontStyle: 'normal', textColor: [60, 60, 60] },
@ -185,8 +186,9 @@ const DailyPOSReport = () => {
startY: currentY,
head: [],
body: [['Total Invoice', String(profitLoss?.summary.total_orders ?? 0)]],
theme: 'plain',
theme: 'grid',
styles: {
lineColor: [0, 0, 0],
fontSize: PDF_FONT_SIZES.subheading,
cellPadding: PDF_SPACING.cellPadding
},
@ -251,9 +253,19 @@ const DailyPOSReport = () => {
},
columnStyles: {
1: { halign: 'center' },
2: { halign: 'center' },
3: { halign: 'right' },
4: { halign: 'center' }
2: { halign: 'right' },
3: { halign: 'right' }
},
didParseCell: data => {
if (data.section === 'foot') {
if (data.column.index === 0) {
data.cell.styles.halign = 'left' // Kolom pertama: kiri
} else if (data.column.index === 1) {
data.cell.styles.halign = 'center' // Kolom kedua: tengah
} else if (data.column.index === 2) {
data.cell.styles.halign = 'right' // Kolom ketiga: kanan
}
}
},
margin: { left: 14, right: 14 }
})
@ -303,6 +315,17 @@ const DailyPOSReport = () => {
1: { halign: 'center' },
2: { halign: 'right' }
},
didParseCell: data => {
if (data.section === 'foot') {
if (data.column.index === 0) {
data.cell.styles.halign = 'left' // Kolom pertama: kiri
} else if (data.column.index === 1) {
data.cell.styles.halign = 'center' // Kolom kedua: tengah
} else if (data.column.index === 2) {
data.cell.styles.halign = 'right' // Kolom ketiga: kanan
}
}
},
margin: { left: 14, right: 14 }
})
@ -337,7 +360,7 @@ const DailyPOSReport = () => {
const orderB = productsB[0]?.category_order ?? 999
return orderA - orderB
})
.forEach(categoryName => {
.forEach((categoryName, index) => {
const categoryProducts = groupedProducts[categoryName].sort((a, b) => {
// Sort by product_sku ASC
const skuA = a.product_sku || ''
@ -365,7 +388,7 @@ const DailyPOSReport = () => {
pdf.setFontSize(PDF_FONT_SIZES.subheading)
pdf.setFont('helvetica', 'bold')
pdf.setTextColor(54, 23, 94)
pdf.text(categoryName.toUpperCase(), 16, currentY)
pdf.text(`${index + 1}. ${categoryName.toUpperCase()}`, 16, currentY)
currentY += 15
// Category table - DENGAN BORDER HITAM
@ -403,6 +426,17 @@ const DailyPOSReport = () => {
1: { halign: 'center', cellWidth: 40 },
2: { halign: 'right', cellWidth: 52 }
},
didParseCell: data => {
if (data.section === 'foot') {
if (data.column.index === 0) {
data.cell.styles.halign = 'left' // Kolom pertama: kiri
} else if (data.column.index === 1) {
data.cell.styles.halign = 'center' // Kolom kedua: tengah
} else if (data.column.index === 2) {
data.cell.styles.halign = 'right' // Kolom ketiga: kanan
}
}
},
margin: { left: 14, right: 14 }
})