$table_name = 'scorecard_stars'; $table_key_column = 'stars'; //Save based data values in prepared variables $stars_counter = 0; for ($stars = 3; $stars >= 0; $stars--) { $stars_counter++; $b = array(); $b['based_id'] = $stars; $b['name'] = "{$stars} Stars"; $based_list[] = $b; $based_key[$stars] = $stars_counter; } $total_key = $stars_counter + 1; } //retrieve saved plan data of this year $plans = scorecard::retrievePlan($based, $year_period); //retrieve manually input data from last year to current year $manual_inputs = scorecard::retrieveManualInput($based, $year_period, $year_previous); //Prepare name of each data table $table_header = array(); $table_header['daily'] = 'Daily Average'; $table_header['total'] = 'Monthly Total'; $table = array(); $table['daily'] = array(); $table['total'] = array(); $table['neutral'] = array(); //Default table collection for monthly and daily values //where monthly = total and daily = average $table_collection = array(); $table_collection['sent_value'] = 'Gross Sales'; $table_collection['sent'] = 'Quantity';