diff --git a/app/Http/Controllers/Finance/FinanceDashboardController.php b/app/Http/Controllers/Finance/FinanceDashboardController.php index 8eb2b34d..2e88fbb2 100644 --- a/app/Http/Controllers/Finance/FinanceDashboardController.php +++ b/app/Http/Controllers/Finance/FinanceDashboardController.php @@ -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(); diff --git a/resources/views/finance/dashboard.blade.php b/resources/views/finance/dashboard.blade.php index 33f10f05..ed42ba4c 100644 --- a/resources/views/finance/dashboard.blade.php +++ b/resources/views/finance/dashboard.blade.php @@ -221,11 +221,11 @@ class="inline-flex items-center gap-2 px-4 py-2 bg-blue-600 hover:bg-blue-700 te - {{-- 최근 거래내역 --}} + {{-- 최근 거래내역 (바로빌) --}}

최근 거래내역

- + 전체보기
@@ -234,53 +234,46 @@ class="inline-flex items-center gap-2 px-4 py-2 bg-blue-600 hover:bg-blue-700 te 날짜 - 계좌 - 유형 + 은행 적요 - 금액 + 상대방 + 입금 + 출금 잔액 @forelse($recentTransactions as $tx) + @php + $transDate = \Carbon\Carbon::createFromFormat('Ymd', $tx->trans_date); + @endphp - {{ $tx->transaction_date->format('m/d') }} + {{ $transDate->format('m/d') }} - {{ $tx->bankAccount?->bank_name ?? '-' }} - - - @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 - - {{ $typeLabels[$tx->transaction_type] ?? $tx->transaction_type }} - + {{ $tx->bank_name ?? '-' }} - {{ Str::limit($tx->description, 20) }} + {{ Str::limit($tx->summary, 15) }} - - {{ $tx->transaction_type === 'deposit' ? '+' : '-' }}{{ number_format($tx->amount) }}원 + + {{ Str::limit($tx->cast, 10) }} + + + {{ $tx->deposit > 0 ? '+' . number_format($tx->deposit) : '-' }} + + + {{ $tx->withdraw > 0 ? '-' . number_format($tx->withdraw) : '-' }} - {{ number_format($tx->balance_after) }}원 + {{ number_format($tx->balance) }}원 @empty - - 거래내역이 없습니다. + + 최근 7일간 거래내역이 없습니다. @endforelse