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

Preserve customer identity in report drill-down

davoodmehraban89 committed Sep 28, 2026 at 13:45 UTC 963213eee073aca0a2babc7bf0977ee665d8d23b
1 file changed +2 -2
js/idle-and-reports.js
+2 -2
@@ -242,7 +242,7 @@ function renderFinancialReports(){
242 const byCustomer={};
243 yearInvoices.forEach(p=>{
244 const key=p.inv.contactId||p.inv.contactName||'—';
245 - if(!byCustomer[key])byCustomer[key]={name:p.inv.contactName||'—',count:0,sum:0};
245 + if(!byCustomer[key])byCustomer[key]={id:p.inv.contactId||'',name:p.inv.contactName||'—',count:0,sum:0};
246 byCustomer[key].count++;
247 byCustomer[key].sum+=(p.inv.grandTotal||0);
248 });
@@ -252,7 +252,7 @@ function renderFinancialReports(){
252 if(topList.length===0){
253 tbody.innerHTML='<tr><td colspan="3" style="text-align:center;color:var(--text-muted);padding:20px">داده‌ای برای نمایش وجود ندارد.</td></tr>';
254 }else{
255 - tbody.innerHTML=topList.map(c=>`<tr><td>${(typeof esc==='function'?esc(c.name):c.name)}</td><td>${c.count.toLocaleString('fa-IR')}</td><td>${c.sum.toLocaleString('fa-IR')}</td></tr>`).join('');
255 + tbody.innerHTML=topList.map(c=>`<tr data-contact-id="${typeof esc==='function'?esc(c.id):c.id}"><td>${(typeof esc==='function'?esc(c.name):c.name)}</td><td>${c.count.toLocaleString('fa-IR')}</td><td>${c.sum.toLocaleString('fa-IR')}</td></tr>`).join('');
256 }
257 }
258