From 53e14b5c48ac901f6b5b85d42cd3ccbc2c38d28a Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Wed, 30 Sep 2026 14:26:07 +0530 Subject: [PATCH] Changed logic in production target plan --- app/Livewire/ProductionTargetPlan.php | 12 +++++++++--- .../views/livewire/production-target-plan.blade.php | 7 +------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/app/Livewire/ProductionTargetPlan.php b/app/Livewire/ProductionTargetPlan.php index 9feb4a99..56c62746 100644 --- a/app/Livewire/ProductionTargetPlan.php +++ b/app/Livewire/ProductionTargetPlan.php @@ -626,16 +626,22 @@ class ProductionTargetPlan extends Component } $this->records = $records; - } - public function loadMonthlyPlan($year, $month, $plantId, $lineId){ - return ProductionPlan::where('plant_id', $plantId) + $this->monthlyRecords = ProductionPlan::where('plant_id', $plantId) ->where('line_id', $lineId) ->whereYear('created_at', $year) ->whereMonth('created_at', $month) ->sum('plan_quantity'); } + // public function loadMonthlyPlan($year, $month, $plantId, $lineId){ + // $this->monthlyRecords = ProductionPlan::where('plant_id', $plantId) + // ->where('line_id', $lineId) + // ->whereYear('created_at', $year) + // ->whereMonth('created_at', $month) + // ->sum('plan_quantity'); + // } + public function exportProductionData() { diff --git a/resources/views/livewire/production-target-plan.blade.php b/resources/views/livewire/production-target-plan.blade.php index 0d928d84..586ecc79 100644 --- a/resources/views/livewire/production-target-plan.blade.php +++ b/resources/views/livewire/production-target-plan.blade.php @@ -35,12 +35,7 @@ - {{ $this->loadMonthlyPlan( - $year, - $month, - $record['plant_id'], - $record['line_id'] - ) }} + {{ $monthlyRecords ?? 0 }}