dsr name changed and made it to landscape
This commit is contained in:
parent
fdfa5e386b
commit
dd06df1fb1
@ -5,7 +5,7 @@
|
|||||||
// docs under src/docs/api.
|
// docs under src/docs/api.
|
||||||
|
|
||||||
export const APP_ID = '434';
|
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) ---
|
// --- Order Booking (src/docs/api/order_booking.md) ---
|
||||||
export const ORDER_BOOKING = {
|
export const ORDER_BOOKING = {
|
||||||
|
|||||||
@ -22,38 +22,43 @@ export function DailySalesReportPage() {
|
|||||||
const [reportData, setReportData] = useState<any>(null);
|
const [reportData, setReportData] = useState<any>(null);
|
||||||
|
|
||||||
const downloadPDF = () => {
|
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
|
// Headers
|
||||||
doc.setFontSize(16);
|
doc.setFontSize(16);
|
||||||
doc.setFont('helvetica', 'bold');
|
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.setFontSize(11);
|
||||||
doc.setFont('helvetica', 'normal');
|
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.setFontSize(12);
|
||||||
doc.setFont('helvetica', 'bold');
|
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
|
// Simple underline for DAILY ORDER REPORT
|
||||||
const textWidth = doc.getTextWidth('DAILY ORDER REPORT');
|
const textWidth = doc.getTextWidth('DAILY ORDER REPORT');
|
||||||
doc.setLineWidth(0.5);
|
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
|
// Meta Info
|
||||||
doc.setFontSize(10);
|
doc.setFontSize(10);
|
||||||
doc.text(`Distributor Name : ${distributor}`, 14, 40);
|
doc.text(`Distributor Name : ${distributor}`, 14, 40);
|
||||||
doc.text(`Date : ${date}`, 196, 40, { align: 'right' });
|
doc.text(`Date : ${date}`, rightMargin, 40, { align: 'right' });
|
||||||
doc.text(`SO Name : ${soName}`, 196, 45, { align: 'right' });
|
doc.text(`SO Name : ${soName}`, rightMargin, 45, { align: 'right' });
|
||||||
|
|
||||||
// Table
|
// Table
|
||||||
autoTable(doc, {
|
autoTable(doc, {
|
||||||
html: '#report-table',
|
html: '#report-table',
|
||||||
startY: 50,
|
startY: 50,
|
||||||
theme: 'grid',
|
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' },
|
headStyles: { fillColor: [243, 244, 246], fontStyle: 'bold', halign: 'center' },
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -61,38 +66,43 @@ export function DailySalesReportPage() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const printReport = async () => {
|
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
|
// Headers
|
||||||
doc.setFontSize(16);
|
doc.setFontSize(16);
|
||||||
doc.setFont('helvetica', 'bold');
|
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.setFontSize(11);
|
||||||
doc.setFont('helvetica', 'normal');
|
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.setFontSize(12);
|
||||||
doc.setFont('helvetica', 'bold');
|
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
|
// Simple underline for DAILY ORDER REPORT
|
||||||
const textWidth = doc.getTextWidth('DAILY ORDER REPORT');
|
const textWidth = doc.getTextWidth('DAILY ORDER REPORT');
|
||||||
doc.setLineWidth(0.5);
|
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
|
// Meta Info
|
||||||
doc.setFontSize(10);
|
doc.setFontSize(10);
|
||||||
doc.text(`Distributor Name : ${distributor}`, 14, 40);
|
doc.text(`Distributor Name : ${distributor}`, 14, 40);
|
||||||
doc.text(`Date : ${date}`, 196, 40, { align: 'right' });
|
doc.text(`Date : ${date}`, rightMargin, 40, { align: 'right' });
|
||||||
doc.text(`SO Name : ${soName}`, 196, 45, { align: 'right' });
|
doc.text(`SO Name : ${soName}`, rightMargin, 45, { align: 'right' });
|
||||||
|
|
||||||
// Table
|
// Table
|
||||||
autoTable(doc, {
|
autoTable(doc, {
|
||||||
html: '#report-table',
|
html: '#report-table',
|
||||||
startY: 50,
|
startY: 50,
|
||||||
theme: 'grid',
|
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' },
|
headStyles: { fillColor: [243, 244, 246], fontStyle: 'bold', halign: 'center' },
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -194,6 +204,12 @@ export function DailySalesReportPage() {
|
|||||||
<div className="p-4 pb-2 print:hidden">
|
<div className="p-4 pb-2 print:hidden">
|
||||||
<h2 className="text-lg font-bold text-strong m-0">Report Details</h2>
|
<h2 className="text-lg font-bold text-strong m-0">Report Details</h2>
|
||||||
</div>
|
</div>
|
||||||
|
{(!reportData.response.rows || reportData.response.rows.length === 0) ? (
|
||||||
|
<div className="p-8 text-center text-slate-500 font-medium bg-slate-50/50 rounded-xl m-4">
|
||||||
|
No records found for the selected criteria.
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
<div className="w-full overflow-x-auto p-4 pt-2">
|
<div className="w-full overflow-x-auto p-4 pt-2">
|
||||||
<div className="min-w-max">
|
<div className="min-w-max">
|
||||||
<div className="flex flex-col items-center text-center gap-1">
|
<div className="flex flex-col items-center text-center gap-1">
|
||||||
@ -257,9 +273,6 @@ export function DailySalesReportPage() {
|
|||||||
)}
|
)}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
{(!reportData.response.rows || reportData.response.rows.length === 0) && (
|
|
||||||
<div className="py-8 text-center text-faint">No records found.</div>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="p-4 pt-4 pb-6 flex flex-col gap-4 print:hidden">
|
<div className="p-4 pt-4 pb-6 flex flex-col gap-4 print:hidden">
|
||||||
@ -270,6 +283,8 @@ export function DailySalesReportPage() {
|
|||||||
Print PDF
|
Print PDF
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</Card>
|
</Card>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -37,7 +37,7 @@ export const SCREENS: ScreenDef[] = [
|
|||||||
{ key: 'stores', label: 'Stores', icon: Store, View: StoresView, Detail: StoreDetail, noun: 'Store' },
|
{ 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: '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: '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 {
|
export function screenByKey(key: string | undefined): ScreenDef | undefined {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user