From 7f30695012361383dd9e107f922ab3cfaa1e5e31 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Wed, 30 Sep 2026 14:05:21 +0530 Subject: [PATCH 1/2] Added dispatch event for monthly plan report in production target --- app/Filament/Pages/ProductionTarget.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/Filament/Pages/ProductionTarget.php b/app/Filament/Pages/ProductionTarget.php index 1a5a68f0..ca8c7a31 100644 --- a/app/Filament/Pages/ProductionTarget.php +++ b/app/Filament/Pages/ProductionTarget.php @@ -208,6 +208,8 @@ class ProductionTarget extends Page } $this->dispatch('loadData1' ,$plantId, $lineId, $year, $month); + + $this->dispatch('loadDataMonthly' ,$plantId, $lineId, $year, $month); } public static function canAccess(): bool From 0fd6ca6f125c28fd3a068b0ab1104b75c32d9648 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Wed, 30 Sep 2026 14:06:22 +0530 Subject: [PATCH 2/2] Added monthly logic in paroduction target plan --- app/Livewire/ProductionTargetPlan.php | 16 +++++ .../livewire/production-target-plan.blade.php | 59 +++++++++++++++++++ 2 files changed, 75 insertions(+) diff --git a/app/Livewire/ProductionTargetPlan.php b/app/Livewire/ProductionTargetPlan.php index 40117983..93d16c35 100644 --- a/app/Livewire/ProductionTargetPlan.php +++ b/app/Livewire/ProductionTargetPlan.php @@ -20,6 +20,8 @@ class ProductionTargetPlan extends Component public $dates = []; + public $monthlyRecords; + public $leaveDates = []; public $productionPlanDates = ''; @@ -27,6 +29,7 @@ class ProductionTargetPlan extends Component protected $listeners = [ 'loadData' => 'loadProductionData', 'loadData1' => 'exportProductionData', + 'loadDataMonthly' => 'loadMonthlyPlan', ]; public function getMonthDates($month, $year) @@ -625,6 +628,19 @@ class ProductionTargetPlan extends Component $this->records = $records; } + public function loadMonthlyPlan($year, $month, $plantId, $lineId){ + $this->monthlyRecords = ProductionPlan::query() + ->selectRaw(' + plant_id, + line_id, + SUM(plan_quantity) as monthly_plan + ') + ->whereYear('created_at', $year) + ->whereMonth('created_at', $month) + ->groupBy('plant_id', 'line_id') + ->get(); + } + public function exportProductionData() { diff --git a/resources/views/livewire/production-target-plan.blade.php b/resources/views/livewire/production-target-plan.blade.php index 696c417b..f3614cb9 100644 --- a/resources/views/livewire/production-target-plan.blade.php +++ b/resources/views/livewire/production-target-plan.blade.php @@ -1,4 +1,63 @@
+ +
+

+ MONTHLY PRODUCTION PLAN: +

+ +
+ + + + + + + + + + + + @forelse ($records as $index => $record) + + + + + + + + + + + + @empty + + + + @endforelse + +
NoPlantLine + Monthly Plan Quantity +
+ {{ $index + 1 }} + + {{ $record['plant_name'] }} + + {{ $record['line_name'] }} + + {{ $this->loadMonthlyPlan( + $year, + $month, + $record['plant_id'], + $record['line_id'] + ) }} +
+ No monthly production plan data found. +
+
+
+ + + {{-- //.. --}}

PRODUCTION PLAN TABLE: