dsr table modified

This commit is contained in:
suryac 2026-08-10 13:08:35 +05:30
parent 57bf600667
commit e528f63236

View File

@ -83,6 +83,9 @@ export function DailySalesReportPage() {
theme: 'grid', theme: 'grid',
styles: { fontSize: 8, textColor: [0, 0, 0], lineColor: [0, 0, 0], lineWidth: 0.2 }, styles: { fontSize: 8, textColor: [0, 0, 0], lineColor: [0, 0, 0], lineWidth: 0.2 },
headStyles: { fillColor: [243, 244, 246], fontStyle: 'bold', halign: 'center' }, headStyles: { fillColor: [243, 244, 246], fontStyle: 'bold', halign: 'center' },
columnStyles: {
0: { cellWidth: 12 }
},
}); });
doc.save(`Daily_Sales_Report_${date || 'Draft'}.pdf`); doc.save(`Daily_Sales_Report_${date || 'Draft'}.pdf`);
@ -126,6 +129,9 @@ export function DailySalesReportPage() {
theme: 'grid', theme: 'grid',
styles: { fontSize: 8, textColor: [0, 0, 0], lineColor: [0, 0, 0], lineWidth: 0.2 }, styles: { fontSize: 8, textColor: [0, 0, 0], lineColor: [0, 0, 0], lineWidth: 0.2 },
headStyles: { fillColor: [243, 244, 246], fontStyle: 'bold', halign: 'center' }, headStyles: { fillColor: [243, 244, 246], fontStyle: 'bold', halign: 'center' },
columnStyles: {
0: { cellWidth: 12 }
},
}); });
const blob = doc.output('blob'); const blob = doc.output('blob');
@ -245,7 +251,7 @@ export function DailySalesReportPage() {
<table id="report-table" className="w-full text-sm text-left border border-black border-collapse mt-2"> <table id="report-table" className="w-full text-sm text-left border border-black border-collapse mt-2">
<thead> <thead>
<tr className="border-b border-black bg-black/5"> <tr className="border-b border-black bg-black/5">
<th className="py-2 px-3 font-bold text-black align-bottom border-r border-black" rowSpan={2}>Sl No</th> <th className="py-2 px-3 font-bold text-black align-bottom border-r border-black whitespace-nowrap" rowSpan={2}>Sl No</th>
<th className="py-2 px-3 font-bold text-black align-bottom" rowSpan={2}>Store</th> <th className="py-2 px-3 font-bold text-black align-bottom" rowSpan={2}>Store</th>
{reportData.response.headers?.map((h: any) => ( {reportData.response.headers?.map((h: any) => (
<th key={h.br_code} colSpan={h.skus?.length || 1} className="py-1 px-3 font-bold text-black text-center border-l border-black"> <th key={h.br_code} colSpan={h.skus?.length || 1} className="py-1 px-3 font-bold text-black text-center border-l border-black">
@ -265,26 +271,26 @@ export function DailySalesReportPage() {
<tbody> <tbody>
{reportData.response.rows?.map((row: any) => ( {reportData.response.rows?.map((row: any) => (
<tr key={row.sl_no} className="border-b border-black hover:bg-black/5 transition-colors"> <tr key={row.sl_no} className="border-b border-black hover:bg-black/5 transition-colors">
<td className="py-2 px-3 text-strong border-r border-black">{row.sl_no}</td> <td className="py-2 px-3 text-strong border-r border-black whitespace-nowrap">{row.sl_no}</td>
<td className="py-2 px-3 text-strong whitespace-nowrap">{row.store}</td> <td className="py-2 px-3 text-strong whitespace-nowrap">{row.store}</td>
{reportData.response.headers?.flatMap((h: any) => h.skus || []).map((sku: string, idx: number) => ( {reportData.response.headers?.flatMap((h: any) => h.skus || []).map((sku: string, idx: number) => (
<td key={`${sku}-${idx}`} className="py-2 px-3 text-strong text-center border-l border-black"> <td key={`${sku}-${idx}`} className="py-2 px-3 text-strong text-center border-l border-black">
{row.products?.[sku] ?? 0} {row.products?.[sku] || ''}
</td> </td>
))} ))}
<td className="py-2 px-3 text-strong font-bold text-center border-l border-black bg-black/5">{row.total ?? 0}</td> <td className="py-2 px-3 text-strong font-bold text-center border-l border-black bg-black/5">{row.total || ''}</td>
</tr> </tr>
))} ))}
{reportData.response.total_row && ( {reportData.response.total_row && (
<tr className="border-b border-black bg-black/10 font-bold"> <tr className="border-b border-black bg-black/10 font-bold">
<td className="py-2 px-3 text-strong border-r border-black">{reportData.response.total_row.sl_no}</td> <td className="py-2 px-3 text-strong border-r border-black whitespace-nowrap">{reportData.response.total_row.sl_no}</td>
<td className="py-2 px-3 text-strong whitespace-nowrap text-right">{reportData.response.total_row.store}</td> <td className="py-2 px-3 text-strong whitespace-nowrap text-right">{reportData.response.total_row.store}</td>
{reportData.response.headers?.flatMap((h: any) => h.skus || []).map((sku: string, idx: number) => ( {reportData.response.headers?.flatMap((h: any) => h.skus || []).map((sku: string, idx: number) => (
<td key={`total-${sku}-${idx}`} className="py-2 px-3 text-strong text-center border-l border-black"> <td key={`total-${sku}-${idx}`} className="py-2 px-3 text-strong text-center border-l border-black">
{reportData.response.total_row.products?.[sku] ?? 0} {reportData.response.total_row.products?.[sku] || ''}
</td> </td>
))} ))}
<td className="py-2 px-3 text-strong text-center border-l border-black">{reportData.response.total_row.total ?? 0}</td> <td className="py-2 px-3 text-strong text-center border-l border-black">{reportData.response.total_row.total || ''}</td>
</tr> </tr>
)} )}
</tbody> </tbody>