Hi, My name is Abhishek actually I am looking for a tool that can make my work easy to produce the report but I am unable to execute the example code provided on your site. And I am running the code on windows, not on the mac so could you please help me to run the code. And thanks in advance. code
index.php
<?php
require_once "SalesByCustomer.php";
$salesbycustomer = new SalesByCustomer;
$salesbycustomer->run()->render();
?>
SalesBycustomer.php
<?php
require_once "../vendor/koolreport/core/autoload.php";
require_once "../vendor/koolreport/core/src/KoolReport.php";
use \Users\Ashwin\XAMPP\htdocs\Reports\processes\Group;
use \Users\Ashwin\XAMPP\htdocs\Reports\processes\Sort;
use \Users\Ashwin\XAMPP\htdocs\Reports\processes\Limit;
class SalesByCustomer
{
public function settings()
{
return array(
"dataSources"=>array(
"sales"=>array(
"connectionString"=>"mysql:host=localhost;dbname=db_sales",
"username"=>"root",
"password"=>"",
"charset"=>"utf8"
)
)
);
}
public function setup()
{
$this->src('sales')
->query("SELECT customerName,dollar_sales FROM customer_product_dollarsales")
->pipe(new Group(array(
"by"=>"customerName",
"sum"=>"dollar_sales"
)))
->pipe(new Sort(array(
"dollar_sales"=>"desc"
)))
->pipe(new Limit(array(10)))
->pipe($this->dataStore('sales_by_customer'));
}
}
?>
SalesBycustomer.view.php
<?php
use \Users\Ashwin\XAMPP\htdocs\Reports\widgets\koolphp\Table;
use \Users\Ashwin\XAMPP\htdocs\Reports\widgets\google\BarChart;
?>
<div class="text-center">
<h1>Sales Report</h1>
<h4>This report shows top 10 sales by customer</h4>
</div>
<hr/>
<?php
BarChart::create(array(
"dataStore"=>$this->dataStore('sales_by_customer'),
"width"=>"100%",
"height"=>"500px",
"columns"=>array(
"customerName"=>array(
"label"=>"Customer"
),
"dollar_sales"=>array(
"type"=>"number",
"label"=>"Amount",
"prefix"=>"$",
)
),
"options"=>array(
"title"=>"Sales By Customer"
)
));
?>
<?php
Table::create(array(
"dataStore"=>$this->dataStore('sales_by_customer'),
"columns"=>array(
"customerName"=>array(
"label"=>"Customer"
),
"dollar_sales"=>array(
"type"=>"number",
"label"=>"Amount",
"prefix"=>"$",
)
),
"cssClass"=>array(
"table"=>"table table-hover table-bordered"
)
));
?>
error
PHP Warnin
Warning: require_once(../vendor/koolreport/core/autoload.php): Failed to open stream: No such file or directory in C:\Users\Ashwin\XAMPP\htdocs\Reports\salesreport\SalesByCustomer.php on line 2
g: require_once(../vendor/koolreport/core/autoload.php): Failed to open stream: No such file or directory in C:\Users\Ashwin\XAMPP\htdocs\Reports\salesreport\SalesByCustomer.php on line 2
PHP Fatal error: Uncaught Error: Failed opening required '../vendor/koolreport/core/autoload.php' (include_path='C:\Users\Ashwin\XAMPP\php\PEAR') in C:\Users\Ashwin\XAMPP\htdocs\Reports\salesreport\SalesByCustomer.php:2
Stack trace:
#0 C:\Users\Ashwin\XAMPP\htdocs\Reports\salesreport\index.php(2): require_once()
#1 {main}
thrown in C:\Users\Ashwin\XAMPP\htdocs\Reports\salesreport\SalesByCustomer.php on line 2
Fatal error: Uncaught Error: Failed opening required '../vendor/koolreport/core/autoload.php' (include_path='C:\Users\Ashwin\XAMPP\php\PEAR') in C:\Users\Ashwin\XAMPP\htdocs\Reports\salesreport\SalesByCustomer.php:2
Stack trace:
#0 C:\Users\Ashwin\XAMPP\htdocs\Reports\salesreport\index.php(2): require_once()
#1 {main}
thrown in C:\Users\Ashwin\XAMPP\htdocs\Reports\salesreport\SalesByCustomer.php on line 2