From a945c63a833ab6cd248b90c7feba54eb69258728 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=B3=B4=EA=B3=A4?= Date: Fri, 20 Feb 2026 14:08:01 +0900 Subject: [PATCH] =?UTF-8?q?Revert=20"feat:=EC=A0=95=EC=82=B0=EA=B4=80?= =?UTF-8?q?=EB=A6=AC=20=EA=B8=B0=EA=B0=84=EC=84=A4=EC=A0=95=20=EC=B2=B4?= =?UTF-8?q?=ED=81=AC=EB=B0=95=EC=8A=A4=20=ED=95=84=ED=84=B0=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20(=EC=8B=9C=EC=9E=91~=EB=81=9D=20=EB=85=84=EC=9B=94?= =?UTF-8?q?=20=EB=B2=94=EC=9C=84=20=EC=A1=B0=ED=9A=8C)"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 11c685bda7cf9d36fc77a38de76a988814745e19. --- .../Finance/SettlementController.php | 39 +------- app/Services/SalesCommissionService.php | 46 +-------- .../partials/commission/filters.blade.php | 96 +++---------------- 3 files changed, 21 insertions(+), 160 deletions(-) diff --git a/app/Http/Controllers/Finance/SettlementController.php b/app/Http/Controllers/Finance/SettlementController.php index 7b9a0ac1..90fb14ac 100644 --- a/app/Http/Controllers/Finance/SettlementController.php +++ b/app/Http/Controllers/Finance/SettlementController.php @@ -35,38 +35,19 @@ public function index(Request $request): View|Response // 수당 정산 탭 데이터 (기본 탭이므로 즉시 로드) $year = $request->input('year', now()->year); $month = $request->input('month', now()->month); - $dateRange = $request->boolean('date_range'); $filters = [ + 'scheduled_year' => $year, + 'scheduled_month' => $month, 'status' => $request->input('status'), 'payment_type' => $request->input('payment_type'), 'partner_id' => $request->input('partner_id'), 'commission_type' => $request->input('commission_type'), 'search' => $request->input('search'), - 'date_range' => $dateRange, ]; - if ($dateRange) { - $filters['scheduled_start_year'] = (int) $request->input('start_year', $year); - $filters['scheduled_start_month'] = (int) $request->input('start_month', $month); - $filters['scheduled_end_year'] = (int) $request->input('end_year', $year); - $filters['scheduled_end_month'] = (int) $request->input('end_month', $month); - $filters['start_year'] = $filters['scheduled_start_year']; - $filters['start_month'] = $filters['scheduled_start_month']; - $filters['end_year'] = $filters['scheduled_end_year']; - $filters['end_month'] = $filters['scheduled_end_month']; - } else { - $filters['scheduled_year'] = $year; - $filters['scheduled_month'] = $month; - } - $commissions = $this->service->getCommissions($filters); - $stats = $dateRange - ? $this->service->getSettlementStatsForRange( - $filters['scheduled_start_year'], $filters['scheduled_start_month'], - $filters['scheduled_end_year'], $filters['scheduled_end_month'] - ) - : $this->service->getSettlementStats($year, $month); + $stats = $this->service->getSettlementStats($year, $month); $partners = SalesPartner::with('user') ->active() @@ -110,27 +91,17 @@ public function commissionTable(Request $request): View { $year = $request->input('year', now()->year); $month = $request->input('month', now()->month); - $dateRange = $request->boolean('date_range'); $filters = [ + 'scheduled_year' => $year, + 'scheduled_month' => $month, 'status' => $request->input('status'), 'payment_type' => $request->input('payment_type'), 'partner_id' => $request->input('partner_id'), 'commission_type' => $request->input('commission_type'), 'search' => $request->input('search'), - 'date_range' => $dateRange, ]; - if ($dateRange) { - $filters['scheduled_start_year'] = (int) $request->input('start_year', $year); - $filters['scheduled_start_month'] = (int) $request->input('start_month', $month); - $filters['scheduled_end_year'] = (int) $request->input('end_year', $year); - $filters['scheduled_end_month'] = (int) $request->input('end_month', $month); - } else { - $filters['scheduled_year'] = $year; - $filters['scheduled_month'] = $month; - } - $commissions = $this->service->getCommissions($filters); return view('finance.settlement.partials.commission.table', compact('commissions')); diff --git a/app/Services/SalesCommissionService.php b/app/Services/SalesCommissionService.php index 464550ae..ed161dcf 100644 --- a/app/Services/SalesCommissionService.php +++ b/app/Services/SalesCommissionService.php @@ -61,15 +61,8 @@ public function getCommissions(array $filters = [], int $perPage = 20): LengthAw $query->where('manager_user_id', $filters['manager_user_id']); } - // 지급예정 기간 범위 필터 - if (!empty($filters['scheduled_start_year']) && !empty($filters['scheduled_start_month']) - && !empty($filters['scheduled_end_year']) && !empty($filters['scheduled_end_month'])) { - $startDate = \Carbon\Carbon::create($filters['scheduled_start_year'], $filters['scheduled_start_month'], 1)->startOfMonth(); - $endDate = \Carbon\Carbon::create($filters['scheduled_end_year'], $filters['scheduled_end_month'], 1)->endOfMonth(); - $query->whereBetween('scheduled_payment_date', [$startDate, $endDate]); - } - // 지급예정 년/월 필터 (단일) - elseif (!empty($filters['scheduled_year']) && !empty($filters['scheduled_month'])) { + // 지급예정 년/월 필터 + if (!empty($filters['scheduled_year']) && !empty($filters['scheduled_month'])) { $query->forScheduledMonth((int) $filters['scheduled_year'], (int) $filters['scheduled_month']); } @@ -537,41 +530,6 @@ public function getSettlementStats(int $year, int $month): array ]; } - /** - * 정산 통계 (기간 범위) - */ - public function getSettlementStatsForRange(int $startYear, int $startMonth, int $endYear, int $endMonth): array - { - $startDate = \Carbon\Carbon::create($startYear, $startMonth, 1)->startOfMonth(); - $endDate = \Carbon\Carbon::create($endYear, $endMonth, 1)->endOfMonth(); - - $commissions = SalesCommission::whereBetween('scheduled_payment_date', [$startDate, $endDate])->get(); - - return [ - 'pending' => [ - 'count' => $commissions->where('status', SalesCommission::STATUS_PENDING)->count(), - 'partner_total' => $commissions->where('status', SalesCommission::STATUS_PENDING)->sum('partner_commission'), - 'manager_total' => $commissions->where('status', SalesCommission::STATUS_PENDING)->sum('manager_commission'), - ], - 'approved' => [ - 'count' => $commissions->where('status', SalesCommission::STATUS_APPROVED)->count(), - 'partner_total' => $commissions->where('status', SalesCommission::STATUS_APPROVED)->sum('partner_commission'), - 'manager_total' => $commissions->where('status', SalesCommission::STATUS_APPROVED)->sum('manager_commission'), - ], - 'paid' => [ - 'count' => $commissions->where('status', SalesCommission::STATUS_PAID)->count(), - 'partner_total' => $commissions->where('status', SalesCommission::STATUS_PAID)->sum('partner_commission'), - 'manager_total' => $commissions->where('status', SalesCommission::STATUS_PAID)->sum('manager_commission'), - ], - 'total' => [ - 'count' => $commissions->count(), - 'base_amount' => $commissions->sum('base_amount'), - 'partner_commission' => $commissions->sum('partner_commission'), - 'manager_commission' => $commissions->sum('manager_commission'), - ], - ]; - } - /** * 입금 대기 중인 테넌트 목록 */ diff --git a/resources/views/finance/settlement/partials/commission/filters.blade.php b/resources/views/finance/settlement/partials/commission/filters.blade.php index e9840f13..2d7c306f 100644 --- a/resources/views/finance/settlement/partials/commission/filters.blade.php +++ b/resources/views/finance/settlement/partials/commission/filters.blade.php @@ -3,72 +3,22 @@
- {{-- 기간설정 체크박스 --}} -
- +
+ +
- {{-- 단일 년/월 (기본) --}} -
-
- - -
-
- - -
-
- - {{-- 기간 범위 (체크 시 표시) --}} -
-
- - -
-
- - -
- ~ -
- - -
-
- - -
+
+ +
@@ -116,21 +66,3 @@ class="px-3 py-2 bg-gray-200 hover:bg-gray-300 text-gray-700 text-sm rounded-lg
- -