feat: add KS-2 UI, reporting period, and table layout fixes

- 004: KS-2 UI (list, create, edit, view, issue) with integration tests
- 005: navigation buttons, financial column alignment, button layout
- 006: reporting_period_from/to fields with migration, validation, display
- 007: fixed table layout with colgroup, quantity2 filter, stable column widths
This commit is contained in:
Арсентьев Александр
2026-09-26 21:36:43 +03:00
parent 1f5eed2064
commit 6c608a8779
20 changed files with 1407 additions and 96 deletions
+9
View File
@@ -7,6 +7,7 @@ SCOPE_MIGRATION = "20260925_agreement_scope_boq"
ITEM_WORK_ITEM_MIGRATION = "20260925_agreement_item_work_item_required"
WORK_ITEM_OPTIONAL_BOQ_MIGRATION = "20260925_work_item_optional_boq"
DAILY_REPORT_OPTIONAL_SYSTEM_MIGRATION = "20260925_daily_report_optional_system"
KS2_REPORTING_PERIOD_MIGRATION = "20260925_ks2_reporting_period"
def run_migrations(engine):
@@ -169,6 +170,14 @@ def run_migrations(engine):
connection.execute("CREATE INDEX IF NOT EXISTS ix_daily_reports_report_date ON daily_reports (report_date)")
connection.execute("INSERT INTO schema_migrations(version, applied_at) VALUES (?, ?)",
(DAILY_REPORT_OPTIONAL_SYSTEM_MIGRATION, datetime.now(timezone.utc).isoformat()))
if KS2_REPORTING_PERIOD_MIGRATION not in applied:
ks2_cols = {row[1] for row in connection.execute("PRAGMA table_info(ks2_documents)")}
if "reporting_period_from" not in ks2_cols:
connection.execute("ALTER TABLE ks2_documents ADD COLUMN reporting_period_from DATE")
if "reporting_period_to" not in ks2_cols:
connection.execute("ALTER TABLE ks2_documents ADD COLUMN reporting_period_to DATE")
connection.execute("INSERT INTO schema_migrations(version, applied_at) VALUES (?, ?)",
(KS2_REPORTING_PERIOD_MIGRATION, datetime.now(timezone.utc).isoformat()))
violations = connection.execute("PRAGMA foreign_key_check").fetchall()
if violations:
raise RuntimeError(f"Foreign key violations after agreement migration: {violations[:10]}")
+4 -2
View File
@@ -1,4 +1,4 @@
from sqlalchemy import CheckConstraint, Column, Date, DateTime, ForeignKey, Integer, Numeric, String, Text, UniqueConstraint
from sqlalchemy import CheckConstraint, Column, Date, DateTime, ForeignKey, Integer, Numeric, String, Text, UniqueConstraint
from sqlalchemy.orm import relationship
from sqlalchemy.sql import func
@@ -13,6 +13,8 @@ class KS2(Base):
project_id = Column(Integer, ForeignKey("projects.id"), nullable=False, index=True)
number = Column(String, nullable=False)
date = Column(Date, nullable=False, index=True)
reporting_period_from = Column(Date, nullable=True)
reporting_period_to = Column(Date, nullable=True)
comment = Column(Text)
status = Column(String, nullable=False, default="draft", index=True)
created_at = Column(DateTime, nullable=False, server_default=func.now())
@@ -51,4 +53,4 @@ class KS2ItemSource(Base):
quantity = Column(Numeric(15, 4), nullable=False)
ks2_item = relationship("KS2Item", back_populates="sources")
daily_report_item = relationship("DailyReportItem")
daily_report_item = relationship("DailyReportItem")
+25 -10
View File
@@ -1,4 +1,4 @@
from datetime import date
from datetime import date
from decimal import Decimal
from pathlib import Path
@@ -15,9 +15,18 @@ from app.services.ks2_service import (
)
from app.utils.formatters import format_money
def _quantity2(value):
try:
return f"{Decimal(str(value if value is not None else 0)):.2f}"
except Exception:
return "0.00"
router = APIRouter()
templates = Jinja2Templates(directory=Path(__file__).resolve().parents[1] / "templates")
templates.env.filters["money"] = format_money
templates.env.filters["quantity2"] = _quantity2
def _project(db, project_id):
@@ -49,8 +58,8 @@ def _render_selection(request, db, project, document=None, error=None, status_co
balances = build_work_item_balances(db, project.id)
selected = {line.work_item_id: line.quantity for line in document.items} if document else {}
visible = [row for row in balances if row.available_quantity > 0 or row.item.id in selected]
return templates.TemplateResponse(request=request, name="ks2/form.html", context={
"project": project, "document": document, "balances": visible,
return templates.TemplateResponse(name="ks2/form.html", context={
"request": request, "project": project, "document": document, "balances": visible,
"selected": selected, "error": error,
}, status_code=status_code)
@@ -59,8 +68,8 @@ def _render_selection(request, db, project, document=None, error=None, status_co
async def ks2_list(request: Request, project_id: int, db: Session = Depends(get_db)):
project = _project(db, project_id)
rows = project_ks2_totals(db, project_id)
return templates.TemplateResponse(request=request, name="ks2/list.html", context={
"project": project, "rows": rows,
return templates.TemplateResponse(name="ks2/list.html", context={
"request": request, "project": project, "rows": rows,
})
@@ -73,13 +82,16 @@ async def ks2_new(request: Request, project_id: int, db: Session = Depends(get_d
@router.post("/{project_id}/ks2")
async def ks2_create(request: Request, project_id: int, number: str = Form(...),
document_date: str = Form(...), comment: str = Form(""),
reporting_period_from: str = Form(""), reporting_period_to: str = Form(""),
db: Session = Depends(get_db)):
project = _project(db, project_id)
form = await request.form()
entries = _entries_from_form(form)
try:
parsed_date = date.fromisoformat(document_date)
document = save_draft(db, project_id, number, parsed_date, comment, entries)
document = save_draft(db, project_id, number, parsed_date, comment, entries,
reporting_period_from=reporting_period_from or None,
reporting_period_to=reporting_period_to or None)
except ValueError as exc:
return _render_selection(request, db, project, error=str(exc), status_code=400)
return RedirectResponse(f"/projects/{project_id}/ks2/{document.id}", status_code=303)
@@ -94,8 +106,8 @@ async def ks2_view(request: Request, project_id: int, ks2_id: int, db: Session =
line.sources.sort(key=lambda source: (source.daily_report_item.report.report_date,
source.daily_report_item.report.id,
source.daily_report_item.id))
return templates.TemplateResponse(request=request, name="ks2/view.html", context={
"project": project, "document": document, "total": total,
return templates.TemplateResponse(name="ks2/view.html", context={
"request": request, "project": project, "document": document, "total": total,
})
@@ -111,6 +123,7 @@ async def ks2_edit(request: Request, project_id: int, ks2_id: int, db: Session =
@router.post("/{project_id}/ks2/{ks2_id}/edit")
async def ks2_update(request: Request, project_id: int, ks2_id: int,
number: str = Form(...), document_date: str = Form(...), comment: str = Form(""),
reporting_period_from: str = Form(""), reporting_period_to: str = Form(""),
db: Session = Depends(get_db)):
project = _project(db, project_id)
document = _document(db, project_id, ks2_id)
@@ -118,7 +131,9 @@ async def ks2_update(request: Request, project_id: int, ks2_id: int,
try:
parsed_date = date.fromisoformat(document_date)
document = save_draft(db, project_id, number, parsed_date, comment,
_entries_from_form(form), ks2_id=ks2_id)
_entries_from_form(form), ks2_id=ks2_id,
reporting_period_from=reporting_period_from or None,
reporting_period_to=reporting_period_to or None)
except ValueError as exc:
db.expire_all()
document = _document(db, project_id, ks2_id)
@@ -132,4 +147,4 @@ async def ks2_issue(project_id: int, ks2_id: int, db: Session = Depends(get_db))
issue_ks2(db, project_id, ks2_id)
except KS2ValidationError as exc:
raise HTTPException(status_code=409, detail=str(exc)) from exc
return RedirectResponse(f"/projects/{project_id}/ks2/{ks2_id}", status_code=303)
return RedirectResponse(f"/projects/{project_id}/ks2/{ks2_id}", status_code=303)
+3
View File
@@ -7,6 +7,7 @@ from app.models import boq
from app.services.project_dashboard import build_project_dashboard
from app.services.effective_plan import BaseBoqConfigurationError
from app.models.daily_report import DailyReport
from app.models.ks2 import KS2
from app.models.work_journal import WorkJournalEntry
from typing import List
import os
@@ -112,6 +113,7 @@ async def read_project(request: Request, project_id: int, db: Session = Depends(
except BaseBoqConfigurationError as exc:
raise HTTPException(status_code=409, detail=str(exc)) from exc
daily_reports = db.query(DailyReport).filter(DailyReport.project_id == project_id).count()
ks2_count = db.query(KS2).filter(KS2.project_id == project_id).count()
journal_tasks = db.query(WorkJournalEntry).filter(
WorkJournalEntry.project_id == project_id,
WorkJournalEntry.type == "task",
@@ -128,6 +130,7 @@ async def read_project(request: Request, project_id: int, db: Session = Depends(
"project": db_project,
"boq_docs": boq_docs,
"daily_reports_count": daily_reports,
"ks2_count": ks2_count,
"journal_tasks": journal_tasks,
"journal_notes": journal_notes,
**dashboard,
+28 -3
View File
@@ -1,4 +1,4 @@
from dataclasses import dataclass
from dataclasses import dataclass
from datetime import date
from decimal import Decimal, InvalidOperation
@@ -37,6 +37,17 @@ def _decimal(value):
return result
def _parse_date(value, label):
if value is None:
return None
if isinstance(value, date):
return value
try:
return date.fromisoformat(str(value).strip())
except (ValueError, TypeError) as exc:
raise KS2ValidationError(f"{label}: неверный формат даты") from exc
def build_work_item_balances(db: Session, project_id: int):
"""Return effective plan, accumulated Daily Report fact and issued KS-2 closure."""
plan = build_effective_plan(db, project_id)
@@ -91,7 +102,8 @@ def _validated_entries(db, project_id, entries, excluded_ks2_id=None):
def save_draft(db: Session, project_id: int, number: str, document_date: date, comment: str | None,
entries, ks2_id: int | None = None):
entries, ks2_id: int | None = None,
reporting_period_from=None, reporting_period_to=None):
"""Create/update a draft and its selected lines in one transaction."""
try:
number = (number or "").strip()
@@ -103,6 +115,17 @@ def save_draft(db: Session, project_id: int, number: str, document_date: date, c
if conflict.first():
raise KS2ValidationError("КС-2 с таким номером уже существует в проекте")
normalized, _ = _validated_entries(db, project_id, entries)
period_from = _parse_date(reporting_period_from, "Период с")
period_to = _parse_date(reporting_period_to, "Период по")
if ks2_id is None:
if period_from is None:
raise KS2ValidationError("Укажите дату начала периода")
if period_to is None:
raise KS2ValidationError("Укажите дату окончания периода")
if period_from is not None and period_to is not None and period_to < period_from:
raise KS2ValidationError("Дата окончания периода не может быть раньше даты начала")
document = None
if ks2_id is not None:
document = db.query(KS2).filter(KS2.id == ks2_id, KS2.project_id == project_id).with_for_update().first()
@@ -115,6 +138,8 @@ def save_draft(db: Session, project_id: int, number: str, document_date: date, c
db.add(document)
document.number = number
document.date = document_date
document.reporting_period_from = period_from
document.reporting_period_to = period_to
document.comment = comment.strip() or None if comment else None
document.items.clear()
for item_id, quantity in normalized.items():
@@ -195,4 +220,4 @@ def project_ks2_totals(db: Session, project_id: int):
for document in documents:
rows.append({"document": document, "item_count": len(document.items),
"amount": sum((_decimal(line.amount) for line in document.items), ZERO)})
return rows
return rows
+14
View File
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1">
<title>{% block title %}Work Volume Tracker{% endblock %}</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body class="bg-light">
<main class="container py-4">
{% block content %}{% endblock %}
</main>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
+95 -32
View File
@@ -1,12 +1,16 @@
{% extends "base.html" %}
{% block title %}Создание КС-2{% endblock %}
{% block title %}{{ 'Редактирование' if document else 'Создание' }} КС-2{% 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</h2>
<h2>{{ 'Редактирование КС-2' if document else 'Создание КС-2' }}</h2>
{% if error %}
<div class="alert alert-danger" role="alert">
@@ -14,85 +18,144 @@
</div>
{% endif %}
<form method="post" action="/projects/{{ project.id }}/ks2">
<form method="post" action="/projects/{{ project.id }}/ks2{% if document %}/{{ document.id }}/edit{% endif %}">
<div class="row mb-3">
<div class="col-md-6">
<div class="col-md-3">
<label for="number" class="form-label">Номер КС-2</label>
<input type="text" class="form-control" id="number" name="number" required>
<input type="text" class="form-control" id="number" name="number" required
value="{{ document.number if document else '' }}">
</div>
<div class="col-md-6">
<div class="col-md-3">
<label for="document_date" class="form-label">Дата</label>
<input type="date" class="form-control" id="document_date" name="document_date" required>
<input type="date" class="form-control" id="document_date" name="document_date" required
value="{{ document.date.isoformat() if document else '' }}">
</div>
<div class="col-md-3">
<label for="reporting_period_from" class="form-label">Период с</label>
<input type="date" class="form-control" id="reporting_period_from" name="reporting_period_from" required
value="{{ document.reporting_period_from.isoformat() if document and document.reporting_period_from else '' }}">
</div>
<div class="col-md-3">
<label for="reporting_period_to" class="form-label">Период по</label>
<input type="date" class="form-control" id="reporting_period_to" name="reporting_period_to" required
value="{{ document.reporting_period_to.isoformat() if document and document.reporting_period_to else '' }}">
</div>
</div>
<div class="row mb-3">
<div class="col-md-12">
<label for="comment" class="form-label">Комментарий</label>
<input type="text" class="form-control" id="comment" name="comment"
value="{{ document.comment if document and document.comment else '' }}">
</div>
</div>
<div class="mb-3">
<label for="comment" class="form-label">Комментарий</label>
<textarea class="form-control" id="comment" name="comment" rows="3"></textarea>
</div>
<h4>Выберите позиции</h4>
<h4>Выберите позиции для закрытия</h4>
<div class="table-responsive">
<table class="table table-striped">
<table class="table table-striped table-sm" style="table-layout: fixed;">
<colgroup>
<col style="width: 50px">
<col>
<col style="width: 40px">
<col style="width: 72px">
<col style="width: 72px">
<col style="width: 72px">
<col style="width: 72px">
<col style="width: 96px">
<col style="width: 90px">
<col style="width: 100px">
</colgroup>
<thead>
<tr>
<th>№ поз.</th>
<th>Наименование</th>
<th>План</th>
<th>Факт</th>
<th>Закрыто</th>
<th>Доступно</th>
<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>
<th class="text-end text-nowrap">Доступно</th>
<th class="text-end text-nowrap">Цена</th>
<th class="text-nowrap">Кол-во</th>
<th class="text-end text-nowrap">Сумма</th>
</tr>
</thead>
<tbody>
{% for balance in balances %}
<tr>
<td>{{ balance.item.name }}</td>
<td>{{ balance.planned_quantity }}</td>
<td>{{ balance.actual_quantity }}</td>
<td>{{ balance.closed_quantity }}</td>
<td>{{ balance.available_quantity }}</td>
<td>{{ balance.item.source_number or '' }}</td>
<td style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">{{ balance.item.name }}</td>
<td>{{ balance.item.unit or '' }}</td>
<td class="text-end text-nowrap">{{ balance.planned_quantity|quantity2 }}</td>
<td class="text-end text-nowrap">{{ balance.actual_quantity|quantity2 }}</td>
<td class="text-end text-nowrap">{{ balance.closed_quantity|quantity2 }}</td>
<td class="text-end text-nowrap">{{ balance.available_quantity|quantity2 }}</td>
<td class="text-end text-nowrap" data-price="{{ balance.item.unit_price or 0 }}">{{ balance.item.unit_price|money }}</td>
<td>
<input type="checkbox" class="form-check-input" id="include_{{ balance.item.id }}"
name="include_{{ balance.item.id }}" value="1"
{% if balance.item.id in selected %}checked{% endif %}>
<input type="number" class="form-control form-control-sm"
<input type="number" class="form-control form-control-sm mt-1"
name="quantity_{{ balance.item.id }}"
value="{{ selected.get(balance.item.id, '') }}"
min="0" step="0.0001"
min="0" step="0.01"
{% if balance.item.id not in selected %}disabled{% endif %}
placeholder="Количество">
placeholder="0.00"
style="width: 100%; box-sizing: border-box;"
data-item-id="{{ balance.item.id }}">
</td>
<td class="text-end text-nowrap" id="amount_{{ balance.item.id }}">—</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<button type="submit" class="btn btn-primary">Создать</button>
<a href="/projects/{{ project.id }}/ks2" class="btn btn-secondary">Отмена</a>
<button type="submit" class="btn btn-primary">{{ 'Сохранить' if document else 'Создать' }}</button>
<a href="/projects/{{ project.id }}/ks2{% if document %}/{{ document.id }}{% endif %}" class="btn btn-secondary">Отмена</a>
</form>
</div>
</div>
</div>
<script>
// Обработчик изменения чекбокса
document.addEventListener('DOMContentLoaded', function() {
const checkboxes = document.querySelectorAll('input[type="checkbox"]');
checkboxes.forEach(checkbox => {
checkbox.addEventListener('change', function() {
const quantityInput = document.querySelector(`input[name="quantity_${this.id.split('_')[1]}"]`);
const itemId = this.id.split('_')[1];
const quantityInput = document.querySelector(`input[name="quantity_${itemId}"]`);
if (this.checked) {
quantityInput.disabled = false;
quantityInput.focus();
} else {
quantityInput.disabled = true;
quantityInput.value = '';
updateAmount(itemId, quantityInput);
}
});
});
document.querySelectorAll('input[type="number"][data-item-id]').forEach(input => {
input.addEventListener('input', function() {
updateAmount(this.dataset.itemId, this);
});
});
// Инициализация сумм при редактировании
document.querySelectorAll('input[type="number"][data-item-id]').forEach(input => {
if (input.value) {
updateAmount(input.dataset.itemId, input);
}
});
function updateAmount(itemId, quantityInput) {
const amountCell = document.getElementById('amount_' + itemId);
const priceCell = quantityInput.closest('tr').querySelector('[data-price]');
const price = parseFloat(priceCell.dataset.price) || 0;
const qty = parseFloat(quantityInput.value) || 0;
const amount = price * qty;
amountCell.textContent = amount > 0 ? amount.toLocaleString('ru-RU', {minimumFractionDigits: 2, maximumFractionDigits: 2}) + ' \u20BD' : '—';
}
});
</script>
{% endblock %}
{% endblock %}
+8 -4
View File
@@ -4,6 +4,10 @@
{% 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 проекта {{ project.name }}</h2>
@@ -17,7 +21,7 @@
<th>Дата</th>
<th>Статус</th>
<th>Количество позиций</th>
<th>Сумма</th>
<th class="text-end text-nowrap">Сумма</th>
<th>Действия</th>
</tr>
</thead>
@@ -25,14 +29,14 @@
{% for row in rows %}
<tr>
<td>{{ row.document.number }}</td>
<td>{{ row.document.date.strftime('%d.%m.%Y') }}</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>
<span class="badge bg-{{ 'success' if row.document.status == 'issued' else 'secondary' }}">
{{ 'Проведён' if row.document.status == 'issued' else 'Черновик' }}
</span>
</td>
<td>{{ row.item_count }}</td>
<td>{{ row.amount | money }}</td>
<td class="text-end text-nowrap">{{ row.amount | money }}</td>
<td>
<a href="/projects/{{ project.id }}/ks2/{{ row.document.id }}" class="btn btn-sm btn-outline-primary">Просмотр</a>
</td>
@@ -44,4 +48,4 @@
</div>
</div>
</div>
{% endblock %}
{% endblock %}
+35 -25
View File
@@ -4,6 +4,10 @@
{% 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>
@@ -15,6 +19,9 @@
{{ 'Проведён' if document.status == 'issued' else 'Черновик' }}
</span>
</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 %}
@@ -28,41 +35,54 @@
<thead>
<tr>
<th>Наименование</th>
<th>Количество</th>
<th>Цена</th>
<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.quantity }}</td>
<td>{{ line.unit_price | money }}</td>
<td>{{ line.amount | money }}</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>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr>
<th>Итого</th>
<th></th>
<th></th>
<th>{{ total | money }}</th>
<th colspan="4" class="text-end">Итого</th>
<th class="text-end text-nowrap">{{ total | money }}</th>
</tr>
</tfoot>
</table>
</div>
{% if document.status == 'draft' %}
<h4>Источники</h4>
<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 %}
<div class="alert alert-success" role="alert">
КС-2 проведено. Документ не может быть изменён.
</div>
<h4>Источники факта</h4>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Наименование</th>
<th>Даты</th>
<th>Дата отчёта</th>
<th>Количество</th>
</tr>
</thead>
@@ -74,7 +94,7 @@
{% for source in line.sources %}
<tr>
<td></td>
<td>{{ source.daily_report_item.report.report_date.strftime('%d.%m.%Y') }} ({{ source.daily_report_item.report.id }})</td>
<td>{{ source.daily_report_item.report.report_date.strftime('%d.%m.%Y') }}</td>
<td>{{ source.quantity }}</td>
</tr>
{% endfor %}
@@ -83,19 +103,9 @@
</table>
</div>
<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?')">Провести</button>
</form>
{% else %}
<div class="alert alert-success" role="alert">
КС-2 проведено
</div>
{% endif %}
<a href="/projects/{{ project.id }}/ks2" class="btn btn-secondary">Назад к списку</a>
{% endif %}
</div>
</div>
</div>
{% endblock %}
{% endblock %}
+1
View File
@@ -34,6 +34,7 @@
<a class="btn btn-outline-primary" href="/boq/{{ project.id }}">Ведомости</a>
<a class="btn btn-outline-primary" href="/projects/{{ project.id }}/agreements">&#1044;&#1086;&#1087;&#1086;&#1083;&#1085;&#1080;&#1090;&#1077;&#1083;&#1100;&#1085;&#1099;&#1077; &#1089;&#1086;&#1075;&#1083;&#1072;&#1096;&#1077;&#1085;&#1080;&#1103;</a>
<a class="btn btn-outline-primary" href="/projects/{{ project.id }}/daily-reports">Daily Reports{% if daily_reports_count %} ({{ daily_reports_count }}){% endif %}</a>
<a class="btn btn-outline-primary" href="/projects/{{ project.id }}/ks2">КС-2{% if ks2_count %} ({{ ks2_count }}){% endif %}</a>
<a class="btn btn-primary" href="/projects/{{ project.id }}/daily-reports/new">Создать Daily Report</a>
</div>
</header>