Merge pull request 'Added efficiency in target plan' (#1152) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled

Reviewed-on: #1152
This commit was merged in pull request #1152.
This commit is contained in:
2026-10-01 12:39:37 +00:00
2 changed files with 10 additions and 5 deletions

View File

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

View File

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