Added logic for particualr plan for line in production report #1430

Merged
jothi merged 1 commits from ranjith-dev into master 2026-11-16 06:05:59 +00:00

View File

@@ -174,6 +174,7 @@ class SendProductionReport extends Command
foreach ($lines as $line) { foreach ($lines as $line) {
$hasProduction = false;
$dayproductionQuantity = 0; $dayproductionQuantity = 0;
$nightproductionQuantity = 0; $nightproductionQuantity = 0;
$productionQuantity = 0; $productionQuantity = 0;
@@ -265,16 +266,16 @@ class SendProductionReport extends Command
// $capacityQuan = $totalHourlyQuantity * 22.5; // $capacityQuan = $totalHourlyQuantity * 22.5;
$leaveDates = ProductionCalendar::where('plant_id', $plant->id) // $leaveDates = ProductionCalendar::where('plant_id', $plant->id)
->whereMonth('created_at', $month) // ->whereMonth('created_at', $month)
->whereYear('created_at', $year) // ->whereYear('created_at', $year)
->value('leave_dates'); // ->value('leave_dates');
$leaveDates = $leaveDates ? array_map('trim', explode(',', $leaveDates)) : []; // $leaveDates = $leaveDates ? array_map('trim', explode(',', $leaveDates)) : [];
if (in_array($startDate->format('Y-m-d'), $leaveDates)) { // if (in_array($startDate->format('Y-m-d'), $leaveDates)) {
$totalTargetQuantity = 0; // $totalTargetQuantity = 0;
} // }
if (strtolower($line->type) == 'fg line') { if (strtolower($line->type) == 'fg line') {
@@ -333,6 +334,26 @@ class SendProductionReport extends Command
->count(); ->count();
} }
if ($productionQuantity > 0) {
$hasProduction = true;
}
$leaveDates = ProductionCalendar::where('plant_id', $plant->id)
->whereMonth('created_at', $month)
->whereYear('created_at', $year)
->value('leave_dates');
$leaveDates = $leaveDates
? array_map('trim', explode(',', $leaveDates))
: [];
if (
in_array($startDate->format('Y-m-d'), $leaveDates)
&& !$hasProduction
) {
$totalTargetQuantity = 0;
}
if ($totalTargetQuantity > 0) { if ($totalTargetQuantity > 0) {
$efficiency = ($productionQuantity / $totalTargetQuantity) * 100; $efficiency = ($productionQuantity / $totalTargetQuantity) * 100;
} else { } else {