Ejemplo n.º 1
0
                }
                if (isset($table_header[$table_key])) {
                    $result .= ' - ' . $table_header[$table_key];
                }
                $result .= '</h3>';
                //echo '<pre>';var_dump($tc_value); echo '</pre><br /><br />';
                //Prepare the total values
                foreach ($table_total[$table_key][$tc_key] as $tt_temp_key => $tt_temp_val) {
                    //Label column need no values
                    if ($tt_temp_key != $classname_label) {
                        if (is_array($tt_temp_val)) {
                            $total = array_sum($tt_temp_val) / count($tt_temp_val);
                        } else {
                            $total = $tt_temp_val;
                        }
                        $table_total[$table_key][$tc_key][$tt_temp_key] = scorecard::finalDisplayFormat($tc_key, $total);
                    }
                }
                $tc_value[$total_key] = $table_total[$table_key][$tc_key];
                $result .= tep_draw_table('scorecard', $tc_value, false, true);
            }
        }
        //That's it, now give back the table
        echo utf8_encode($result);
        exit;
    }
}
$period_options = array();
$period_options['all'] = 'Show All Months';
$period_options['actual'] = 'Show Actual Months';
$view_option = array();
        $result .= tep_draw_table('scorecard', $table_products_margin);
        //DRAW table average margin by categories
        $table_products_margin = array();
        $tpn_row = array();
        $tpn_row[$classname_label] = 'Brand';
        foreach ($periods as $p) {
            $tpn_row[$p] = $periods_name[$p];
        }
        $table_products_margin[] = $tpn_row;
        $table_total = array();
        $table_total[$classname_label] = 'Total';
        foreach ($products_margin_categories as $categories_id => $margins) {
            $tpn_row = array();
            $tpn_row[$classname_label] = $product_categories_name[$categories_id];
            foreach ($margins as $p => $v) {
                $tpn_row[$p] = $v == '-' ? '-' : scorecard::finalDisplayFormat('average_margin', $v / 100);
            }
            $table_products_margin[] = $tpn_row;
        }
        $result .= '<h3 style="margin:20px 0 0 0;">Average Margin by Categories</h3>';
        $result .= tep_draw_table('scorecard', $table_products_margin);
        echo utf8_encode($result);
        exit;
    }
}
$period_options = array();
$period_options['all'] = 'Show All Months';
$period_options['actual'] = 'Show Actual Months';
$view_option = array();
$view_option['overview'] = 'Show Overview';
$view_option['details'] = 'Show Details';