Files
Арсентьев Александр 34fb98e69c feat: add KS-6a Excel/Word export
2026-09-27 14:32:36 +03:00

103 lines
4.9 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{% extends "base.html" %}
{% block title %}КС-6а — {{ project.name }}{% endblock %}
{% block content %}
<div class="container mt-4">
<nav class="mb-3">
<a href="/projects/{{ project.id }}" class="btn btn-outline-secondary btn-sm">&larr; К проекту</a>
</nav>
<h2>КС-6а — Журнал выполненных работ</h2>
<p class="text-muted">{{ project.name }}</p>
<form method="get" action="/projects/{{ project.id }}/ks6a" class="card card-body mb-3">
<div class="row g-3 align-items-end">
<div class="col-md-3">
<label for="date_from" class="form-label">Дата с</label>
<input type="date" class="form-control" id="date_from" name="date_from" required
value="{{ date_from }}">
</div>
<div class="col-md-3">
<label for="date_to" class="form-label">Дата по</label>
<input type="date" class="form-control" id="date_to" name="date_to" required
value="{{ date_to }}">
</div>
<div class="col-md-4">
<label for="system_id" class="form-label">Система</label>
<select class="form-select" id="system_id" name="system_id">
<option value="all" {% if not system_id or system_id == 'all' %}selected{% endif %}>Все системы</option>
{% for system in systems %}
<option value="{{ system.id }}" {% if system_id|string == system.id|string %}selected{% endif %}>{{ system.name }}</option>
{% endfor %}
</select>
</div>
<div class="col-md-2">
<button type="submit" class="btn btn-primary w-100">Сформировать</button>
</div>
</div>
</form>
{% if error %}
<div class="alert alert-danger" role="alert">{{ error }}</div>
{% endif %}
{% if date_from and date_to and not error %}
<div class="mb-2 d-flex flex-wrap align-items-center gap-2">
<div class="text-muted">
Период: {{ date_from }} — {{ date_to }}
{% if system_id and system_id != 'all' %}
{% for system in systems %}{% if system_id|string == system.id|string %} · Система: {{ system.name }}{% endif %}{% endfor %}
{% else %} · Все системы{% endif %}
· Строк: {{ total_count }}
</div>
<a href="/projects/{{ project.id }}/ks6a/export/excel?date_from={{ date_from }}&amp;date_to={{ date_to }}&amp;system_id={{ system_id or 'all' }}"
class="btn btn-outline-success btn-sm">📊 Excel</a>
<a href="/projects/{{ project.id }}/ks6a/export/word?date_from={{ date_from }}&amp;date_to={{ date_to }}&amp;system_id={{ system_id or 'all' }}"
class="btn btn-outline-primary btn-sm">📄 Word</a>
</div>
{% if rows %}
<div class="table-responsive">
<table class="table table-striped table-sm" style="table-layout: fixed;">
<colgroup>
<col style="width: 88px">
<col style="width: 120px">
<col style="width: 120px">
<col style="width: 70px">
<col>
<col style="width: 50px">
<col style="width: 80px">
</colgroup>
<thead>
<tr>
<th>Дата</th>
<th>Система</th>
<th>Раздел</th>
<th>№ поз.</th>
<th>Наименование</th>
<th>Ед.</th>
<th class="text-end text-nowrap">Кол-во</th>
</tr>
</thead>
<tbody>
{% for row in rows %}
<tr>
<td class="text-nowrap">{{ row.report.report_date.strftime('%d.%m.%Y') }}</td>
<td style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">{{ row.work_item.system.name if row.work_item.system else '—' }}</td>
<td style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">{{ row.work_item.section.name if row.work_item.section else '—' }}</td>
<td>{{ row.work_item.source_number or '' }}</td>
<td style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">{{ row.work_item.name }}</td>
<td>{{ row.work_item.unit or '' }}</td>
<td class="text-end text-nowrap">{{ row.completed_quantity|quantity2 }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<div class="alert alert-info">За выбранный период работ не найдено.</div>
{% endif %}
{% endif %}
</div>
{% endblock %}