v10: Отчеты — фильтры по ФИО, филиалу, месту дислокации, статистика пересчитывается
This commit is contained in:
parent
de425d80fd
commit
d64f547ae9
48
index.html
48
index.html
@ -660,6 +660,19 @@ tr:hover td { background: var(--cyan-50); }
|
||||
|
||||
<!-- TAB: Отчеты -->
|
||||
<div class="panel" id="tab-reports">
|
||||
<div class="toolbar">
|
||||
<input type="text" id="repFilterName" placeholder="🔍 Фамилия работника..." oninput="renderReports()">
|
||||
<select id="repFilterBranch" onchange="renderReports()">
|
||||
<option value="">Все филиалы</option>
|
||||
<option>ДКБ</option><option>ДРБ</option><option>ДТК</option><option>ДЦБСФ</option><option>ОДС</option>
|
||||
</select>
|
||||
<select id="repFilterLocation" onchange="renderReports()">
|
||||
<option value="">Все локации</option>
|
||||
<option>Акмолинская область</option><option>г. Астана</option><option>г. Шымкент</option>
|
||||
<option>Жамбылская область</option><option>Карагандинская область</option><option>Туркестанская область</option>
|
||||
</select>
|
||||
<button class="btn btn-outline" onclick="document.getElementById('repFilterName').value='';document.getElementById('repFilterBranch').value='';document.getElementById('repFilterLocation').value='';renderReports();">Сброс</button>
|
||||
</div>
|
||||
<div class="stats">
|
||||
<div class="stat-card">
|
||||
<div class="stat-label">Работников</div>
|
||||
@ -687,7 +700,7 @@ tr:hover td { background: var(--cyan-50); }
|
||||
<div class="table-wrap" style="margin-top:20px;">
|
||||
<table>
|
||||
<thead>
|
||||
<tr><th>Работник</th><th>Должность</th><th>Выдано позиций</th><th>Из них просрочено</th></tr>
|
||||
<tr><th>Работник</th><th>Филиал</th><th>Дислокация</th><th>Должность</th><th>Выдано позиций</th><th>Из них просрочено</th></tr>
|
||||
</thead>
|
||||
<tbody id="repTable"></tbody>
|
||||
</table>
|
||||
@ -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 `<tr>
|
||||
<td><span class="emp-name-link" onclick="showEmpHistory('${e.id}')">${e.fullName}</span></td>
|
||||
<td>${e.branch || '—'}</td>
|
||||
<td>${e.location || '—'}</td>
|
||||
<td>${e.position}</td>
|
||||
<td>${issuedCount}</td>
|
||||
<td>${expiredCount ? '<span class="badge badge-red">' + expiredCount + '</span>' : '<span class="badge badge-green">0</span>'}</td>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user