From dd06df1fb1840d1acb24ddb42fa2b2bfd00efd68 Mon Sep 17 00:00:00 2001 From: suryacp23 Date: Tue, 28 Jul 2026 15:26:38 +0530 Subject: [PATCH] dsr name changed and made it to landscape --- src/api/config.ts | 2 +- src/screens/DailySalesReportPage.tsx | 193 +++++++++++++++------------ src/screens/tabs.ts | 2 +- 3 files changed, 106 insertions(+), 91 deletions(-) diff --git a/src/api/config.ts b/src/api/config.ts index d8a2772..71ba692 100644 --- a/src/api/config.ts +++ b/src/api/config.ts @@ -5,7 +5,7 @@ // docs under src/docs/api. export const APP_ID = '434'; -export const BASE_URL = 'https://sandbox.getzino.in'; +export const BASE_URL = 'https://dev.getzino.in'; // --- Order Booking (src/docs/api/order_booking.md) --- export const ORDER_BOOKING = { diff --git a/src/screens/DailySalesReportPage.tsx b/src/screens/DailySalesReportPage.tsx index e675110..b5df370 100644 --- a/src/screens/DailySalesReportPage.tsx +++ b/src/screens/DailySalesReportPage.tsx @@ -22,38 +22,43 @@ export function DailySalesReportPage() { const [reportData, setReportData] = useState(null); const downloadPDF = () => { - const doc = new jsPDF(); + const doc = new jsPDF('landscape'); + const pageWidth = doc.internal.pageSize.getWidth(); + const centerX = pageWidth / 2; + const rightMargin = pageWidth - 14; // Headers doc.setFontSize(16); doc.setFont('helvetica', 'bold'); - doc.text('Krishna Flour Mills (Bangalore) Pvt. Limited', 105, 15, { align: 'center' }); + doc.text('Krishna Flour Mills (Bangalore) Pvt. Limited', centerX, 15, { align: 'center' }); doc.setFontSize(11); doc.setFont('helvetica', 'normal'); - doc.text('19, Platform Road, Bengaluru - 560 020', 105, 22, { align: 'center' }); + doc.text('19, Platform Road, Bengaluru - 560 020', centerX, 22, { align: 'center' }); doc.setFontSize(12); doc.setFont('helvetica', 'bold'); - doc.text('DAILY ORDER REPORT', 105, 30, { align: 'center' }); + doc.text('DAILY ORDER REPORT', centerX, 30, { align: 'center' }); // Simple underline for DAILY ORDER REPORT const textWidth = doc.getTextWidth('DAILY ORDER REPORT'); doc.setLineWidth(0.5); - doc.line(105 - textWidth / 2, 31, 105 + textWidth / 2, 31); + doc.line(centerX - textWidth / 2, 31, centerX + textWidth / 2, 31); // Meta Info doc.setFontSize(10); doc.text(`Distributor Name : ${distributor}`, 14, 40); - doc.text(`Date : ${date}`, 196, 40, { align: 'right' }); - doc.text(`SO Name : ${soName}`, 196, 45, { align: 'right' }); + doc.text(`Date : ${date}`, rightMargin, 40, { align: 'right' }); + doc.text(`SO Name : ${soName}`, rightMargin, 45, { align: 'right' }); // Table autoTable(doc, { html: '#report-table', startY: 50, theme: 'grid', - styles: { fontSize: 8, textColor: [0, 0, 0], lineColor: [0, 0, 0], lineWidth: 0.2 }, + horizontalPageBreak: true, + horizontalPageBreakRepeat: 0, + styles: { fontSize: 6, textColor: [0, 0, 0], lineColor: [0, 0, 0], lineWidth: 0.2, cellPadding: 1, minCellWidth: 10 }, headStyles: { fillColor: [243, 244, 246], fontStyle: 'bold', halign: 'center' }, }); @@ -61,38 +66,43 @@ export function DailySalesReportPage() { }; const printReport = async () => { - const doc = new jsPDF(); + const doc = new jsPDF('landscape'); + const pageWidth = doc.internal.pageSize.getWidth(); + const centerX = pageWidth / 2; + const rightMargin = pageWidth - 14; // Headers doc.setFontSize(16); doc.setFont('helvetica', 'bold'); - doc.text('Krishna Flour Mills (Bangalore) Pvt. Limited', 105, 15, { align: 'center' }); + doc.text('Krishna Flour Mills (Bangalore) Pvt. Limited', centerX, 15, { align: 'center' }); doc.setFontSize(11); doc.setFont('helvetica', 'normal'); - doc.text('19, Platform Road, Bengaluru - 560 020', 105, 22, { align: 'center' }); + doc.text('19, Platform Road, Bengaluru - 560 020', centerX, 22, { align: 'center' }); doc.setFontSize(12); doc.setFont('helvetica', 'bold'); - doc.text('DAILY ORDER REPORT', 105, 30, { align: 'center' }); + doc.text('DAILY ORDER REPORT', centerX, 30, { align: 'center' }); // Simple underline for DAILY ORDER REPORT const textWidth = doc.getTextWidth('DAILY ORDER REPORT'); doc.setLineWidth(0.5); - doc.line(105 - textWidth / 2, 31, 105 + textWidth / 2, 31); + doc.line(centerX - textWidth / 2, 31, centerX + textWidth / 2, 31); // Meta Info doc.setFontSize(10); doc.text(`Distributor Name : ${distributor}`, 14, 40); - doc.text(`Date : ${date}`, 196, 40, { align: 'right' }); - doc.text(`SO Name : ${soName}`, 196, 45, { align: 'right' }); + doc.text(`Date : ${date}`, rightMargin, 40, { align: 'right' }); + doc.text(`SO Name : ${soName}`, rightMargin, 45, { align: 'right' }); // Table autoTable(doc, { html: '#report-table', startY: 50, theme: 'grid', - styles: { fontSize: 8, textColor: [0, 0, 0], lineColor: [0, 0, 0], lineWidth: 0.2 }, + horizontalPageBreak: true, + horizontalPageBreakRepeat: 0, + styles: { fontSize: 6, textColor: [0, 0, 0], lineColor: [0, 0, 0], lineWidth: 0.2, cellPadding: 1, minCellWidth: 10 }, headStyles: { fillColor: [243, 244, 246], fontStyle: 'bold', halign: 'center' }, }); @@ -194,82 +204,87 @@ export function DailySalesReportPage() {

