Merge pull request 'Added this month plan data logic in production dashboard' (#1332) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 14s

Reviewed-on: #1332
This commit was merged in pull request #1332.
This commit is contained in:
2026-10-29 04:02:37 +00:00

View File

@@ -158,7 +158,25 @@ class ItemOverview extends ChartWidget
count($orderedData), count($orderedData),
$planQuantity $planQuantity
); );
} else { }
elseif ($activeFilter === 'this_month') {
$weeklyProduction = [];
foreach ($orderedData as $index => $quantity) {
$day = (int) date('j', strtotime($labels[$index]));
$weekNumber = (int) ceil($day / 7);
$weeklyProduction[$weekNumber] =
($weeklyProduction[$weekNumber] ?? 0) + $quantity;
}
$planData = [];
foreach ($weeklyProduction as $weekNumber => $quantity) {
$planData[] = round($quantity / 22.5, 2);
}
}
else {
// This Week: each day's production / 22.5 // This Week: each day's production / 22.5
// This Month: each week's production / 22.5 // This Month: each week's production / 22.5
$planData = array_map( $planData = array_map(