i am using KoolReport with CodeIgniter 4.
i want to have dates in dateRange values which user entered to run report as it always initialized to defaultParamValues which is correct but How I can have the defaultParamValues of dateRange as previously entered dateRange retain within current session for all other reports which contains dateRage as parameter. please help.
RiderSummary.php
<?php
namespace App\reports;
require_once ROOTPATH . "load.koolreport.php";
use \koolreport\pivot\processes\Pivot;
use \koolreport\pivot\processes\PivotExtract;
use \koolreport\processes\ColumnMeta;
use \koolreport\processes\Filter;
use \koolreport\KoolReport;
use \koolreport\processes\Sort;
class RiderSummary extends \koolreport\KoolReport
{
use \koolreport\amazing\Theme;
use \koolreport\codeigniter\Friendship;
use \koolreport\inputs\Bindable;
use \koolreport\inputs\POSTBinding;
protected function defaultParamValues()
{
return array(
"dateRange"=>array(date("2022-12-01"),date("2022-12-01")),
"riders"=>NULL,
);
}
protected function bindParamsToInputs()
{
return array(
"dateRange",
"riders",
);
}
public function setup()
{
$node = $this->src("default")
->query("SELECT id, DATE(order_date) AS order_date, id order_no, orderDay, orderMonth, orderYear, orderQuarter, rider_id, rider_name, cast(ridCharges AS SIGNED) AS ridCharges, cast(gvm AS SIGNED) AS gvm, customer_name, user_id, order_status, rider_id, rider_name
FROM total_orders
WHERE
rider_id = ".($this->params["riders"] == '' ? 'rider_id' : ':riders')."
AND
order_date >= :start
AND
order_date <= :end")
->params(array(
":start"=>$this->params["dateRange"][0],
":end"=>$this->params["dateRange"][1],
":riders"=>$this->params["riders"],
// ":customers"=>$this->params["customers"]
));
$node->pipe(new ColumnMeta(array(
"id" => array(
"type" => "number",
"label" => "Orders"
),
"ridCharges" => array(
"type" => "number",
"label" => "DC"
),
"gvm" => array(
"type" => "number",
"label" => "GVM"
),
)))
->saveTo($node2);
$aa = $node2->pipe(new Pivot(array(
"dimensions" => array(
"column" => "orderYear",
"row" => "rider_name, customer_name, order_date",
),
"aggregates" => array(
"count" => "id",
"sum" => array("ridCharges", "gvm"),
),
)))->pipe($this->dataStore('customersData'));
$this->src("default")->query("
SELECT DISTINCT
rider_id,
rider_name
FROM
rider_summary
ORDER BY rider_name
")
->pipe($this->dataStore("riders"));
}
}
regards