changed 50 sku and page zoomed out

This commit is contained in:
suryac 2026-08-27 17:43:39 +05:30
parent fcfdbc4458
commit 949cad9926
2 changed files with 6 additions and 2 deletions

View File

@ -265,5 +265,5 @@ export const HIDDEN_FORM_FIELDS = [
]; ];
export const SELECT_OPTION_LIMIT = 200; export const SELECT_OPTION_LIMIT = 200;
export const PDF_MAX_SKUS_PER_CHUNK = 20; export const PDF_MAX_SKUS_PER_CHUNK = 50;

View File

@ -48,7 +48,11 @@ export function DailySalesReportPage() {
}, []); }, []);
const generatePdfDoc = () => { const generatePdfDoc = () => {
const doc = new jsPDF('landscape'); const totalSkus = reportData?.response?.headers?.reduce((acc: number, h: any) => acc + (h.skus?.length || 0), 0) || 0;
const maxSkusOnPage = Math.min(totalSkus, PDF_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 pageWidth = doc.internal.pageSize.getWidth();
const centerX = pageWidth / 2; const centerX = pageWidth / 2;
const rightMargin = pageWidth - 14; const rightMargin = pageWidth - 14;