I have two Select2 controls and DateTimePicker on my View. The select2 controls work well when I click on Submit button. However, the DateTimePicker doesn't work. Please any suggestions. Below is my display:
This is MyReportMortgage.view.php file:
<?php //Step 1: Load KoolReport require_once "../load.koolreport.php"; use \koolreport\processes\ValueMap; use \koolreport\processes\Sort; use \koolreport\clients\Bootstrap; use \koolreport\processes\ColumnMeta; use \koolreport\processes\Transpose; use \koolreport\processes\ColumnRename; use \koolreport\core\src\core\Utility; use \koolreport\cube\processes\Cube; use \koolreport\inputs\Select2; use \koolreport\processes\TimeBucket; use \koolreport\processes\Group; use \koolreport\processes\DateTimeFormat; //Step 2: Creating Report class class MyReportMortgage extends \koolreport\KoolReport
{
use \koolreport\export\Exportable;
use \koolreport\inputs\Bindable;
use \koolreport\inputs\POSTBinding;
use \koolreport\clients\Bootstrap;
protected function defaultParamValues()
{
return array(
"years"=>"2019",
// "Years"=>"",
"TypeOfApp"=> "",
"startDatePicker"=>date("M"),
"endDatePicker"=>date("M"),
);
}
protected function bindParamsToInputs()
{
return array(
"years",
"TypeOfApp",
"startDatePicker",
"endDatePicker",
);
}
protected function settings()
{
return array(
"dataSources"=>array(
"data"=>array(
"connectionString"=>"mysql:host=localhost;dbname=mlnrgh",
"username"=>"root",
"password"=>"",
"charset"=>"utf8"
),
)
);
}
protected function setup()
{
$query_params = array();
if($this->params["years"]!=array())
{
$query_params[":years"] = $this->params["years"];
}
if($this->params["TypeOfApp"]!=array())
{
$query_params[":TypeOfApp"] = $this->params["TypeOfApp"];
$this->src('data')->query("
select
RecDate,
sum(ApplicationsRcvd) as 'ApplicationsReceived',
sum(ApplicationProc) as 'ApplicationsProcessed',
sum(TotalPending)as 'TotalPending',
YEAR(RecDate) as 'Year',
MONTHNAME(RecDate) as 'MONTH'
from landtitlereg
where 1=1
".(($this->params["years"]!=array())?"and YEAR(RecDate) in (:years)":"")."
".(($this->params["TypeOfApp"]!=array())?"and TypeOfApp in (:TypeOfApp)":"")."
GROUP BY Year, TypeOfApp, MONTH
ORDER BY FIELD(MONTH,'January','February','March','April','May','June','July','August','September','October','November','December')
")->params($query_params)
->pipe(new DateTimeFormat(array(
"RecDate"=>array(
"from"=>"Y-m-d",
"to"=>"M",
)
)))
->pipe($this->dataStore("result"));
}
}
}
The MyreportMortgage.php file is:
<?php //Step 1: Load KoolReport require_once "../load.koolreport.php"; use \koolreport\processes\ValueMap; use \koolreport\processes\Sort; use \koolreport\clients\Bootstrap; use \koolreport\processes\ColumnMeta; use \koolreport\processes\Transpose; use \koolreport\processes\ColumnRename; use \koolreport\core\src\core\Utility; use \koolreport\cube\processes\Cube; use \koolreport\inputs\Select2; use \koolreport\processes\TimeBucket; use \koolreport\processes\Group; use \koolreport\processes\DateTimeFormat; //Step 2: Creating Report class class MyReportMortgage extends \koolreport\KoolReport
{
use \koolreport\export\Exportable;
use \koolreport\inputs\Bindable;
use \koolreport\inputs\POSTBinding;
use \koolreport\clients\Bootstrap;
protected function defaultParamValues()
{
return array(
"years"=>"2019",
// "Years"=>"",
"TypeOfApp"=> "",
"startDatePicker"=>date("M"),
"endDatePicker"=>date("M"),
);
}
protected function bindParamsToInputs()
{
return array(
"years",
"TypeOfApp",
"startDatePicker",
"endDatePicker",
);
}
protected function settings()
{
return array(
"dataSources"=>array(
"data"=>array(
"connectionString"=>"mysql:host=localhost;dbname=mlnrgh",
"username"=>"root",
"password"=>"",
"charset"=>"utf8"
),
)
);
}
protected function setup()
{
$query_params = array();
if($this->params["years"]!=array())
{
$query_params[":years"] = $this->params["years"];
}
if($this->params["TypeOfApp"]!=array())
{
$query_params[":TypeOfApp"] = $this->params["TypeOfApp"];
$this->src('data')->query("
select
RecDate,
sum(ApplicationsRcvd) as 'ApplicationsReceived',
sum(ApplicationProc) as 'ApplicationsProcessed',
sum(TotalPending)as 'TotalPending',
YEAR(RecDate) as 'Year',
MONTHNAME(RecDate) as 'MONTH'
from landtitlereg
where 1=1
".(($this->params["years"]!=array())?"and YEAR(RecDate) in (:years)":"")."
".(($this->params["TypeOfApp"]!=array())?"and TypeOfApp in (:TypeOfApp)":"")."
GROUP BY Year, TypeOfApp, MONTH
ORDER BY FIELD(MONTH,'January','February','March','April','May','June','July','August','September','October','November','December')
")->params($query_params)
->pipe(new DateTimeFormat(array(
"RecDate"=>array(
"from"=>"Y-m-d",
"to"=>"M",
)
)))
->pipe($this->dataStore("result"));
}
}
}