diff --git a/src/api/config.ts b/src/api/config.ts index 377180f..d3689a0 100644 --- a/src/api/config.ts +++ b/src/api/config.ts @@ -272,4 +272,4 @@ export const HIDDEN_FORM_FIELDS = [ ]; export const LOOKUP_RECORD_LIMIT = 200; -export const MAX_SKUS_PER_CHUNK = 20; +export const MAX_SKUS_PER_CHUNK = 50; diff --git a/src/screens/DailySalesReportPage.tsx b/src/screens/DailySalesReportPage.tsx index 6459021..30bc711 100644 --- a/src/screens/DailySalesReportPage.tsx +++ b/src/screens/DailySalesReportPage.tsx @@ -47,7 +47,11 @@ export function DailySalesReportPage() { }, []); const generatePdfDoc = () => { - const doc = new jsPDF({ orientation: 'landscape' }); + const totalSkus = reportData?.response?.headers?.reduce((acc: number, h: any) => acc + (h.skus?.length || 0), 0) || 0; + const maxSkusOnPage = Math.min(totalSkus, MAX_SKUS_PER_CHUNK); + const requiredWidth = Math.max(297, (maxSkusOnPage + 3) * 12 + 40); + + const doc = new jsPDF({ orientation: 'landscape', format: [requiredWidth, 210] }); const pageWidth = doc.internal.pageSize.getWidth(); const centerX = pageWidth / 2; const rightMargin = pageWidth - 14;