Dear KoolReport team,
I have an issue. I have 2 login users 1) Admin and 2) Employee Generate report based on user session id I got the report successfully. But here my issue is, Whenever Admin logged in, he will pass the Employee name, Which Employee Report , he wants to see, this report I can't render. I written the query based on SESSION variable. But it is not executed. Why?
Can you tell me, where I done mistake...
index.php
include APPPATH."reports/WeeklyReport_Ex.php"
$report = new WeeklyReport_EX(array("Empid" => $Empid)); // It shows the ERROR: Undefined variable Empid
$report = new WeeklyReport_EX(array("Empid" =>isset($this->params['Empid'])?Empid:NULL));
WeeklyReport_Ex.php
function setup()
{
if($_SESSION['Roleid] != 1)
{
$querystr = " ........."
->this->src('default')
->this->query($querystr);
->pipe(new Pivot(
==========
=========
))
->pipe($this->dataStore('EmployeeWeeklyReport))
}
else
{
if (isset($this->params['Employee']))
{
$querystr = " ........."
->this->src('default')
->this->query($querystr);
->pipe(new Pivot(
==========
=========
))
->pipe($this->dataStore('EmployeeFilterReport))
}
else
{
$querystr = " ........."
->this->src('default')
->this->query($querystr);
->pipe(new Pivot(
==========
=========
))
->pipe($this->dataStore('AdminWeeklyReport))
}
}
}
WeeklyReport_Ex.view.php
<form method= "post">
<?php
IF($_SESSION['Roleid'] == 1)
{
?>
<div class = "row">
<h6> Employee Name </h6>
<?php
select2 :: create(array(
"name" => "Employee",
"dataStore" => $this->dataStore("EmployeeFilter"),
"dataBind" => array("text" => "EmpName" , "value" => "Empid")
));
?>
</div>
<button type="submit" name= "submitBtn" onclick = "btnClick();">Submit</button>
</form>
<div class = "row">
<?php
if($_SESSION['Roleid] != 1)
{
PivotTable :: create(array(
"dataStore" => $this->dataStore('EmployeeWeeklyReport')
));
}
else
{
if(isset($this->params["Empid"]) && $_SESSION['empid'] != $_POST['empid'])
{
PivotTable :: create(array(
"dataStore" => $this->dataStore(EmployeeFilterReport') /// This is not giving OUTPUT
));
}
else
{
PivotTable :: create(array(
"dataStore" => $this->dataStore('AdminWeeklyReport')
));
}
}
?>
</div>
$(document).ready(function()
{
function btnClick()
{
var Empid = $(this).val();
$.ajax({
type : 'POST',
url : '<?php echo site_url();?>/WeeklyReport/index',
data : {Empid : Empid},
success : function(response){
console.log(response);
},
error : function()
{
alert(error);
}
});
}
});
Thanks in Advance. I already reached my dead line. Please reply me as early as possible. I am waiting for your reply.