feat: add KS-3/payments, tech debt fixes, UI polish, and KS-2 Excel/Word export

Tasks 008-016: KS-6a journal, KS-3 documents, payments with allocations,
tech debt cleanup, financial privacy, document tree, storno mechanism,
row-click UI, BOQ collapse/sticky header, and KS-2 export to Excel/Word
via shared DTO architecture.
This commit is contained in:
Арсентьев Александр
2026-09-27 13:38:45 +03:00
parent 6c608a8779
commit 9cfb341774
57 changed files with 7163 additions and 50 deletions
+2 -2
View File
@@ -27,7 +27,7 @@
</thead>
<tbody>
{% for row in rows %}
<tr>
<tr class="clickable-row" data-url="/projects/{{ project.id }}/ks2/{{ row.document.id }}">
<td>{{ row.document.number }}</td>
<td>{{ row.document.date.strftime('%d.%m.%Y') }}{% if row.document.reporting_period_from and row.document.reporting_period_to %}<br><small class="text-muted">{{ row.document.reporting_period_from.strftime('%d.%m.%Y') }} — {{ row.document.reporting_period_to.strftime('%d.%m.%Y') }}</small>{% endif %}</td>
<td>
@@ -36,7 +36,7 @@
</span>
</td>
<td>{{ row.item_count }}</td>
<td class="text-end text-nowrap">{{ row.amount | money }}</td>
<td class="text-end text-nowrap money-value">{{ row.amount | money }}</td>
<td>
<a href="/projects/{{ project.id }}/ks2/{{ row.document.id }}" class="btn btn-sm btn-outline-primary">Просмотр</a>
</td>
+37 -12
View File
@@ -15,9 +15,13 @@
<div class="card mb-3">
<div class="card-body">
<p><strong>Статус:</strong>
<span class="badge bg-{{ 'success' if document.status == 'issued' else 'secondary' }}">
{{ 'Проведён' if document.status == 'issued' else 'Черновик' }}
</span>
{% if document.status == 'cancelled' %}
<span class="badge bg-danger">Сторнирован</span>
{% elif document.status == 'issued' %}
<span class="badge bg-success">Проведён</span>
{% else %}
<span class="badge bg-secondary">Черновик</span>
{% endif %}
</p>
{% if document.reporting_period_from and document.reporting_period_to %}
<p><strong>Период:</strong> {{ document.reporting_period_from.strftime('%d.%m.%Y') }} — {{ document.reporting_period_to.strftime('%d.%m.%Y') }}</p>
@@ -25,9 +29,32 @@
{% if document.comment %}
<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>
</div>
</div>
</div>
{% if document.status == 'cancelled' %}
<div class="alert alert-danger" role="alert">
КС-2 сторнирован. Документ неизменяем, исключён из финансовых агрегатов. История сохранена.
</div>
<a href="/projects/{{ project.id }}/ks2" class="btn btn-secondary">Назад к списку</a>
{% else %}
{% if document.status == 'issued' %}
<div class="alert alert-success" role="alert">
КС-2 проведено. Документ не может быть изменён.
</div>
<div class="mb-3">
<form method="post" action="/projects/{{ project.id }}/ks2/{{ document.id }}/cancel" class="d-inline">
<button type="submit" class="btn btn-outline-danger"
onclick="return confirm('ВНИМАНИЕ: Сторнировать КС-2? Документ будет исключён из финансовых агрегатов. Действие необратимо.')">Сторнировать</button>
</form>
</div>
{% endif %}
<h4>Позиции</h4>
<div class="table-responsive">
@@ -46,16 +73,16 @@
<tr>
<td>{{ line.work_item.name }}</td>
<td>{{ line.work_item.unit or '' }}</td>
<td class="text-end text-nowrap">{{ line.quantity }}</td>
<td class="text-end text-nowrap">{{ line.unit_price | money }}</td>
<td class="text-end text-nowrap">{{ line.amount | money }}</td>
<td class="text-end text-nowrap">{{ line.quantity|quantity2 }}</td>
<td class="text-end text-nowrap money-value">{{ line.unit_price | money }}</td>
<td class="text-end text-nowrap money-value">{{ line.amount | money }}</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr>
<th colspan="4" class="text-end">Итого</th>
<th class="text-end text-nowrap">{{ total | money }}</th>
<th class="text-end text-nowrap money-value">{{ total | money }}</th>
</tr>
</tfoot>
</table>
@@ -71,9 +98,6 @@
<a href="/projects/{{ project.id }}/ks2" class="btn btn-secondary">Назад к списку</a>
</div>
{% else %}
<div class="alert alert-success" role="alert">
КС-2 проведено. Документ не может быть изменён.
</div>
<h4>Источники факта</h4>
@@ -95,7 +119,7 @@
<tr>
<td></td>
<td>{{ source.daily_report_item.report.report_date.strftime('%d.%m.%Y') }}</td>
<td>{{ source.quantity }}</td>
<td>{{ source.quantity|quantity2 }}</td>
</tr>
{% endfor %}
{% endfor %}
@@ -105,7 +129,8 @@
<a href="/projects/{{ project.id }}/ks2" class="btn btn-secondary">Назад к списку</a>
{% endif %}
{% endif %}
</div>
</div>
</div>
{% endblock %}
{% endblock %}