var K=Object.defineProperty,ee=Object.defineProperties;var te=Object.getOwnPropertyDescriptors;var A=Object.getOwnPropertySymbols;var ae=Object.prototype.hasOwnProperty,oe=Object.prototype.propertyIsEnumerable;var H=(i,o,u)=>o in i?K(i,o,{enumerable:!0,configurable:!0,writable:!0,value:u}):i[o]=u,P=(i,o)=>{for(var u in o||(o={}))ae.call(o,u)&&H(i,u,o[u]);if(A)for(var u of A(o))oe.call(o,u)&&H(i,u,o[u]);return i},$=(i,o)=>ee(i,te(o));import{d as le,u as re,i as v,W as k,o as m,j as p,c as a,w as n,b as t,a as B,Z as ne,e as c,U as ue,x as se,f as _,t as b,F as D,n as S,H as ie,J as E,aN as me,aq as ce,B as pe,aO as _e,aP as de,aQ as ve}from"./index.29cf2edd.js";/* empty css              *//* empty css              *//* empty css              *//* empty css              *//* empty css              *//* empty css              *//* empty css              *//* empty css              *//* empty css              */import{R as fe}from"./ReportService.10f7d665.js";import{f as I}from"./filters.69c883c5.js";import{_ as ye}from"./ReportGroupSelection.4516a291.js";import{_ as he}from"./BuyModeSelection.7846d63e.js";import{_ as ge}from"./StatusSelection.682823fe.js";import{_ as xe}from"./HospitalSelection.c3cfe7ce.js";import{_ as Ce}from"./PurposeSelection.b97f97a6.js";const ke=_("Search"),be=_("Clear"),Se=_("Excel "),Ne={key:0},Ye={key:1},Me={key:2},Le={key:3},Oe=_("Total"),ze=le({__name:"ClaimSummaryReport",setup(i){const o=[{title:"Date",dataIndex:"txtime",key:"txtime"},{title:"Claim Orders",dataIndex:"total",key:"total"},{title:"Volume",dataIndex:"volume",key:"volume"}],u=re();let s=v(),l=v();const d=v([]);let f=v(),g=v(),x=v(),C=v();const R=k(()=>{let e=0,r=0;return s.value.forEach(({total:M,volume:h})=>{e+=Number(M),r+=Number(h)}),{totalOrders:e,totalVolume:r}}),V=e=>{if(s.value=[],e==="LOCATION")return l.value=void 0,S.warn("Can't report group by location");e==="HOSPITAL"&&(f.value=void 0),l.value=e},G=e=>{C.value=e},F=e=>{g.value=e},U=e=>{x.value=e},X=e=>{if(l.value==="HOPITAL")return S.warn("Report group by hospital, Can't choose service hospital"),f.value=void 0;f.value=e},j=async()=>{if(!l.value)return S.warn("Please choose a report group");if(!N.value&&!Y.value)return S.warn("Please choose report date");const e={reportGroup:l.value,fromdate:N.value,todate:Y.value,hospital:f.value,purpose:g.value,buyMode:x.value,status:C.value};ie(),await fe.getClaimSummaryReport(e).then(r=>{E(),s.value=r.data}).catch(r=>{E()})},q=()=>{l.value=void 0,d.value=[],f.value=void 0,g.value=void 0,x.value=void 0,C.value=void 0},z=()=>{const e=`${l.value}_Report.${N.value}.${Y.value}.xlsx`;me(e,T.value)},N=k(()=>d.value[0]?d.value[0].format("YYYY-MM-DD"):null),Y=k(()=>d.value[1]?d.value[1].format("YYYY-MM-DD"):null),T=k(()=>s&&s.value.length>0?s.value.map(e=>{let r=e.txtime;return l.value==="DAILY"&&(r=I.formatDob(r)),l.value==="MONTHLY"&&(r=r.toString().padStart(2,"0")),$(P({},e),{total:Number(e.total),volume:Number(e.volume),txtime:r})}):s.value);return(e,r)=>{const M=ce,h=pe,J=ue,L=_e,w=de,Q=ve,W=se;return m(),p("div",null,[a(J,{size:8,style:{"margin-bottom":"8px"}},{default:n(()=>[a(ye,{value:t(l),onChange:V},null,8,["value"]),a(M,{value:d.value,"onUpdate:value":r[0]||(r[0]=y=>d.value=y)},null,8,["value"]),["ADMIN","ACCOUNTING"].includes(t(u).role)?(m(),B(xe,{key:0,value:t(f),onChange:X},null,8,["value"])):c("",!0),a(Ce,{value:t(g),onChange:F},null,8,["value"]),a(he,{value:t(x),onChange:U},null,8,["value"]),a(ge,{value:t(C),onChange:G},null,8,["value"]),a(h,{onClick:j},{default:n(()=>[ke]),_:1}),a(h,{onClick:q},{default:n(()=>[be]),_:1}),a(h,{disabled:!t(s)||t(s)&&t(s).length===0,type:"primary",onClick:z},{default:n(()=>[Se]),_:1},8,["disabled"])]),_:1}),t(s)?(m(),B(W,{key:0,columns:o,"data-source":t(T),pagination:!1},ne({headerCell:n(({column:y,text:Z,record:O})=>[y.key==="txtime"?(m(),p(D,{key:0},[t(l)==="DAILY"?(m(),p("span",Ne,"Date")):c("",!0),t(l)==="MONTHLY"?(m(),p("span",Ye,"Month")):c("",!0),t(l)==="YEARLY"?(m(),p("span",Me,"Year")):c("",!0),t(l)==="HOSPITAL"?(m(),p("span",Le,"Hospital")):c("",!0)],64)):c("",!0)]),bodyCell:n(({column:y,text:Z,record:O})=>[y.key==="txtime"?(m(),p(D,{key:0},[_(b(O.txtime),1)],64)):c("",!0),y.key==="volume"?(m(),p(D,{key:1},[_(b(t(I).formatMoney(O.volume)),1)],64)):c("",!0)]),_:2},[t(s)?{name:"summary",fn:n(()=>[a(Q,null,{default:n(()=>[a(L,null,{default:n(()=>[Oe]),_:1}),a(L,null,{default:n(()=>[a(w,{type:"success"},{default:n(()=>[_(b(t(R).totalOrders),1)]),_:1})]),_:1}),a(L,null,{default:n(()=>[a(w,{type:"success"},{default:n(()=>[_(b(t(I).formatMoney(t(R).totalVolume)),1)]),_:1})]),_:1})]),_:1})])}:void 0]),1032,["data-source"])):c("",!0)])}}});export{ze as default};
