Added efficiency in target plan #1152

Merged
jothi merged 1 commits from ranjith-dev into master 2026-10-01 12:39:38 +00:00
2 changed files with 10 additions and 5 deletions

View File

@@ -23,6 +23,8 @@ class ProductionTargetPlan extends Component
public $monthlyRecords = [];
public $efficiency = [];
public $monthlyActualQuantity = [];
public $leaveDates = [];
@@ -645,12 +647,14 @@ class ProductionTargetPlan extends Component
$this->monthlyActualQuantity = ProductionPlan::where('plant_id', $plantId)
->where('line_id', $lineId)
->whereBetween('created_at', [
Carbon::create($year, $month, 1)->startOfMonth(),
now(),
])
->whereYear('created_at', $year)
->whereMonth('created_at', $month)
->count();
$this->efficiency = $this->monthlyRecords > 0
? ($this->monthlyActualQuantity / $this->monthlyRecords) * 100
: 0;
//$this->monthlyRecords = $plans->sum('plan_quantity');
}
@@ -669,6 +673,7 @@ class ProductionTargetPlan extends Component
'records' => $this->records,
'monthlyRecords' => $this->monthlyRecords,
'monthlyActualRecords' => $this->monthlyActualQuantity,
'monthlyEfficiency' => $this->efficiency,
'dates' => $this->dates,
]);
}

View File

@@ -48,7 +48,7 @@
{{ $monthlyActualQuantity ?? 0 }}
</td>
<td class="border px-4 py-2 whitespace-nowrap font-semibold">
{{ $monthlyRecords ?? 0 }}
{{ number_format($efficiency ?? 0, 2) }}%
</td>
</tr>