349 lines
22 KiB
PHP
349 lines
22 KiB
PHP
<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>
|