feat:재무 대시보드 페이지 추가
This commit is contained in:
64
app/Http/Controllers/Finance/FinanceDashboardController.php
Normal file
64
app/Http/Controllers/Finance/FinanceDashboardController.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Finance;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Finance\BankAccount;
|
||||
use App\Models\Finance\BankTransaction;
|
||||
use App\Models\Finance\FundSchedule;
|
||||
use App\Services\BankAccountService;
|
||||
use App\Services\FundScheduleService;
|
||||
use Illuminate\Contracts\View\View;
|
||||
|
||||
class FinanceDashboardController extends Controller
|
||||
{
|
||||
public function __construct(
|
||||
private BankAccountService $bankAccountService,
|
||||
private FundScheduleService $fundScheduleService
|
||||
) {}
|
||||
|
||||
/**
|
||||
* 재무 대시보드
|
||||
*/
|
||||
public function index(): View
|
||||
{
|
||||
// 계좌 요약
|
||||
$accountSummary = $this->bankAccountService->getSummary();
|
||||
|
||||
// 자금 일정 요약
|
||||
$scheduleSummary = $this->fundScheduleService->getSummary();
|
||||
|
||||
// 이번 달 자금 일정 요약
|
||||
$monthlySummary = $this->fundScheduleService->getMonthlySummary(
|
||||
now()->year,
|
||||
now()->month
|
||||
);
|
||||
|
||||
// 향후 7일 자금 일정
|
||||
$upcomingSchedules = $this->fundScheduleService->getUpcomingSchedules(7);
|
||||
|
||||
// 최근 거래내역 (10건)
|
||||
$recentTransactions = BankTransaction::with('bankAccount:id,bank_name,account_number')
|
||||
->latest('transaction_date')
|
||||
->limit(10)
|
||||
->get();
|
||||
|
||||
// 계좌별 잔액
|
||||
$accountBalances = BankAccount::active()
|
||||
->ordered()
|
||||
->get(['id', 'bank_name', 'account_number', 'account_name', 'balance', 'account_type']);
|
||||
|
||||
// 은행별 통계
|
||||
$bankStats = $this->bankAccountService->getStatsByBank();
|
||||
|
||||
return view('finance.dashboard', compact(
|
||||
'accountSummary',
|
||||
'scheduleSummary',
|
||||
'monthlySummary',
|
||||
'upcomingSchedules',
|
||||
'recentTransactions',
|
||||
'accountBalances',
|
||||
'bankStats'
|
||||
));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user