Hi there,
I have done the following: index.php:
<?php
// index.php: Just a bootstrap file
require_once "SalesByQuarter.php";
$salesByQuarter = new SalesByQuarter;
$salesByQuarter->run()->render();
SalesByQuarter.php:
<?php
require_once "../koolreport/autoload.php";
use \koolreport\processes\TimeBucket;
use \koolreport\processes\Group;
class QuarterSaleReport extends \koolreport\KoolReport
{
function settings()
{
return array(
"dataSources"=>array(
"mydata"=>array(
'connectionString' => "mysql:host=localhost;dbname=mydbname",
'username' => 'root',
'password' => 'xxxxxxx',
'charset' => 'utf8'
),
)
);
}
protected function setup()
{
$this->src("mydata")
->query("select tran_date, ov_amount from 0_debtor_trans")
->pipe(new TimeBucket(array(
"bucket"=>"quarter"
)))
->pipe(new Group(array(
"by"=>"tran_date",
"sum"=>"ov_amount"
)))
->pipe($this->dataStore("sale_by_quarter"));
}
}
SalesByQuarter.view.php
<?php
use \koolreport\widgets\google\ColumnChart;
?>
<html>
<head>
<title>Quarter Sale Report</title>
</head>
<body>
<?php
ColumnChart::create(array(
"dataStore"=>$this->dataStore("sale_by_quarter")
));
?>
</body>
</html>
After setting up the above 3 files, I ran the index.php and it returned with error 500.
I went thru' a few times and I couldn't figure out what went wrong... Could some one help to point out if there is any issues with the codes?
Many thanks.
/Mark