I can not implement it. Give me a 500 error. Can you help me?
index.php
`
<?php
require_once "koolreport/oportunidade/OpMes.php";
$report = new OpMes;
$report->run()->render();
`
OpMes.php
<?php
require_once "koolreport/autoload.php";
use \koolreport\KoolReport;
use \koolreport\processes\Filter;
use \koolreport\processes\TimeBucket;
use \koolreport\processes\Group;
use \koolreport\processes\Limit;
class OpMes extends KoolReport
{
function settings()
{
return array(
"dataSources"=>array(
"op_mes"=>array(
"connectionString"=>"mysql:host=localhost;dbname=almafor2_grav326",
"username"=>"almafor2_grav326",
"password"=>"xxxx",
"charset"=>"utf8"
),
)
);
}
protected function setup()
{
$this->src('op_mes')
->query("SELECT estimated_date,estimated FROM u_yf_ssalesprocesses")
->pipe(new TimeBucket(array(
"estimated_date"=>"month"
)))
->pipe(new Group(array(
"by"=>"estimated_date",
"sum"=>"estimated"
)))
->pipe($this->dataStore('op1_by_month'));
}
}
OpMes.view.php
<?php
use \koolreport\widgets\koolphp\Table;
use \koolreport\widgets\google\ColumnChart;
?>
<div class="report-content">
<div class="text-center">
<h1>Oportunidades - Valor Estimado por Mês</h1>
<p class="lead">Este relatório foi efectuado com muito engenho e arte</p>
</div>
<?php
ColumnChart::create(array(
"dataStore"=>$this->dataStore('op1_by_month'),
"columns"=>array(
"estimated_date"=>array(
"label"=>"Mês",
"type"=>"datetime",
"format"=>"Y-n",
"displayFormat"=>"F, Y",
),
"amount"=>array(
"label"=>"ValorEuros",
"type"=>"number",
"prefix"=>"$",
)
),
"width"=>"100%",
));
?>
<?php
Table::create(array(
"dataStore"=>$this->dataStore('op1_by_month'),
"columns"=>array(
"estimated_date"=>array(
"label"=>"Mês",
"type"=>"datetime",
"format"=>"Y-n",
"displayFormat"=>"F, Y",
),
"amount"=>array(
"label"=>"ValorEuros",
"type"=>"number",
"prefix"=>"$",
)
),
"cssClass"=>array(
"table"=>"table table-hover table-bordered"
)
));
?>
</div>