Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines
i send you the code .
//MyReport.php
<?php
namespace App\Reports;
use \koolreport\Koolreport;
class MyReport extends KoolReport
{
use \koolreport\bootstrap4\Theme;
use \koolreport\inputs\POSTBinding;
use \koolreport\visualquery\Bindable;
protected function settings()
{
//Define the "sales" data source which is the orders.csv
return array(
"dataSources"=>array(
"assurance"=>[
"connectionString"=>"mysql:host=localhost;dbname=db_sales",
"username"=>"root",
"password"=>"",
"charset"=>"utf8"
]
)
);
}
protected function setup()
{
if (isset($this->queryParams['visualquery1'])) {
$vqParams = $this->queryParams['visualquery1'];
$queryBuilder = $this->paramsToQueryBuilder($vqParams);
$this->queryStr = $queryStr = $queryBuilder->toMySQL();
} else {
$this->queryStr = $queryStr = "SELECT * FROM koolreport_assurance LIMIT 100";
}
$this->src('assurance')
->query($queryStr)
->pipe($this->dataStore('assurance'));
}
}
//MyReport.view.php
<?php
use koolreport\datagrid\DataTables;
use koolreport\visualquery\VisualQuery;
use koolreport\widgets\google\BarChart;
use koolreport\widgets\google\PieChart;
//dump($this->dataStore('personnes'));exit;
VisualQuery::create([
"name" => 'visualquery1',
"schema" => [
"tables" => [
"koolreport_assurance"=>[
"{meta}" => [
"alias" => "Assurance"
],
"departement"=>["alias"=>"Département"],
"nature"=>["alias"=>"Nature"],
"compagnie"=>["alias"=>"Compagnie"],
"type"=>["alias"=>"Type"],
"date"=>[
"alias"=>"Date",
"type"=>"datetime",
"format"=>"dd-M-YY"
],
"montant"=>[
"alias"=>"Montant",
"type"=>"number",
"decimal"=>2,
"decimalPoint" => ".",
"thousandSeparator" => " "
]
],
],
"relations" => [
]
],
"defaultValue" => [
"selectTables" => [
"koolreport_assurance"
],
"selectFields" => [
"koolreport_assurance.departement",
"koolreport_assurance.nature",
"koolreport_assurance.compagnie",
"koolreport_assurance.type",
"koolreport_assurance.date",
"koolreport_assurance.montant"
],
"filters" => [
],
"groups" => [
],
"sorts" => [
],
"offset" => 0,
"limit" => 100,
],
]);
DataTables::create([
"dataSource"=>$this->dataStore("assurance")
]);
?>
Hi Epitello,
Sorry for the late reply. To avoid manual copying the resource files yourself, please try to set your report's "assets" setting like this:
class MyReport extends \koolreport\KoolReport
{
protected function settings()
{
return array(
...
"assets"=>array(
"path"=>"../../public/koolreport_assets", //replace this path with the path to folder koolreport_assets in your Symphony public folder
"url"=>"/public/koolreport_assets" //replace this url with the url tofolder koolreport_assets in your Symphony public folder
)
);
}
}
This would ensure any widget's resource files to be copy to your Symphony public folder an be accessible by client browsers.
Let KoolReport help you to make great reports. It's free & open-source released under MIT license.
Download KoolReport View demo