1"use strict";(globalThis.webpackChunkflabs_frontend||=[]).push([[3681],{66673(e,l,t){t.d(l,["k",0,function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const t=Object.fromEntries(l.tests.map(e=>[null==e?void 0:e._id,null==e?void 0:e.name])),n=null==e?void 0:e.tests.filter(e=>{var l,t;return(null==e||null===(l=e.governmentPanelList)||void 0===l?void 0:l._id)&&(null==e||null===(t=e.governmentPanelList)||void 0===t?void 0:t.testCode)}).map(e=>({...e.governmentPanelList,testName:t[null==e?void 0:e._id],barCode:null==e?void 0:e.barCode})),o=n.reduce((e,l)=>e+l.testCost,0),i=(null==e?void 0:e.total)-o,a=(null==e?void 0:e.paid)>i?(null==e?void 0:e.paid)-i:0,r=o-a;return{...l,billID:(null==l?void 0:l.flabsbillID)||(null==l?void 0:l.billID),governmentPanelCardNumber:null==e?void 0:e.governmentPanelCardNumber,governmentPanelCardholderCode:null==e?void 0:e.governmentPanelCardholderCode,governmentPanelCardholderName:null==e?void 0:e.governmentPanelCardholderName,governmentPanelCardholderDesignation:null==e?void 0:e.governmentPanelCardholderDesignation,governmentPanelCardholderStation:null==e?void 0:e.governmentPanelCardholderStation,governmentPanelCategory:null==e?void 0:e.governmentPanelCategory,governmentPanelDepartment:null==e?void 0:e.governmentPanelDepartment,governmentPanelPatientType:null==e?void 0:e.governmentPanelPatientType,governmentPanelReferralName:null==e?void 0:e.governmentPanelReferralName,governmentPanelRelation:null==e?void 0:e.governmentPanelRelation,paymentType:null==e?void 0:e.payment,total:o,paid:a,due:r,tests:n}}])},55532(e,l,t){var n=t(8828),o=t(660);t.d(l,["h",0,async e=>{let{billIDs:l=[],b2bCenterIDs:t=[],sendTo:i,setProgress:a=()=>{},departmentPosition:r,labData:d,labGlobalSetting:s,setSuccess:u=()=>{},setLoading:c=()=>{},labId:p,isOrg:m=!1,withBackground:v=!0}=e;const b=l.length,y=async(e,l)=>{try{var c;const a=null===(c=t[l])||void 0===c?void 0:c.b2bCenterID,b={labData:d,labGlobalSetting:s,departmentPosition:r};a?(await(0,o.MQ)({billId:e,labId:p,isOrg:m,initValues:b,uploadPdfWithLetterHead:!0}),await(0,o.MQ)({billId:e,labId:p,isOrg:m,initValues:b,uploadPdfWithLetterHead:!1})):await(async e=>{try{return(await fetch(`https://flabs-lab.s3.ap-south-1.amazonaws.com/report/${e}.pdf`,{method:"HEAD",cache:"no-store"})).ok}catch{return!1}})(e)||await(0,o.MQ)({billId:e,labId:p,isOrg:m,initValues:b,uploadPdfWithLetterHead:!0}),await(async e=>{const l=await n.A.post("/billing/sendReport",{billNumber:e,withLetterHead:v,sendTo:i});null!=l&&l.data&&u(!0)})(e)}catch(e){}finally{a(Math.round((l+1)/b*100))}};c(!0);for(let e=0;e<b;e++)await y(l[e],e);c(!1)}])},10637(e,l,t){var n=t(12925),o=t(8660);t.d(l,["O",0,async(e,l)=>{var t;let{id:i,name:a}=l;const r=await(0,n.o)({billID:null==e?void 0:e._id,toB2B:i,fromB2B:null==e||null===(t=e.b2bCenter)||void 0===t?void 0:t._id});return!(null==r||!r.status)&&(o.b.getState().setPatientListData(l=>null==l?void 0:l.map((l,t)=>t===(null==e?void 0:e.key)-1?{...l,b2bCenter:{_id:i,name:a}}:l)),!0)}])},82991(e,l,t){var n=t(73114),o=t(67030),i=t(90402),a=t(62169);n.GlobalWorkerOptions.workerSrc=o;const r=async e=>{const l=n.getDocument({data:e}),t=await l.promise,o=[];for(let e=1;e<=t.numPages;e++){const l=await t.getPage(e),n=await l.getTextContent();for(const e of n.items)null!=e&&e.str&&o.push(e.str)}return await t.destroy(),o.join(" ")},d=e=>e?e.toLowerCase().replace(/\d{1,2}[-/ ][a-z]{3,9}[-/ ]\d{2,4}/gi,"").replace(/\d{4}-\d{2}-\d{2}/g,"").replace(/\d{1,2}:\d{2}(:\d{2})?\s*(am|pm)?/gi,"").replace(/page\s*\d+\s*(of|\/)\s*\d+/gi,"").replace(/\bpage\s*\d+\b/gi,"").replace(/[^\w.]+/g," ").replace(/\s+/g," ").trim():"",s=async e=>{const l=`https://flabs-lab.s3.ap-south-1.amazonaws.com/report/${e}.pdf`,t=await fetch(l,{cache:"no-store"});if(!t.ok){const e=new Error(`S3 ${t.status}`);throw e.code=403===t.status||404===t.status?"MISSING":"FETCH",e}return await t.blob()},u=async e=>{let{billId:l,labId:t,isOrg:n}=e;const o=await(0,i.p)({billId:l,labId:t,isOrg:n}),{patientData:r,barcodes:d,testsIdAndFillCount:s,departmentAndTest:u,departmentAndItsAllTestsArray:c,departmentTestCount:p,pendingTests:m,QRCodeString:v,qrSmartReportUrl:b,billingDetails:y,labDetails:g,labGlobalSettings:f,b2bCenterData:D,isTestMacData:h,machines:C,signs:A,notAllSigns:S,allAntibodies:P}=o;return await(0,a.E)({newReport:!0,QRCodeString:v,qrSmartReportUrl:b,patientData:r,departmentTestCount:p,labDetails:g,billingDetails:y,departmentAndTest:u,departmentAndItsAllTestsArray:c,testsIdObj:s,isHeader:!0,signs:A,labGlobalSetting:f,b2bCenterData:D,barCodeImages:d,isTestMacData:h,machines:C,promotionPdf:null==g?void 0:g.report_promotion_urls,notAllSigns:S,pendingTests:m,allAntibodies:P,isSendWithLetterhead:!0})},c=async e=>{var l,t,n;let{bill:o,labId:i,isOrg:a}=e;const c=(null==o?void 0:o._id)||(null==o?void 0:o.id),p=(null==o||null===(l=o.patient)||void 0===l?void 0:l.first_name)||(null==o?void 0:o.patientName)||(null==o?void 0:o.name)||"",m=(null==o?void 0:o.billDate)||(null==o?void 0:o.billing_date)||(null==o?void 0:o.createdAt)||"",v=((null==o?void 0:o.tests)||[]).map(e=>{var l;return(null==e||null===(l=e.test)||void 0===l?void 0:l.name)||(null==e?void 0:e.name)||(null==e?void 0:e.testName)}
1).filter(Boolean),b={billId:c,patientName:p,patientContact:(null==o||null===(t=o.patient)||void 0===t?void 0:t.contact)||(null==o?void 0:o.patientContact)||(null==o?void 0:o.contact)||"",patientCountryCode:(null==o||null===(n=o.patient)||void 0===n?void 0:n.country_code)||(null==o?void 0:o.countryCode)||"91",billDate:m,testNames:v,status:"match",similarity:null,reason:"",uploadedBlob:null,generatedBlob:null};try{const[e,l]=await Promise.all([s(c).catch(e=>{if("MISSING"===e.code)return null;throw e}),u({billId:c,labId:i,isOrg:a})]);if(b.generatedBlob=l||null,!e)return b.status="missing",b.reason="No uploaded PDF at S3",b;b.uploadedBlob=e;const[t,n]=await Promise.all([e.arrayBuffer(),l.arrayBuffer()]),[o,p]=await Promise.all([r(t),r(n)]),m=((e,l)=>{const t=new Set(d(e).split(" ").filter(Boolean)),n=new Set(d(l).split(" ").filter(Boolean));if(0===t.size&&0===n.size)return 1;if(0===t.size||0===n.size)return 0;let o=0;t.forEach(e=>{n.has(e)&&o++});const i=t.size+n.size-o;return o/i})(o,p);b.similarity=Number(m.toFixed(3)),m<.9&&(b.status="mismatch",b.reason=`Similarity ${b.similarity} < 0.9`)}catch(e){b.status="error",b.reason=(null==e?void 0:e.message)||"Unknown error"}return b};t.d(l,["W1",0,async e=>{let{bills:l,labId:t,isOrg:n,concurrency:o=3,onProgress:i}=e;const a=[];let r=0,d=0;const s=Array.from({length:Math.min(o,l.length)},()=>(async()=>{for(;r<l.length;){const e=r++,o=l[e],s=await c({bill:o,labId:t,isOrg:n});a[e]=s,d++,null==i||i({done:d,total:l.length,latest:s})}})());return await Promise.all(s),a}])},2452(e,l,t){t.d(l,["_",0,{"S.No":.4,"Bill Date":1.2,"Bill ID":.8,IDs:1.1,"Patient Info":1.4,Referrals:1.3,Tests:2.2,Amount:.8,Status:.7,Barcode:1.2,"Dispatched Mode":1.2,Paid:.6,Due:.6,Discount:.7,Net:.7,"Discounted by":1.1,Remarks:1.4,"Refund Date":1.2,"Refunded By":1.1,Refunded:.7,"Outsource Lab":1.3,"Form F Filled":.9},"g",0,{ALL:{key:"1",label:"All",type:"ALL"},PENDING_DISPATCH:{key:"2",label:"Pending Dispatched",type:"PENDING_DISPATCHED"},DISPATCHED:{key:"3",label:"Dispatched",type:"DISPATCHED"},OUTSOURCE:{key:"4",label:"Outsource",type:"OUTSOURCE"},CLEAR_DUE:{key:"5",label:"Due",type:"DUE"},REFUND:{key:"6",label:"Refund",type:"REFUNDED"},DISCOUNT:{key:"7",label:"Discount",type:"DISCOUNT"},CANCELLED:{key:"8",label:"Cancelled",type:"CANCELLED"},GOVERNMENT_PANEL:{key:"9",label:"Government Panel",type:"GOVERNMENT_PANEL"},PCPNDT:{key:"10",label:"PCPNDT",type:"PCPNDT"}}])},13679(e,l,t){t.d(l,{E:()=>c});var n=t(4159),o=t.n(n);const i=e=>{const l=new Map;return null==e||e.forEach(e=>null==l?void 0:l.set(e._id,e)),Array.from(null==l?void 0:l.values())};var a=t(2543),r=t(31297),d=t(2452),s=t(43287);const u=e=>e?o()(e).format("DD-MM-YYYY hh:mm A"):"N/A",c=function(e,l){var t;let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"ALL",c=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const p=null==n?void 0:n.replace(/\s+/g,"").toLowerCase();return null==e||null===(t=e.filter(e=>{var l,t;if(!p)return!0;const{first_name:n,last_name:o,patientID:i,uhid:a}=(null==e?void 0:e.patient)||{};return`${n||""}${o||""}`.toLowerCase().includes(p)||(null==i?void 0:i.toLowerCase().includes(p))||(null==a?void 0:a.toLowerCase().includes(p))||(null==e||null===(l=e.billID)||void 0===l?void 0:l.toLowerCase().includes(p))||(null==e||null===(t=e.barCode)||void 0===t?void 0:t.toLowerCase().includes(p))}))||void 0===t?void 0:t.map((e,t)=>{var n,p,m,v,b,y,g,f,D,h,C,A,S,P,R,w,k,I,E,T,L,N,B,O,x,_,$;return{"S.No":t+1,"Bill Date":u(null==e?void 0:e.billDate),"Bill ID":(null==e?void 0:e.billID)||"",IDs:`${null!=l&&l.paient_id&&null!=e&&null!==(n=e.patient)&&void 0!==n&&n.patientID?null==e||null===(p=e.patient)||void 0===p?void 0:p.patientID:""} ${null!=l&&l.uhid&&null!=e&&null!==(m=e.patient)&&void 0!==m&&m.uhid?","+(null==e||null===(v=e.patient)||void 0===v?void 0:v.uhid):""} ${null!=l&&l.daywise_id&&null!=e&&e.dayWiseID?","+(null==e?void 0:e.dayWiseID):""} ${null!=l&&l.custom_id&&null!=e&&e.customID?","+(null==e?void 0:e.customID):""}`,"Patient Info":`${(null==e||null===(b=e.patient)||void 0===b?void 0:b.first_name)||""} ${(null==e||null===(y=e.patient)||void 0===y?void 0:y.last_name)||""}, ${(null==e||null===(g=e.patient)||void 0===g?void 0:g.age)+" "+(null==e||null===(f=e.patient)||void 0===f?void 0:f.age_type)}, ${(0,a.B)((null==e||null===(D=e.patient)||void 0===D?void 0:D.gender)||"")}`,..."REFUNDED"!==o&&"OUTSOURCE"!==o&&{Referrals:`${(null==e||null===(h=e.referredOrganization)||void 0===h?void 0:h.name)||""} ${(null==e||null===(C=e.referredHospitalOrganization)||void 0===C?void 0:C.name)||""} ${(null==e||null===(A=e.secondOrganization)||void 0===A?void 0:A.name)||""} ${(null==e||null===(S=e.b2bCenter)||void 0===S?void 0:S.name)||""} ${null!=e&&null!==(P=e.referredOrganization)&&void 0!==P&&P.name||null!=e&&null!==(R=e.referredHospitalOrganization)&&void 0!==R&&R.name||null!=e&&null!==(w=e.secondOrganization)&&void 0!==w&&w.name||null!=e&&null!==(k=e.b2bCenter)&&void 0!==k&&k.name?"":"Self"}`},Tests:(null===(I=i(null==e?void 0:e.tests))||void 0===I||null===(E=I.map(e=>null==e?void 0:e.name))||void 0===E?void 0:E.join(", "))||"N/A",...[d.g.ALL.type,d.g.PENDING_DISPATCH.type].includes(o)&&!(null!=c&&c.hideAmountColumn)&&{Amount:null==e?void 0:e.total},...[d.g.ALL.type,d.g.OUTSOURCE.type,d.g.GOVERNMENT_PANEL.type].includes(o)&&{Barcode:(null===(T=i(null==e?void 0:e.tests))||void 0===T||null===(L=T.map(e=>null==e?void 0:e.barCode))||void 0===L?void 0:L.join(", "))||"-"},..."REFUNDED"===o&&{"Refund Date":u(null==e?void 0:e.updatedAt),"Refunded By":null===(N=e.refundedBy)||void 0===N?void 0:N.name,Refunded:Math.abs(null==e?void 0:e.paymentTypeAmount),Remarks:null==e?void 0:e.refundReason},...("PENDING_DISPATCHED"===o||"DISPATCHED"===o)&&{"Dispatched Mode":null==e||null===(B=e.dispatchMode)||void 0===B||null===(O=B.filter(e=>null==e?void 0:e.isDispatched))||void 0===O||null===(x=O.map(e=>null==e?void 0:e.mode))||void 0===x?void 0:x.join(", ")},..."DUE"===o&&{Amount:null==e?void 0:e.total,Paid:null==e?void 0:e.paid,Due:null==e?void 0:e.due},..."DISCOUNT"===o&&(l=>{const{gross:t,discount:n,net:o}=(0,s.m)(e);return{"Discounted by":null==e||null===(l=e.createdBy)||void 0===l?void 0:l.name,Amount:t,Discount:n,Net:o,Remarks:null==e?void 0:e.reasonOfDiscount}})(),..."OUTSOURCE"===o&&{"Outsource Lab":null===(_=(0,r.z)(null==e||null===($=e.tests)||void 0===$?void 0:$.map(e=>null==e?void 0:e.outSourceLab)))||void 0===_?void 0:_.join(", ")},..."REFUNDED"!==o&&"DISCOUNT"!==o&&{Status:null==e?void 0:e.status},..."PCPNDT"===o&&{"Form F Filled":(l=>{const t=(null==e||null===(l=e.tests)||void 0===l?void 0:l.filter(e=>null==e?void 0:e.isPcpndt))||[];
1if(0===t.length)return"N/A";const n=t.filter(e=>{var l;return!0===(null==e||null===(l=e.pcpndtData)||void 0===l?void 0:l.formFFilled)}).length;return 0===n?"Not Filled":n===t.length?"Filled":`Partial (${n}/${t.length})`})()}}})}},35970(e,l,t){var n=t(28728),o=t.n(n),i=t(34691),a=t(32858),r=t(25836),d=t(92436),s=t(76977),u=t(21894),c=t(3449),p=t(15814),m=t(51084),v=t(66673),b=t(8660),y=t(35994);function g(e,l){if(!l.has(e))return l.add(e),e;const t=e.lastIndexOf("."),n=-1===t?e:e.slice(0,t),o=-1===t?"":e.slice(t);let i=1,a=`${n}_${i}${o}`;for(;l.has(a);)i+=1,a=`${n}_${i}${o}`;return l.add(a),a}t.d(l,["R",0,async e=>{let{bills:l,currentLab:t,labData:n}=e;const{setSelectedRowKeys:f,setLoadingGovPanelBulkInvoice:D}=b.b.getState();if(Array.isArray(l)&&0!==l.length)try{var h,C;const{bills:e,failedCount:b}=await async function(e){const l=[];let t=0;for(const n of e)try{const e=await(0,m.u)(null==n?void 0:n._id),t=(0,v.k)(e,n);l.push(t)}catch(e){t+=1}return{bills:l,failedCount:t}}(l);if(0===e.length)return void a.Ay.error("No bills could be fetched. Please try again.");const D=(0,r.I)({labData:n,currentLab:t,isB2BMRP:!1}),A="true"===localStorage.getItem("bill_header"),{labGlobalSetting:S,collectionCenters:P}=null!==(h=null===(C=y.i.getState())||void 0===C?void 0:C.user)&&void 0!==h?h:{},R=new(o()),w=new Set;let k=0,I=0;for(const l of e)try{const e=await(0,d.Y)({bill:l,billSettings:D,currentLab:t,isHeader:A,patientData:(0,c.e)({bill:l,labData:n,billType:null===p.uv||void 0===p.uv?void 0:p.uv.GOV_PANEL_BILL,labGlobalSetting:S,collectionCenters:P})});R.file(g((0,s.Q)(l),w),e),k+=1}catch(e){I+=1}if(0===k)return void a.Ay.error("Failed to generate any bills. Please try again.");const E=await R.generateAsync({type:"blob"});(0,i.saveAs)(E,(0,u.nk)());const T=b+I;T>0?a.Ay.warning(`Downloaded ${k} of ${l.length} bills. ${T} failed â please retry them.`):f([])}finally{D(!1)}else D(!1)}])},99364(e,l,t){var n=t(28728),o=t.n(n),i=t(90402),a=t(62169);const r=e=>{let l="";var t,n;null!=e&&e.first_name&&(l+=null==e||null===(t=e.first_name)||void 0===t?void 0:t.trim());null!=e&&e.last_name&&(l+=" "+(null==e||null===(n=e.last_name)||void 0===n?void 0:n.trim()));return null!=e&&e.gender&&(l+="_"+(null==e?void 0:e.gender)),null!=e&&e.age&&(l+="_"+(null==e?void 0:e.age)+" "+(null==e?void 0:e.age_type)),l};t.d(l,["k",0,async e=>{let{selectedRows:l,labId:t,labData:n,labGlobalSetting:d,setProgress:s,setPhase:u,setLoading:c,setShowModal:p,withBackground:m,b2bReport:v,saveZip:b=!0,isCustomSettingsEnabled:y=!1,separateTest:g=!1,departmentPosition:f,isOrg:D=!1}=e;c(!0),s(0),null==u||u("download");const h=new(o());let C=0;const A=l.length;for(const e of l){const l=e._id,o=e.patient,u=r(o);try{if(y){const{patientData:e,barcodes:o,testsIdAndFillCount:r,departmentAndTest:s,departmentAndItsAllTestsArray:c,departmentTestCount:p,pendingTests:b,QRCodeString:y,labDetails:A,b2bCenterData:S,isTestMacData:P,machines:R,signs:w,notAllSigns:k,qrSmartReportUrl:I,allAntibodies:E,billingDetails:T}=await(0,i.p)({billId:l,labId:t,isOrg:D,initValues:{labData:n,labGlobalSetting:d,departmentPosition:f}}),L=await(0,a.E)({type:"report",QRCodeString:y,qrSmartReportUrl:I,patientData:e,departmentTestCount:p,labDetails:A,billingDetails:T,departmentAndTest:s,departmentAndItsAllTestsArray:c,testsIdObj:r,isHeader:m,signs:w,separateTest:g,labGlobalSetting:d,b2bCenterData:S,isUseB2BLabDetails:v,barCodeImages:o,isTestMacData:P,machines:R,promotionPdf:null==A?void 0:A.report_promotion_urls,isSendWithPromotion:!1,notAllSigns:k,showReportInterpretation:!0,pendingTests:b,allAntibodies:E,compareReport:!1,patientHistory:[],isSendWithLetterhead:m});L&&h.file(`${u}_${C+1}.pdf`,L)}else{const e=`https://flabs-lab.s3.ap-south-1.amazonaws.com/report/${l}.pdf`;let t=await fetch(e,{cache:"no-store"}).then(e=>e.blob());t&&h.file(`${u}_${C+1}.pdf`,t)}}catch(e){}finally{C++,s(Math.round(C/A*100))}}s(0),null==u||u("zip");try{const e=await h.generateAsync({type:"blob",streamFiles:!0,compression:"DEFLATE"},e=>{s(e.percent)});return c(!1),p(!1),b?void saveAs(e,"reports.zip"):e}catch(e){throw e}}])},95642(e,l,t){var n=t(46445);t.d(l,["B",0,async(e,l,t)=>{try{const o=[],i=[];for(const e of l){o.push(e._id);const l=e.tests.map(e=>e._id);i.push(...l)}const a=[...new Set(i)],r=await n.K.post("/billing/consolidatedReport",{labID:e,billIDs:o,tests:a,showOnlyMachineValues:t}),d=new Blob([r],{type:"text/csv;charset=utf-8;"});saveAs(d,"consolidated_report.csv")}catch(e){}}])},58535(e,l,t){function n(e){var l,t,n,o,i;const a=localStorage.getItem("isCorporateLoggedInBrowser");if(!e)return"N/A";const r=new Date(e);if(isNaN(r))return"N/A";const d=String(null==r||null===(l=r.getDate)||void 0===l?void 0:l.call(r)).padStart(2,"0"),s=String((null==r||null===(t=r.getMonth)||void 0===t?void 0:t.call(r))+1).padStart(2,"0"),u=null==r||null===(n=r.getFullYear)||void 0===n?void 0:n.call(r);let c=null==r||null===(o=r.getHours)||void 0===o?void 0:o.call(r);const p=String(null==r||null===(i=r.getMinutes)||void 0===i?void 0:i.call(r)).padStart(2,"0"),m=c>=12?"PM":"AM";return c%=12,c=c||12,a?`${d}-${s}-${u}`:`${d}-${s}-${u} ${String(c).padStart(2,"0")}:${p}${m}`}t.d(l,{Y:()=>n})},86253(e,l,t){t.d(l,["O",0,function(){var e,l,t,n,o,i,a,r;let d=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const u={page:arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,labID:(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")||null,orderListStatus:arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,gte:d[0]||null,lte:d[1]||null,billIDSort:(null==s?void 0:s.billIDSort)||null,refundedBy:(null==s?void 0:s.refundedBy)||null,department:(null==s?void 0:s.department)||null,test:(null==s?void 0:s.test)||null,package:(null==s?void 0:s.package)||null,referredDoctor:(null==s||null===(e=s.referralDoc)||void 0===e?void 0:e.join(","))||null,referredHospital:(null==s||null===(l=s.referralHos)||void 0===l?void 0:l.join(","))||null,secondReferral:(null==s||null===(t=s.secondReferral)||void 0===t?void 0:t.join(","))||null,b2bCenter:(null==s||null===(n=s.b2bCenter)||void 0===n?void 0:n.join(","))||null,collectionCenter:(null==s||null===(o=s.collectionCenter)||void 0===o?void 0:o.join(","))||null,dispatchMode:(null==s||null===(i=s.dispatchedMode)||void 0===i?void 0:i.join(","))||null,status:(null==s?void 0:s.status)||null,outSourceLab:(null==s?void 0:s.outSourceLab)||null,createdBy:(null==s?void 0:s.createdBy)||null,discountedBy:(null==s?void 0:s.discountedBy)||null,isUrgent:(null==s?void 0:s.isUrgent)||null,isSmartReport:(null==s?void 0:s.isSmartReport)||null,sampleC
1ollector:(null==s||null===(a=s.sampleCollector)||void 0===a?void 0:a.join(","))||null,labCollectionCenter:(null==s||null===(r=s.labCollectionCenter)||void 0===r?void 0:r.join(","))||null,pro:(null==s?void 0:s.pro)||null,isSelf:null==s?void 0:s.selfPatients,formFFilled:(null==s?void 0:s.formFFilled)||null,isAbhaLinked:null==s?void 0:s.isAbhaLinked,isCredent:(null==s?void 0:s.isCredent)||null};return Object.fromEntries(Object.entries(u).filter(e=>{let[l,t]=e;return null!=t}))}])},43287(e,l,t){var n=t(53583);t.d(l,["m",0,e=>{const l=(0,n.X4)(null==e?void 0:e.total),t=(0,n.X4)(null==e?void 0:e.discountAmount);return{gross:(0,n.X4)(l+t),discount:t,net:l}}])},44876(e,l,t){var n=t(84064),o=t(89919),i=t(22748),a=t(43287),r=t(44414);t.d(l,["F",0,(e,l,t,d)=>{var s;switch(e){case"Amount":if("DISCOUNT"===l){const{gross:e}=(0,a.m)(t);return`${d||""} ${e.toFixed(2)}`}return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("span",{children:[d||""," ",parseInt(null==t?void 0:t.total)||"0"]}),"DUE"!==l&&(null==t?void 0:t.due)>0&&(0,r.jsx)("span",{style:{color:"#F5222D"},children:(null==t?void 0:t.due)>0?(0,r.jsxs)(n.A,{gap:8,children:[`${d||""} ${parseInt(null==t?void 0:t.due)}`,(0,r.jsx)(i.A,{placement:"top",title:"Due",children:(0,r.jsx)(o.A,{bordered:!1,color:"error",style:{borderRadius:4,border:"none",height:20},children:"D"})})]}):"0"})]});case"Paid":return`${d||""} ${(null==t?void 0:t.paid)||"0"}`;case"Due":return(null==t?void 0:t.due)>0?`${d||""} ${(null==t||null===(s=t.due)||void 0===s?void 0:s.toFixed(2))||"0"}`:"";case"Refunded":return`${d||""} ${Math.abs(null==t?void 0:t.paymentTypeAmount)||"0"}`;case"Discount":{if("DISCOUNT"!==l)return"";const{discount:e}=(0,a.m)(t);return`${d||""} ${e.toFixed(2)}`}case"Net":if("DISCOUNT"===l){const{net:e}=(0,a.m)(t);return`${d||""} ${e.toFixed(2)}`}return null;default:return null}}])},11925(e,l,t){t.d(l,["Q",0,(e,l,t,n,o,i,a,r,d,s,u,c,p,m,v)=>({ALL:[{id:1,label:"Status",options:s,key:"status",mode:void 0},{id:2,label:"Referral Doctor",options:i,key:"referralDoc",mode:"multiple"},{id:3,label:"Referral Hospital",options:a,key:"referralHos",mode:"multiple"},{id:4,label:"Second Referral",options:r,key:"secondReferral",mode:"multiple"},{id:5,label:"B2B",options:l,key:"b2bCenter",mode:"multiple"},{id:6,label:"Collection At",options:n,key:"collectionCenter",mode:"multiple"},{id:7,label:"PRO",options:p,key:"pro"},{id:8,label:"Phlebotomist",options:o,key:"sampleCollector",mode:"multiple"},!(null!=v&&v.isCollectionCenter)&&{id:9,label:"Collection Center",options:m,key:"labCollectionCenter",mode:"multiple"}].filter(Boolean),PENDING_DISPATCHED:[{id:1,label:"Dispatched mode",options:d,key:"dispatchedMode",mode:"multiple"},{id:2,label:"Referral Doctor",options:i,key:"referralDoc",mode:"multiple"},{id:3,label:"Referral Hospital",options:a,key:"referralHos",mode:"multiple"},{id:4,label:"Second Referral",options:r,key:"secondReferral",mode:"multiple"},{id:5,label:"B2B",options:l,key:"b2bCenter",mode:"multiple"},{id:6,label:"Department",options:t,key:"department",mode:void 0},{id:7,label:"Collection At",options:n,key:"collectionCenter",mode:"multiple"},{id:8,label:"Phlebotomist",options:o,key:"sampleCollector",mode:"multiple"},!(null!=v&&v.isCollectionCenter)&&{id:9,label:"Collection Center",options:m,key:"labCollectionCenter",mode:"multiple"}].filter(Boolean),DISPATCHED:[{id:1,label:"Dispatched mode",options:d,key:"dispatchedMode",mode:"multiple"},{id:2,label:"Referral Doctor",options:i,key:"referralDoc",mode:"multiple"},{id:3,label:"Referral Hospital",options:a,key:"referralHos",mode:"multiple"},{id:4,label:"Second Referral",options:r,key:"secondReferral",mode:"multiple"},{id:5,label:"B2B",options:l,key:"b2bCenter",mode:"multiple"},{id:6,label:"Department",options:t,key:"department",mode:void 0},{id:7,label:"Collection At",options:n,key:"collectionCenter",mode:"multiple"},{id:8,label:"Phlebotomist",options:o,key:"sampleCollector",mode:"multiple"},!(null!=v&&v.isCollectionCenter)&&{id:9,label:"Collection Center",options:m,key:"labCollectionCenter",mode:"multiple"}].filter(Boolean),DUE:[{id:1,label:"Status",options:s,key:"status",mode:void 0},{id:2,label:"Referral Doctor",options:i,key:"referralDoc",mode:"multiple"},{id:3,label:"Referral Hospital",options:a,key:"referralHos",mode:"multiple"},{id:4,label:"Second Referral",options:r,key:"secondReferral",mode:"multiple"},{id:5,label:"B2B",options:l,key:"b2bCenter",mode:"multiple"},{id:6,label:"Department",options:t,key:"department",mode:void 0},{id:7,label:"Collection At",options:n,key:"collectionCenter",mode:"multiple"},{id:8,label:"Phlebotomist",options:o,key:"sampleCollector",mode:"multiple"},!(null!=v&&v.isCollectionCenter)&&{id:9,label:"Collection Center",options:m,key:"labCollectionCenter",mode:"multiple"}
1].filter(Boolean),OUTSOURCE:[{id:1,label:"Status",options:s,key:"status",mode:void 0},{id:2,label:"Outsource Lab",options:u,key:"outSourceLab",mode:void 0},{id:3,label:"User",options:c,key:"createdBy",mode:void 0},{id:4,label:"Referral Doctor",options:i,key:"referralDoc",mode:"multiple"},{id:5,label:"Referral Hospital",options:a,key:"referralHos",mode:"multiple"},{id:6,label:"Second Referral",options:r,key:"secondReferral",mode:"multiple"},{id:7,label:"B2B",options:l,key:"b2bCenter",mode:"multiple"},{id:8,label:"Collection At",options:n,key:"collectionCenter",mode:"multiple"},{id:9,label:"Phlebotomist",options:o,key:"sampleCollector",mode:"multiple"},!(null!=v&&v.isCollectionCenter)&&{id:10,label:"Collection Center",options:m,key:"labCollectionCenter",mode:"multiple"}].filter(Boolean),REFUNDED:[{id:1,label:"Refunded By",options:c,key:"refundedBy",mode:void 0},{id:2,label:"Referral Doctor",options:i,key:"referralDoc",mode:"multiple"},{id:3,label:"Referral Hospital",options:a,key:"referralHos",mode:"multiple"},{id:4,label:"Second Referral",options:r,key:"secondReferral",mode:"multiple"},{id:5,label:"B2B",options:l,key:"b2bCenter",mode:"multiple"},{id:6,label:"Collection At",options:n,key:"collectionCenter",mode:"multiple"},{id:7,label:"Phlebotomist",options:o,key:"sampleCollector",mode:"multiple"},!(null!=v&&v.isCollectionCenter)&&{id:8,label:"Collection Center",options:m,key:"labCollectionCenter",mode:"multiple"}].filter(Boolean),DISCOUNT:[{id:1,label:"Discount By",options:c,key:"discountedBy",mode:void 0},{id:2,label:"Referral Doctor",options:i,key:"referralDoc",mode:"multiple"},{id:3,label:"Referral Hospital",options:a,key:"referralHos",mode:"multiple"},{id:4,label:"Second Referral",options:r,key:"secondReferral",mode:"multiple"},{id:5,label:"B2B",options:l,key:"b2bCenter",mode:"multiple"},{id:6,label:"Department",options:t,key:"department",mode:void 0},{id:7,label:"Collection At",options:n,key:"collectionCenter",mode:"multiple"},{id:8,label:"Phlebotomist",options:o,key:"sampleCollector",mode:"multiple"},!(null!=v&&v.isCollectionCenter)&&{id:9,label:"Collection Center",options:m,key:"labCollectionCenter",mode:"multiple"}].filter(Boolean)}[e]||[])])},62646(e,l,t){t.d(l,{s:()=>n});const n=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return"0"===l||0===l?null:null!=e&&e.length&&""!==l?null==(n=String(null===(t=e[parseInt(l)])||void 0===t?void 0:t.status))||null===(o=n.replace(/([a-z])([A-Z])/g,"$1_$2"))||void 0===o||null===(i=o.replace(/\s+/g,"_"))||void 0===i?void 0:i.toUpperCase():null;var t,n,o,i}},81588(e,l,t){t.d(l,["D",0,e=>{const l=[];for(const u of e){const e={mainTest:"",allTests:[]};e.mainTest=null==u?void 0:u.name;for(const l of null!==(t=null==u?void 0:u.testCategory)&&void 0!==t?t:[]){var t,n,o;if("testDetails"===(null==l?void 0:l.type)&&(null==e||e.allTests.push(null==l||null===(n=l.data)||void 0===n?void 0:n.name)),"testDetailsCategory"===(null==l?void 0:l.type))if(Array.isArray(null==l||null===(o=l.data)||void 0===o?void 0:o.categories))for(const t of null!==(i=null==l||null===(a=l.data)||void 0===a?void 0:a.categories)&&void 0!==i?i:[]){var i,a;null==e||e.allTests.push(null==t?void 0:t.name)}else for(const[t,n]of null==Object?void 0:Object.entries(null!==(r=null==l||null===(d=l.data)||void 0===d?void 0:d.categories)&&void 0!==r?r:{})){var r,d,s;null==e||null===(s=e.allTests)||void 0===s||s.push(null==n?void 0:n.name)}}l.push(e)}return l}])},10054(e,l,t){t.d(l,["L",0,(e,l)=>{var t;if(!l||!Array.isArray(e))return null;const n=null==e||null===(t=e.find)||void 0===t?void 0:t.call(e,e=>(null==e?void 0:e._id)===l);return(null==n?void 0:n.name)||null}])},27277(e,l,t){var n=t(44820),o=t(4159),i=t.n(o),a=t(33778),r=t(2452),d=t(44414);const s=n.StyleSheet.create({page:{padding:16,fontFamily:"Helvetica",fontSize:8},header:{flexDirection:"row",justifyContent:"space-between",alignItems:"flex-start",marginBottom:10},title:{fontSize:14,fontFamily:"Helvetica-Bold"},meta:{fontSize:8,color:"#595959",textAlign:"right"},table:{borderWidth:1,borderColor:"#E5EAEE",borderRightWidth:0,borderBottomWidth:0},row:{flexDirection:"row"},headRow:{backgroundColor:"#F0F5FF"},cell:{borderRightWidth:1,borderBottomWidth:1,borderColor:"#E5EAEE",padding:4},headCell:{fontFamily:"Helvetica-Bold"}}),u=e=>{let{columns:l,rows:t,title:o,labName:i,rangeText:a}=e;const u=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const l=null==e?void 0:e.map(e=>{var l;return null!==(l=r._[e])&&void 0!==l?l:1}),t=null==l?void 0:l.reduce((e,l)=>e+l,0);return null==e?void 0:e.reduce((n,o,i)=>(n[o]=t?l[i]/t*100+"%":100/e.length+"%",n),{})}(l);return(0,d.jsx)(n.yo,{children:(0,d.jsxs)(n.YW,{size:"A4",orientation:"landscape",style:s.page,wrap:!0,children:[(0,d.jsxs)(n.View,{style:s.header,fixed:!0,children:[(0,d.jsx)(n.Text,{style:s.title,children:o}),(0,d.jsxs)(n.View,{children:[!!i&&(0,d.jsx)(n.Text,{style:s.meta,children:i}),!!a&&(0,d.jsx)(n.Text,{style:s.meta,children:a})]})]}),(0,d.jsxs)(n.View,{style:s.table,children:[(0,d.jsx)(n.View,{style:[s.row,s.headRow],fixed:!0,children:l.map(e=>(0,d.jsx)(n.View,{style:[s.cell,{width:u[e]}],children:(0,d.jsx)(n.Text,{style:s.headCell,children:e})},e))}),t.map((e,t)=>(0,d.jsx)(n.View,{style:s.row,wrap:!1,children:l.map(l=>{var t;return(0,d.jsx)(n.View,{style:[s.cell,{width:u[l]}],children:(0,d.jsx)(n.Text,{children:0===e[l]?"0":String(null!==(t=e[l])&&void 0!==t?t:"")})},l)})},t))]})]})})};t.d(l,["x",0,async e=>{let{rows:l,fileName:t,title:o,currentLab:r,dateRange:s}=e;if(!Array.isArray(l)||0===l.length)return!1;const c=Object.keys(l[0]),p=(null==r?void 0:r.name)||(null==r?void 0:r.labName)||"",m=2===(null==s?void 0:s.length)?`${i()(s[0]).format("DD-MM-YYYY")} to ${i()(s[1]).format("DD-MM-YYYY")}`:"",v=await(0,n.x8)((0,d.jsx)(u,{columns:c,rows:l,title:o,labName:p,rangeText:m})).toBlob();return(0,a.W)(v,`${t}.pdf`),!0}])},13165(e,l,t){var n=t(44820),o=t(71346),i=t(32858),a=t(44414);t.d(l,["Y",0,e=>{var l,t;if(e.length<=0)return i.Ay.error("Please Select Patient");(async e=>{const l=window.open("","_blank");if(!l)return void i.Ay.error("Popup blocked! Please allow popups.");l.document.open(),l.document.write('\n <!DOCTYPE html>\n <html>\n <head>\n <title>Generating PDF...</title>\n <style>\n body {\n margin: 0;\n height: 100vh;\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: column;\n font-family: Arial, sans-serif;\n background: #f9f9f9;\n }\n .loader {\n border: 6px solid #f3f3f3;\n border-top: 6px solid #2D5CF2;\n border-radius: 50%;\n width: 60px;\n height: 60px;\n animation: spin 1s linear infinite;\n }\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n h2 {\n margin-top: 20px;\n color: #555;\n }\n </style>\n </head>\n <body>\n <div class="loader"></div>\n <h2>Generating PDF...</h2>\n </body>\n </html>\n '),l.document.close();const t=await(0,n.x8)((0,a.jsx)(o.A,{worksheetPdfData:e})).toBlob(),r=new Blob([t],{type:"application/pdf"}),d=URL.createObjectURL(r);l.location.href=d})({date:null===(l=e[0])||void 0===l||null===(t=l.billDate)||void 0===t?void 0:t.split(" ")[0],patientsData:e})}])},73384(e,l,t){t.d(l,{N:()=>a});var n=t(58535),o=t(10054);const i=(e,l,t)=>{var n;if(null==e||!e.statusUpdate||!Array.isArray(null==e?void 0:e.statusUpdate))return null;let i=null;for(let t=(null==e||null===(a=e.statusUpdate)||void 0===a?void 0:a.length)-1;t>=0;t-=1){var a,r;const n=null==e||null===(r=e.statusUpdate)||void 0===r?void 0:r[t];if((null==n?void 0:n.status)===l&&null!=n&&n.updatedBy){i=n;break}}return i?(0,o.L)(t,null===(n=i)||void 0===n?void 0:n.updatedBy):null},a=[{key:"billing",color:"#2D5CF2",getLabel:e=>{var l;let{billData:t}=e;const n=null==t||null===(l=t.createdBy)||void 0===l?void 0:l.name;return n?`Billing (${n})`:"Billing"},getTime:e=>{let{billData:l}=e;return(0,n.Y)(null==l?void 0:l.billDate)},isPresent:e=>{let{billData:l}=e;return!(null==l||!l.billDate)}},{key:"sample_collected",color:"#2D5CF2",getLabel:e=>{let{test:l,allLabUsers:t}=e;const n=(0,o.L)(t,null==l?void 0:l.collectionBy);return n?`Sample Collected (${n})`:"Sample Collected"},getTime:e=>{let{test:l}=e;return(0,n.Y)(null==l?void 0:l.collectionDate)},isPresent:e=>{let{test:l}=e;return!(null==l||!l.collectionDate)}},{key:"sample_received",color:"#2D5CF2",getLabel:e=>{let{test:l,allLabUsers:t}=e;const n=(0,o.L)(t,null==l?void 0:l.receivedBy);return n?`Sample Received (${n})`:"Sample Received"},getTime:e=>{let{test:l}=e;return(0,n.Y)(null==l?void 0:l.receivedDate)},isPresent:e=>{let{test:l}=e;return!(null==l||!l.receivedDate)}},{key:"sample_rejected",color:"#F5222D",getLabel:e=>{let{test:l,allLabUsers:t}=e;const n=(0,o.L)(t,null==l?void 0:l.rejectedBy);return n?`Sample Rejected (${n})`:"Sample Rejected"},getTime:e=>{let{test:l}=e;return(0,n.Y)(null==l?void 0:l.rejectedDate)},isPresent:e=>{let{test:l}=e;return!(null==l||!l.rejectedDate)}},{key:"sample_not_received",color:"#F5222D",getLabel:()=>"Sample not received (user name)",getTime:e=>{let{statusMap:l}=e;return null==l?void 0:l.sample_not_received},isPresent:e=>{let{statusMap:l}=e;return!(null==l||!l.sample_not_received)},dynamic:!0},{key:"NEED_VERIFICATION",color:"#FA8C16",getLabel:e=>{let{test:l,allLabUsers:t}=e;const n=i(l,"NEED_VERIFICATION",t);return n?`Send for Verification (${n})`:"Send for Verification"},getTime:e=>{let{statusMap:l}=e;return null==l?void 0:l.NEED_VERIFICATION},isPresent:e=>{let{statusMap:l}=e;return!(null==l||!l.NEED_VERIFICATION)},dynamic:!0},{key:"PROVISIONAL",color:"#EB2F96",getLabel:e=>{let{test:l,allLabUsers:t}=e;const n=i(l,"PROVISIONAL",t);return n?`Provisional, (${n})`:"Provisional"},getTime:e=>{let{statusMap:l}=e;return null==l?void 0:l.PROVISIONAL},isPresent:e=>{let{statusMap:l}=e;return!(null==l||!l.PROVISIONAL)},dynamic:!0},{key:"RE_RUN",color:"#722ED1",getLabel:e=>{let{test:l,allLabUsers:t}=e;const n=i(l,"RE_RUN",t);return n?`Re-run (${n})`:"Re-run"},getTime:e=>{let{statusMap:l}=e;return null==l?void 0:l.RE_RUN},isPresent:e=>{let{statusMap:l}=e;return!(null==l||!l.RE_RUN)},dynamic:!0},{key:"HOLD",color:"#1F1F1F",getLabel:e=>{let{test:l,allLabUsers:t}=e;const n=i(l,"HOLD",t);return n?`On Hold (${n})`:"On Hold"},getTime:e=>{let{statusMap:l}=e;return null==l?void 0:l.HOLD},isPresent:e=>{let{statusMap:l}=e;return!(null==l||!l.HOLD)},dynamic:!0},{key:"COMPLETE",color:"#52C41A",getLabel:e=>{let{test:l,allLabUsers:t}=e;const n=i(l,"COMPLETE",t);return n?`Report Approved (${n})`:"Report Approved"},getTime:e=>{let{statusMap:l}=e;return null==l?void 0:l.COMPLETE},isPresent:e=>{let{statusMap:l}=e;return!(null==l||!l.COMPLETE)},dynamic:!0},{key:"delivered",color:"#13C2C2",getLabel:(e,l,t,n)=>{const o=i(l,"DELIVERED",n);return o?`Delivered (${o})`:"Delivered"},getTime:e=>{let{statusMap:l}=e;return null==l?void 0:l.DELIVERED},isPresent:e=>{let{statusMap:l}=e;return!(null==l||!l.DELIVERED)},dynamic:!0}]},14556(e,l,t){var n=t(9950),o=t(57495),i=t(8660),a=t(44414);t.d(l,["K",0,e=>{let{isExpandable:l}=e;const{expandedRowKey:t,setExpandedRowKey:r,setPdfLink:d,setOpenConsentModal:s}=i.b.getState(),u=(0,n.useCallback)((e,l)=>{r(e?null==l?void 0:l.key:null)},[r]),c=(0,n.useCallback)(e=>(0,a.jsx)(o.A,{data:e,setPdfLink:d,setOpenConsentModal:s}),[d,s]);return(0,n.useMemo)(()=>
1l?{expandedRowRender:c,expandedRowKeys:t?[t]:[],onExpand:u}:null,[l,t,c,u])},"s",0,e=>{let{isRowSelection:l,getCheckboxProps:t}=e;const{selectedRowKeys:o,setSelectedRowKeys:a,setSelectedPatient:r}=i.b.getState(),d=(0,n.useCallback)((e,l)=>{const t=l.map(e=>({billID:null==e?void 0:e._id,data:e}));a(e),r(t)},[a,r]);return(0,n.useMemo)(()=>l?{type:"checkbox",selectedRowKeys:o,onChange:d,...t?{getCheckboxProps:t}:{}}:null,[l,o,d,t])}])},53583(e,l,t){const n=e=>{const l=Number(e);return Number.isFinite(l)?Math.round(100*l)/100:0};t.d(l,["$A",0,e=>(Array.isArray(e)?e:[]).reduce((e,l)=>({total:n(e.total+(Number(null==l?void 0:l.total)||0)),totalPaid:n(e.totalPaid+(Number(null==l?void 0:l.paid)||0)),totalDiscount:n(e.totalDiscount+(Number(null==l?void 0:l.discountAmount)||0)),totalDue:n(e.totalDue+(Number(null==l?void 0:l.due)||0))}),{total:0,totalPaid:0,totalDiscount:0,totalDue:0}),"E5",0,e=>{var l;return Boolean((null==e?void 0:e.isB2BBill)||(null==e||null===(l=e.b2bCenter)||void 0===l?void 0:l._id)||(null==e?void 0:e.b2bCenter))},"X4",0,n,"wV",0,e=>n((Array.isArray(e)?e:[]).reduce((e,l)=>e+(Number(null==l?void 0:l.amount)||0),0))])},83274(e,l,t){t.d(l,["f",0,e=>{var l,t;return null==e||null===(l=e.toLowerCase())||void 0===l||null===(t=l.replace(/_/g," "))||void 0===t?void 0:t.replace(/\b\w/g,e=>e.toUpperCase())}])},19607(e,l,t){var n=t(8828),o=t(32858);const i=e=>({deleteBill:async l=>{try{await n.A.post("/billing/deleteBillByBillNumber",{billNumber:l}),o.Ay.success("Bill Deleted Successfully"),e(e=>!e)}catch(e){o.Ay.error("Failed to delete bill")}}});t.d(l,["A",0,i])},68492(e,l,t){t.r(l);var n=t(82056),o=t(25688),i=t(1203),a=t(84064),r=t(12853),d=t(8828),s=t(4159),u=t.n(s),c=t(9950),p=(t(44820),t(28728),t(3688),t(81593)),m=t(98341),v=t(47185),b=t(44414);const{RangePicker:y}=o.A,{Title:g,Text:f}=r.A,D=(0,m.Ng)((e,l)=>{var t;return{currentLab:null!=l&&l.labID?{_id:null==l?void 0:l.labID}:null==e||null===(t=e.user)||void 0===t?void 0:t.current_lab}},null)(e=>{let{currentLab:l}=e;const[t,o]=(0,c.useState)([]),[r,s]=(0,c.useState)(!1),[m,D]=(0,c.useState)([]),[h,C]=(0,c.useState)(!1),[A,S]=(0,c.useState)([u()((new Date).setHours(0,0,0)).subtract(1,"month"),u()((new Date).setHours(23,59,59))]),P=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:A;const l={headers:{Authorization:`Basic ${localStorage.getItem("adminToken")}`}},t=await d.A.get(`lab-payment/downloadExcelData?startDate=${e[0]}&endDate=${e[1]}`,l);D(t.data),C(!1)};let R=[];return m.map((e,l)=>{R.push({Date:u()(null==e?void 0:e.date).format("DD-MMMM-YY"),Particulars:null==e?void 0:e.labName,"Invoice Id":null==e?void 0:e.invoiceId,"Sub Total":null==e?void 0:e.subTotal,"GST Amount":null==e?void 0:e.gstAmount,"Total Amount":null==e?void 0:e.total,Duration:null==e?void 0:e.months,"State Code":null==e?void 0:e.state})}),(0,b.jsx)("div",{style:{padding:16},children:(0,b.jsxs)(n.A,{style:{border:"1px solid #d9d9d9",borderRadius:8},styles:{body:{padding:20}},children:[(0,b.jsxs)(a.A,{justify:"space-between",align:"center",wrap:"wrap",gap:16,children:[(0,b.jsxs)(a.A,{vertical:!0,gap:4,children:[(0,b.jsx)(g,{level:5,style:{margin:0},children:"Bulk Pay Receipt Download"}),(0,b.jsx)(f,{type:"secondary",style:{fontSize:13},children:"Select a date range to download invoice data as Excel"})]}),(0,b.jsxs)(a.A,{align:"center",gap:12,wrap:"wrap",children:[(0,b.jsx)(y,{defaultValue:A,onChange:async(e,l)=>{s(!0),C(!0);const t=[u()(new Date(l[0]).setHours(0,0,0)),u()(new Date(l[1]).setHours(23,59,59))];S(t),P(t)},allowClear:!1,style:{width:280},ranges:{Today:[u()(),u()()],"This Week":[u()().startOf("week"),u()().endOf("week")],"This Month":[u()().startOf("month"),u()().endOf("month")]}}),(0,b.jsx)(p.P,{csvData:R,fileName:"Invoice Data",loading:h,disabled:0===m.length})]})]}),m.length>0&&(0,b.jsx)("div",{style:{marginTop:16,padding:"12px 16px",background:"#f6ffed",borderRadius:6,border:"1px solid #b7eb8f"},children:(0,b.jsxs)(f,{children:[(0,b.jsx)(v.A,{style:{color:"#52c41a",marginRight:8}}),(0,b.jsx)("strong",{children:m.length})," invoice record",1!==m.length?"s":""," ready for download"]})}),0===m.length&&!h&&(0,b.jsx)("div",{style:{marginTop:24},children:(0,b.jsx)(i.A,{image:i.A.PRESENTED_IMAGE_SIMPLE,description:(0,b.jsx)(f,{type:"secondary",children:"Select a date range to fetch invoice data"})})})]})})});t.d(l,["default",0,D])}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.