I'm learning KoolReport and I get this message: Fatal error: Uncaught Error: Class 'KoolReport' not found in C:\xampp\htdocs\tutorials\GetStarted\salesreport\SalesReport.php:4 Stack trace: #0 C:\xampp\htdocs\tutorials\GetStarted\salesreport\index.php(6): require_once() #1 {main} thrown in C:\xampp\htdocs\tutorials\GetStarted\salesreport\SalesReport.php on line 4
I tried to follow the solutions for the similar problems, but none of them worked for me. so please I need your help, I'll include the PHP code starting by the module name:
INDEX.php: *****
<?php
require_once "SalesReport.php";
$report = new SalesReport;
$report->run()->render();
SalesReport.php ******************************
<?php
require_once "../vendor/autoload.php";
class SalesReport extends KoolReport
{
//use \koolreport\clients\Bootstrap;
use \koolreport\bootstrap4\Theme;
//Create settings()
protected function settings()
{
return array(
"dataSources"=> array(
"eld"=>array(
"connectionString"=>"mysql:host=localhost;dbname=eld",
"username"=>"root",
"password"=>"",
"charset"=>"utf8"
)
)
);
}
//Setup report
protected function setup()
{
//, DRIVERS.driver_ID, DRIVERS.full_name
//we will get the top ten paying customers
$this->src("eld")
->query("
SELECT eld_history.truck_id, SUM(eld_history.elapsed_time/3600) AS totaltime from eld_history
INNER JOIN DRIVERS ON drivers.driver_id = eld_history.driver_id
group by eld_history.truck_id
order by totaltime
LIMIT 10;
")
->pipe($this->dataStore("result"));
}
}
ReportPdf.view.php *************************
<?php
use \koolreport\widgets\koolphp\Table;
use \koolreport\widgets\google\BarChart;
?>
<html>
<body style="margin:0.5in 1in 0.5in 1in">
<link rel="stylesheet" href="/koolreport/core/src/clients/bootstrap/css/bootstrap.min.css" />
<link rel="stylesheet" href="/koolreport/core/src/clients/bootstrap/css/bootstrap-theme.min.css" />
<div class="page-header" style="text-align:right"><i>Drivers Stat</i></div>
<div class="page-footer" style="text-align:right">{pageNum}</div>
<div class="text-center">
<h1>Cash In Report</h1>
<h4>This report show the cash-in report per month</h4>
</div>
<hr/>
<?php
koolreport\widgets\google\BarChart::create(array(
"dataSource"=>$this->dataStore("result"),
"columns"=>array(
"truck_id"=>array(
"label"=>"Truck"
),
"totaltime"=>array(
"suffix"=>"h"
)
)
));
?>
<?php
koolreport\widgets\koolphp\Table::create(array(
"dataSource"=>$this->dataStore("result"),
"columns"=>array(
"truck_id"=>array(
"label"=>"Truck"
),
"totaltime"=>array(
"prefix"=>"Hours: "
)
)
));
?>
</body>
</html>
SalesReport.view.php *****************************************
<html>
<head>
<title>Best Driver Time</title>
</head>
<body>
<h1>Top 10 working Trucks </h1>
<div class="text-center">
<a href="export.php" class="btn btn-primary">Download PDF</a>
</div>
<?php
koolreport\widgets\google\BarChart::create(array(
"dataSource"=>$this->dataStore("result"),
"columns"=>array(
"truck_id"=>array(
"label"=>"Truck"
),
"totaltime"=>array(
"suffix"=>"h"
)
)
));
?>
<?php
koolreport\widgets\koolphp\Table::create(array(
"dataSource"=>$this->dataStore("result"),
"columns"=>array(
"truck_id"=>array(
"label"=>"Truck"
),
"totaltime"=>array(
"prefix"=>"Hours: "
)
)
));
?>
</body>
</html>
EXPORT.php *********************************
<?php
require_once "SalesReport.php";
$report = new SalesReport2;
$report->run()
->export('ReportPdf')
->settings([
"useLocalTempFolder" => true,
])
->pdf(array(
"format"=>"Letter",
"orientation"=>"portrait",
//"zoom"=>2
))
->toBrowser("ELD.pdf");