From 623298dd82221b814f1b0f756d6a7dec6a5ef9f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9C=A0=EB=B3=91=EC=B2=A0?= Date: Thu, 19 Mar 2026 19:33:25 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20[dashboard]=20=EC=83=9D=EC=82=B0?= =?UTF-8?q?=ED=98=84=ED=99=A9=20shipments.shipping=5Fcost=20=EC=BB=AC?= =?UTF-8?q?=EB=9F=BC=20=EB=AF=B8=EC=A1=B4=EC=9E=AC=20=EC=97=90=EB=9F=AC=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - shipments 테이블에 shipping_cost 컬럼이 없어서 500 에러 발생 - 컬럼 추가 전까지 금액 0 고정, 건수만 집계 - TODO: shipping_cost 컬럼 추가 시 금액 집계 복원 Co-Authored-By: Claude Opus 4.6 (1M context) --- app/Services/DashboardCeoService.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/Services/DashboardCeoService.php b/app/Services/DashboardCeoService.php index 1dccd321..540dae20 100644 --- a/app/Services/DashboardCeoService.php +++ b/app/Services/DashboardCeoService.php @@ -467,12 +467,15 @@ private function getShipmentSummary(int $tenantId, string $today): array $monthEnd = $thisMonth->copy()->endOfMonth()->format('Y-m-d'); // 예정 출고 + // NOTE: shipments 테이블에 shipping_cost 컬럼이 아직 없음 (2026-03-19) + // 금액 집계는 컬럼 추가 + 입력 UI 반영 후 활성화 예정 + // TODO: shipping_cost 컬럼 추가 시 → selectRaw에 SUM(shipping_cost) 복원 $expected = DB::table('shipments') ->where('tenant_id', $tenantId) ->whereBetween('scheduled_date', [$monthStart, $monthEnd]) ->whereIn('status', ['scheduled', 'ready']) ->whereNull('deleted_at') - ->selectRaw('COUNT(*) as count, COALESCE(SUM(shipping_cost), 0) as amount') + ->selectRaw('COUNT(*) as count') ->first(); // 실제 출고 @@ -481,13 +484,13 @@ private function getShipmentSummary(int $tenantId, string $today): array ->whereBetween('scheduled_date', [$monthStart, $monthEnd]) ->whereIn('status', ['shipping', 'completed']) ->whereNull('deleted_at') - ->selectRaw('COUNT(*) as count, COALESCE(SUM(shipping_cost), 0) as amount') + ->selectRaw('COUNT(*) as count') ->first(); return [ - 'expected_amount' => (int) ($expected->amount ?? 0), + 'expected_amount' => 0, // shipping_cost 컬럼 추가 전까지 0 고정 'expected_count' => (int) ($expected->count ?? 0), - 'actual_amount' => (int) ($actual->amount ?? 0), + 'actual_amount' => 0, // shipping_cost 컬럼 추가 전까지 0 고정 'actual_count' => (int) ($actual->count ?? 0), ]; }