سامانه صدور فاکتور و حسابداری
feat(finance): wire draft-only accounting management and exclude unposted receivables from KPI
davoodmehraban89 committed
Oct 11, 2026 at 20:45 UTC
c3e6b94c7fba51e83d65daace1b75405d6ee176a
1 file changed
+1
-1
js/invoices.js
+1
-1
@@ -82,7 +82,7 @@ function commitSaveDefaultSettings(){
82
}
83
function renderDashboard(){
84
const cur=getCurrencyLabel(),myInvoices=getMyInvoices(),myPurchases=typeof getMyPurchases==='function'?getMyPurchases():[],myPayments=typeof getMyPayments==='function'?getMyPayments():[],companies=getMyCompanies(),settings=getMySettings(),activeCompId=settings.default_company_id||document.getElementById('invoice-company-id')?.value||(companies[0]?.id);
85
- const companyOk=x=>!activeCompId||x.companyId===activeCompId,inv=myInvoices.filter(companyOk),pur=myPurchases.filter(companyOk),pay=myPayments.filter(companyOk);
85
+ const companyOk=x=>!activeCompId||x.companyId===activeCompId,inv=myInvoices.filter(x=>companyOk(x)&&invoiceCreatesAccountingEntry(x.kind)&&invoiceDocumentStatus(x)==='posted'),pur=myPurchases.filter(companyOk),pay=myPayments.filter(companyOk);
86
const receivable=inv.filter(x=>x.paymentMethod==='credit').reduce((s,x)=>s+(typeof invoiceOutstanding==='function'?invoiceOutstanding(x):Number(x.grandTotal||0)),0);
87
const payable=pur.filter(x=>x.paymentMethod==='credit').reduce((s,x)=>s+(typeof purchaseOutstanding==='function'?purchaseOutstanding(x):Number(x.grandTotal||0)),0);
88
let assets=0,cash=0;try{if(window.P6Reports){const f=P6Reports.financials('','');assets=Number(f.assets||0);const cashId=typeof jeCashAccount==='function'?jeCashAccount()?.id||'':'';if(cashId){const row=P6Reports.rollup('','').find(x=>x.accountId===cashId);cash=Number(row?.balance||0)}}}catch(_){}