changed logic in houlry report in production #1252

Merged
jothi merged 1 commits from ranjith-dev into master 2026-10-15 05:50:58 +00:00

View File

@@ -140,15 +140,32 @@ class ItemOverview extends ChartWidget
}, $shiftedKeys);
}
$totalQuantity = array_sum($orderedData);
// $totalQuantity = array_sum($orderedData);
$planQuantity = round($totalQuantity / 22.5, 2);
// $planQuantity = round($totalQuantity / 22.5, 2);
$planData = array_fill(
0,
count($orderedData),
$planQuantity
);
// $planData = array_fill(
// 0,
// count($orderedData),
// $planQuantity
// );
if (in_array($activeFilter, ['today', 'yesterday'])) {
$planQuantity = round(array_sum($orderedData) / 22.5, 2);
$planData = array_fill(
0,
count($orderedData),
$planQuantity
);
} else {
// This Week: each day's production / 22.5
// This Month: each week's production / 22.5
$planData = array_map(
fn ($quantity) => round($quantity / 22.5, 2),
$orderedData
);
}
return [
'datasets' => [