سامانه صدور فاکتور و حسابداری
Scope cheque settlements to active company
davoodmehraban89 committed
Sep 28, 2026 at 13:45 UTC
d29e4620c456d180a2432769041d7856e1d892ad
1 file changed
+1
-1
js/invoices.js
+1
-1
@@ -90,7 +90,7 @@ function renderDashboard(){
90
const filteredInvoices=activeCompId?myInvoices.filter(inv=>inv.companyId===activeCompId):myInvoices;
91
const cur=getCurrencyLabel();
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);
93
+ const inboundSettlements=myCheques.filter(q=>q.direction==='inbound'&&(!activeCompId||q.companyId===activeCompId||(!q.companyId&&myCompanies.length===1))).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');