158 lines
6.7 KiB
HTML
158 lines
6.7 KiB
HTML
{% extends "base.html" %}
|
||
{% block title %}Заказ {{ object.number }} — ERP WaterSurf{% endblock %}
|
||
{% block content %}
|
||
<div class="ws-card">
|
||
<div class="ws-card-header">
|
||
<h2 class="ws-page-title mb-0">Заказ клиента {{ object.number }} от {{ object.date }}</h2>
|
||
<div class="ws-btn-group">
|
||
<a href="{% url 'documents:customer_order_edit' object.pk %}" class="btn btn-ws-secondary">Изменить</a>
|
||
<a href="{% url 'documents:customer_order_delete' object.pk %}" class="btn btn-ws-secondary ws-link-danger">Удалить</a>
|
||
<a href="{% url 'documents:customer_order_list' %}" class="btn btn-ws-secondary">К списку</a>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="ws-form-section" style="margin-top: 1rem;">
|
||
<h3 class="ws-form-section-title">Данные заказа</h3>
|
||
<p class="mb-1"><strong>Организация:</strong> {{ object.organization }}</p>
|
||
<p class="mb-1"><strong>Клиент:</strong> {{ object.client }}</p>
|
||
<p class="mb-1"><strong>Вид заказа:</strong> {{ object.order_kind }}</p>
|
||
<p class="mb-1"><strong>Стоимость заказа:</strong> {{ object.total_amount|floatformat:2 }}</p>
|
||
</div>
|
||
|
||
<div class="ws-form-section" style="margin-top: 1.5rem;">
|
||
<h3 class="ws-form-section-title">Экономика заказа</h3>
|
||
<table class="ws-table" style="max-width: 32rem;">
|
||
<tbody>
|
||
<tr>
|
||
<td>Поступило от клиента (всего поступлений по заказу)</td>
|
||
<td class="ws-num">{{ economics.total_inflows|floatformat:2 }}</td>
|
||
</tr>
|
||
<tr>
|
||
<td>Расходы: оплата поставщикам (по заказам поставщику по этому заказу)</td>
|
||
<td class="ws-num">−{{ economics.expenses_via_supplier|floatformat:2 }}</td>
|
||
</tr>
|
||
<tr>
|
||
<td>Расходы: прочие по заказу (логистика и т.п.)</td>
|
||
<td class="ws-num">−{{ economics.expenses_direct|floatformat:2 }}</td>
|
||
</tr>
|
||
<tr>
|
||
<td><strong>Всего расходов</strong></td>
|
||
<td class="ws-num"><strong>−{{ economics.total_expenses|floatformat:2 }}</strong></td>
|
||
</tr>
|
||
<tr>
|
||
<td><strong>Маржа (поступления − расходы)</strong></td>
|
||
<td class="ws-num"><strong>{{ economics.margin|floatformat:2 }}</strong></td>
|
||
</tr>
|
||
<tr>
|
||
<td>Маржинальность (маржа / поступления)</td>
|
||
<td class="ws-num">{% if economics.margin_pct is not None %}{{ economics.margin_pct|floatformat:1 }}%{% else %}—{% endif %}</td>
|
||
</tr>
|
||
<tr>
|
||
<td>Рентабельность (маржа / расходы)</td>
|
||
<td class="ws-num">{% if economics.profitability_pct is not None %}{{ economics.profitability_pct|floatformat:1 }}%{% else %}—{% endif %}</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
|
||
<div class="ws-form-section" style="margin-top: 1.5rem;">
|
||
<h3 class="ws-form-section-title">Поступления по заказу</h3>
|
||
{% if object.cash_inflows.all %}
|
||
<div class="ws-table-wrap">
|
||
<table class="ws-table">
|
||
<thead>
|
||
<tr>
|
||
<th>Дата</th>
|
||
<th>Номер</th>
|
||
<th>Получатель</th>
|
||
<th class="ws-num">Сумма</th>
|
||
<th></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
{% for inv in object.cash_inflows.all %}
|
||
<tr>
|
||
<td>{{ inv.date }}</td>
|
||
<td>{{ inv.number }}</td>
|
||
<td>{{ inv.recipient }}</td>
|
||
<td class="ws-num">{{ inv.amount|floatformat:2 }}</td>
|
||
<td><a href="{% url 'documents:cash_inflow_edit' inv.pk %}" class="ws-link">Изменить</a></td>
|
||
</tr>
|
||
{% endfor %}
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
{% else %}
|
||
<p class="ws-text-muted">Нет поступлений, привязанных к этому заказу.</p>
|
||
{% endif %}
|
||
<p style="margin-top: 0.5rem;"><a href="{% url 'documents:cash_inflow_create' %}" class="ws-link">+ Оформить поступление</a></p>
|
||
</div>
|
||
|
||
<div class="ws-form-section" style="margin-top: 1.5rem;">
|
||
<h3 class="ws-form-section-title">Заказы поставщику по этому заказу</h3>
|
||
{% if object.supplier_orders.all %}
|
||
<div class="ws-table-wrap">
|
||
<table class="ws-table">
|
||
<thead>
|
||
<tr>
|
||
<th>Дата</th>
|
||
<th>Номер</th>
|
||
<th>Поставщик</th>
|
||
<th class="ws-num">Стоимость</th>
|
||
<th></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
{% for so in object.supplier_orders.all %}
|
||
<tr>
|
||
<td>{{ so.date }}</td>
|
||
<td>{{ so.number }}</td>
|
||
<td>{{ so.supplier }}</td>
|
||
<td class="ws-num">{{ so.total_amount|floatformat:2 }}</td>
|
||
<td><a href="{% url 'documents:supplier_order_edit' so.pk %}" class="ws-link">Изменить</a></td>
|
||
</tr>
|
||
{% endfor %}
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
{% else %}
|
||
<p class="ws-text-muted">Нет заказов поставщику по этому заказу.</p>
|
||
{% endif %}
|
||
<p style="margin-top: 0.5rem;"><a href="{% url 'documents:supplier_order_create' %}" class="ws-link">+ Создать заказ поставщику</a></p>
|
||
</div>
|
||
|
||
<div class="ws-form-section" style="margin-top: 1.5rem;">
|
||
<h3 class="ws-form-section-title">Прочие расходы по заказу (логистика и т.п.)</h3>
|
||
{% if object.cash_expenses.all %}
|
||
<div class="ws-table-wrap">
|
||
<table class="ws-table">
|
||
<thead>
|
||
<tr>
|
||
<th>Дата</th>
|
||
<th>Номер</th>
|
||
<th>Отправитель</th>
|
||
<th class="ws-num">Сумма</th>
|
||
<th></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
{% for ex in object.cash_expenses.all %}
|
||
<tr>
|
||
<td>{{ ex.date }}</td>
|
||
<td>{{ ex.number }}</td>
|
||
<td>{{ ex.sender }}</td>
|
||
<td class="ws-num">{{ ex.amount|floatformat:2 }}</td>
|
||
<td><a href="{% url 'documents:cash_expense_edit' ex.pk %}" class="ws-link">Изменить</a></td>
|
||
</tr>
|
||
{% endfor %}
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
{% else %}
|
||
<p class="ws-text-muted">Нет прочих расходов, привязанных к этому заказу.</p>
|
||
{% endif %}
|
||
<p style="margin-top: 0.5rem;"><a href="{% url 'documents:cash_expense_create' %}" class="ws-link">+ Оформить расход</a></p>
|
||
</div>
|
||
</div>
|
||
{% endblock %}
|