} foreach ($p['articles'] as $aid => $a) { $a_counter++; $fc_base_daily = $obj_product->getForecastDailyBaseValue($aid); $size[$a_counter] = $a['article_length'] > 0 ? textLength($a['article_length']) : 'None'; $ean[$a_counter] = $a['article_ean']; $sold_last_month_nopromo[$a_counter] = intval($a['article_fc_base_monthly']); $sold_last_month[$a_counter] = intval($a['article_sold_monthly_1']); $stock[$a_counter] = intval($a['article_stock']); $stock_target[$a_counter] = $obj_product->getDIOHstockTarget($aid); $qty_ordered[$a_counter] = intval($a['article_orders_qty']); $qty_missing[$a_counter] = $stock_target[$a_counter] - ($stock[$a_counter] + $qty_ordered[$a_counter]); if ($qty_missing[$a_counter] < 0) { $qty_missing[$a_counter] = 0; } $levelling_target[$a_counter] = $fc->calcLevellingTarget($fc_base_daily, $current_month); $count_levelling_orders = $class_do->countOrdersLevellingDetailsByArticle($pid, $aid); $count_levelling_orders_today = $class_do->countOrdersLevellingByArticleAndDate($pid, $aid, 'today'); $levelling_orders[$a_counter] = $count_levelling_orders['total']; $levelling_orders_ptb[$a_counter] = $count_levelling_orders['internal']; $levelling_orders_os[$a_counter] = $count_levelling_orders['outsourcing']; //DURING OVERLAP PERIOD WE MUST USE ONLY THE LEVELLING //TARGET BECAUSE STOCK TARGET IS ALREADY INCLUDED THERE $total_target[$a_counter] = $target_is_overlap ? $levelling_target[$a_counter] : $levelling_target[$a_counter] + $stock_target[$a_counter]; $total_qty_missing[$a_counter] = $total_target[$a_counter] - ($stock[$a_counter] + $qty_ordered[$a_counter]); if ($total_qty_missing[$a_counter] < 0) { $total_qty_missing[$a_counter] = 0; } $levelling_orders_today[$a_counter] = $count_levelling_orders_today; //Set text of killed article to gray $size[$a_counter] = $size[$a_counter];
$levelling_orders_forecast[$mp] = $no_values; $levelling_target_forecast[$mp] = $no_values; } else { $levelling_orders_forecast[$mp] = 0; $levelling_target_forecast[$mp] = 0; } } foreach ($pids as $pid) { $p = new Product($pid); $fc_base_daily = $p->getForecastDailyBaseValue(); foreach ($months as $mp => $mtext) { $sales_real[$mp] += $p->getSoldMonthlyExcludingPromotionOrders($year, $mp); if (intval($mp) >= date('n')) { $sales_forecast[$mp] += $fc->calcForecastMonthly($fc_base_daily, $mp); $levelling_orders_forecast[$mp] += $fc->calcLevellingSplit($fc_base_daily, $mp); $levelling_target_forecast[$mp] += $fc->calcLevellingTarget($fc_base_daily, $mp); } } } $result = '<div class="draw-table">'; $result .= '<table border="0" cellpadding="0" cellspacing="0">'; //THEAD $result .= '<thead>'; $result .= '<tr>'; $result .= '<th class="w250">Description</th>'; foreach ($months as $mp => $mtext) { $result .= '<th class="w080">' . $mtext . '</th>'; } $result .= ''; $result .= '</tr>'; $result .= '</thead>';