Added this month plan data logic in production dashboard #1332
@@ -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(
|
||||||
|
|||||||
Reference in New Issue
Block a user