Files
2025-11-20 23:21:05 +08:00

483 lines
15 KiB
PHP

<!DOCTYPE html>
<html lang="zh-TW">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>銀行調節表 - {{ $reconciliation->reconciliation_month->format('Y年m月') }}</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: "Microsoft JhengHei", "PingFang TC", sans-serif;
font-size: 12pt;
line-height: 1.6;
color: #333;
padding: 2cm;
print-color-adjust: exact;
-webkit-print-color-adjust: exact;
}
.header {
text-align: center;
margin-bottom: 30px;
border-bottom: 3px solid #333;
padding-bottom: 20px;
}
.header h1 {
font-size: 24pt;
font-weight: bold;
margin-bottom: 10px;
}
.header .subtitle {
font-size: 14pt;
color: #666;
}
.info-section {
margin-bottom: 25px;
}
.info-section h2 {
font-size: 16pt;
font-weight: bold;
margin-bottom: 15px;
padding-bottom: 5px;
border-bottom: 2px solid #666;
}
.info-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 15px;
margin-bottom: 15px;
}
.info-item {
padding: 10px;
background-color: #f9f9f9;
border-left: 3px solid #4f46e5;
}
.info-item dt {
font-size: 10pt;
color: #666;
margin-bottom: 5px;
}
.info-item dd {
font-size: 12pt;
font-weight: bold;
}
.balance-summary {
margin: 25px 0;
padding: 20px;
background-color: #f0f4ff;
border: 2px solid #4f46e5;
border-radius: 8px;
}
.balance-row {
display: flex;
justify-content: space-between;
padding: 8px 0;
border-bottom: 1px solid #ddd;
}
.balance-row:last-child {
border-bottom: none;
font-weight: bold;
font-size: 14pt;
}
.balance-row.highlight {
background-color: #fff;
padding: 12px;
margin-top: 10px;
border: 2px solid #333;
}
table {
width: 100%;
border-collapse: collapse;
margin-bottom: 20px;
}
table thead {
background-color: #4f46e5;
color: white;
}
table th {
padding: 10px;
text-align: left;
font-weight: bold;
font-size: 11pt;
}
table th.text-right {
text-align: right;
}
table tbody tr {
border-bottom: 1px solid #ddd;
}
table tbody tr:nth-child(even) {
background-color: #f9f9f9;
}
table td {
padding: 8px 10px;
font-size: 11pt;
}
table td.text-right {
text-align: right;
}
table td.font-mono {
font-family: "Courier New", monospace;
}
table tfoot {
background-color: #f0f0f0;
font-weight: bold;
}
table tfoot td {
padding: 12px 10px;
font-size: 12pt;
}
.status-badge {
display: inline-block;
padding: 5px 12px;
border-radius: 12px;
font-size: 10pt;
font-weight: bold;
}
.status-completed {
background-color: #d1fae5;
color: #065f46;
}
.status-discrepancy {
background-color: #fee2e2;
color: #991b1b;
}
.status-pending {
background-color: #fef3c7;
color: #92400e;
}
.amount-positive {
color: #059669;
}
.amount-negative {
color: #dc2626;
}
.signatures {
margin-top: 40px;
display: grid;
grid-template-columns: 1fr 1fr 1fr;
gap: 20px;
}
.signature-box {
border: 1px solid #999;
padding: 15px;
text-align: center;
min-height: 100px;
}
.signature-box .title {
font-weight: bold;
margin-bottom: 10px;
font-size: 11pt;
}
.signature-box .name {
margin-top: 20px;
border-top: 1px solid #999;
padding-top: 10px;
font-size: 10pt;
}
.signature-box .date {
margin-top: 5px;
font-size: 9pt;
color: #666;
}
.footer {
margin-top: 40px;
padding-top: 20px;
border-top: 1px solid #ddd;
text-align: center;
font-size: 9pt;
color: #666;
}
.warning-box {
background-color: #fef2f2;
border-left: 4px solid #dc2626;
padding: 15px;
margin-bottom: 20px;
}
.warning-box .title {
font-weight: bold;
color: #991b1b;
margin-bottom: 8px;
}
.warning-box .content {
color: #7f1d1d;
font-size: 11pt;
}
@media print {
body {
padding: 1cm;
}
.page-break {
page-break-after: always;
}
@page {
margin: 1.5cm;
}
}
</style>
</head>
<body>
<!-- Header -->
<div class="header">
<h1>銀行調節表</h1>
<div class="subtitle">Bank Reconciliation Statement</div>
<div class="subtitle">{{ $reconciliation->reconciliation_month->format('Y年m月') }}</div>
</div>
<!-- Discrepancy Warning -->
@if($reconciliation->hasUnresolvedDiscrepancy())
<div class="warning-box">
<div class="title"> 發現差異</div>
<div class="content">
調節後餘額與銀行對帳單餘額不符,差異金額: NT$ {{ number_format($reconciliation->discrepancy_amount, 2) }}
</div>
</div>
@endif
<!-- Basic Information -->
<div class="info-section">
<h2>一、基本資訊</h2>
<div class="info-grid">
<div class="info-item">
<dt>調節月份</dt>
<dd>{{ $reconciliation->reconciliation_month->format('Y年m月') }}</dd>
</div>
<div class="info-item">
<dt>對帳單日期</dt>
<dd>{{ $reconciliation->bank_statement_date->format('Y-m-d') }}</dd>
</div>
<div class="info-item">
<dt>製表人</dt>
<dd>{{ $reconciliation->preparedByCashier->name }}</dd>
</div>
<div class="info-item">
<dt>製表時間</dt>
<dd>{{ $reconciliation->prepared_at->format('Y-m-d H:i') }}</dd>
</div>
</div>
<div class="info-grid">
<div class="info-item">
<dt>調節狀態</dt>
<dd>
<span class="status-badge
@if($reconciliation->reconciliation_status === 'completed') status-completed
@elseif($reconciliation->reconciliation_status === 'discrepancy') status-discrepancy
@else status-pending
@endif">
{{ $reconciliation->getStatusText() }}
</span>
</dd>
</div>
@if($reconciliation->notes)
<div class="info-item">
<dt>備註</dt>
<dd>{{ $reconciliation->notes }}</dd>
</div>
@endif
</div>
</div>
<!-- Balance Reconciliation -->
<div class="info-section">
<h2>二、餘額調節</h2>
<div class="balance-summary">
<div class="balance-row">
<span>銀行對帳單餘額</span>
<span>NT$ {{ number_format($reconciliation->bank_statement_balance, 2) }}</span>
</div>
<div class="balance-row">
<span>系統帳面餘額</span>
<span>NT$ {{ number_format($reconciliation->system_book_balance, 2) }}</span>
</div>
<div class="balance-row">
<span>調節後餘額</span>
<span class="amount-positive">NT$ {{ number_format($reconciliation->calculateAdjustedBalance(), 2) }}</span>
</div>
<div class="balance-row highlight">
<span>差異金額</span>
<span class="{{ $reconciliation->discrepancy_amount > 0 ? 'amount-negative' : 'amount-positive' }}">
NT$ {{ number_format($reconciliation->discrepancy_amount, 2) }}
</span>
</div>
</div>
</div>
<!-- Outstanding Items -->
@php
$summary = $reconciliation->getOutstandingItemsSummary();
@endphp
<div class="info-section">
<h2>三、調節項目</h2>
<!-- Outstanding Checks -->
@if($reconciliation->outstanding_checks && count($reconciliation->outstanding_checks) > 0)
<h3 style="font-size: 13pt; margin: 15px 0 10px 0;">3.1 未兌現支票 ({{ $summary['outstanding_checks_count'] }} )</h3>
<table>
<thead>
<tr>
<th style="width: 30%;">支票號碼</th>
<th class="text-right" style="width: 25%;">金額 (NT$)</th>
<th style="width: 45%;">說明</th>
</tr>
</thead>
<tbody>
@foreach($reconciliation->outstanding_checks as $check)
<tr>
<td class="font-mono">{{ $check['check_number'] ?? 'N/A' }}</td>
<td class="text-right amount-negative">{{ number_format($check['amount'], 2) }}</td>
<td>{{ $check['description'] ?? '' }}</td>
</tr>
@endforeach
</tbody>
<tfoot>
<tr>
<td>小計</td>
<td class="text-right amount-negative">{{ number_format($summary['total_outstanding_checks'], 2) }}</td>
<td></td>
</tr>
</tfoot>
</table>
@endif
<!-- Deposits in Transit -->
@if($reconciliation->deposits_in_transit && count($reconciliation->deposits_in_transit) > 0)
<h3 style="font-size: 13pt; margin: 15px 0 10px 0;">3.2 在途存款 ({{ $summary['deposits_in_transit_count'] }} )</h3>
<table>
<thead>
<tr>
<th style="width: 25%;">存款日期</th>
<th class="text-right" style="width: 25%;">金額 (NT$)</th>
<th style="width: 50%;">說明</th>
</tr>
</thead>
<tbody>
@foreach($reconciliation->deposits_in_transit as $deposit)
<tr>
<td>{{ $deposit['date'] ?? 'N/A' }}</td>
<td class="text-right amount-positive">{{ number_format($deposit['amount'], 2) }}</td>
<td>{{ $deposit['description'] ?? '' }}</td>
</tr>
@endforeach
</tbody>
<tfoot>
<tr>
<td>小計</td>
<td class="text-right amount-positive">{{ number_format($summary['total_deposits_in_transit'], 2) }}</td>
<td></td>
</tr>
</tfoot>
</table>
@endif
<!-- Bank Charges -->
@if($reconciliation->bank_charges && count($reconciliation->bank_charges) > 0)
<h3 style="font-size: 13pt; margin: 15px 0 10px 0;">3.3 銀行手續費 ({{ $summary['bank_charges_count'] }} )</h3>
<table>
<thead>
<tr>
<th class="text-right" style="width: 30%;">金額 (NT$)</th>
<th style="width: 70%;">說明</th>
</tr>
</thead>
<tbody>
@foreach($reconciliation->bank_charges as $charge)
<tr>
<td class="text-right amount-negative">{{ number_format($charge['amount'], 2) }}</td>
<td>{{ $charge['description'] ?? '' }}</td>
</tr>
@endforeach
</tbody>
<tfoot>
<tr>
<td class="text-right amount-negative">{{ number_format($summary['total_bank_charges'], 2) }}</td>
<td>小計</td>
</tr>
</tfoot>
</table>
@endif
</div>
<!-- Signatures -->
<div class="signatures">
<div class="signature-box">
<div class="title">製表人(出納)</div>
<div class="name">{{ $reconciliation->preparedByCashier->name }}</div>
<div class="date">{{ $reconciliation->prepared_at->format('Y-m-d') }}</div>
</div>
<div class="signature-box">
<div class="title">覆核人(會計)</div>
@if($reconciliation->reviewed_at)
<div class="name">{{ $reconciliation->reviewedByAccountant->name }}</div>
<div class="date">{{ $reconciliation->reviewed_at->format('Y-m-d') }}</div>
@else
<div class="name" style="color: #999;">待覆核</div>
@endif
</div>
<div class="signature-box">
<div class="title">核准人(主管)</div>
@if($reconciliation->approved_at)
<div class="name">{{ $reconciliation->approvedByManager->name }}</div>
<div class="date">{{ $reconciliation->approved_at->format('Y-m-d') }}</div>
@else
<div class="name" style="color: #999;">待核准</div>
@endif
</div>
</div>
<!-- Footer -->
<div class="footer">
<p>本調節表由系統自動產生 - {{ now()->format('Y-m-d H:i:s') }}</p>
<p>此文件為正式財務記錄,請妥善保存</p>
</div>
</body>
</html>