From 6196630baae5c5f358344879804e8ab8a719fd0a Mon Sep 17 00:00:00 2001 From: Deepa Date: Fri, 8 Mar 2024 04:11:46 +0000 Subject: [PATCH] Added mcollect receipt key --- .../packages/modules/mCollect/src/EmployeeChallan.js | 4 ++-- .../packages/modules/mCollect/src/utils/index.js | 12 +++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/src/EmployeeChallan.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/src/EmployeeChallan.js index 0570092b1b6..2662ae74304 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/src/EmployeeChallan.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/src/EmployeeChallan.js @@ -99,13 +99,13 @@ const EmployeeChallan = (props) => { const challanDownload = { order: 1, - label: t("PDF_STATIC_LABEL_CONSOLIDATED_RECEIPT_LETTER_HEAD"), + label: t("UC_CHALLAN"), onClick: () => downloadAndPrintChallan(challanno), }; const receiptDownload = { order: 2, - label: t("RECEIPT"), + label: t("Receipt"), onClick: () => downloadAndPrintReciept(challanDetails?.businessService, challanno), }; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/src/utils/index.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/src/utils/index.js index 8ff4ec2e2c7..9e2a37a8924 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/src/utils/index.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/mCollect/src/utils/index.js @@ -101,7 +101,17 @@ export const downloadAndPrintChallan = async (challanNo, mode = "download") => { export const downloadAndPrintReciept = async (bussinessService, consumerCode, mode = "download") => { const tenantId = Digit.ULBService.getCurrentTenantId(); - const response = await Digit.MCollectService.receipt_download(bussinessService, consumerCode, tenantId); + const data = await Digit.PaymentService.getReciept(tenantId, bussinessService,{ consumerCodes: consumerCode }); + const payments=data?.Payments[0]; + let response=null; + if (payments?.fileStoreIdS ) { + response = { filestoreIds: [payments?.fileStoreId] }; + } + else{ + response = await Digit.PaymentService.generatePdf(tenantId, { Payments: [{...payments}] }, "consolidatedreceipt"); + } + const fileStore = await Digit.PaymentService.printReciept(tenantId, { fileStoreIds: response.filestoreIds[0] }); + window.open(fileStore[response?.filestoreIds[0]], "_blank"); const responseStatus = parseInt(response.status, 10); if (responseStatus === 201 || responseStatus === 200) { let fileName =