Merge pull request 'Fix #330 Missed android functionality' (#331) from CapacitorAndroidfoldermove into main

Reviewed-on: Pozomind/pozo-retail-app#331
This commit is contained in:
karthikalakshmi 2026-03-31 18:55:12 +05:30
commit 0d570f6c9e
2 changed files with 35 additions and 10 deletions

View File

@ -2,6 +2,7 @@ import { blobToBase64,encryptObject, pdfDiv } from "../../../../Services/Others"
import { PrintStyleFunction } from "../../../paymentpdfPage/PrintStyleFunction";
import { Emailsend } from "../../../../Features/PurchaseOrder/PurchaseOrder";
import { PublicQrCodepost } from "../../../../Features/ConfigMasterPage/ConfigMasterPage";
import { downloadFile } from "../../../../utils/downloadFile";
const MainHomeUrl = import.meta.env.ENV_MAIN_BASE_URL;
export const MobilePdfPrint = async ({
printerTemplateStyle = 'Style 13',
@ -111,14 +112,26 @@ export const MobilePdfPrint = async ({
if (PrintComing === 'download') {
// 📥 Download PDF
const link = document.createElement('a');
link.href = URL.createObjectURL(pdfBlob);
link.download = `Receipt_${new Date().getTime()}.pdf`;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
URL.revokeObjectURL(link.href);
// const link = document.createElement('a');
// link.href = URL.createObjectURL(pdfBlob);
// link.download = `Receipt_${new Date().getTime()}.pdf`;
// document.body.appendChild(link);
// link.click();
// document.body.removeChild(link);
// 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
setPrintOrderDetails([]);
return;

View File

@ -34,6 +34,7 @@ import { useSelector } from 'react-redux';
import excelExport from '../../../Images/xls-export.png';
import ExcelJS from 'exceljs';
import { saveAs } from 'file-saver';
import { downloadFile } from '../../../utils/downloadFile.js';
dayjs.extend(customParseFormat);
@ -620,8 +621,19 @@ const LedgerReport = () => {
hours = String(hours).padStart(2, '0');
const fileName = `Ledger Report_${day}-${month}-${year}_${hours}-${minutes}-${ampm}.xlsx`;
saveAs(blob, fileName);
downloadFile(
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);