Initial commit

This commit is contained in:
2025-11-20 23:21:05 +08:00
commit 13bc6db529
378 changed files with 54527 additions and 0 deletions

View File

@@ -0,0 +1,287 @@
<x-app-layout>
<x-slot name="header">
<h2 class="text-xl font-semibold leading-tight text-gray-800">
製作銀行調節表
</h2>
</x-slot>
<div class="py-12">
<div class="mx-auto max-w-5xl sm:px-6 lg:px-8 space-y-4">
@if (session('error'))
<div class="rounded-md bg-red-50 p-4">
<p class="text-sm font-medium text-red-800">{{ session('error') }}</p>
</div>
@endif
<!-- Help Info -->
<div class="bg-blue-50 border border-blue-200 rounded-lg p-4">
<div class="flex">
<div class="flex-shrink-0">
<svg class="h-5 w-5 text-blue-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
</div>
<div class="ml-3">
<h3 class="text-sm font-medium text-blue-800">銀行調節表說明</h3>
<div class="mt-2 text-sm text-blue-700">
<p>銀行調節表用於核對銀行對帳單餘額與內部現金簿餘額的差異。請準備好:</p>
<ul class="list-disc pl-5 mt-2 space-y-1">
<li>銀行對帳單 (PDF/圖片檔)</li>
<li>當月的現金簿記錄</li>
<li>未兌現支票清單</li>
<li>在途存款記錄</li>
</ul>
</div>
</div>
</div>
</div>
<form method="POST" action="{{ route('admin.bank-reconciliations.store') }}" enctype="multipart/form-data" class="space-y-4">
@csrf
<!-- Basic Information -->
<div class="bg-white shadow sm:rounded-lg">
<div class="px-4 py-5 sm:p-6">
<h3 class="text-lg font-medium leading-6 text-gray-900 mb-4">基本資訊</h3>
<div class="grid grid-cols-1 gap-6 sm:grid-cols-2">
<!-- Reconciliation Month -->
<div>
<label for="reconciliation_month" class="block text-sm font-medium text-gray-700">
調節月份 <span class="text-red-500">*</span>
</label>
<input type="month" name="reconciliation_month" id="reconciliation_month" required
value="{{ old('reconciliation_month', $month) }}"
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm @error('reconciliation_month') border-red-300 @enderror">
@error('reconciliation_month')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<!-- Bank Statement Date -->
<div>
<label for="bank_statement_date" class="block text-sm font-medium text-gray-700">
對帳單日期 <span class="text-red-500">*</span>
</label>
<input type="date" name="bank_statement_date" id="bank_statement_date" required
value="{{ old('bank_statement_date') }}"
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm @error('bank_statement_date') border-red-300 @enderror">
@error('bank_statement_date')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<!-- Bank Statement Balance -->
<div>
<label for="bank_statement_balance" class="block text-sm font-medium text-gray-700">
銀行對帳單餘額 <span class="text-red-500">*</span>
</label>
<div class="relative mt-1 rounded-md shadow-sm">
<div class="pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3">
<span class="text-gray-500 sm:text-sm">NT$</span>
</div>
<input type="number" name="bank_statement_balance" id="bank_statement_balance" step="0.01" required
value="{{ old('bank_statement_balance') }}"
class="block w-full rounded-md border-gray-300 pl-12 focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm @error('bank_statement_balance') border-red-300 @enderror">
</div>
@error('bank_statement_balance')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<!-- System Book Balance -->
<div>
<label for="system_book_balance" class="block text-sm font-medium text-gray-700">
系統帳面餘額 <span class="text-red-500">*</span>
</label>
<div class="relative mt-1 rounded-md shadow-sm">
<div class="pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3">
<span class="text-gray-500 sm:text-sm">NT$</span>
</div>
<input type="number" name="system_book_balance" id="system_book_balance" step="0.01" required
value="{{ old('system_book_balance', $systemBalance) }}"
class="block w-full rounded-md border-gray-300 pl-12 focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm @error('system_book_balance') border-red-300 @enderror">
</div>
<p class="mt-1 text-xs text-gray-500">從現金簿自動帶入: NT$ {{ number_format($systemBalance, 2) }}</p>
@error('system_book_balance')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
<!-- Bank Statement File -->
<div class="sm:col-span-2">
<label for="bank_statement_file" class="block text-sm font-medium text-gray-700">
銀行對帳單檔案
</label>
<input type="file" name="bank_statement_file" id="bank_statement_file" accept=".pdf,.jpg,.jpeg,.png"
class="mt-1 block w-full text-sm text-gray-500
file:mr-4 file:py-2 file:px-4
file:rounded-md file:border-0
file:text-sm file:font-semibold
file:bg-indigo-50 file:text-indigo-700
hover:file:bg-indigo-100">
<p class="mt-1 text-xs text-gray-500">支援格式: PDF, JPG, PNG (最大 10MB)</p>
@error('bank_statement_file')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
</div>
</div>
</div>
<!-- Outstanding Checks -->
<div class="bg-white shadow sm:rounded-lg">
<div class="px-4 py-5 sm:p-6">
<h3 class="text-lg font-medium leading-6 text-gray-900 mb-4">未兌現支票</h3>
<div id="outstanding-checks-container" class="space-y-3">
<!-- Template will be added by JavaScript -->
</div>
<button type="button" onclick="addOutstandingCheck()" class="mt-3 inline-flex items-center rounded-md border border-gray-300 bg-white px-3 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50">
<svg class="-ml-1 mr-2 h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4" />
</svg>
新增支票
</button>
</div>
</div>
<!-- Deposits in Transit -->
<div class="bg-white shadow sm:rounded-lg">
<div class="px-4 py-5 sm:p-6">
<h3 class="text-lg font-medium leading-6 text-gray-900 mb-4">在途存款</h3>
<div id="deposits-container" class="space-y-3">
<!-- Template will be added by JavaScript -->
</div>
<button type="button" onclick="addDeposit()" class="mt-3 inline-flex items-center rounded-md border border-gray-300 bg-white px-3 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50">
<svg class="-ml-1 mr-2 h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4" />
</svg>
新增存款
</button>
</div>
</div>
<!-- Bank Charges -->
<div class="bg-white shadow sm:rounded-lg">
<div class="px-4 py-5 sm:p-6">
<h3 class="text-lg font-medium leading-6 text-gray-900 mb-4">銀行手續費</h3>
<div id="charges-container" class="space-y-3">
<!-- Template will be added by JavaScript -->
</div>
<button type="button" onclick="addCharge()" class="mt-3 inline-flex items-center rounded-md border border-gray-300 bg-white px-3 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50">
<svg class="-ml-1 mr-2 h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4" />
</svg>
新增手續費
</button>
</div>
</div>
<!-- Notes -->
<div class="bg-white shadow sm:rounded-lg">
<div class="px-4 py-5 sm:p-6">
<label for="notes" class="block text-sm font-medium text-gray-700">備註</label>
<textarea name="notes" id="notes" rows="3"
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm">{{ old('notes') }}</textarea>
</div>
</div>
<!-- Form Actions -->
<div class="flex justify-end space-x-3">
<a href="{{ route('admin.bank-reconciliations.index') }}" class="inline-flex items-center rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2">
取消
</a>
<button type="submit" class="inline-flex items-center rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2">
製作調節表
</button>
</div>
</form>
</div>
</div>
@push('scripts')
<script>
let checkIndex = 0;
let depositIndex = 0;
let chargeIndex = 0;
function addOutstandingCheck() {
const container = document.getElementById('outstanding-checks-container');
const div = document.createElement('div');
div.className = 'grid grid-cols-1 gap-4 sm:grid-cols-3 p-4 border border-gray-200 rounded-md';
div.innerHTML = `
<div>
<label class="block text-sm font-medium text-gray-700">支票號碼</label>
<input type="text" name="outstanding_checks[${checkIndex}][check_number]"
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm">
</div>
<div>
<label class="block text-sm font-medium text-gray-700">金額 <span class="text-red-500">*</span></label>
<input type="number" name="outstanding_checks[${checkIndex}][amount]" step="0.01" min="0" required
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm">
</div>
<div>
<label class="block text-sm font-medium text-gray-700">說明</label>
<input type="text" name="outstanding_checks[${checkIndex}][description]"
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm">
</div>
`;
container.appendChild(div);
checkIndex++;
}
function addDeposit() {
const container = document.getElementById('deposits-container');
const div = document.createElement('div');
div.className = 'grid grid-cols-1 gap-4 sm:grid-cols-3 p-4 border border-gray-200 rounded-md';
div.innerHTML = `
<div>
<label class="block text-sm font-medium text-gray-700">存款日期</label>
<input type="date" name="deposits_in_transit[${depositIndex}][date]"
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm">
</div>
<div>
<label class="block text-sm font-medium text-gray-700">金額 <span class="text-red-500">*</span></label>
<input type="number" name="deposits_in_transit[${depositIndex}][amount]" step="0.01" min="0" required
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm">
</div>
<div>
<label class="block text-sm font-medium text-gray-700">說明</label>
<input type="text" name="deposits_in_transit[${depositIndex}][description]"
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm">
</div>
`;
container.appendChild(div);
depositIndex++;
}
function addCharge() {
const container = document.getElementById('charges-container');
const div = document.createElement('div');
div.className = 'grid grid-cols-1 gap-4 sm:grid-cols-2 p-4 border border-gray-200 rounded-md';
div.innerHTML = `
<div>
<label class="block text-sm font-medium text-gray-700">金額 <span class="text-red-500">*</span></label>
<input type="number" name="bank_charges[${chargeIndex}][amount]" step="0.01" min="0" required
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm">
</div>
<div>
<label class="block text-sm font-medium text-gray-700">說明</label>
<input type="text" name="bank_charges[${chargeIndex}][description]"
placeholder="例如: 轉帳手續費"
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm">
</div>
`;
container.appendChild(div);
chargeIndex++;
}
// Add one of each by default
window.addEventListener('load', function() {
addOutstandingCheck();
addDeposit();
addCharge();
});
</script>
@endpush
</x-app-layout>

