From d76c911880b83f5ed09e8016533cf38912a525b8 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Thu, 1 Oct 2026 18:02:48 +0530 Subject: [PATCH] Added monthly plan in production target plan --- app/Livewire/ProductionTargetPlan.php | 33 ++++++++++--------- .../livewire/production-target-plan.blade.php | 6 ++-- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/app/Livewire/ProductionTargetPlan.php b/app/Livewire/ProductionTargetPlan.php index d8d4f58e..9b6e89da 100644 --- a/app/Livewire/ProductionTargetPlan.php +++ b/app/Livewire/ProductionTargetPlan.php @@ -23,6 +23,8 @@ class ProductionTargetPlan extends Component public $monthlyRecords = []; + public $monthlyActualQuantity = []; + public $leaveDates = []; public $productionPlanDates = ''; @@ -635,22 +637,23 @@ class ProductionTargetPlan extends Component $this->records = $records; - // $this->monthlyRecords = ProductionPlan::where('plant_id', $plantId) - // ->where('line_id', $lineId) - // ->whereYear('created_at', $year) - // ->whereMonth('created_at', $month) - // ->sum('plan_quantity'); + $this->monthlyRecords = ProductionPlan::where('plant_id', $plantId) + ->where('line_id', $lineId) + ->whereYear('created_at', $year) + ->whereMonth('created_at', $month) + ->sum('plan_quantity'); - // $this->monthlyRecords = $plans->sum('plan_quantity'); + $this->monthlyActualQuantity = ProductionPlan::where('plant_id', $plantId) + ->where('line_id', $lineId) + ->whereBetween('created_at', [ + Carbon::create($year, $month, 1)->startOfMonth(), + now(), + ]) + ->count(); + + //$this->monthlyRecords = $plans->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() { return Excel::download( @@ -664,9 +667,9 @@ class ProductionTargetPlan extends Component // return view('livewire.production-target-plan'); return view('livewire.production-target-plan', [ 'records' => $this->records, - // 'monthlyRecords' => $this->monthlyRecords, + 'monthlyRecords' => $this->monthlyRecords, + 'monthlyActualRecords' => $this->monthlyActualQuantity, 'dates' => $this->dates, ]); - } } diff --git a/resources/views/livewire/production-target-plan.blade.php b/resources/views/livewire/production-target-plan.blade.php index bbaed873..75ed892b 100644 --- a/resources/views/livewire/production-target-plan.blade.php +++ b/resources/views/livewire/production-target-plan.blade.php @@ -1,6 +1,6 @@
- {{--
+

MONTHLY PRODUCTION PLAN:

@@ -45,7 +45,7 @@ {{ $monthlyRecords ?? 0 }} - {{ $monthlyRecords ?? 0 }} + {{ $monthlyActualQuantity ?? 0 }} {{ $monthlyRecords ?? 0 }} @@ -63,7 +63,7 @@
-
--}} +
{{-- //.. --}}