PageSourceSearch

https://ehr.roojh.com/assets/Billing-BrSEmCbN.js

js roojh.com collected 2026-09-24 14:20:18 UTC 17,510 bytes, 57 lines download raw bytes

1import{I as ae,R as l,r as ne,j as e,a as R,B as j}from"./index-BPZ0Tu-q.js";import{r as E}from"./runtime-env-45ArgfY6.js";import"./provider.service-B5u76bkC.js";import{d as L}from"./dayjs.min-TkjlUj6H.js";import{h as z}from"./moment-9orjG3iL.js";import{E as F}from"./export-BZMcAhIn.js";import{b as ie}from"./billing.service-h69Wgdz7.js";import{d as oe}from"./ArrowBackIosNew-CUEleMrs.js";import{C as le}from"./Vector-DTgnXEMO.js";import{C as ce}from"./Cohort-CLGKa6XA.js";import{S as de}from"./index-6l0XkpUM.js";import{T as pe,a as me,b as xe,c as W,d as r,e as he}from"./TableRow-BrtFur_T.js";import{P as ge}from"./Paper-BVAQp4ao.js";import{T as ue}from"./TablePagination-C9VoXh5k.js";import{s as $}from"./styled-BHCmf7oE.js";import"./routing-constants-D_d4teuM.js";import"./createSvgIcon-C0tb55I3.js";import"./debounce-B4KKL1rx.js";import"./isMuiElement-CWMwEMB2.js";import"./useId-DWBHnGLh.js";import"./useControlled-Cv_cl0Xp.js";import"./useIsFocusVisible-Di6E_YNW.js";import"./Close-KlLk42XR.js";import"./calendar-Cg_5Be6l.js";import"./Clear-BvGSht3H.js";import"./useDrugSearch-CFWmLqcY.js";import"./useProblemListSearch-7lPr4W5x.js";/* empty css                        */import"./Drawer-B-78RTPq.js";import"./index-CW4QP1nW.js";import"./AppBar-BxCiflMh.js";import"./Toolbar-A3Afcs6V.js";import"./IconButton-DoiAad2V.js";import"./ButtonBase-CHULMRoT.js";import"./assertThisInitialized-CPFABtj-.js";import"./Autocomplete-B_eXESzC.js";import"./Select-C640dA7O.js";import"./Menu-Cr-M7AtH.js";import"./Grow-CZWrO_XV.js";import"./OutlinedInput-BG32hfBd.js";import"./useFormControl-CzRgK9dn.js";import"./formControlState-CBHnTVNO.js";import"./Close-BxcxgM3p.js";import"./Popper-B7Q3ae_V.js";import"./useAutocomplete-CEUMFsnu.js";import"./Chip-DqqdEzfd.js";import"./TextField-DKiK-DV-.js";import"./FormControl-BWxzUfhh.js";import"./Button-CJX4vknK.js";import"./FormControlLabel-CQTFdK6G.js";import"./Stack-ytE0SEjs.js";import"./useThemeProps-amPutscP.js";import"./Switch-UpWYmvby.js";import"./SwitchBase-B9Y6hk3V.js";import"./useMobilePicker-CmnR_Fdz.js";import"./index-DEqVrWaX.js";import"./InputAdornment-DZJFSC8_.js";import"./visuallyHidden-HYUTdpYY.js";import"./createStyled-CnDF2OVD.js";import"./colorManipulator-DKgO1_i6.js";import"./Dialog-BlI2Fgst.js";import"./DialogContent-B16Ubs63.js";import"./dialogTitleClasses-BxAwWPO8.js";import"./DialogActions-DLhv-LTc.js";import"./ListItem-DoQu-Ax2.js";import"./AdapterDayjs-lcb235sU.js";import"./DatePicker-CtVHib-X.js";import"./Slider-CvndnS_g.js";import"./makeStyles-C_DbDCM5.js";import"./type-BOs2CKZ_.js";import"./upperFirst-B2_JZY_H.js";import"./isSymbol-DyhhpcDe.js";import"./asyncToGenerator-BTCRlQa5.js";import"./debounce-DKKbMOut.js";import"./KeyboardArrowRight-Dpn8tVt8.js";import"./LastPage-DunrSXZd.js";import"./MenuItem-CkoW2deP.js";(function(){try{var i=typeof globalThis<"u"?globalThis:typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{};i["__faroGitHash_roojh-web"]="e10f4edfac9af7700f53a2e4507d7c1e30f45024"}catch{}})();(function(){try{var i=typeof globalThis<"u"?globalThis:typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{};i["__faroBundleId_roojh-web"]="1790253054184ad54def21a"}catch{}})();const Y=$(r)(({theme:i})=>({position:"sticky",backgroundColor:"grey",zIndex:9999}));$(Y)({left:0});$(Y)({left:100});const n={minWidth:"90px",background:"#EFF5FF",height:"37px",color:"#204289 !important",padding:"0px 16px 0px 16px !important",fontSize:"11px",whiteSpace:"nowrap"},U=i=>i?typeof i=="string"?i:typeof i=="object"?i.value||i.label||i.key||i.code||i.name||"":String(i):"",d=i=>Array.isArray(i)?i.map(U).filter(Boolean).join(","):U(i),Gt=()=>{const{hasPermissionBy:i}=ae(),D=i("featureName","Billing Reports","canView"),[K,C]=l.useState([]),[_,M]=l.useState(0),[H,O]=l.useState(10),[G,A]=l.useState(0),[S,y]=l.useState({startDate:"",endDate:"",pageNo:1,pageSize:100}),s=ne.useRef(S),w=L();L("2024-06-20");const[V,g]=l.useState(!1),[fe,je]=l.useState(w),[ye,be]=l.useState(w),[Ne,De]=l.useState(w),[T,Se]=l.useState("IPD"),[q,v]=l.useState(!1);l.useEffect(()=>{const t={startDate:b(new Date),endDate:b(new Date),patientType:T,pageNo:1,pageSize:10};y(a=>({...a,...t}))},[]),l.useEffect(()=>{s.current=S},[S]);const b=t=>{if(t){const a=t.getFullYear(),o=String(t.getMonth()+1).padStart(2,"0"),p=String(t.getDate()).padStart(2,"0");return`${a}-${o}-${p}`}},B=t=>{const a=new Date(t),o={timeZone:"Asia/Kolkata",day:"2-digit",month:"2-digit",year:"numeric"};
1return a.toLocaleString("en-IN",o).replace(/\//g,"-").replace(",","")},P=async(t,a=T)=>{var x,u;console.log("params",t),g(!0);const o=localStorage.getItem("enterpriseId"),p=d(t.patientType)||d(a)||d(T)||"IPD";try{const c=await ie.getBillingReport({enterpriseId:o,billType:p,startDate:t.startDate||B(new Date),endDate:t.endDate||B(new Date),name:t.name||"",tags:t.tags||[],gender:t.gender||"",registerBeforeDate:t.registerBeforeDate||"",registerAfterDate:t.registerAfterDate||"",recentlyActiveWithinLast:t.recentlyActiveWithinLast||"",notActiveWithinLast:t.notActiveWithinLast||"",diagnosis:t.diagnosis||[],medications:t.medications||[],facilityId:t.facilityId||"",age:t.age||[],pageNo:t.pageNo||1,pageSize:t.pageSize||10,searchKey:t.searchKey||"",consultants:t.consultants||[],referringDoctors:t.referringDoctors||[],billStatus:t.billStatus||"",serviceName:t.serviceName||""});c.data&&(C(c.data),A(c.data.length))}catch(c){console.log("error",c),C([]),A(0),j.error(((u=(x=c==null?void 0:c.response)==null?void 0:x.data)==null?void 0:u.message)||"Unable to load the billing report")}finally{g(!1)}},Q=(t,a)=>{const o={...s.current,pageNo:a+1,pageSize:s.current.pageSize};y(p=>({...p,...o})),P(o),M(a)},X=t=>{O(parseInt(t.target.value,10));const a={...s.current,pageNo:s.current.pageNo,pageSize:parseInt(t.target.value,10)};y(o=>({...o,...a})),P(a)},Z=async()=>{var a;const t=String(E.nodeApiBaseUrl||"").replace(/\/+$/,"");g(!0),console.log("filterParamsRef.current",s.current);try{const o=d(s.current.patientType)||"IPD",p=Array.isArray(s.current.age)?s.current.age:[0,0],x=`[${p[0]||0},${p[1]||0}]`;console.log(x);const u=d(s.current.consultants),c=d(s.current.referringDoctors),I=`${t}/api/v1/billingServices/getPatientsBill?enterpriseId=${localStorage.getItem("enterpriseId")}&billType=${o}&startDate=${s.current.startDate}&endDate=${s.current.endDate}&returnType=xlsx&gender=${s.current.gender||""}&ageRange=${x}&searchKey=${s.current.searchKey||""}&consultantName=${u}&referredByConsultantName=${c}&billStatus=${encodeURIComponent(s.current.billStatus||"")}&serviceName=${encodeURIComponent(s.current.serviceName||"")}`,m=await R({method:"get",url:I,headers:{Authorization:sessionStorage.getItem("idToken")}});if(!((a=m.data)!=null&&a.url))throw new Error("No download URL received");const N=await R({method:"get",url:m.data.url,responseType:"blob"}),h=document.createElement("a");h.href=window.URL.createObjectURL(new Blob([N.data]));const f=`report_${s.current.startDate}_${s.current.endDate}.xlsx`;h.setAttribute("download",f),document.body.appendChild(h),h.click(),document.body.removeChild(h)}catch(o){console.error("Error downloading the file:",o),j.error("Error downloading Excel file")}finally{g(!1)}},J=async()=>{const t=String(E.nodeApiBaseUrl||"").replace(/\/+$/,"");g(!0);try{const a=d(s.current.patientType)||"IPD",o=Array.isArray(s.current.age)?s.current.age:[0,0],p=`[${o[0]||0},${o[1]||0}]`,x=d(s.current.consultants),u=d(s.current.referringDoctors),c=`${t}/api/v1/billingServices/getPatientsBill?enterpriseId=${localStorage.getItem("enterpriseId")}&billType=${a}&startDate=${s.current.startDate}&endDate=${s.current.endDate}&returnType=pdf&gender=${s.current.gender||""}&ageRange=${p}&searchKey=${s.current.searchKey||""}&consultantName=${x}&referredByConsultantName=${u}&billStatus=${encodeURIComponent(s.current.billStatus||"")}&serviceName=${encodeURIComponent(s.current.serviceName||"")}`,I=await R({method:"get",url:c,headers:{Authorization:sessionStorage.getItem("idToken")},responseType:"blob"}),m=document.createElement("iframe");m.style.display="none",document.body.appendChild(m);const N=m.contentDocument||m.contentWindow.document,h=`
2        <style>
3          @media print {
4            @page {
5              size: landscape;
6              margin: 5mm;
7              width: 100%;
8            }
9            @page :first {
10              margin-top: 0;
11            }
12            @page :left {
13              margin-header: 0;
14              margin-footer: 0;
15            }
16            @page :right {
17              margin-header: 0;
18              margin-footer: 0;
19            }
20            html, body {
21              margin: 0;
22              padding: 0;
23              width: 100%;
24              max-width: 100%;
25              -webkit-print-color-adjust: exact !important;
26              print-color-adjust: exact !important;
27            }
28            table {
29              width: 100%;
30              max-width: 100%;
31              table-layout: fixed;
32              border-collapse: collapse;
33              font-size: 6pt;
34            }
35            th, td {
36              padding: 1px 2px;
37              border: 1px solid #ddd;
38              text-align: center;
39              white-space: nowrap;
40              overflow: hidden;
41              text-overflow: ellipsis;
42            }
43            th {
44              background-color: #f5f5f5 !important;
45            }
46            thead {
47              display: table-header-group;
48            }
49            tfoot {
50              display: none !important;
51            }
52            @page { size: landscape }
53            @page :left { @bottom-left { content: ""; } @bottom-right { content: ""; } }
54            @page :right { @bottom-left { content: ""; } @bottom-right { content: ""; } }
55          }
56        </style>
57      `,f=new FileReader;f.onload=function(){const k=f.result;k.trim()?(N.write(`<!DOCTYPE html><html><head>${h}</head><body>${k}</body></html>`),N.close(),setTimeout(()=>{try{m.contentWindow.print()}catch(se){console.error("Print error:",se),j.error("Error printing document")}finally{document.body.removeChild(m)}},500)):(document.body.removeChild(m),j.info("No data to print"))},f.readAsText(I.data)}catch(a){console.error("Error details:",a),j.error(a.message||"Error generating PDF report")}finally{g(!1)}},ee=()=>{window.history.back()},te=(t=!0)=>{v(t)},re=t=>{console.log("coModified cohort for search: billing",t);const a={startDate:t.startDate?b(t.startDate.$d):"",endDate:t.endDate?b(t.endDate.$d):"",name:t.name||"",tags:t.tags||[],gender:t.gender||"",registerBeforeDate:t.registerBeforeDate||"",registerAfterDate:t.registerAfterDate||"",recentlyActiveWithinLast:t.recentlyActiveWithinLast||"",notActiveWithinLast:t.notActiveWithinLast||"",diagnosis:t.diagnosis||[],medications:t.medications||[],enterpriseId:localStorage.getItem("enterpriseId"),facilityId:t.facilityId||"",age:t.age||[],pageNo:1,pageSize:10,searchKey:t.searchKey||"",consultants:d(t.consultants||t.consultant),referringDoctors:d(t.referringDoctors||t.referringDoctor),patientType:d(t.patientType),billStatus:t.billStatus||"",serviceName:t.serviceName||""};y(o=>({...o,...a})),P(a),v(!1)};return D.visible?e.jsxs("div",{className:"billing-report",children:[V?e.jsx("div",{className:"loader",children:e.jsx(de,{size:"large"})}):"",e.jsxs("div",{style:{display:"flex",width:"100%",height:"50px",marginBottom:"10px",borderBottom:"1px solid #D9D9D9",padding:"15px 0px 0px 2px;"},children:[e.jsx("div",{style:{width:"45%",paddingTop:"14px"},children:e.jsxs("span",{onClick:ee,style:{fontFamily:"Rubik",fontSize:"15px",fontWeight:"500",letterSpacing:"0.001em",cursor:"pointer",display:"flex",alignItems:"center",gap:"5px",color:"#204289",lineHeight:"1"},children:[e.jsx(oe,{sx:{fontSize:"18px"}})," ","Billing Report"]})}),e.jsxs("div",{style:{width:"55%",display:"flex",justifyContent:"end",paddingRight:"15px"},children:[e.jsx("div",{style:{paddingTop:"12px",marginLeft:"7px"},children:e.jsxs("button",{className:"cohort-search-btn",style:{backgroundColor:"white",border:"1px solid #d9d9d9",borderRadius:"5px",padding:"3px",paddingLeft:"10px",paddingRight:"10px",display:"flex",alignItems:"center"},onClick:()=>te(!0),children:[e.jsx("img",{src:le,style:{marginRight:"9px"}}),"Cohort Search"]})}),e.jsx("span",{style:{paddingTop:"14px",marginRight:"7px",marginLeft:"7px"}}),e.jsx("div",{style:{paddingTop:"12px"},children:e.jsxs("button",{className:"export-btn",onClick:Z,children:[e.jsx("img",{src:F})," Export Excel"]})}),e.jsx("span",{style:{paddingTop:"14px",marginRight:"7px",marginLeft:"7px"}}),e.jsx("div",{style:{paddingTop:"12px"},children:e.jsxs("button",{className:"export-btn",onClick:J,children:[e.jsx("img",{src:F})," Export PDF"]})})]})]}),e.jsx(ce,{state:q,setOpenDrawer:v,search:re,cohortType:"billing"}),e.jsx(pe,{component:ge,style:{maxHeight:"calc(100vh - 170px)",width:"calc(100vw - 65px)",maxWidth:"calc(100vw - 65px)",marginRight:"10px",overflowX:"auto"},children:e.jsxs(me,{stickyHeader:!0,sx:{minWidth:"2200px"},children:[e.jsx(xe,{children:e.jsxs(W,{sx:{height:"20px"},children:[e.jsx(r,{sx:n,children:e.jsx("span",{className:"report-head-text",children:"S.No."})}),e.jsx(r,{sx:n,children:e.jsx("span",{className:"report-head-text",children:"UHID"})}),e.jsx(r,{sx:n,children:e.jsx("span",{className:"report-head-text",children:"IPD Number"})}),e.jsx(r,{sx:n,children:e.jsx("span",{className:"report-head-text",children:"Patient Name"})}),e.jsx(r,{sx:n,children:e.jsx("span",{className:"report-head-text",children:"DOB"})}),e.jsx(r,{sx:n,children:e.jsx("span",{className:"report-head-text",children:"Gender"})}),e.jsx(r,{sx:n,children:e.jsx("span",{className:"report-head-text",children:"Invoice Date"})}),e.jsx(r,{sx:n,children:e.jsx("span",{className:"report-head-text",children:"Invoice Number"})}),e.jsx(r,{sx:n,children:e.jsx("span",{className:"report-head-text",children:"Bill Type"})}),e.jsx(r,{sx:n,children:e.jsx("span",{className:"report-head-text",children:"Doctor Name"})}),e.jsx(r,{sx:n,children:e.jsx("span",{className:"report-head-text",children:"Service Type"})}),e.jsx(r,{sx:n,children:e.jsx("span",{className:"report-head-text",children:"Service Name"})}),e.jsx(r,{sx:n,children:e.jsx("span",{className:"report-head-text",children:"Quantity"})}),e.jsx(r,{sx:n,children:e.jsx("span",{className:"report-head-text",children:"Price"})}),e.jsx(r,{sx:n,children:e.jsx("span",{className:"report-head-text",children:"Discount"})}),e.jsx(r,{sx:n,children:e.jsx("span",{className:"report-head-text",children:"GST %"})}),e.jsx(r,{sx:n,children:e.jsx("span",{className:"report-head-text",children:"Total Paid"})}),e.jsx(r,{sx:n,children:e.jsx("span",{className:"report-head-text",children:"Payment Type"})}),e.jsx(r,{sx:n,children:e.jsx("span",{className:"report-head-text",children:"Balance"})}),e.jsx(r,{sx:n,children:e.jsx("span",{className:"report-head-text",children:"Status"})}),e.jsx(r,{sx:n,children:e.jsx("span",{className:"report-head-text",children:"Deposited Amount"})}),e.jsx(r,{sx:n,children:e.jsx("span",{className:"report-head-text",children:"refundAmount"})}),e.jsx(r,{sx:n,children:e.jsx("span",{className:"report-head-text",children:"remark"})})]})}),e.jsx(he,{children:K.map((t,a)=>e.jsxs(W,{children:[e.jsx(r,{children:e.jsx("span",{className:"row-text",children:a+1})}),e.jsx(r,{children:e.jsx("span",{className:"row-text",children:t.uhid||"-"})}),e.jsx(r,{children:e.jsx("span",{className:"row-text",children:t.ipdNumber||"-"})}),e.jsx(r,{children:e.jsx("span",{className:"row-text",children:t.name||"-"})}),e.jsx(r,{children:e.jsx("span",{className:"row-text",children:t.dob?z(t.dob).format("DD-MM-YYYY"):"-"})}),e.jsx(r,{children:e.jsx("span",{className:"row-text",children:t.gender||"-"})}),e.jsx(r,{children:e.jsx("span",{className:"row-text",children:t.invoiceDate?z(t.invoiceDate).format("DD-MM-YYYY"):"-"})}),e.jsx(r,{children:e.jsx("span",{className:"row-text",children:t.invoiceNumber||"-"})}),e.jsx(r,{children:e.jsx("span",{className:"row-text",children:t.billType||"-"})}),e.jsx(r,{children:e.jsx("span",{className:"row-text",children:t.doctorName||"-"})}),e.jsx(r,{children:e.jsx("span",{className:"row-text",children:t.serviceType||"-"})}),e.jsx(r,{children:e.jsx("span",{className:"row-text",children:t.serviceName||"-"})}),e.jsx(r,{children:e.jsx("span",{className:"row-text",children:t.quantity||"-"})}),e.jsx(r,{children:e.jsx("span",{className:"row-text",children:t.price||"-"})}),e.jsx(r,{children:e.jsx("span",{className:"row-text",children:t.discount??"-"})}),e.jsx(r,{children:e.jsx("span",{className:"row-text",children:t.gst||"-"})}),e.jsx(r,{children:e.jsx("span",{className:"row-text",children:t.refundAmount?"-":t.totalPaid||"-"})}),e.jsx(r,{children:e.jsx("span",{className:"row-text",children:t.paymentType||"-"})}),e.jsx(r,{children:e.jsx("span",{className:"row-text",children:t.balance||"-"})}),e.jsx(r,{children:e.jsx("span",{className:"row-text",children:t.isRefund?"Refund":t.status?t.status.charAt(0).toUpperCase()+t.status.slice(1):"-"})}),e.jsx(r,{children:e.jsx("span",{className:"row-text",children:t.depositAmount||"-"})}),e.jsx(r,{children:e.jsx("span",{className:"row-text",children:t.refundAmount||"-"})}),e.jsx(r,{children:e.jsx("span",{className:"row-text",children:t.remark||"-"})})]},a+1))})]})}),e.jsx(ue,{rowsPerPageOptions:[10,25,50],component:"div",count:G,rowsPerPage:H,page:_,onPageChange:Q,onRowsPerPageChange:X})]}):e.jsx("div",{style:{padding:24,color:"#b71c1c",fontWeight:500},children:"You do not have permission to view this report."})};export{Gt as default};

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.