Report Details

-
-
-
-

Krishna Flour Mills (Bangalore) Pvt. Limited

-

19, Platform Road, Bengaluru - 560 020

-

DAILY ORDER REPORT

-
+ {(!reportData.response.rows || reportData.response.rows.length === 0) ? ( +
+ No records found for the selected criteria. +
+ ) : ( + <> +
+
+
+

Krishna Flour Mills (Bangalore) Pvt. Limited

+

19, Platform Road, Bengaluru - 560 020

+

DAILY ORDER REPORT

+
-
-
Distributor Name : {distributor}
-
-
Date : {date}
-
SO Name : {soName}
+
+
Distributor Name : {distributor}
+
+
Date : {date}
+
SO Name : {soName}
+
+
+ + + + + + + {reportData.response.headers?.map((h: any) => ( + + ))} + + + + {reportData.response.headers?.flatMap((h: any) => h.skus || []).map((sku: string, idx: number) => ( + + ))} + + + + {reportData.response.rows?.map((row: any) => ( + + + + {reportData.response.headers?.flatMap((h: any) => h.skus || []).map((sku: string, idx: number) => ( + + ))} + + + ))} + {reportData.response.total_row && ( + + + + {reportData.response.headers?.flatMap((h: any) => h.skus || []).map((sku: string, idx: number) => ( + + ))} + + + )} + +
Sl NoStore + {h.br_code} + Total
+ {sku} +
{row.sl_no}{row.store} + {row.products?.[sku] ?? 0} + {row.total ?? 0}
{reportData.response.total_row.sl_no}{reportData.response.total_row.store} + {reportData.response.total_row.products?.[sku] ?? 0} + {reportData.response.total_row.total ?? 0}
- - - - - - - {reportData.response.headers?.map((h: any) => ( - - ))} - - - - {reportData.response.headers?.flatMap((h: any) => h.skus || []).map((sku: string, idx: number) => ( - - ))} - - - - {reportData.response.rows?.map((row: any) => ( - - - - {reportData.response.headers?.flatMap((h: any) => h.skus || []).map((sku: string, idx: number) => ( - - ))} - - - ))} - {reportData.response.total_row && ( - - - - {reportData.response.headers?.flatMap((h: any) => h.skus || []).map((sku: string, idx: number) => ( - - ))} - - - )} - -
Sl NoStore - {h.br_code} - Total
- {sku} -
{row.sl_no}{row.store} - {row.products?.[sku] ?? 0} - {row.total ?? 0}
{reportData.response.total_row.sl_no}{reportData.response.total_row.store} - {reportData.response.total_row.products?.[sku] ?? 0} - {reportData.response.total_row.total ?? 0}
- {(!reportData.response.rows || reportData.response.rows.length === 0) && ( -
No records found.
- )} -
-
-
- - -
+
+ + +
+ + )} )}
diff --git a/src/screens/tabs.ts b/src/screens/tabs.ts index dbe4d17..b4ed12e 100644 --- a/src/screens/tabs.ts +++ b/src/screens/tabs.ts @@ -37,7 +37,7 @@ export const SCREENS: ScreenDef[] = [ { key: 'stores', label: 'Stores', icon: Store, View: StoresView, Detail: StoreDetail, noun: 'Store' }, { key: 'all-daily', label: 'All Logs', icon: ClipboardList, View: DailyLogsView, Detail: DailyLogDetail, noun: 'Daily Log' }, { key: 'analytics', label: 'Analytics', icon: BarChart2, View: AnalyticsPage as any }, - { key: 'sales-report', label: 'Sales Report', icon: FileText, View: DailySalesReportPage as any } + { key: 'sales-report', label: 'DSR', icon: FileText, View: DailySalesReportPage as any } ]; export function screenByKey(key: string | undefined): ScreenDef | undefined {