From 8dec2f7ec2cee7af950d04ab7a557447de0197f4 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 19:56:06 +0900 Subject: [PATCH] =?UTF-8?q?fix:=EB=B2=95=EC=9D=B8=EC=B9=B4=EB=93=9C=20?= =?UTF-8?q?=EB=A7=A4=EC=9B=94=EA=B2=B0=EC=A0=9C=EC=9D=BC=20=ED=98=84?= =?UTF-8?q?=EC=9E=AC=EC=9D=BC=EC=9E=90=20=EA=B8=B0=EC=A4=80=20=EB=8F=99?= =?UTF-8?q?=EC=A0=81=20=EA=B3=84=EC=82=B0=20(=EA=B2=B0=EC=A0=9C=EC=9D=BC?= =?UTF-8?q?=20=EC=A7=80=EB=82=98=EB=A9=B4=20=EC=9D=B5=EC=9B=94=EB=A1=9C=20?= =?UTF-8?q?=EC=9E=90=EB=8F=99=20=EB=B3=80=EA=B2=BD)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Finance/CorporateCardController.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/Finance/CorporateCardController.php b/app/Http/Controllers/Finance/CorporateCardController.php index ff6f493b..9c6b1d4c 100644 --- a/app/Http/Controllers/Finance/CorporateCardController.php +++ b/app/Http/Controllers/Finance/CorporateCardController.php @@ -216,13 +216,21 @@ public function summary(): JsonResponse $creditCard = $activeCards->firstWhere('card_type', 'credit'); $paymentDay = $creditCard ? $creditCard->payment_day : 15; - // 휴일 조정 결제일 계산 + // 휴일 조정 결제일 계산 (현재 월) $originalDate = $this->createPaymentDate($now->year, $now->month, $paymentDay); $adjustedDate = $this->getAdjustedPaymentDate($tenantId, $now->year, $now->month, $paymentDay); + + // 현재일이 결제일을 지났으면 다음 월로 이동 + if ($now->greaterThan($adjustedDate)) { + $nextMonth = $now->copy()->addMonth(); + $originalDate = $this->createPaymentDate($nextMonth->year, $nextMonth->month, $paymentDay); + $adjustedDate = $this->getAdjustedPaymentDate($tenantId, $nextMonth->year, $nextMonth->month, $paymentDay); + } + $isAdjusted = !$originalDate->isSameDay($adjustedDate); - // 청구기간: 전월 1일 ~ 당월 결제일(조정후) - $billingStart = $now->copy()->subMonth()->startOfMonth(); + // 청구기간: 결제일 기준 전월 1일 ~ 결제일 + $billingStart = $adjustedDate->copy()->subMonth()->startOfMonth(); $billingEnd = $adjustedDate->copy(); // 카드번호 목록 @@ -236,8 +244,8 @@ public function summary(): JsonResponse $cardNumbers ); - // 선불결제 금액 - $yearMonth = $now->format('Y-m'); + // 선불결제 금액 (결제일 기준 월) + $yearMonth = $adjustedDate->format('Y-m'); $prepayment = CorporateCardPrepayment::getOrCreate($tenantId, $yearMonth); return response()->json([