审批&PDF生成

This commit is contained in:
mzl
2025-09-08 11:34:19 +08:00
parent 8a4848bc75
commit 28368e27a7
30 changed files with 1269 additions and 980 deletions
-172
View File
@@ -1,172 +0,0 @@
<!-- app/view/pdf/delivery_template.php -->
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>出货单 - <?php echo htmlspecialchars($data['delivery_id'] ?? 'N/A'); ?></title>
<style>
/* styles.css */
body {
font-family: "DejaVu Sans", sans-serif; /* TCPDF 支持的字体 */
font-size: 10pt;
color: #333;
margin: 20mm 15mm 20mm 15mm; /* 页边距 */
}
.header {
text-align: center;
border-bottom: 2px solid #000;
padding-bottom: 5mm;
margin-bottom: 8mm;
}
.header h1 {
margin: 0;
font-size: 16pt;
color: #000;
}
.header p {
margin: 2mm 0;
}
.company-info {
font-size: 9pt;
text-align: right;
margin-bottom: 10mm;
}
.document-details {
margin-bottom: 10mm;
}
.document-details table {
width: 100%;
border-collapse: collapse;
}
.document-details th, .document-details td {
border: 1px solid #999;
padding: 2mm;
text-align: left;
vertical-align: top;
}
.document-details th {
background-color: #f0f0f0;
font-weight: bold;
text-align: center;
}
.items-table {
width: 100%;
border-collapse: collapse;
margin-bottom: 10mm;
}
.items-table th, .items-table td {
border: 1px solid #999;
padding: 2mm;
text-align: left;
}
.items-table th {
background-color: #eaeaea;
font-weight: bold;
}
.items-table tfoot td {
font-weight: bold;
background-color: #f9f9f9;
}
.footer {
border-top: 1px solid #ccc;
padding-top: 5mm;
font-size: 9pt;
text-align: center;
}
/* 特定于出货单的样式 */
.delivery-address {
margin-bottom: 10mm;
}
</style>
</head>
<body>
<div class="header">
<h1>商品出货单</h1>
<p>出货编号: <?php echo htmlspecialchars($data['delivery_id'] ?? 'N/A'); ?></p>
</div>
<div class="company-info">
<p>发货方: Your Company Ltd.</p>
<p>地址: 123 Main Street, City</p>
<p>电话: (123) 456-7890</p>
</div>
<div class="document-details">
<table>
<tr>
<th width="20%">客户名称</th>
<td width="30%"><?php echo htmlspecialchars($data['customer_name'] ?? ''); ?></td>
<th width="20%">出货日期</th>
<td width="30%"><?php echo htmlspecialchars($data['delivery_date'] ?? ''); ?></td>
</tr>
<tr>
<th>订单编号</th>
<td><?php echo htmlspecialchars($data['order_id'] ?? ''); ?></td>
<th>运输方式</th>
<td><?php echo htmlspecialchars($data['shipping_method'] ?? ''); ?></td>
</tr>
</table>
</div>
<div class="delivery-address">
<h3>收货地址</h3>
<p><?php echo nl2br(htmlspecialchars($data['recipient_address'] ?? '')); ?></p>
</div>
<div>
<h3>出货明细</h3>
<table class="items-table">
<thead>
<tr>
<th width="5%">序号</th>
<th width="15%">产品编码</th>
<th width="30%">产品名称</th>
<th width="10%">规格</th>
<th width="10%">单位</th>
<th width="15%">数量</th>
<th width="15%">备注</th>
</tr>
</thead>
<tbody>
<?php if (!empty($data['items'])): ?>
<?php foreach ($data['items'] as $index => $item): ?>
<tr>
<td><?php echo $index + 1; ?></td>
<td><?php echo htmlspecialchars($item['product_code'] ?? ''); ?></td>
<td><?php echo htmlspecialchars($item['product_name'] ?? ''); ?></td>
<td><?php echo htmlspecialchars($item['specification'] ?? ''); ?></td>
<td><?php echo htmlspecialchars($item['unit'] ?? ''); ?></td>
<td style="text-align: right;"><?php echo number_format($item['quantity'] ?? 0, 2); ?></td>
<td><?php echo htmlspecialchars($item['remark'] ?? ''); ?></td>
</tr>
<?php endforeach; ?>
<?php else: ?>
<tr>
<td colspan="7" style="text-align: center;">无出货明细</td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
<div class="footer">
<p>仓库经办人: _________________ &nbsp;&nbsp;&nbsp;&nbsp; 司机签名: _________________ &nbsp;&nbsp;&nbsp;&nbsp; 客户签收: _________________</p>
<p>签收日期: _________</p>
</div>
</body>
</html>
@@ -1,178 +0,0 @@
<!-- app/view/pdf/reimbursement_template.php -->
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>报销单 - <?php echo htmlspecialchars($data['reimbursement_id'] ?? 'N/A'); ?></title>
<style>
/* 明确指定支持中文的字体族 */
body {
font-family: "STSongStdLight", "Arial", sans-serif; /* STSongStdLight 对应 TCPDF 的 stsongstdlight */
font-size: 10pt;
color: #333;
margin: 20mm 15mm 20mm 15mm; /* 页边距 */
}
.header {
text-align: center;
border-bottom: 2px solid #000;
padding-bottom: 5mm;
margin-bottom: 8mm;
}
.header h1 {
margin: 0;
font-size: 16pt;
color: #000;
/* 确保标题也使用正确字体 */
font-family: "STSongStdLight", "Arial", sans-serif;
}
.header p {
margin: 2mm 0;
}
.company-info {
font-size: 9pt;
text-align: right;
margin-bottom: 10mm;
}
.document-details {
margin-bottom: 10mm;
}
.document-details table {
width: 100%;
border-collapse: collapse;
}
.document-details th, .document-details td {
border: 1px solid #999;
padding: 2mm;
text-align: left;
vertical-align: top;
/* 确保表格内容使用正确字体 */
font-family: "STSongStdLight", "Arial", sans-serif;
}
.document-details th {
background-color: #f0f0f0;
font-weight: bold;
text-align: center;
}
.items-table {
width: 100%;
border-collapse: collapse;
margin-bottom: 10mm;
}
.items-table th, .items-table td {
border: 1px solid #999;
padding: 2mm;
text-align: left;
/* 确保表格内容使用正确字体 */
font-family: "STSongStdLight", "Arial", sans-serif;
}
.items-table th {
background-color: #eaeaea;
font-weight: bold;
}
.items-table tfoot td {
font-weight: bold;
background-color: #f9f9f9;
}
.footer {
border-top: 1px solid #ccc;
padding-top: 5mm;
font-size: 9pt;
text-align: center;
}
</style>
</head>
<body>
<div class="header">
<h1>费用报销申请单</h1>
<p>报销编号: <?php echo htmlspecialchars($data['reimbursement_id'] ?? 'N/A'); ?></p>
</div>
<div class="company-info">
<!-- 公司信息可以从配置中获取 -->
<p>公司名称: Your Company Ltd.</p>
<p>地址: 123 Main Street, City</p>
<p>电话: (123) 456-7890</p>
</div>
<div class="document-details">
<table>
<tr>
<th width="20%">申请人</th>
<td width="30%"><?php echo htmlspecialchars($data['applicant_name'] ?? ''); ?></td>
<th width="20%">部门</th>
<td width="30%"><?php echo htmlspecialchars($data['department'] ?? ''); ?></td>
</tr>
<tr>
<th>申请日期</th>
<td><?php echo htmlspecialchars($data['application_date'] ?? ''); ?></td>
<th>报销总金额</th>
<td><?php echo number_format($data['total_amount'] ?? 0, 2); ?> 元</td>
</tr>
<tr>
<th>事由说明</th>
<td colspan="3"><?php echo nl2br(htmlspecialchars($data['reason'] ?? '')); ?></td>
</tr>
</table>
</div>
<div>
<h3>费用明细</h3>
<table class="items-table">
<thead>
<tr>
<th width="5%">序号</th>
<th width="15%">日期</th>
<th width="20%">费用类别</th>
<th width="30%">说明</th>
<th width="15%">金额 (元)</th>
<th width="15%">备注</th>
</tr>
</thead>
<tbody>
<?php if (!empty($data['items'])): ?>
<?php foreach ($data['items'] as $index => $item): ?>
<tr>
<td><?php echo $index + 1; ?></td>
<td><?php echo htmlspecialchars($item['date'] ?? ''); ?></td>
<td><?php echo htmlspecialchars($item['category'] ?? ''); ?></td>
<td><?php echo htmlspecialchars($item['description'] ?? ''); ?></td>
<td style="text-align: right;"><?php echo number_format($item['amount'] ?? 0, 2); ?></td>
<td><?php echo htmlspecialchars($item['remark'] ?? ''); ?></td>
</tr>
<?php endforeach; ?>
<?php else: ?>
<tr>
<td colspan="6" style="text-align: center;">无费用明细</td>
</tr>
<?php endif; ?>
</tbody>
<tfoot>
<tr>
<td colspan="4" style="text-align: right;"><strong>合计:</strong></td>
<td style="text-align: right;"><strong><?php echo number_format($data['total_amount'] ?? 0, 2); ?></strong></td>
<td></td>
</tr>
</tfoot>
</table>
</div>
<div class="footer">
<p>申请人签名: _________________ &nbsp;&nbsp;&nbsp;&nbsp; 审批人签名: _________________ &nbsp;&nbsp;&nbsp;&nbsp; 日期: _________________</p>
<p>本单据由系统生成,仅供参考。</p>
</div>
</body>
</html>
@@ -0,0 +1,237 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>合塑实业-汽车事业部-备货单(客户下定)</title>
<style>
/* 横版:A4 297mm,左右各 12mm => 可用宽度 273mm */
@page { margin: 12mm; }
body {
font-family: 'notosanssc', 'DejaVu Sans', Arial, sans-serif;
font-size: 10pt;
line-height: 1.3;
color: #000;
background: #fff;
}
.container {
width: 273mm; /* 横向版心 */
margin: 0 auto;
background: #fff;
}
.header {
text-align: center;
margin-bottom: 10pt;
padding-bottom: 6pt;
}
.title {
font-size: 14pt;
font-weight: bold;
margin-bottom: 6pt;
}
.sub-title {
font-size: 9pt;
color: #000;
margin: 0 6pt;
}
table {
width: 100%;
border-collapse: collapse;
margin-bottom: 10pt;
font-size: 9pt;
table-layout: fixed; /* 横向固定布局,配合 colgroup 更稳 */
}
th, td {
border: 0.5pt solid #000;
padding: 6pt 6pt;
text-align: center;
vertical-align: middle;
word-break: break-all;
}
th {
background-color: #f0f0f0;
font-weight: bold;
color: #000;
}
/* 跨页友好 */
thead { display: table-header-group; }
tfoot { display: table-row-group; }
tr, img { page-break-inside: avoid; }
/* 信息类表格左对齐 */
.info-table td,
.logistics-table td { text-align: left; }
.info-label { font-weight: bold; color: #000; }
.info-value { color: #000; }
.summary-row {
background-color: #f0f0f0;
font-weight: bold;
}
.payment-title {
background-color: #f0f0f0;
font-weight: bold;
text-align: center;
vertical-align: middle;
white-space: nowrap;
}
.nowrap { white-space: nowrap; }
</style>
</head>
<body>
<div class="container">
<!-- 头部 -->
<div class="header">
<h1 class="title">合塑实业-汽车事业部-备货单(客户下定)</h1>
<div>
<span class="sub-title">备货单号: <?php echo htmlspecialchars($data['order_no'] ?? 'N/A'); ?></span>
<span class="sub-title">业务员: <?php echo htmlspecialchars($data['salesperson_snapshot'] ?? ' - '); ?></span>
</div>
</div>
<!-- 基本信息 -->
<table class="info-table">
<colgroup>
<col style="width:18%">
<col style="width:15%">
<col style="width:14%">
<col style="width:14%">
<col style="width:19%">
<col style="width:20%">
</colgroup>
<tbody>
<tr>
<td><span class="info-label">阿里订单号/PI号:</span> <span class="info-value"><?php echo htmlspecialchars($data['pi_no'] ?? ' - '); ?></span></td>
<td><span class="info-label">日期:</span> <span class="info-value nowrap"><?php echo htmlspecialchars($data['biz_date'] ?? ' - '); ?></span></td>
<td><span class="info-label">关目的国:</span> <span class="info-value"><?php echo htmlspecialchars($data['clearance_country_snapshot'] ?? ' - '); ?></span></td>
<td><span class="info-label">客户来源:</span> <span class="info-value"><?php echo htmlspecialchars($data['customer_source_snapshot'] ?? ' - '); ?></span></td>
<td><span class="info-label">客户名称:</span> <span class="info-value"><?php echo htmlspecialchars($data['customer_snapshot'] ?? ' - '); ?></span></td>
<td><span class="info-label">客户所在国:</span> <span class="info-value"><?php echo htmlspecialchars($data['customer_country_snapshot'] ?? ' - '); ?></span></td>
</tr>
</tbody>
</table>
<!-- 产品列表 -->
<table class="product-table">
<colgroup>
<col style="width:6%">
<col style="width:34%">
<col style="width:6%">
<col style="width:6%">
<col style="width:6%">
<col style="width:14%">
<col style="width:8%">
<col style="width:8%">
<col style="width:6%">
<col style="width:6%">
</colgroup>
<thead>
<tr>
<th>编号</th>
<th>车型</th>
<th>数量/台</th>
<th>颜色/外</th>
<th>内饰</th>
<th>改装</th>
<th class="nowrap">单价(美金)</th>
<th class="nowrap">总价(美金)</th>
<th class="nowrap">官方指导价</th>
<th class="nowrap">优惠</th>
</tr>
</thead>
<tbody>
<?php foreach (($data['veh_list'] ?? []) as $vehicle): ?>
<tr>
<td><?php echo htmlspecialchars($vehicle['index'] ?? ' - '); ?></td>
<td><?php echo htmlspecialchars($vehicle['model_snapshot'] ?? ' - '); ?></td>
<td><?php echo htmlspecialchars($vehicle['num'] ?? ' - '); ?></td>
<td><?php echo htmlspecialchars($vehicle['color_exterior_snapshot'] ?? ' - '); ?></td>
<td><?php echo htmlspecialchars($vehicle['color_interior_snapshot'] ?? ' - '); ?></td>
<td><?php echo htmlspecialchars($vehicle['modify'] ?? ' - '); ?></td>
<td class="nowrap"><?php echo htmlspecialchars($vehicle['unit_price_text'] ?? ' - '); ?></td>
<td class="nowrap"><?php echo htmlspecialchars($vehicle['total_price_text'] ?? ' - '); ?></td>
<td class="nowrap"><?php echo htmlspecialchars($vehicle['official_price_text'] ?? ' - '); ?></td>
<td class="nowrap"><?php echo htmlspecialchars($vehicle['discount_price_text'] ?? ' - '); ?></td>
</tr>
<?php endforeach; ?>
<tr class="summary-row">
<td colspan="6" style="text-align:left;">
<span class="info-label">合同汇率:</span> <span class="info-value"><?php echo htmlspecialchars($data['contract_exchange_rate'] ?? ' - '); ?></span>
</td>
<td colspan="4" style="text-align:left;">
<span class="info-label">合计到岸价:</span> <span class="info-value"><?php echo htmlspecialchars($data['cif_total_amount'] ?? ' - '); ?></span>
</td>
</tr>
</tbody>
</table>
<!-- 物流信息 -->
<table class="logistics-table">
<colgroup>
<col style="width:16%">
<col style="width:18%">
<col style="width:12%">
<col style="width:18%">
<col style="width:22%">
<col style="width:14%">
</colgroup>
<tbody>
<tr>
<td><span class="info-label">清关人:</span> <span class="info-value"><?php echo htmlspecialchars($data['declarant_name'] ?? ' - '); ?></span></td>
<td><span class="info-label">预计发运日期:</span> <span class="info-value nowrap"><?php echo htmlspecialchars($data['eta_ship_date'] ?? ' - '); ?></span></td>
<td><span class="info-label">出运方式:</span> <span class="info-value"><?php echo htmlspecialchars($data['shipping_method_snapshot'] ?? ' - '); ?></span></td>
<td><span class="info-label">国内收货港:</span> <span class="info-value"><?php echo htmlspecialchars($data['domestic_port_snapshot'] ?? ' - '); ?></span></td>
<td><span class="info-label">贸易条款/清关目的港:</span> <span class="info-value"><?php echo htmlspecialchars($data['trade_term_snapshot'] ?? ' - '); ?>/<?php echo htmlspecialchars($data['clearance_port_snapshot'] ?? ' - '); ?></span></td>
<td><span class="info-label">最迟到港时间:</span> <span class="info-value nowrap"><?php echo htmlspecialchars($data['latest_arrival_date'] ?? ' - '); ?></span></td>
</tr>
</tbody>
</table>
<!-- 计划收款信息 -->
<table class="payment-table">
<colgroup>
<col style="width:12%">
<col style="width:10%">
<col style="width:14%">
<col style="width:12%">
<col style="width:12%">
<col style="width:20%">
<col style="width:10%">
</colgroup>
<thead>
<tr>
<th style="width:24mm" rowspan="<?php echo htmlspecialchars($data['acc_index']); ?>">计划收款信息</th>
<th>序号</th>
<th>汇款国</th>
<th>日期</th>
<th>币种</th>
<th>账户</th>
<th>汇款人</th>
<th>金额</th>
</tr>
</thead>
<tbody>
<?php foreach (($data['account_list'] ?? []) as $account): ?>
<tr>
<td class="nowrap"><?php echo htmlspecialchars($account['index'] ?? ' - '); ?></td>
<td><?php echo htmlspecialchars($account['remit_country_name_snapshot'] ?? ' - '); ?></td>
<td class="nowrap"><?php echo htmlspecialchars($account['remit_date'] ?? ' - '); ?></td>
<td class="nowrap"><?php echo htmlspecialchars($account['currency_name_snapshot'] ?? ' - '); ?></td>
<td class="nowrap"><?php echo htmlspecialchars($account['account_name_snapshot'] ?? ' - '); ?></td>
<td style="text-align:left;"><?php echo htmlspecialchars($account['remitter_name'] ?? ' - '); ?></td>
<td class="nowrap"><?php echo htmlspecialchars($account['amount'] ?? ' - '); ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</body>
</html>
-81
View File
@@ -1,81 +0,0 @@
/* styles.css */
body {
font-family: "DejaVu Sans", sans-serif; /* TCPDF 支持的字体 */
font-size: 10pt;
color: #333;
margin: 20mm 15mm 20mm 15mm; /* 页边距 */
}
.header {
text-align: center;
border-bottom: 2px solid #000;
padding-bottom: 5mm;
margin-bottom: 8mm;
}
.header h1 {
margin: 0;
font-size: 16pt;
color: #000;
}
.header p {
margin: 2mm 0;
}
.company-info {
font-size: 9pt;
text-align: right;
margin-bottom: 10mm;
}
.document-details {
margin-bottom: 10mm;
}
.document-details table {
width: 100%;
border-collapse: collapse;
}
.document-details th, .document-details td {
border: 1px solid #999;
padding: 2mm;
text-align: left;
vertical-align: top;
}
.document-details th {
background-color: #f0f0f0;
font-weight: bold;
text-align: center;
}
.items-table {
width: 100%;
border-collapse: collapse;
margin-bottom: 10mm;
}
.items-table th, .items-table td {
border: 1px solid #999;
padding: 2mm;
text-align: left;
}
.items-table th {
background-color: #eaeaea;
font-weight: bold;
}
.items-table tfoot td {
font-weight: bold;
background-color: #f9f9f9;
}
.footer {
border-top: 1px solid #ccc;
padding-top: 5mm;
font-size: 9pt;
text-align: center;
}