(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[693],{67:function(){},2061:function(){},4397:function(e,t,n){Promise.resolve().then(n.bind(n,6403))},6403:function(e,t,n){"use strict";n.d(t,{default:function(){return d}});var a=n(7437),r=n(1649),s=n(2735),l=n(2093),c=n(3375),i=n(4457),o=n.n(i);function d(e){let{ledger:t,companyName:n}=e,i=async()=>{let e=document.querySelector(".printable-area");if(!e)return;let t=document.querySelectorAll(".no-print");t.forEach(e=>e.style.display="none");try{let t=await o()(e,{scale:2,useCORS:!0}),a=t.toDataURL("image/png"),r=new c.ZP("p","mm","a4"),s=r.internal.pageSize.getWidth(),l=t.height*s/t.width,i=r.internal.pageSize.getHeight(),d=l,u=0;for(r.addImage(a,"PNG",0,u,s,l),d-=i;d>=0;)u=d-l,r.addPage(),r.addImage(a,"PNG",0,u,s,l),d-=i;r.save("كشف_حساب_".concat(n.replace(/\\s+/g,"_"),".pdf"))}finally{t.forEach(e=>e.style.display="")}};return(0,a.jsxs)("div",{style:{display:"flex",gap:"0.5rem"},className:"no-print",children:[(0,a.jsxs)("button",{onClick:()=>{let e=t.map(e=>({التاريخ:e.date.toLocaleDateString("ar-SA"),البيان:e.desc,"مدين (لهم)":e.debit||"-","دائن (عليهم)":e.credit||"-","الرصيد التراكمي":e.runningBalance})),a=l.P6.json_to_sheet(e);a["!dir"]||(a["!dir"]="rtl");let r=l.P6.book_new();l.P6.book_append_sheet(r,a,"كشف الحساب"),l.NC(r,"كشف_حساب_".concat(n.replace(/\\s+/g,"_"),".xlsx"))},className:"btn btn-outline",style:{borderColor:"var(--success)",color:"var(--success)"},children:[(0,a.jsx)(r.Z,{size:18})," Excel"]}),(0,a.jsxs)("button",{onClick:i,className:"btn btn-primary",style:{backgroundColor:"#e74c3c"},children:[(0,a.jsx)(s.Z,{size:18})," PDF"]})]})}}},function(e){e.O(0,[425,337,505,125,378,478,117,744],function(){return e(e.s=4397)}),_N_E=e.O()}]);