View File

@@ -0,0 +1,165 @@
<x-app-layout>
<x-slot name="header">
<h2 class="text-xl font-semibold leading-tight text-gray-800">
銀行調節表
</h2>
</x-slot>
<div class="py-12">
<div class="mx-auto max-w-7xl sm:px-6 lg:px-8 space-y-4">
@if (session('status'))
<div class="rounded-md bg-green-50 p-4">
<p class="text-sm font-medium text-green-800">{{ session('status') }}</p>
</div>
@endif
@if (session('error'))
<div class="rounded-md bg-red-50 p-4">
<p class="text-sm font-medium text-red-800">{{ session('error') }}</p>
</div>
@endif
<!-- Action Button -->
@can('prepare_bank_reconciliation')
<div class="flex justify-end">
<a href="{{ route('admin.bank-reconciliations.create') }}" class="inline-flex items-center rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2">
<svg class="-ml-1 mr-2 h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4" />
</svg>
製作調節表
</a>
</div>
@endcan
<!-- Filters -->
<div class="bg-white shadow sm:rounded-lg">
<div class="px-4 py-5 sm:p-6">
<form method="GET" action="{{ route('admin.bank-reconciliations.index') }}" class="grid grid-cols-1 gap-4 sm:grid-cols-3">
<div>
<label for="reconciliation_status" class="block text-sm font-medium text-gray-700">狀態</label>
<select name="reconciliation_status" id="reconciliation_status" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm">
<option value="">全部</option>
<option value="pending" {{ request('reconciliation_status') == 'pending' ? 'selected' : '' }}>待覆核</option>
<option value="completed" {{ request('reconciliation_status') == 'completed' ? 'selected' : '' }}>已完成</option>
<option value="discrepancy" {{ request('reconciliation_status') == 'discrepancy' ? 'selected' : '' }}>有差異</option>
</select>
</div>
<div>
<label for="month" class="block text-sm font-medium text-gray-700">調節月份</label>
<input type="month" name="month" id="month" value="{{ request('month') }}"
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm">
</div>
<div class="flex items-end">
<button type="submit" class="inline-flex items-center rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2">
篩選
</button>
<a href="{{ route('admin.bank-reconciliations.index') }}" class="ml-2 inline-flex items-center rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2">
清除
</a>
</div>
</form>
</div>
</div>
<!-- Reconciliations Table -->
<div class="bg-white shadow sm:rounded-lg">
<div class="px-4 py-5 sm:p-6">
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th scope="col" class="px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500">
調節月份
</th>
<th scope="col" class="px-4 py-3 text-right text-xs font-medium uppercase tracking-wider text-gray-500">
銀行餘額
</th>
<th scope="col" class="px-4 py-3 text-right text-xs font-medium uppercase tracking-wider text-gray-500">
帳面餘額
</th>
<th scope="col" class="px-4 py-3 text-right text-xs font-medium uppercase tracking-wider text-gray-500">
差異金額
</th>
<th scope="col" class="px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500">
狀態
</th>
<th scope="col" class="px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500">
製表人
</th>
<th scope="col" class="px-4 py-3 text-right text-xs font-medium uppercase tracking-wider text-gray-500">
<span class="sr-only">操作</span>
</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-200 bg-white">
@forelse ($reconciliations as $reconciliation)
<tr>
<td class="whitespace-nowrap px-4 py-4 text-sm font-medium text-gray-900">
{{ $reconciliation->reconciliation_month->format('Y年m月') }}
</td>
<td class="whitespace-nowrap px-4 py-4 text-sm text-right text-gray-500">
NT$ {{ number_format($reconciliation->bank_statement_balance, 2) }}
</td>
<td class="whitespace-nowrap px-4 py-4 text-sm text-right text-gray-500">
NT$ {{ number_format($reconciliation->system_book_balance, 2) }}
</td>
<td class="whitespace-nowrap px-4 py-4 text-sm text-right {{ $reconciliation->discrepancy_amount > 0 ? 'text-red-600 font-semibold' : 'text-gray-500' }}">
NT$ {{ number_format($reconciliation->discrepancy_amount, 2) }}
</td>
<td class="whitespace-nowrap px-4 py-4 text-sm">
<span class="inline-flex rounded-full px-2 text-xs font-semibold leading-5
@if($reconciliation->reconciliation_status === 'completed') bg-green-100 text-green-800
@elseif($reconciliation->reconciliation_status === 'discrepancy') bg-red-100 text-red-800
@else bg-yellow-100 text-yellow-800
@endif">
{{ $reconciliation->getStatusText() }}
</span>
</td>
<td class="whitespace-nowrap px-4 py-4 text-sm text-gray-500">
{{ $reconciliation->preparedByCashier->name ?? 'N/A' }}
</td>
<td class="whitespace-nowrap px-4 py-4 text-right text-sm font-medium">
<a href="{{ route('admin.bank-reconciliations.show', $reconciliation) }}" class="text-indigo-600 hover:text-indigo-900">
查看
</a>
</td>
</tr>
@empty
<tr>
<td colspan="7" class="px-4 py-8 text-center text-sm text-gray-500">
沒有銀行調節表記錄
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
<div class="mt-4">
{{ $reconciliations->links() }}
</div>
</div>
</div>
<!-- Help Info -->
<div class="bg-blue-50 border border-blue-200 rounded-lg p-4">
<div class="flex">
<div class="flex-shrink-0">
<svg class="h-5 w-5 text-blue-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
</div>
<div class="ml-3">
<h3 class="text-sm font-medium text-blue-800">關於銀行調節表</h3>
<div class="mt-2 text-sm text-blue-700">
<p>銀行調節表用於核對銀行對帳單與內部現金簿的差異。建議每月定期製作,以確保帳務正確。</p>
<p class="mt-1">調節流程:出納製作 會計覆核 主管核准</p>
</div>
</div>
</div>
</div>
</div>
</div>
</x-app-layout>

