Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 3.14.134.195
<?php
function getUserReportsReportName($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$source_db =($aobj_context->mobj_data["source_db"]);
$get_details="select internal_code,report_name as name from report_header order by report_name desc";
$lobj_details = $aobj_context->mobj_db->getAll($get_details);
$arr['rept_name']=$lobj_details;
if( $lobj_details)
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
}
function getSearchedEmployeeFields($aobj_context,$value,$emp_ids)
{
require_once($aobj_context->main_src."/custom_src/employeeClass.php");
$emp_obj=new employeeClass($aobj_context);
$emp_obj->employee();
if(!empty($value))
{
$get_data="select internal_code,case when internal_code in ({$emp_ids})
then 1
else 0 end as checked,
concat({$emp_obj->employee_code},'-',{$emp_obj->employee_name}) as emp_code
from {$emp_obj->employee_table} where
(
({$emp_obj->employee_code} like '{$value}%'
or internal_code in ({$emp_ids})) )
order by {$emp_obj->employee_code} ";
$obj_get_employee_fields = $aobj_context->mobj_db->GetAll($get_data);
if(empty($obj_get_employee_fields))
{
$get_data="select internal_code,case when internal_code in ({$emp_ids})
then 1
else 0 end as checked,
concat({$emp_obj->employee_name},'-',{$emp_obj->employee_code}) as emp_code
from {$emp_obj->employee_table}(
({$emp_obj->employee_code} like '{$value}%'
or internal_code in ({$emp_ids})) ) order by {$emp_obj->employee_name} ";
$obj_get_employee_fields = $aobj_context->mobj_db->GetAll($get_data);
}
}
else
{
$get_data="select internal_code,case when internal_code in ({$emp_ids})
then 1
else 0 end as checked,
concat({$emp_obj->employee_code},'-',{$emp_obj->employee_name}) as emp_code
from {$emp_obj->employee_table} order by {$emp_obj->employee_code} ";
$obj_get_employee_fields = $aobj_context->mobj_db->GetAll($get_data);
}
return $obj_get_employee_fields ;
}
function getUserReportEnableEmp($aobj_context)
{
$value=trim($aobj_context->mobj_data["value"]);
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$emp_ids=trim($aobj_context->mobj_data["emp_ids"]);
$emp_ids='0'.substr($emp_ids,0,strlen($emp_ids)-1);
$obj_get_employee_fields=getSearchedEmployeeFields($aobj_context,$value,$emp_ids);
$str_emp="<table width='50%' align='center' border='0' cellpadding='' cellspacing=''>";
$str_emp.="<tr>";
$str_emp.="<td style='width:180px;'>";
$str_emp.="<div id='report_setup_employee_div' style='padding:2px;overflow-y:scroll;overflow-y:auto;width:260px;height:250px;border:1px solid #cccccc;'>";
for($mdata = 0 ; $mdata < count($obj_get_employee_fields) ; $mdata++)
{
$field_data_id = $obj_get_employee_fields[$mdata][emp_code];
$internal_code = $obj_get_employee_fields[$mdata][internal_code];
$checked = $obj_get_employee_fields[$mdata][checked];
$checked=($checked==1)?" checked ":"";
$str_emp.="<input type='checkbox' {$checked} id = 'emp_user_report_int_code_$internal_code' name='{$internal_code}' /><label for='checkOption1'>{$field_data_id}</label><br />";
}
$str_emp.="</div></td>";
$str_emp.="</tr></table>";
$select_emp_schema_id="select internal_code from s_user_schema where
module_name='Employee'";
$obj_select_emp_schema_id = $aobj_context->mobj_db->GetRow($select_emp_schema_id);
$arr['html']=$str_emp;
$arr['schema_id']=$obj_select_emp_schema_id;
$arr['emp_table_data']=$obj_get_employee_fields;
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
}
function getUserReportsName($aobj_context)
{
$internal_code = $aobj_context->mobj_data["internal_code"];
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$lstr_qry = "select report_name,
DATE_FORMAT(from_date,'%d/%m/%Y') as from_date,
DATE_FORMAT(to_date,'%d/%m/%Y') as to_date
from report_header
where internal_code ={$internal_code}";
$lobj_rs = $aobj_context->mobj_db->getRow($lstr_qry);
$rdata['report_name']= $lobj_rs[report_name];
$rdata['from_date']= $lobj_rs[from_date];
$rdata['to_date']= $lobj_rs[to_date];
echo $aobj_context->mobj_output->ToJSONEnvelope($rdata,0,"success");
return $rdata;
}
function displayUserReports($aobj_context)
{
include("search-condition.php");
include("/JSON.php");
//echo $lstr_ids;
$json = new Services_JSON();
$limit = $_GET['rows'];
$sidx = $_GET['sidx'];
$sord = $_GET['sord'];
$page = $_GET['page'];
if(!$sidx)
$sidx =1;
// to take th e parameters from Search field
if(isset($_GET['searchField']) && $_GET["_search"]=='true')
{
$field_name=$_GET['searchField'];
$final_value=getsearchcondition($_GET['searchOper'],$_GET['searchString']);
$cond=$final_value[0];
$value=$final_value[1];
}
if(isset($_GET['searchField']) && $_GET["_search"]=='true')
{
$count_id="select count(*) as count from
report_header
where $field_name $cond$value";
}
else
{
$count_id="select count(*) as count from
report_header";
}
$result = mysql_query($count_id);
$row = mysql_fetch_array($result,MYSQL_ASSOC);
$count = $row['count'];
// calculation of total pages for the query
if( $count >0 )
{
$total_pages = ceil($count/$limit);
}
else
{
$total_pages = 0;
}
if ($page > $total_pages)
$page=$total_pages;
$start = $limit*$page - $limit;
if($start <0)
$start = 0;
// the actual query for the grid data
if(isset($_GET['searchField']) && $_GET["_search"]=='true')
{
$SQL="select * from (select internal_code as id,report_name from
report_header )a where $field_name $cond$value
ORDER BY $sidx $sord LIMIT $start,$limit";
}
else
{
$SQL = "select internal_code as id,report_name from
report_header
ORDER BY $sidx $sord LIMIT $start , $limit";
//echo $SQL;
}
$responce->page = $page;
$responce->total = $total_pages;
$responce->records = $count;
$lobj_rs = $aobj_context->mobj_db->GetAll($SQL);
foreach($lobj_rs as $key =>$value)
{
$responce->rows[$key]['id']=$value[id];
$responce->rows[$key]['cell']=array($value[report_name]);
}
// return the formated data
echo $json->encode($responce);
}
?>
|