سامانه صدور فاکتور و حسابداری
Mirrored from https://github.com/davoodmehraban89/Factor-easy.git
Synced Dec 4, 01:45 UTC
Use allocated receipts for real invoice receivables
davoodmehraban89 committed
Sep 28, 2026 at 15:07 UTC
13c9f3c9d945be10f7f9fa3e57f3e64077fef07f
1 file changed
+1
-1
js/invoices.js
+1
-1
@@ -89,7 +89,7 @@ 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+=Number(inv.grandTotal||0);if(inv.paymentMethod==='credit')debtorsSum+=Number(inv.grandTotal||0);});
92
+ filteredInvoices.forEach(inv=>{salesSum+=Number(inv.grandTotal||0);if(inv.paymentMethod==='credit')debtorsSum+=(typeof invoiceOutstanding==='function'?invoiceOutstanding(inv):Number(inv.grandTotal||0));});
93
const inboundSettlements=myCheques.filter(q=>q.direction==='inbound'&&q.status==='cleared'&&(!activeCompId||q.companyId===activeCompId||(!q.companyId&&myCompanies.length===1))).reduce((a,q)=>a+Number(q.amount||0),0);
94
const appliedInbound=Math.min(debtorsSum,inboundSettlements);
95
debtorsSum=Math.max(0,debtorsSum-appliedInbound);