View File

@@ -0,0 +1,482 @@
<!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>

View File

@@ -0,0 +1,348 @@
<x-app-layout>
<x-slot name="header">
<h2 class="text-xl font-semibold leading-tight text-gray-800">
銀行調節表詳情: {{ $reconciliation->reconciliation_month->format('Y年m月') }}
</h2>
</x-slot>
<div class="py-12">
<div class="mx-auto max-w-5xl sm:px-6 lg:px-8 space-y-4">
@if (session('status'))
<div class="rounded-md bg-green-50 p-4">
<p class="text-sm font-medium text-green-800">{{ session('status') }}</p>
</div>
@endif
@if (session('error'))
<div class="rounded-md bg-red-50 p-4">
<p class="text-sm font-medium text-red-800">{{ session('error') }}</p>
</div>
@endif
<!-- Reconciliation Status Warning -->
@if($reconciliation->hasUnresolvedDiscrepancy())
<div class="rounded-md bg-red-50 p-4 border border-red-200">
<div class="flex">
<div class="flex-shrink-0">
<svg class="h-5 w-5 text-red-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
</svg>
</div>
<div class="ml-3">
<h3 class="text-sm font-medium text-red-800">發現差異</h3>
<p class="mt-1 text-sm text-red-700">
調節後餘額與銀行對帳單餘額不符,差異金額: NT$ {{ number_format($reconciliation->discrepancy_amount, 2) }}
</p>
</div>
</div>
</div>
@endif
<!-- Basic Information -->
<div class="bg-white shadow sm:rounded-lg">
<div class="px-4 py-5 sm:p-6">
<div class="flex items-center justify-between mb-4">
<h3 class="text-lg font-medium leading-6 text-gray-900">調節表資訊</h3>
<span class="inline-flex rounded-full px-3 py-1 text-sm font-semibold
@if($reconciliation->reconciliation_status === 'completed') bg-green-100 text-green-800
@elseif($reconciliation->reconciliation_status === 'discrepancy') bg-red-100 text-red-800
@else bg-yellow-100 text-yellow-800
@endif">
{{ $reconciliation->getStatusText() }}
</span>
</div>
<dl class="grid grid-cols-1 gap-x-4 gap-y-4 sm:grid-cols-2">
<div>
<dt class="text-sm font-medium text-gray-500">調節月份</dt>
<dd class="mt-1 text-sm text-gray-900 font-semibold">{{ $reconciliation->reconciliation_month->format('Y年m月') }}</dd>
</div>
<div>
<dt class="text-sm font-medium text-gray-500">對帳單日期</dt>
<dd class="mt-1 text-sm text-gray-900">{{ $reconciliation->bank_statement_date->format('Y-m-d') }}</dd>
</div>
<div>
<dt class="text-sm font-medium text-gray-500">銀行對帳單餘額</dt>
<dd class="mt-1 text-lg font-semibold text-blue-600">NT$ {{ number_format($reconciliation->bank_statement_balance, 2) }}</dd>
</div>
<div>
<dt class="text-sm font-medium text-gray-500">系統帳面餘額</dt>
<dd class="mt-1 text-lg font-semibold text-indigo-600">NT$ {{ number_format($reconciliation->system_book_balance, 2) }}</dd>
</div>
<div>
<dt class="text-sm font-medium text-gray-500">調節後餘額</dt>
<dd class="mt-1 text-lg font-semibold text-green-600">NT$ {{ number_format($reconciliation->calculateAdjustedBalance(), 2) }}</dd>
</div>
<div>
<dt class="text-sm font-medium text-gray-500">差異金額</dt>
<dd class="mt-1 text-lg font-semibold {{ $reconciliation->discrepancy_amount > 0 ? 'text-red-600' : 'text-green-600' }}">
NT$ {{ number_format($reconciliation->discrepancy_amount, 2) }}
</dd>
</div>
@if($reconciliation->bank_statement_file_path)
<div class="sm:col-span-2">
<dt class="text-sm font-medium text-gray-500">銀行對帳單</dt>
<dd class="mt-1">
<a href="{{ route('admin.bank-reconciliations.download', $reconciliation) }}" class="text-indigo-600 hover:text-indigo-900">
<svg class="inline h-5 w-5 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
</svg>
下載對帳單
</a>
</dd>
</div>
@endif
<div class="sm:col-span-2">
<dt class="text-sm font-medium text-gray-500">製表人(出納)</dt>
<dd class="mt-1 text-sm text-gray-900">
{{ $reconciliation->preparedByCashier->name }} - {{ $reconciliation->prepared_at->format('Y-m-d H:i') }}
</dd>
</div>
@if($reconciliation->notes)
<div class="sm:col-span-2">
<dt class="text-sm font-medium text-gray-500">備註</dt>
<dd class="mt-1 text-sm text-gray-900">{{ $reconciliation->notes }}</dd>
</div>
@endif
</dl>
</div>
</div>
<!-- Outstanding Items Summary -->
@php
$summary = $reconciliation->getOutstandingItemsSummary();
@endphp
<div class="bg-white shadow sm:rounded-lg">
<div class="px-4 py-5 sm:p-6">
<h3 class="text-lg font-medium leading-6 text-gray-900 mb-4">調節項目明細</h3>
<div class="grid grid-cols-1 gap-4 sm:grid-cols-3 mb-6">
<!-- Outstanding Checks -->
<div class="rounded-lg border border-red-200 bg-red-50 p-4">
<dt class="text-sm font-medium text-gray-700">未兌現支票</dt>
<dd class="mt-2 text-2xl font-semibold text-red-700">
- NT$ {{ number_format($summary['total_outstanding_checks'], 2) }}
</dd>
<dd class="mt-1 text-xs text-gray-600">{{ $summary['outstanding_checks_count'] }} </dd>
</div>
<!-- Deposits in Transit -->
<div class="rounded-lg border border-green-200 bg-green-50 p-4">
<dt class="text-sm font-medium text-gray-700">在途存款</dt>
<dd class="mt-2 text-2xl font-semibold text-green-700">
+ NT$ {{ number_format($summary['total_deposits_in_transit'], 2) }}
</dd>
<dd class="mt-1 text-xs text-gray-600">{{ $summary['deposits_in_transit_count'] }} </dd>
</div>
<!-- Bank Charges -->
<div class="rounded-lg border border-yellow-200 bg-yellow-50 p-4">
<dt class="text-sm font-medium text-gray-700">銀行手續費</dt>
<dd class="mt-2 text-2xl font-semibold text-yellow-700">
- NT$ {{ number_format($summary['total_bank_charges'], 2) }}
</dd>
<dd class="mt-1 text-xs text-gray-600">{{ $summary['bank_charges_count'] }} </dd>
</div>
</div>
<!-- Detailed Outstanding Checks -->
@if($reconciliation->outstanding_checks && count($reconciliation->outstanding_checks) > 0)
<div class="mb-4">
<h4 class="text-sm font-semibold text-gray-700 mb-2">未兌現支票明細</h4>
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th class="px-3 py-2 text-left text-xs font-medium text-gray-500">支票號碼</th>
<th class="px-3 py-2 text-right text-xs font-medium text-gray-500">金額</th>
<th class="px-3 py-2 text-left text-xs font-medium text-gray-500">說明</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-200 bg-white">
@foreach($reconciliation->outstanding_checks as $check)
<tr>
<td class="whitespace-nowrap px-3 py-2 text-sm text-gray-900 font-mono">{{ $check['check_number'] ?? 'N/A' }}</td>
<td class="whitespace-nowrap px-3 py-2 text-sm text-right text-red-600">NT$ {{ number_format($check['amount'], 2) }}</td>
<td class="px-3 py-2 text-sm text-gray-500">{{ $check['description'] ?? '' }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@endif
<!-- Detailed Deposits in Transit -->
@if($reconciliation->deposits_in_transit && count($reconciliation->deposits_in_transit) > 0)
<div class="mb-4">
<h4 class="text-sm font-semibold text-gray-700 mb-2">在途存款明細</h4>
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th class="px-3 py-2 text-left text-xs font-medium text-gray-500">存款日期</th>
<th class="px-3 py-2 text-right text-xs font-medium text-gray-500">金額</th>
<th class="px-3 py-2 text-left text-xs font-medium text-gray-500">說明</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-200 bg-white">
@foreach($reconciliation->deposits_in_transit as $deposit)
<tr>
<td class="whitespace-nowrap px-3 py-2 text-sm text-gray-900">{{ $deposit['date'] ?? 'N/A' }}</td>
<td class="whitespace-nowrap px-3 py-2 text-sm text-right text-green-600">NT$ {{ number_format($deposit['amount'], 2) }}</td>
<td class="px-3 py-2 text-sm text-gray-500">{{ $deposit['description'] ?? '' }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@endif
<!-- Detailed Bank Charges -->
@if($reconciliation->bank_charges && count($reconciliation->bank_charges) > 0)
<div>
<h4 class="text-sm font-semibold text-gray-700 mb-2">銀行手續費明細</h4>
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th class="px-3 py-2 text-right text-xs font-medium text-gray-500">金額</th>
<th class="px-3 py-2 text-left text-xs font-medium text-gray-500">說明</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-200 bg-white">
@foreach($reconciliation->bank_charges as $charge)
<tr>
<td class="whitespace-nowrap px-3 py-2 text-sm text-right text-yellow-600">NT$ {{ number_format($charge['amount'], 2) }}</td>
<td class="px-3 py-2 text-sm text-gray-500">{{ $charge['description'] ?? '' }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@endif
</div>
</div>
<!-- Accountant Review Section -->
<div class="bg-white shadow sm:rounded-lg">
<div class="px-4 py-5 sm:p-6">
<h3 class="text-lg font-medium leading-6 text-gray-900 mb-4">會計覆核</h3>
@if($reconciliation->reviewed_at)
<dl class="grid grid-cols-1 gap-x-4 gap-y-4 sm:grid-cols-2">
<div>
<dt class="text-sm font-medium text-gray-500">覆核人</dt>
<dd class="mt-1 text-sm text-gray-900">{{ $reconciliation->reviewedByAccountant->name }}</dd>
</div>
<div>
<dt class="text-sm font-medium text-gray-500">覆核時間</dt>
<dd class="mt-1 text-sm text-gray-900">{{ $reconciliation->reviewed_at->format('Y-m-d H:i') }}</dd>
</div>
@if($reconciliation->review_notes)
<div class="sm:col-span-2">
<dt class="text-sm font-medium text-gray-500">覆核備註</dt>
<dd class="mt-1 text-sm text-gray-900">{{ $reconciliation->review_notes }}</dd>
</div>
@endif
</dl>
@else
<p class="text-sm text-gray-500 mb-4">此調節表待會計覆核</p>
@can('review_bank_reconciliation')
@if($reconciliation->canBeReviewed())
<form method="POST" action="{{ route('admin.bank-reconciliations.review', $reconciliation) }}" class="space-y-4">
@csrf
<div>
<label for="review_notes" class="block text-sm font-medium text-gray-700">覆核備註</label>
<textarea name="review_notes" id="review_notes" rows="3"
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm"></textarea>
</div>
<div>
<button type="submit"
class="inline-flex items-center rounded-md border border-transparent bg-green-600 px-4 py-2 text-sm font-medium text-white hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-green-500 focus:ring-offset-2">
確認覆核
</button>
</div>
</form>
@endif
@endcan
@endif
</div>
</div>
<!-- Manager Approval Section -->
<div class="bg-white shadow sm:rounded-lg">
<div class="px-4 py-5 sm:p-6">
<h3 class="text-lg font-medium leading-6 text-gray-900 mb-4">主管核准</h3>
@if($reconciliation->approved_at)
<dl class="grid grid-cols-1 gap-x-4 gap-y-4 sm:grid-cols-2">
<div>
<dt class="text-sm font-medium text-gray-500">核准人</dt>
<dd class="mt-1 text-sm text-gray-900">{{ $reconciliation->approvedByManager->name }}</dd>
</div>
<div>
<dt class="text-sm font-medium text-gray-500">核准時間</dt>
<dd class="mt-1 text-sm text-gray-900">{{ $reconciliation->approved_at->format('Y-m-d H:i') }}</dd>
</div>
@if($reconciliation->approval_notes)
<div class="sm:col-span-2">
<dt class="text-sm font-medium text-gray-500">核准備註</dt>
<dd class="mt-1 text-sm text-gray-900">{{ $reconciliation->approval_notes }}</dd>
</div>
@endif
</dl>
@else
@if($reconciliation->reviewed_at)
<p class="text-sm text-gray-500 mb-4">此調節表待主管核准</p>
@can('approve_bank_reconciliation')
@if($reconciliation->canBeApproved())
<form method="POST" action="{{ route('admin.bank-reconciliations.approve', $reconciliation) }}" class="space-y-4">
@csrf
<div>
<label for="approval_notes" class="block text-sm font-medium text-gray-700">核准備註</label>
<textarea name="approval_notes" id="approval_notes" rows="3"
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm"></textarea>
</div>
<div>
<button type="submit"
class="inline-flex items-center rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2">
確認核准
</button>
</div>
</form>
@endif
@endcan
@else
<p class="text-sm text-gray-500">等待會計覆核完成後,方可進行主管核准</p>
@endif
@endif
</div>
</div>
<!-- Actions -->
<div class="flex justify-between">
<a href="{{ route('admin.bank-reconciliations.index') }}" class="inline-flex items-center rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2">
返回列表
</a>
@if($reconciliation->isCompleted())
<a href="{{ route('admin.bank-reconciliations.pdf', $reconciliation) }}" target="_blank" class="inline-flex items-center rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2">
<svg class="-ml-1 mr-2 h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
</svg>
匯出PDF
</a>
@endif
</div>
</div>
</div>
</x-app-layout>