@davoodmehraban89 / Factor-easy / commits / 433d461
Fork 0

سامانه صدور فاکتور و حسابداری

Clarify cheque lifecycle in account drilldown

davoodmehraban89 committed Sep 28, 2026 at 15:00 UTC 433d46105b2ffa34b73def1886312465aa22edee
1 file changed +1 -1
js/drilldown.js
+1 -1
@@ -12,7 +12,7 @@ window.openContactLedger=function(contactId){
12 const rows=[];
13 getMyInvoices().filter(i=>i.contactId===contactId).forEach(i=>rows.push({date:i.date,type:'فروش '+(i.paymentMethod==='credit'?'نسیه':'نقدی'),ref:i.number,name:(i.projectName?i.projectName+' — ':'')+(i.description||c.name),amount:i.grandTotal,action:invAction(i)}));
14 (datastore.purchases||[]).filter(p=>p.ownerUserId===currentUser.id&&p.supplierId===contactId).forEach(p=>rows.push({date:p.date,type:'خرید '+(p.paymentMethod==='credit'?'نسیه':'نقدی'),ref:p.number,name:(p.costCenterLabel?p.costCenterLabel+' — ':'')+(p.description||c.name),amount:p.grandTotal,action:purAction(p)}));
15 - getMyCheques().filter(q=>q.contactId===contactId||(!q.contactId&&q.contactName===c.name)).forEach(q=>rows.push({date:q.due_date,type:q.direction==='inbound'?'چک دریافتی':'چک پرداختی',ref:q.sayad_id,name:q.bank||c.name,amount:q.amount,action:chqAction(q)}));
15 + getMyCheques().filter(q=>q.contactId===contactId||(!q.contactId&&q.contactName===c.name)).forEach(q=>rows.push({date:q.due_date,type:(q.direction==='inbound'?'چک دریافتی':'چک پرداختی')+' — '+(q.status==='cleared'?'وصول/پرداخت شده':q.status==='bounced'?'برگشتی':q.status==='cancelled'?'باطل':'در جریان'),ref:q.sayad_id,name:q.bank||c.name,amount:q.amount,action:chqAction(q)}));
16 const sales=rows.filter(r=>r.type.startsWith('فروش')).reduce((a,r)=>a+r.amount,0);
17 const purchases=rows.filter(r=>r.type.startsWith('خرید')).reduce((a,r)=>a+r.amount,0);
18 const receivable=getMyInvoices().filter(i=>i.contactId===contactId&&i.paymentMethod==='credit').reduce((a,i)=>a+Number(i.grandTotal||0),0);