hi, im using map process to create total row for some column like this:
but it can moved to top like this:
i think it was not set as footer, instead a new row.
here is my code:
->pipe(new \koolreport\processes\Map(array(
"{value}"=>function($row, $meta, $index, $mapState)
{
$totalRow = isset($mapState['TotalRow'])?$mapState['TotalRow']:[]; //change 'Total" to "TotalRow" for clearer meaning
$totalColumnNames = ["20", "40", "CBM", "Chg Wgt", "Selling", "Buying", "Profit"]; // choose which columns to do total
foreach ($row as $column => $value) { // loop through the row to do total for chosen columns
if (in_array($column, $totalColumnNames)) {
if(!isset($totalRow[$column]))
{
$totalRow[$column] = 0;
}
$totalRow[$column] += 1 * $value; // or 1 * $row[$column]
}
}
$mapState['TotalRow'] = $totalRow;
return ['{rows}' => $row, '{state}' => $mapState];
},
"{end}" => function($count, $mapState)
{
$total = $mapState['TotalRow'];
return [$total];
}
)))
how to move the mapped data to footer?