Above image represent the current output of the Pivot table I have designed so far. As mentioned in the title, I need to add extra information to the ItmName column like below :
EachPrice & Qty Columns should be inside the ItmName Column in horizontal orientation.
EX:
Cement- Tokyo Super
Each Price : 960
Qty : 20
Here is my code so far :
protected function setup()
{
$query = "SELECT
poh.id AS POId,
poh.code AS POCode,
poh.po_date AS PODate,
poh.total AS POTotal,
pod.qty AS Qty,
pod.each_price AS EachPrice,
itm.code AS ItmCode,
itm.name AS ItmName,
unt.name AS UnitName
FROM ... ";
$this->src('konst_pro')
->query($query)
->pipe(new CalculatedColumn(array(
"SubTot" => array(
"exp" => "{EachPrice}*{Qty}",
"type" => "number",
"decimals" => 2,
// "prefix" => "Rs"
)
)))
->pipe(new Pivot(array(
'dimensions' => array(
// 'column' => 'Qty',
'row' => 'POCode, ItmName, EachPrice, Qty'
),
"aggregates" => array(
"sum" => "SubTot"
)
)))
->pipe($this->dataStore('posum_report'));
}
Report.view.php
<h1>PO Summary Report</h1>
<div>
<?php
$dataStore = $this->dataStore('posum_report');
PivotTable::create(array(
'dataStore' => $dataStore,
'hideSubtotalRow' => true,
'showDataHeaders' => true,
'rowDimension' => 'row',
'headerMap' => array(
'SubTot - sum' => 'Purchase Order'
),
));
?>
</div>
Any help or suggestion would be appreciable. Thanks.