feat: official KS-2 Excel/Word forms with template markers and single-table flow
Replace the simplified KS-2 exports with the official unified form: - Excel: official blank as working template, merge-safe row insertion, compact layout, header/signer polish, 0.00 money format - Word: official blank via named template markers (DOC-C4), one dynamic works table with repeating header rows, separate closing totals block (Итого / Всего по акту), system group rows merged across 8 columns - Word money formatter (space thousands, comma decimals) and split contract date day/month/year boxes - Issue persists both xlsx and docx artifacts; UI keeps Excel and adds Word download - Daily reports: multi-system item selection in the form Regression tests for renderers, artifacts and layout; docs/tasks + docs/implementation for the DOC-C* series.
This commit is contained in:
@@ -30,14 +30,9 @@
|
||||
<p><strong>Комментарий:</strong> {{ document.comment }}</p>
|
||||
{% endif %}
|
||||
<div class="mt-2">
|
||||
<a href="/projects/{{ project.id }}/ks2/{{ document.id }}/export/excel" class="btn btn-outline-success btn-sm">📊 Excel</a>
|
||||
<a href="/projects/{{ project.id }}/ks2/{{ document.id }}/export/word" class="btn btn-outline-primary btn-sm">📄 Word</a>
|
||||
{% if document.status != 'draft' %}
|
||||
<a href="/projects/{{ project.id }}/ks2/{{ document.id }}/artifact" class="btn btn-outline-dark btn-sm">
|
||||
📎 Официальная форма (Excel)
|
||||
{% if document.status == 'cancelled' %}<span class="badge bg-danger ms-1">СТОРНИРОВАН</span>{% endif %}
|
||||
</a>
|
||||
{% endif %}
|
||||
<a href="/projects/{{ project.id }}/ks2/{{ document.id }}/export/excel" class="btn btn-outline-success btn-sm">КС-2 (Excel)</a>
|
||||
<a href="/projects/{{ project.id }}/ks2/{{ document.id }}/export/word" class="btn btn-outline-primary btn-sm">КС-2 (Word)</a>
|
||||
{% if document.status == 'cancelled' %}<span class="badge bg-danger ms-1">СТОРНИРОВАН</span>{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
{% for system in systems %}<option value="{{ system.id }}" {% if selected_system and selected_system.id == system.id %}selected{% endif %}>{{ system.name }}</option>{% endfor %}
|
||||
{% if has_unclassified_items %}<option value="unclassified" {% if unclassified_selected %}selected{% endif %}>Проектные позиции без системы</option>{% endif %}
|
||||
</select><button class="btn btn-outline-primary" type="submit">Показать позиции</button></div>
|
||||
{% if report %}<div class="form-text">При смене системы сначала нажмите «Показать позиции»; несохранённые изменения формы будут сброшены.</div>{% endif %}
|
||||
<div class="form-text">Выберите систему и нажмите «Показать позиции». Позиции разных систем можно добавлять в один отчёт — уже введённые количества сохраняются.</div>
|
||||
</form>
|
||||
|
||||
{% if selected_system or unclassified_selected %}
|
||||
@@ -31,7 +31,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-header"><strong>{{ selected_system.name if selected_system else 'Проектные позиции без системы' }}</strong> — укажите фактическое количество хотя бы для одной позиции</div>
|
||||
<div class="card-header"><strong><span id="current-system-name">{{ selected_system.name if selected_system else 'Проектные позиции без системы' }}</span></strong> — укажите фактическое количество хотя бы для одной позиции</div>
|
||||
<div class="p-3 border-bottom">
|
||||
<label class="form-label" for="position-search">Поиск позиций</label>
|
||||
<input id="position-search" class="form-control" type="search" autocomplete="off" placeholder="Номер, наименование, модель или производитель">
|
||||
@@ -41,12 +41,12 @@
|
||||
<thead><tr><th>Раздел</th><th>№</th><th>Рабочая позиция</th><th>Ед.</th><th class="text-end">План</th><th class="text-end">Накоплено до отчёта</th><th style="width: 180px">Выполнено за дату</th></tr></thead>
|
||||
<tbody>
|
||||
{% for row in rows %}
|
||||
<tr class="position-row {% if row.over_plan %}table-warning{% endif %}" data-number="{{ row.item.source_number or '' }}" data-name="{{ row.item.name or '' }}" data-model="{{ row.item.model or '' }}" data-manufacturer="{{ row.item.manufacturer or '' }}">
|
||||
<td>{{ row.item.section.name if row.item.section else '—' }}</td><td>{{ row.item.source_number or '' }}</td><td>{{ row.item.name }}</td><td>{{ row.item.unit or '' }}</td>
|
||||
<tr class="position-row {% if row.over_plan %}table-warning{% endif %}" data-number="{{ row.item.source_number or '' }}" data-name="{{ row.item.name or '' }}" data-model="{{ row.item.model or '' }}" data-manufacturer="{{ row.item.manufacturer or '' }}" data-system="{{ row.item.system_id if row.item.system_id is not none else 'unclassified' }}" {% if not row.in_selection and row.current_quantity is none %}hidden{% endif %}>
|
||||
<td>{{ row.item.section.name if row.item.section else '—' }}<div class="small text-muted">{{ row.item.system.name if row.item.system else 'Без системы' }}</div></td><td>{{ row.item.source_number or '' }}</td><td>{{ row.item.name }}</td><td>{{ row.item.unit or '' }}</td>
|
||||
<td class="text-end">{{ row.planned_quantity if row.planned_quantity is not none else '—' }}</td><td class="text-end">{{ row.accumulated }}</td>
|
||||
<td><input class="form-control form-control-sm" type="number" min="0" step="0.0001" name="quantity_{{ row.item.id }}" value="{{ row.current_quantity if row.current_quantity is not none else '' }}" aria-label="Выполнено: {{ row.item.name }}"></td>
|
||||
</tr>
|
||||
{% else %}<tr><td colspan="7" class="text-center text-muted py-4">В этой системе нет рабочих позиций ведомости.</td></tr>{% endfor %}
|
||||
{% else %}<tr><td colspan="7" class="text-center text-muted py-4">В ведомости нет рабочих позиций.</td></tr>{% endfor %}
|
||||
</tbody>
|
||||
</table></div>
|
||||
<div class="card-footer d-flex justify-content-between"><a class="btn btn-outline-secondary" href="/projects/{{ project.id }}/daily-reports">Отмена</a><button class="btn btn-primary" type="submit">{{ 'Сохранить изменения' if report else 'Создать отчёт' }}</button></div>
|
||||
@@ -58,18 +58,37 @@
|
||||
if (!search) return;
|
||||
const rows = [...document.querySelectorAll('.position-row')];
|
||||
const empty = document.getElementById('position-search-empty');
|
||||
const picker = document.getElementById('system-picker');
|
||||
const pickerForm = picker ? picker.form : null;
|
||||
const hiddenSystem = document.querySelector('form[method="post"] input[name="system_id"]');
|
||||
const systemName = document.getElementById('current-system-name');
|
||||
const normalize = value => (value || '').toLocaleLowerCase('ru-RU').trim();
|
||||
search.addEventListener('input', () => {
|
||||
const applyFilters = () => {
|
||||
const selected = picker ? picker.value : '';
|
||||
const query = normalize(search.value);
|
||||
let visible = 0;
|
||||
for (const row of rows) {
|
||||
const filled = [...row.querySelectorAll('input')].some(input => input.value.trim() !== '');
|
||||
const inSystem = !selected || row.dataset.system === selected || filled;
|
||||
const haystack = normalize(['number', 'name', 'model', 'manufacturer']
|
||||
.map(key => row.dataset[key]).join(' '));
|
||||
row.hidden = !haystack.includes(query);
|
||||
row.hidden = !(inSystem && haystack.includes(query));
|
||||
if (!row.hidden) visible++;
|
||||
}
|
||||
empty.hidden = visible !== 0;
|
||||
});
|
||||
};
|
||||
if (pickerForm && picker) {
|
||||
pickerForm.addEventListener('submit', event => {
|
||||
event.preventDefault();
|
||||
if (hiddenSystem) hiddenSystem.value = picker.value;
|
||||
if (systemName && picker.selectedOptions.length) {
|
||||
systemName.textContent = picker.selectedOptions[0].textContent;
|
||||
}
|
||||
applyFilters();
|
||||
});
|
||||
}
|
||||
search.addEventListener('input', applyFilters);
|
||||
applyFilters();
|
||||
})();
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<div class="d-flex justify-content-between align-items-start mb-4 gap-3 flex-wrap">
|
||||
<div>
|
||||
<h1>Daily Report</h1>
|
||||
<div class="text-muted">{{ report.report_date.strftime('%d.%m.%Y') }} · {{ report.system.name if report.system else 'Проектные позиции без системы' }}</div>
|
||||
<div class="text-muted">{{ report.report_date.strftime('%d.%m.%Y') }} · {{ system_names|join(', ') if system_names else 'Проектные позиции без системы' }}</div>
|
||||
{% if report.notes %}<p class="mt-2">{{ report.notes }}</p>{% endif %}
|
||||
</div>
|
||||
<div class="d-flex gap-2">
|
||||
@@ -35,7 +35,7 @@
|
||||
<thead><tr><th>Раздел</th><th>№</th><th>Рабочая позиция</th><th>Ед.</th><th class="text-end">План</th><th class="text-end">В этом отчёте</th><th class="text-end">Закрыто КС-2</th><th class="text-end">Доступно</th></tr></thead>
|
||||
<tbody>{% for row in rows %}
|
||||
<tr class="{% if row.over_plan %}table-warning{% endif %}">
|
||||
<td>{{ row.item.section.name if row.item.section else '—' }}</td>
|
||||
<td>{{ row.item.section.name if row.item.section else '—' }}<div class="small text-muted">{{ row.item.system.name if row.item.system else 'Без системы' }}</div></td>
|
||||
<td>{{ row.item.source_number or '' }}</td>
|
||||
<td>{{ row.item.name }}</td>
|
||||
<td>{{ row.item.unit or '' }}</td>
|
||||
|
||||
Reference in New Issue
Block a user