Files
work-volume-tracker/app/templates/ks2/view.html
T
Арсентьев Александр bd64bb6307 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.
2026-10-03 19:48:29 +03:00

144 lines
7.2 KiB
HTML
Raw 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 %}КС-2 №{{ document.number }} от {{ document.date.strftime('%d.%m.%Y') }}{% 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>
<div class="row">
<div class="col-12">
<h2>КС-2 №{{ document.number }} от {{ document.date.strftime('%d.%m.%Y') }}</h2>
<div class="card mb-3">
<div class="card-body">
<p><strong>Статус:</strong>
{% 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>
{% endif %}
{% 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">КС-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>
{% 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>
{% if cancel_blocked_reason %}
<div class="alert alert-warning" role="alert">
Сторнирование недоступно: {{ cancel_blocked_reason }}
</div>
{% else %}
<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 %}
{% endif %}
<h4>Позиции</h4>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Наименование</th>
<th>Ед.</th>
<th class="text-end text-nowrap">Количество</th>
<th class="text-end text-nowrap">Цена</th>
<th class="text-end text-nowrap">Сумма</th>
</tr>
</thead>
<tbody>
{% for line in document.items %}
<tr>
<td>{{ line.work_item.name }}</td>
<td>{{ line.work_item.unit or '' }}</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 money-value">{{ total | money }}</th>
</tr>
</tfoot>
</table>
</div>
{% if document.status == 'draft' %}
<div class="d-flex gap-2 align-items-center">
<a href="/projects/{{ project.id }}/ks2/{{ document.id }}/edit" class="btn btn-primary">Редактировать</a>
<form method="post" action="/projects/{{ project.id }}/ks2/{{ document.id }}/issue" class="d-inline">
<button type="submit" class="btn btn-success"
onclick="return confirm('После проведения КС-2 изменить его будет нельзя. Продолжить?')">Провести КС-2</button>
</form>
<a href="/projects/{{ project.id }}/ks2" class="btn btn-secondary">Назад к списку</a>
</div>
{% else %}
<h4>Источники факта</h4>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Наименование</th>
<th>Дата отчёта</th>
<th>Количество</th>
</tr>
</thead>
<tbody>
{% for line in document.items %}
<tr>
<td colspan="3"><strong>{{ line.work_item.name }}</strong></td>
</tr>
{% for source in line.sources %}
<tr>
<td></td>
<td>{{ source.daily_report_item.report.report_date.strftime('%d.%m.%Y') }}</td>
<td>{{ source.quantity|quantity2 }}</td>
</tr>
{% endfor %}
{% endfor %}
</tbody>
</table>
</div>
<a href="/projects/{{ project.id }}/ks2" class="btn btn-secondary">Назад к списку</a>
{% endif %}
{% endif %}
</div>
</div>
</div>
{% endblock %}