@davoodmehraban89 / Factor-easy / commits / a8c6bf2
Fork 0

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

Reflect received cheques in outstanding receivables

davoodmehraban89 committed Sep 28, 2026 at 13:44 UTC a8c6bf27c516dd74a9f98523ae4c54c3e7f08d22
1 file changed +3 -1
js/invoices.js
+3 -1
@@ -89,7 +89,9 @@ function renderDashboard(){
89 const activeCompId=mySettings.default_company_id||document.getElementById('invoice-company-id')?.value||(myCompanies[0]?.id);
90 const filteredInvoices=activeCompId?myInvoices.filter(inv=>inv.companyId===activeCompId):myInvoices;
91 const cur=getCurrencyLabel();
92 - filteredInvoices.forEach(inv=>{salesSum+=inv.grandTotal;if(inv.paymentMethod==='credit')debtorsSum+=inv.grandTotal;});
92 + filteredInvoices.forEach(inv=>{salesSum+=Number(inv.grandTotal||0);if(inv.paymentMethod==='credit')debtorsSum+=Number(inv.grandTotal||0);});
93 + const inboundSettlements=myCheques.filter(q=>q.direction==='inbound').reduce((a,q)=>a+Number(q.amount||0),0);
94 + debtorsSum=Math.max(0,debtorsSum-inboundSettlements);
95 const salesEl=document.getElementById('kpi-sales-sum');
96 const settledEl=document.getElementById('kpi-settled-sum');
97 const debtorsEl=document.getElementById('kpi-debtors-sum');