how to insert column with calculated
<?php
//Step 1: Load KoolReport
require_once "../../../load.koolreport.php";
use \koolreport\pivot\processes\Pivot;
use \koolreport\pivot\processes\PivotExtract;
use \koolreport\processes\ColumnMeta;
use \koolreport\processes\Filter;
use \koolreport\processes\calculatedcolumn;
//Step 2: Creating Report class
class MyReport extends \koolreport\KoolReport
{
function settings()
{
$config = include "../../../config.php";
return array(
"dataSources" => array(
"laporan"=>$config["laporan"]
)
);
}
public function setup()
{
$this->src('laporan')
->query("select * from kegiatan")
->pipe(new pivot(array(
"dimensions" => array(
"column" => "kdbeban",
"row" => "kdgiat, kdoutput, kdkmpnen, kdskmpnen, kdakun",
),
"aggregates" => array(
"sum" => "pagu, realisasi",
),
)))->saveto($source);
$source->pipe($this->datastore('lapkeg'));
}
}