Files
fdesk/app/common/utils/pdf/template/reimbursement.php
T
2025-09-05 09:26:29 +08:00

178 lines
5.3 KiB
PHP

<!-- 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>