Merge pull request 'changed logic in houlry report in production' (#1252) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 15s

Reviewed-on: #1252
This commit was merged in pull request #1252.
This commit is contained in:
2026-10-15 05:50:57 +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' => [