Hi Koolreport team, I'm facing same issue from last one week. Please help me out. Error Message: require_once(koolreport\core\autoload.php): failed to open stream: No such file or directory
Actually I'm koolreport Pro user. In my folder I have autoload.php file. But it gives me the above message. Please Please Please.... help me out this situtation. I generated so many emails, but no one gave me answer. I have to submit my report Right now. But it gives me the error.
Please any one can help me urgently. Here I'm attaching my error and Code, which I implemented.. and mean while I'm using SqlServer 2017, Codeigniter3,Koolreport4
class Welcome extends CI_Controller { public function index()
{
include APPPATH."reports\SalesByCustomer.php";
$salesByCustomer = new SalesByCustomer;
$salesByCustomer->run()->render();
}
}
SalesByCustomer.php:
<?php require_once "koolreport\core\autoload.php"; use \koolreport\processes\Group; use \koolreport\processes\Sort; use \koolreport\processes\Limit;
class SalesByCustomer extends \koolreport\KoolReport {
public function settings()
{
return array(
"dataSources"=>array(
"sales"=>array(
"connectionString"=>"sqlsrv:host=localhost;dbname=Demo",
"username"=>"sa",
"password"=>"sa1234",
"charset"=>"utf8"
)
)
);
}
public function setup()
{
$this->src('sales')
->query("SELECT customerName,dollar_sales FROM Sales_by_Customer")
->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 \koolreport\widgets\koolphp\Table;
use \koolreport\widgets\google\BarChart;
?>
Sales Report
This report shows top 10 sales by customer
<?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"
)
)); ?>
Database.php: $active_group = 'default'; $query_builder = TRUE;
$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost',
'username' => 'sa',
'password' => 'sa1234',
'database' => 'Demo',
'dbdriver' => 'sqlsrv',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => FALSE, //(ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);
autoload.php: <?php /* This file will autoload KoolReport class when included @category Core @package KoolReport @author KoolPHP Inc support@koolphp.net @copyright 2017-2028 KoolPHP Inc @license MIT License https://www.koolreport.com/license#mit-license @link https://www.koolphp.net /
$packageFolders = glob(dirname(FILE)."/../*", GLOB_ONLYDIR); foreach ($packageFolders as $folder) {
$packageVendorAutoLoadFile = $folder."/vendor/autoload.php";
if (is_file($packageVendorAutoLoadFile)) {
include_once $packageVendorAutoLoadFile;
}
}
spl_autoload_register(
function ($classname) {
if (strpos($classname, "koolreport\\")!==false) {
$dir = str_replace("\\", "/", dirname(__FILE__));
$classname = str_replace("\\", "/", $classname);
$filePath = $dir."/".str_replace("koolreport/", "src/", $classname).".php";
//try to load in file
if (is_file($filePath)) {
include_once $filePath;
} else {
//try to load in packages in the same level with core
$dir = str_replace("\\", "/", dirname(dirname(__FILE__)));
$filePath = $dir."/".str_replace("koolreport/", "", $classname).".php";
if (is_file($filePath)) {
include_once $filePath;
} else {
//Try to load pakages in packages folder inside core
$dir = str_replace("\\", "/", dirname(__FILE__));
$filePath = $dir."/".str_replace("koolreport/", "packages/", $classname).".php";
if (is_file($filePath)) {
include_once $filePath;
}
}
}
}
}
);