KoolReport with CI4:
local env: Windows 10, XAMPP
server env (both staging and live): Ubuntu, MySQL Server
created a report, it was working fine on local and server both. when add code to store dateRange in session variables, it is working fine on Local environment, but on staging server it is showing nothing but page with:
1) $this->dataStore("result")
2) No data available in table
note: in an another report, added same functionality and it was working fine (thanks to @Sebastian Morales) but here it is not working. definitely i made mistake but failed to find yet what's wrong. please help.
my code and screenshot below for reference.
CustomerSummary.php:
<?php
namespace App\reports;
// we have copied below file in root path of our app
require_once ROOTPATH . "load.koolreport.php";
use \koolreport\KoolReport;
use \koolreport\processes\Sort;
use \koolreport\processes\Map;
use \koolreport\processes\Limit;
use \koolreport\processes\Filter;
use \koolreport\cube\processes\Cube;
use \koolreport\pivot\processes\Pivot;
class CustomerSummary extends \koolreport\KoolReport
{
//use \koolreport\bootstrap4\Theme;
use \koolreport\amazing\Theme;
use \koolreport\codeigniter\Friendship;
use \koolreport\inputs\Bindable;
use \koolreport\inputs\POSTBinding;
use \koolreport\export\Exportable;
use \koolreport\excel\ExcelExportable;
use \koolreport\excel\BigSpreadsheetExportable;
protected function defaultParamValues()
{
$start = isset($_SESSION["startDate"]) ? $_SESSION["startDate"] : date("2022-12-01");
$end = isset($_SESSION["startDate"]) ? $_SESSION["endDate"] : date("2022-12-01");
return array(
"dateRange"=>array($start ,$end),
"customers"=>NULL,
);
}
protected function bindParamsToInputs()
{
return array(
"dateRange",
"customers",
);
}
function setup()
{
$_SESSION["startDate"] = $this->params["dateRange"][0];
$_SESSION["endDate"] = $this->params["dateRange"][1];
$this->src("default")
->query("SELECT DATE(order_date) AS order_date, user_id, customer_name, rides,rider_charges, order_total FROM customer_summary WHERE
user_id = ".($this->params["customers"] == '' ? 'user_id' : ':customers')."
AND
order_date >= :startDate
AND
order_date <= :endDate")
->params(array(
":startDate"=>$this->params["dateRange"][0],
":endDate"=>$this->params["dateRange"][1],
":customers"=>$this->params["customers"],
))
->pipe(Sort::process([
"order_date"=>"desc"
]))
->pipe($this->dataStore("result"));
$this->src("default")->query("
SELECT DISTINCT
user_id,
customer_name
FROM
customer_summary
ORDER BY customer_name
")
->pipe($this->dataStore("customers"));
}
}
### Screenshot:
regards