Files
order_system/po_app/templates/order_view.html
T

204 lines
9.0 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 body %}
<h1 class="page">{{ o.doc_type_text }} · {{ o.order_no }}
<span class="badge {{ o.status }}" style="font-size:13px;vertical-align:middle;">{{ o.status_text }}</span>
</h1>
<div class="toolbar">
{% if editable %}<a class="btn primary" href="{{ url_for('order_edit', oid=o.id) }}">编辑</a>{% endif %}
<a class="btn" href="{{ url_for('order_pdf', oid=o.id) }}" target="_blank">导出 / 预览 PDF</a>
<a class="btn" href="{{ url_for('order_pdf', oid=o.id) }}?dl=1" download>下载 PDF</a>
<form method="post" action="{{ url_for('order_copy', oid=o.id) }}" style="display:inline;">
<button class="btn">复制为新订单</button>
</form>
<span class="grow"></span>
<a class="btn" href="{{ url_for('orders') }}">返回列表</a>
</div>
<div class="card">
<h2>单据信息</h2>
<table class="kv-table" style="width:100%;">
<tr>
<td class="k">供应商</td><td>{{ o.supplier_name }}</td>
<td class="k">需方</td><td>{{ o.our_company }}</td>
</tr>
<tr>
<td class="k">联系人</td><td>{{ o.supplier_contact }}</td>
<td class="k">联系人</td><td>{{ o.our_contact }}</td>
</tr>
<tr>
<td class="k">电话</td><td>{{ o.supplier_phone }}</td>
<td class="k">电话</td><td>{{ o.our_phone }}</td>
</tr>
<tr>
<td class="k">付款方式</td><td>{{ o.payment_terms }}</td>
<td class="k">税点</td><td>{{ o.tax_rate }}</td>
</tr>
<tr>
<td class="k">税号</td><td>{{ o.supplier_tax_no }}</td>
<td class="k">税号</td><td>{{ o.our_tax_no }}</td>
</tr>
<tr>
<td class="k">银行帐号</td><td>{{ o.supplier_bank_account }}</td>
<td class="k">采购单号</td><td>{{ o.order_no }}</td>
</tr>
<tr>
<td class="k">开户银行</td><td>{{ o.supplier_bank_name }}</td>
<td class="k">采购日期</td><td>{{ o.order_date }}</td>
</tr>
<tr><td class="k">交货地点</td><td colspan="3">{{ o.delivery_place }}</td></tr>
</table>
<h3>物料明细</h3>
<table class="grid">
<tr><th>序号</th><th>物料代码</th><th>物料规格</th><th>单位</th><th class="num">数量</th>
<th class="num">含税单价</th><th class="num">金额</th><th>交期</th><th>备注</th></tr>
{% for it in o.items %}
<tr>
<td class="center">{{ loop.index }}</td>
<td>{{ it.material_code }}</td>
<td>{{ it.material_spec }}</td>
<td class="center">{{ it.unit }}</td>
<td class="num">{{ it.qty }}</td>
<td class="num">{{ '%.2f'|format(it.price) }}</td>
<td class="num">{{ '%.2f'|format(it.amount) }}</td>
<td>{{ it.delivery_date }}</td>
<td>{{ it.remark }}</td>
</tr>
{% else %}
<tr><td colspan="9" class="center muted">暂无明细</td></tr>
{% endfor %}
</table>
<div class="total-bar">
<span>合计(小写):<span class="amt">{{ '%.2f'|format(o.total_amount) }}</span> 元</span>
<span>大写:<b>{{ total_cn }}</b></span>
</div>
{% if o.note %}<p class="muted">补充说明:{{ o.note }}</p>{% endif %}
</div>
<div class="card">
<h2>审核流程</h2>
<table class="grid">
<tr><th>环节</th><th>操作人</th><th>时间</th></tr>
<tr><td>制单</td><td>{{ o.created_by_name }}</td><td>{{ o.created_at.strftime('%Y-%m-%d %H:%M') if o.created_at else '-' }}</td></tr>
<tr><td>主管审核</td><td>{{ o.reviewed_by or '—' }}</td><td>{{ o.reviewed_at.strftime('%Y-%m-%d %H:%M') if o.reviewed_at else '—' }}</td></tr>
<tr><td>经理批准</td><td>{{ o.approved_by or '—' }}</td><td>{{ o.approved_at.strftime('%Y-%m-%d %H:%M') if o.approved_at else '—' }}</td></tr>
</table>
{% if user.role in ['reviewer','admin'] and o.status == 'pending_review' %}
<div style="margin-top:12px;">
<div id="stampBox" style="display:none; margin-bottom:10px;">
<div class="seal-wrap">
<div class="seal-tip">已加盖主管审核章</div>
<div class="seal-circle">
<span class="co">{{ o.our_company or COMPANY_NAME }}</span>
<span class="txt">审核专用</span>
<span class="who">{{ user.name }}<br><span id="stampTime"></span></span>
</div>
</div>
</div>
<form method="post" action="{{ url_for('order_review', oid=o.id) }}" class="toolbar"
onsubmit="return checkStamp()">
<input type="hidden" name="stamped" id="stampedInput" value="0">
<input type="text" name="comment" placeholder="审核意见(选填)" style="width:280px;">
<button type="button" class="btn" id="stampBtn" onclick="applyStamp()">加盖审核章</button>
<button type="submit" class="btn ok" id="confirmBtn" disabled
title="请先加盖审核章">确认审核通过 → 提交经理批准</button>
</form>
<div class="muted" style="margin-top:6px;">流程:先点「加盖审核章」,确认无误后再点「确认审核通过」。</div>
</div>
<script>
function applyStamp(){
document.getElementById('stampedInput').value = '1';
document.getElementById('stampBox').style.display = 'block';
const d = new Date(), p = n => String(n).padStart(2, '0');
document.getElementById('stampTime').textContent =
d.getFullYear() + '-' + p(d.getMonth() + 1) + '-' + p(d.getDate()) +
' ' + p(d.getHours()) + ':' + p(d.getMinutes());
const c = document.getElementById('confirmBtn');
c.disabled = false;
const s = document.getElementById('stampBtn');
s.disabled = true;
s.textContent = '已加章';
}
function checkStamp(){
if (document.getElementById('stampedInput').value !== '1'){
alert('请先点击「加盖审核章」,再确认审核。');
return false;
}
return confirm('确认审核通过并提交经理批准?');
}
</script>
{% endif %}
{% if user.role in ['approver','admin'] and o.status == 'pending_approval' %}
<div style="margin-top:12px;">
<div id="apprStampBox" style="display:none; margin-bottom:10px;">
<div class="seal-wrap">
<div class="seal-tip">已加盖经理批准章</div>
<div class="seal-circle">
<span class="co">{{ o.our_company or COMPANY_NAME }}</span>
<span class="txt">批准专用</span>
<span class="who">{{ user.name }}<br><span id="apprStampTime"></span></span>
</div>
</div>
</div>
<form method="post" action="{{ url_for('order_approve', oid=o.id) }}" class="toolbar"
onsubmit="return checkStampA()">
<input type="hidden" name="stamped" id="apprStampedInput" value="0">
<input type="text" name="comment" placeholder="批准意见(选填)" style="width:280px;">
<button type="button" class="btn" id="apprStampBtn" onclick="applyStampA()">加盖批准章</button>
<button type="submit" class="btn ok" id="apprConfirmBtn" disabled
title="请先加盖批准章">确认批准通过</button>
</form>
<div class="muted" style="margin-top:6px;">流程:先点「加盖批准章」,确认无误后再点「确认批准通过」。</div>
</div>
<script>
function applyStampA(){
document.getElementById('apprStampedInput').value = '1';
document.getElementById('apprStampBox').style.display = 'block';
const d = new Date(), p = n => String(n).padStart(2, '0');
document.getElementById('apprStampTime').textContent =
d.getFullYear() + '-' + p(d.getMonth() + 1) + '-' + p(d.getDate()) +
' ' + p(d.getHours()) + ':' + p(d.getMinutes());
document.getElementById('apprConfirmBtn').disabled = false;
const s = document.getElementById('apprStampBtn');
s.disabled = true;
s.textContent = '已加章';
}
function checkStampA(){
if (document.getElementById('apprStampedInput').value !== '1'){
alert('请先点击「加盖批准章」,再确认批准。');
return false;
}
return confirm('确认批准通过?批准后即可导出正式 PDF。');
}
</script>
{% endif %}
{% if user.role in ['reviewer','approver','admin'] and o.status in ['pending_review','pending_approval'] %}
<form method="post" action="{{ url_for('order_reject', oid=o.id) }}" class="toolbar" style="margin-top:8px;">
<input type="text" name="comment" placeholder="驳回原因(必填)" style="width:280px;" required>
<button class="btn danger">驳回给制单人</button>
</form>
{% endif %}
{% if editable and o.status in ['draft','rejected'] %}
<form method="post" action="{{ url_for('order_submit', oid=o.id) }}" class="toolbar" style="margin-top:8px;">
<input type="text" name="comment" placeholder="提交说明(选填)" style="width:280px;">
<button class="btn primary">提交审核</button>
</form>
{% endif %}
{% if o.status == 'rejected' and o.reject_reason %}
<div class="flash error">驳回原因:{{ o.reject_reason }}</div>
{% endif %}
<h3>审核记录</h3>
<ul class="timeline">
{% for lg in o.logs %}
<li>{{ lg.created_at.strftime('%Y-%m-%d %H:%M') }} · {{ lg.user_name }} · {{ lg.action }}
{% if lg.comment %}({{ lg.comment }}){% endif %}</li>
{% else %}
<li class="muted">暂无记录</li>
{% endfor %}
</ul>
</div>
{% endblock %}