feat:재무 대시보드 최근 거래내역을 바로빌 데이터로 표시
- barobill_bank_transactions 테이블에서 최근 7일 거래 조회 - 입금/출금/잔액 컬럼 표시 - 전체보기 링크를 계좌 입출금내역 페이지로 변경 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,8 +3,8 @@
|
||||
namespace App\Http\Controllers\Finance;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Barobill\BankTransaction as BarobillBankTransaction;
|
||||
use App\Models\Finance\BankAccount;
|
||||
use App\Models\Finance\BankTransaction;
|
||||
use App\Models\Finance\FundSchedule;
|
||||
use App\Services\BankAccountService;
|
||||
use App\Services\FundScheduleService;
|
||||
@@ -37,9 +37,15 @@ public function index(): View
|
||||
// 향후 7일 자금 일정
|
||||
$upcomingSchedules = $this->fundScheduleService->getUpcomingSchedules(7);
|
||||
|
||||
// 최근 거래내역 (10건)
|
||||
$recentTransactions = BankTransaction::with('bankAccount:id,bank_name,account_number')
|
||||
->latest('transaction_date')
|
||||
// 최근 거래내역 (바로빌 - 최근 7일, 최대 10건)
|
||||
$tenantId = session('selected_tenant_id', 1);
|
||||
$weekAgo = now()->subDays(7)->format('Ymd');
|
||||
$today = now()->format('Ymd');
|
||||
|
||||
$recentTransactions = BarobillBankTransaction::where('tenant_id', $tenantId)
|
||||
->whereBetween('trans_date', [$weekAgo, $today])
|
||||
->orderBy('trans_date', 'desc')
|
||||
->orderBy('trans_time', 'desc')
|
||||
->limit(10)
|
||||
->get();
|
||||
|
||||
|
||||
@@ -221,11 +221,11 @@ class="inline-flex items-center gap-2 px-4 py-2 bg-blue-600 hover:bg-blue-700 te
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- 최근 거래내역 --}}
|
||||
{{-- 최근 거래내역 (바로빌) --}}
|
||||
<div class="bg-white rounded-lg shadow-sm overflow-hidden">
|
||||
<div class="px-6 py-4 border-b border-gray-200 flex justify-between items-center">
|
||||
<h2 class="text-lg font-semibold text-gray-800">최근 거래내역</h2>
|
||||
<a href="{{ route('finance.account-transactions') }}" class="text-sm text-blue-600 hover:text-blue-700">
|
||||
<a href="{{ route('barobill.eaccount.index') }}" class="text-sm text-blue-600 hover:text-blue-700">
|
||||
전체보기
|
||||
</a>
|
||||
</div>
|
||||
@@ -234,53 +234,46 @@ class="inline-flex items-center gap-2 px-4 py-2 bg-blue-600 hover:bg-blue-700 te
|
||||
<thead class="bg-gray-50">
|
||||
<tr>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">날짜</th>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">계좌</th>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">유형</th>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">은행</th>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">적요</th>
|
||||
<th class="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">금액</th>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">상대방</th>
|
||||
<th class="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">입금</th>
|
||||
<th class="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">출금</th>
|
||||
<th class="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">잔액</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="bg-white divide-y divide-gray-200">
|
||||
@forelse($recentTransactions as $tx)
|
||||
@php
|
||||
$transDate = \Carbon\Carbon::createFromFormat('Ymd', $tx->trans_date);
|
||||
@endphp
|
||||
<tr class="hover:bg-gray-50">
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
||||
{{ $tx->transaction_date->format('m/d') }}
|
||||
{{ $transDate->format('m/d') }}
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">
|
||||
{{ $tx->bankAccount?->bank_name ?? '-' }}
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
@php
|
||||
$typeColors = [
|
||||
'deposit' => 'bg-green-100 text-green-700',
|
||||
'withdrawal' => 'bg-red-100 text-red-700',
|
||||
'transfer' => 'bg-blue-100 text-blue-700',
|
||||
];
|
||||
$typeLabels = [
|
||||
'deposit' => '입금',
|
||||
'withdrawal' => '출금',
|
||||
'transfer' => '이체',
|
||||
];
|
||||
@endphp
|
||||
<span class="px-2 py-1 text-xs font-medium rounded-full {{ $typeColors[$tx->transaction_type] ?? 'bg-gray-100 text-gray-700' }}">
|
||||
{{ $typeLabels[$tx->transaction_type] ?? $tx->transaction_type }}
|
||||
</span>
|
||||
{{ $tx->bank_name ?? '-' }}
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800">
|
||||
{{ Str::limit($tx->description, 20) }}
|
||||
{{ Str::limit($tx->summary, 15) }}
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-right font-medium {{ $tx->transaction_type === 'deposit' ? 'text-green-600' : 'text-red-600' }}">
|
||||
{{ $tx->transaction_type === 'deposit' ? '+' : '-' }}{{ number_format($tx->amount) }}원
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-600">
|
||||
{{ Str::limit($tx->cast, 10) }}
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-right font-medium {{ $tx->deposit > 0 ? 'text-green-600' : 'text-gray-300' }}">
|
||||
{{ $tx->deposit > 0 ? '+' . number_format($tx->deposit) : '-' }}
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-right font-medium {{ $tx->withdraw > 0 ? 'text-red-600' : 'text-gray-300' }}">
|
||||
{{ $tx->withdraw > 0 ? '-' . number_format($tx->withdraw) : '-' }}
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-right text-gray-500">
|
||||
{{ number_format($tx->balance_after) }}원
|
||||
{{ number_format($tx->balance) }}원
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="6" class="px-6 py-8 text-center text-gray-400">
|
||||
거래내역이 없습니다.
|
||||
<td colspan="7" class="px-6 py-8 text-center text-gray-400">
|
||||
최근 7일간 거래내역이 없습니다.
|
||||
</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
|
||||
Reference in New Issue
Block a user