Fix #330 Missed android functionality
This commit is contained in:
parent
02843b1990
commit
1ed7ec2bbb
|
|
@ -2,6 +2,7 @@ import { blobToBase64,encryptObject, pdfDiv } from "../../../../Services/Others"
|
||||||
import { PrintStyleFunction } from "../../../paymentpdfPage/PrintStyleFunction";
|
import { PrintStyleFunction } from "../../../paymentpdfPage/PrintStyleFunction";
|
||||||
import { Emailsend } from "../../../../Features/PurchaseOrder/PurchaseOrder";
|
import { Emailsend } from "../../../../Features/PurchaseOrder/PurchaseOrder";
|
||||||
import { PublicQrCodepost } from "../../../../Features/ConfigMasterPage/ConfigMasterPage";
|
import { PublicQrCodepost } from "../../../../Features/ConfigMasterPage/ConfigMasterPage";
|
||||||
|
import { downloadFile } from "../../../../utils/downloadFile";
|
||||||
const MainHomeUrl = import.meta.env.ENV_MAIN_BASE_URL;
|
const MainHomeUrl = import.meta.env.ENV_MAIN_BASE_URL;
|
||||||
export const MobilePdfPrint = async ({
|
export const MobilePdfPrint = async ({
|
||||||
printerTemplateStyle = 'Style 13',
|
printerTemplateStyle = 'Style 13',
|
||||||
|
|
@ -111,14 +112,26 @@ export const MobilePdfPrint = async ({
|
||||||
|
|
||||||
if (PrintComing === 'download') {
|
if (PrintComing === 'download') {
|
||||||
// 📥 Download PDF
|
// 📥 Download PDF
|
||||||
const link = document.createElement('a');
|
// const link = document.createElement('a');
|
||||||
link.href = URL.createObjectURL(pdfBlob);
|
// link.href = URL.createObjectURL(pdfBlob);
|
||||||
link.download = `Receipt_${new Date().getTime()}.pdf`;
|
// link.download = `Receipt_${new Date().getTime()}.pdf`;
|
||||||
document.body.appendChild(link);
|
// document.body.appendChild(link);
|
||||||
link.click();
|
// link.click();
|
||||||
document.body.removeChild(link);
|
// document.body.removeChild(link);
|
||||||
URL.revokeObjectURL(link.href);
|
// URL.revokeObjectURL(link.href);
|
||||||
|
const buffer = await pdfBlob.arrayBuffer();
|
||||||
|
|
||||||
|
downloadFile(
|
||||||
|
buffer,
|
||||||
|
`Receipt_${new Date().getTime()}.pdf`,
|
||||||
|
"application/pdf",
|
||||||
|
(success) => {
|
||||||
|
if (!success) {
|
||||||
|
|
||||||
|
console.error('Failed to download the file. Please try again.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
// Clear printed orders
|
// Clear printed orders
|
||||||
setPrintOrderDetails([]);
|
setPrintOrderDetails([]);
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ import { useSelector } from 'react-redux';
|
||||||
import excelExport from '../../../Images/xls-export.png';
|
import excelExport from '../../../Images/xls-export.png';
|
||||||
import ExcelJS from 'exceljs';
|
import ExcelJS from 'exceljs';
|
||||||
import { saveAs } from 'file-saver';
|
import { saveAs } from 'file-saver';
|
||||||
|
import { downloadFile } from '../../../utils/downloadFile.js';
|
||||||
|
|
||||||
dayjs.extend(customParseFormat);
|
dayjs.extend(customParseFormat);
|
||||||
|
|
||||||
|
|
@ -620,8 +621,19 @@ const LedgerReport = () => {
|
||||||
hours = String(hours).padStart(2, '0');
|
hours = String(hours).padStart(2, '0');
|
||||||
|
|
||||||
const fileName = `Ledger Report_${day}-${month}-${year}_${hours}-${minutes}-${ampm}.xlsx`;
|
const fileName = `Ledger Report_${day}-${month}-${year}_${hours}-${minutes}-${ampm}.xlsx`;
|
||||||
|
downloadFile(
|
||||||
saveAs(blob, fileName);
|
buffer,
|
||||||
|
fileName,
|
||||||
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||||
|
(success) => {
|
||||||
|
if (success) {
|
||||||
|
console.log("File downloaded and opened successfully!");
|
||||||
|
} else {
|
||||||
|
console.log("Failed to download/open file.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
// saveAs(blob, fileName);
|
||||||
};
|
};
|
||||||
|
|
||||||
const FirstOrderLedgerDateRaw = dayjs(FirstOrderLedgerDate);
|
const FirstOrderLedgerDateRaw = dayjs(FirstOrderLedgerDate);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue