diff --git a/index.html b/index.html index e0d87dc..39453f0 100644 --- a/index.html +++ b/index.html @@ -660,6 +660,19 @@ tr:hover td { background: var(--cyan-50); }
+
+ + + + +
Работников
@@ -687,7 +700,7 @@ tr:hover td { background: var(--cyan-50); }
- +
РаботникДолжностьВыдано позицийИз них просрочено
РаботникФилиалДислокацияДолжностьВыдано позицийИз них просрочено
@@ -1723,26 +1736,35 @@ function renderControl() { // ===================== REPORTS ===================== function renderReports() { - const employees = DB.employees; + let employees = DB.employees; const sizList = DB.siz; const warehouse = DB.warehouse; const issuances = DB.issuances; + const q = (document.getElementById('repFilterName').value || '').toLowerCase(); + const fb = document.getElementById('repFilterBranch').value; + const fl = document.getElementById('repFilterLocation').value; + + if (q) employees = employees.filter(e => (e.fullName || '').toLowerCase().includes(q)); + if (fb) employees = employees.filter(e => e.branch === fb); + if (fl) employees = employees.filter(e => e.location === fl); + + const empIds = new Set(employees.map(e => e.id)); + document.getElementById('repEmployees').textContent = employees.length; document.getElementById('repSiz').textContent = sizList.length; - let totalStock = 0, totalIssued = 0, totalExpired = 0; - sizList.forEach(s => { - totalStock += getStockBalance(s.id); - }); + let totalStock = 0; + sizList.forEach(s => { totalStock += getStockBalance(s.id); }); + + let totalIssued = 0, totalExpired = 0; issuances.forEach(i => { - if (i.status !== 'returned') { - totalIssued += i.quantity; - if (getIssStatus(i) === 'expired') totalExpired += i.quantity; - } else { - totalIssued += i.quantity; - } + if (!empIds.has(i.employeeId)) return; + const qty = i.quantity; + totalIssued += qty; + if (getIssStatus(i) === 'expired') totalExpired += qty; }); + document.getElementById('repStock').textContent = totalStock; document.getElementById('repIssued').textContent = totalIssued; document.getElementById('repExpired').textContent = totalExpired; @@ -1753,6 +1775,8 @@ function renderReports() { const expiredCount = empIss.filter(i => getIssStatus(i) === 'expired').length; return ` ${e.fullName} + ${e.branch || '—'} + ${e.location || '—'} ${e.position} ${issuedCount} ${expiredCount ? '' + expiredCount + '' : '0'}