hesabixCore/public_html/webui/assets/robika-0d07fc15.js

2 lines
13 KiB
JavaScript
Raw Normal View History

2025-03-21 14:20:43 +03:30
import{S as d,a as b,_ as w}from"./main-9b36f05f.js";import{h as $,a as h,o as r,s as c,e as t,ar as q,b as m,u,ab as p,B as n,d as i,F as D,C as B,t as F,w as k,A as g,_ as U}from"./vendor-adef9cb4.js";import{_ as j,a as x,b as N,c as S}from"./recList-3e892c5b.js";const Y=$({name:"rec",props:{totalAmount:Number,originalDoc:String,person:[String,Number],windowsState:Object},data:()=>({submitedDoc:{},des:"",items:[],date:"",year:{},listBanks:[],listSalarys:[],listCashdesks:[],totalPays:0,currencyConfig:{masked:!1,prefix:"",suffix:"ریال",thousands:",",decimal:".",precision:0,disableNegative:!1,disabled:!1,min:0,max:null,allowBlank:!1,minimumNumberOfCharacters:0,shouldRound:!0,focusOnRight:!0}}),methods:{fillWithTotal(o){o.bd=this.$props.totalAmount-this.totalPays},addItem(o){let s={},l=!0;o=="bank"?this.listBanks.length==0?(d.fire({text:"ابتدا یک حساب بانکی ایجاد کنید.در حال حاضر هیچ بانکی تعریف نشده است.",icon:"error",confirmButtonText:"قبول"}),l=!1):s={id:"",type:"bank",bank:{},cashdesk:{},salary:{},bs:0,bd:0,des:"",table:5,referral:""}:o=="cashdesk"?(this.listCashdesks.length==0&&(d.fire({text:"ابتدا یک صندوق ایجاد کنید.در حال حاضر هیچ صندوقی تعریف نشده است.",icon:"error",confirmButtonText:"قبول"}),l=!1),s={id:"",type:"cashdesk",bank:{},cashdesk:{},salary:{},bs:0,bd:0,des:"",table:121,referral:""}):o=="salary"?(this.listSalarys.length==0&&(d.fire({text:"ابتدا یک تخواه گردان ایجاد کنید.در حال حاضر هیچ تنخواه گردانی تعریف نشده است.",icon:"error",confirmButtonText:"قبول"}),l=!1),s={id:"",type:"salary",bank:{},cashdesk:{},salary:{},bs:0,bd:0,des:"",table:122,referral:""}):o=="cheque"&&(s={id:"",type:"cheque",bank:{},cashdesk:{},salary:{},bs:0,bd:0,des:"",table:125,referral:"",chequeBank:"",chequeDate:"",chequeSayadNum:"",chequeNum:"",chequeType:"input",chequeOwner:this.$props.person}),l&&this.items.push(s)},deleteItem(o){this.items.splice(o,1),this.calc()},loadData(){b.post("/api/bank/list").then(o=>{this.listBanks=o.data}),b.post("/api/salary/list").then(o=>{this.listSalarys=o.data}),b.post("/api/cashdesk/list").then(o=>{this.listCashdesks=o.data}),b.post("/api/year/get").then(o=>{this.year=o.data,this.date=o.data.now})},calc(){this.totalPays=0,this.items.forEach(o=>{this.totalPays+=parseInt(o.bd)})},async submit(){let o=[];if(this.$props.totalAmount<this.totalPays&&o.push("مبالغ وارد شده بیشتر از مبلغ فاکتور است."),this.items.forEach((s,l)=>{s.bd==0&&o.push("مبلغ صفر در ردیف "+(l+1)+" نا معتبر است."),s.type=="cheque"&&(s.chequeBank==""||s.chequeNum==""||s.chequeDate=="")&&(s.bank==null||Object.keys(s.bank).length==0)&&o.push("موارد الزامی ثبت چک در ردیف "+(l+1)+" وارد نشده است."),s.type=="bank"?(s.bank==null||Object.keys(s.bank).length==0)&&o.push("بانک در ردیف "+(l+1)+" انتخاب نشده است."):s.type=="salary"?(s.salary==null||Object.keys(s.salary).length==0)&&o.push("تنخواه گردان در ردیف "+(l+1)+" انتخاب نشده است."):s.type=="cashdesk"&&(s.cashdesk==null||Object.keys(s.cashdesk).length==0)&&o.push("صندوق در ردیف "+(l+1)+" انتخاب نشده است.")}),this.items.length==0)d.fire({text:"هیچ دریافتی ثبت نشده است.",icon:"error",confirmButtonText:"قبول"});else if(o.length!=0){let s='<ul class="justify-content-center">';o.forEach(l=>{s+='<div class="">'+l+"</div>"}),s+="</ul>",d.fire({html:s,icon:"error",confirmButtonText:"قبول"})}else{let s=[...this.items];s.forEach(l=>{l.type=="bank"?l.id=l.bank.id:l.type=="salary"?l.id=l.salary.id:l.type=="cashdesk"&&(l.id=l.cashdesk.id),l.des==""&&(l.des="دریافت وجه فاکتور شماره "+this.$props.originalDoc)}),s.push({id:this.$props.person,type:"person",bd:0,bs:this.totalPays,table:3,des:"دریافت وجه فاکتور شماره "+this.$filters.formatNumber(this.$props.originalDoc)}),this.des==""&&(this.des="