"use strict";(self["webpackChunkacctg_ui"]=self["webpackChunkacctg_ui"]||[]).push([[7149],{7149:function(t,e,a){a.r(e),a.d(e,{default:function(){return D}});a(560);var n=a(6252),l=a(2262),s=a(9963),o=(a(7303),a(7810)),r=a(4530),c=a(2201),i=a(7530),u=a(8291),d=a(466);const m=(0,n.uE)('<div class="d-flex justify-content-between align-items-center mb-4"><h2>Receipts</h2><span><button class="btn btn-sm btn-primary mx-1"><svg xmlns="http://www.w3.org/2000/svg" width="1.3em" height="1.3em" viewBox="0 0 24 24"><path fill="white" d="M19 8h-1V3H6v5H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3M8 5h8v3H8zm8 12v2H8v-4h8zm2-2v-2H6v2H4v-4c0-.55.45-1 1-1h14c.55 0 1 .45 1 1v4z"></path><circle cx="18" cy="11.5" r="1" fill="white"></circle></svg> Print </button></span></div>',1),p={class:"row"},h={class:"d-flex col-8 col-md-5 align-items-center mb-4"},v=(0,n._)("div",{class:"flex-pill text-nowrap"},"Transaction Dates: ",-1),w=(0,n._)("span",null,"-",-1),f={class:"d-flex col-3 col-md-6 align-items-center mb-4"},b={class:"row"},_=(0,n._)("thead",null,[(0,n._)("tr",null,[(0,n._)("th",{style:{width:"12%"}},"Posted Date"),(0,n._)("th",{style:{width:"12%"}},"Trans Date"),(0,n._)("th",{style:{width:"15%"}},"Voucher #"),(0,n._)("th",null,"Particulars"),(0,n._)("th",{style:{width:"15%"}},"Amount"),(0,n._)("th",{style:{width:"8%"}},"Status")])],-1);var y={__name:"ReceiptList",setup(t){const e=(0,l.iH)([]),a=(0,l.qj)({});let y=(0,l.qj)({from:D(),to:D()});function g(t){const e=window.$("#disbursementVoucherTable").DataTable();e.on("click","tr",(function(t){const a=e.row(this).data();void 0!==a&&H.push({name:"receiptDetails",params:{code:a.code}})}))}function D(){let t=(new Date).getDate(),e=(new Date).getMonth()+1;return e<10&&(e="0"+e),t<10&&(t="0"+t),(new Date).getFullYear()+"-"+e+"-"+t}const x=async()=>{e.value=await(0,u.go)("entities",null,null,"all")},U=t=>{let a=e.value?.filter((e=>e.code===t));if(void 0!==a)return a[0]?a[0].name:""},H=(0,c.tv)(),k=(0,l.iH)([{data:"postedDate"},{data:"transDate"},{data:"reference"},{data:"particulars"},{data:"amount"},{data:null,render:function(t,e,a,n){return"posted"===t.status?`<span style="color: #009e1a" class="fw-bold"> ${t.status.toUpperCase()}</span>`:`<span class="fw-bold" style="color: #999999"> ${t.status.toUpperCase()}</span>`}}]),V=async()=>{let t=await(0,i.Z)("journal_entry","list").addPayload("conditions",{type:"receipt:"+y.from+":"+y.to}).execute();if(t){if(t.data.code)return void await d.w.failedAlert("Failed to retrieve list!","SERVER ERROR");let e=t.data.data,n=[];for(let t in e){let a={code:e[t].code,entityName:U(e[t].entity),entryDate:e[t].entry_date,postedDate:e[t].posted_date,transDate:e[t].transaction_date,reference:e[t].reference_number,particulars:e[t].particulars,amount:e[t].amount,status:e[t].status};n.push(a)}a.value=n,console.log(a)}},R=()=>{H.push({name:"receiptNew"})};return(0,n.bv)((async()=>{g(),await x(),await V()})),(t,e)=>((0,n.wg)(),(0,n.iD)("div",null,[m,(0,n._)("div",p,[(0,n._)("div",h,[v,(0,n.wy)((0,n._)("input",{type:"date",class:"form-control form-control-sm mx-2","onUpdate:modelValue":e[0]||(e[0]=t=>(0,l.SU)(y).from=t)},null,512),[[s.nr,(0,l.SU)(y).from]]),w,(0,n.wy)((0,n._)("input",{type:"date",class:"form-control form-control-sm mx-2","onUpdate:modelValue":e[1]||(e[1]=t=>(0,l.SU)(y).to=t)},null,512),[[s.nr,(0,l.SU)(y).to]]),(0,n._)("button",{class:"btn btn-primary btn-sm",onClick:V},"Generate")]),(0,n._)("div",f,[(0,n._)("span",null,[(0,n._)("button",{onClick:R,class:"btn btn-sm btn-success"},[(0,n.Wm)((0,l.SU)(o.GN),{icon:"plus"}),(0,n.Uk)(" New Voucher ")])])])]),(0,n._)("div",b,[(0,n._)("div",null,[(0,n.Wm)(r.Z,{columns:k.value,"table-id":"disbursementVoucherTable",data:a.value,class:"ar-list-table disbursement-voucher-table"},{tableHeader:(0,n.w5)((()=>[_])),_:1},8,["columns","data"])])])]))}};const g=y;var D=g}}]);
//# sourceMappingURL=7149.85ca86cb.js.map