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 : 18.222.167.85
<?php
function GetReportNames($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$sql_query="select s.internal_code,module_name as report_names from s_user_schema s
inner join s_ref_type t on t.internal_code=s.module_type
where t.value='Reports' order by module_name;";
//echo $sql_query; die();
$lobj_rs = $aobj_context->mobj_db->GetAll($sql_query);
$arr['rpt']=$lobj_rs;
include_once("getmoduledetails.php");
$arr['links_data']= getLinks($aobj_context,"Report Setup");
if( $lobj_rs)
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
}
function getParameterDetails($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$ref_s_user_schema_code =($aobj_context->mobj_data["ref_s_user_schema_code"]);
$main_report_names =($aobj_context->mobj_data["main_report_names"]);
$get_para="select GROUP_CONCAT(replace(name,' ','')) as ele_field_name from s_user_schema_elements
where ref_s_user_schema_code='{$ref_s_user_schema_code}'";
$lobj_para_rs = $aobj_context->mobj_db->GetRow($get_para);
$arr['parameter']=$lobj_para_rs;
$arr['header']='';
$arr['details_html']='';
$get_header="select * from report_setup_header where report_id={$ref_s_user_schema_code} and ifnull(report_name,'') = '{$main_report_names}' ";
//echo $get_header; die();
$lobj_get_header = $aobj_context->mobj_db->GetRow($get_header);
if(!empty($lobj_get_header))
{
$report_header_code=$lobj_get_header[internal_code];
$arr['header']=$lobj_get_header;
$get_details="select * from report_setup_details where ref_report_setup_header_code={$report_header_code}
order by ifnull(col,0),internal_code";
$lobj_get_details = $aobj_context->mobj_db->GetAll($get_details);
$query_columns.="<div class='ui-widget-header ui-corner-all sub-tab-header' align='left' style='padding: 2px; font-size: 1.4em; height:15px; width:838px;'>Query Columns</div>";
$query_columns.="<table align='center' cellspacing='0' style='font-size: 1.4em;' cellpadding='0' border='0' width='100%'>";
$query_columns.="<tr colspan='16' class='ui-state-default ui-jqgrid-hdiv'>";
$query_columns.="<td align='center' style='padding:2px; width:190px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC;'>Columns</td>";
$query_columns.="<td align='center' style='padding:2px; width:84px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC;'>Hide</td>";
$query_columns.="<td align='center' style='padding:2px; width:84px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC;'>Total</td>";
$query_columns.="<td align='center' style='padding:2px; width:120px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC;'>Picture</td>";
$query_columns.="<td align='center' style='padding:2px; width:120px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC;'>Subtotal</td>";
$query_columns.="<td align='center' style='padding:2px; width:84px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC;'>Row</td>";
$query_columns.="<td align='center' style='padding:2px; width:84px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC;'>Col</td>";
$query_columns.="<td align='center' style='padding:2px; width:100px; border-left:px solid #C5DBEC; border-right:1px solid #C5DBEC;'>Style</td>";
$query_columns.="<td align='center' style='padding:2px; width:90px; border-left:px solid #C5DBEC; border-right:1px solid #C5DBEC;'>UL</td>";
$query_columns.="<td align='center' style='padding:2px; width:90px; border-left:px solid #C5DBEC; border-right:1px solid #C5DBEC;'>Bold</td>";
$query_columns.="<td align='center' style='padding:2px; width:90px; border-left:px solid #C5DBEC; border-right:1px solid #C5DBEC;'>Alignment</td>";
$query_columns.="<td align='center' style='padding:2px; width:90px; border-left:px solid #C5DBEC; border-right:1px solid #C5DBEC;'>Width</td>";
$query_columns.="<td align='center' style='padding:2px; width:90px; border-left:px solid #C5DBEC; border-right:1px solid #C5DBEC;'>Title</td>";
$query_columns.="<td align='center' style='padding:2px; width:90px; border-left:px solid #C5DBEC; border-right:1px solid #C5DBEC;'>Alias</td>";
$query_columns.="<td align='center' style='padding:2px; width:90px; border-left:px solid #C5DBEC; border-right:1px solid #C5DBEC;'>Sep.Len</td>";
$query_columns.="<td align='center' style='padding:2px; width:90px; border-left:px solid #C5DBEC; border-right:1px solid #C5DBEC;'>Sep.Text</td>";
$query_columns.="</tr>";
$counter=0;
$k=0;
foreach($lobj_get_details as $key=> $value)
{
if($k%2==0)
$class='tbl_row';
else
$class='tbl_row1';
$is_hide_checked='';
$is_total_checked='';
$is_ul_checked='';
$is_bold_checked='';
$is_title_checked='';
if($value[hide]==1)
$is_hide_checked='checked';
if($value[total]==1)
$is_total_checked='checked';
if($value[ul]==1)
$is_ul_checked='checked';
if($value[bold]==1)
$is_bold_checked='checked';
if($value[title]==1)
$is_title_checked='checked';
$is_selected_total1='';
$is_selected_total2='';
$is_selected_total3='';
if($value[sub_total]==1)
$is_selected_total1=" selected ";
elseif($value[sub_total]==2)
$is_selected_total2=" selected ";
elseif($value[sub_total]==3)
$is_selected_total3=" selected ";
$is_selected_style1='';
$is_selected_style2='';
$is_selected_style3='';
$is_selected_style4='';
if($value[style]=='Normal')
$is_selected_style1=" selected ";
elseif($value[style]=='Compress')
$is_selected_style2=" selected ";
elseif($value[style]=='Medium')
$is_selected_style3=" selected ";
elseif($value[style]=='Wide')
$is_selected_style4=" selected ";
$is_selected_alignment1='';
$is_selected_alignment2='';
$is_selected_alignment3='';
if($value[alignment]=='Left')
$is_selected_alignment1=" selected ";
elseif($value[alignment]=='Center')
$is_selected_alignment2=" selected ";
elseif($value[alignment]=='Right')
$is_selected_alignment3=" selected ";
$query_columns.="<tr>";
$query_columns.="<td class='tbl_row_new' style='border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px;' id='report_setup_row_column_{$counter}' style='width: 50px;'>{$value[query_columns]}</td>";
$query_columns.="<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC;'><input {$is_hide_checked} id='report_setup_row_hide_{$counter}' value='{$value[hide]}' type='checkbox' style='width: 20px;'></td>";
$query_columns.="<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC;'><input {$is_total_checked} id='report_setup_row_total_{$counter}' value='{$value[total]}' type='checkbox' style='width: 20px;'></td>";
$query_columns.="<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC;'><input id='report_setup_row_picture_{$counter}'value='{$value[picture]}' type='text' style='width: 60px;'></td>";
$query_columns.="<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC;'><select id='report_setup_row_sub_total_{$counter}' value='{$value[sub_total]}' style='width: 80px;'><option value='0'>Select</option><option value='1' {$is_selected_total1}>1</option><option value='2' {$is_selected_total2}>2</option><option value='3' {$is_selected_total3}>3</option></select></td>";
$query_columns.="<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC;'><input id='report_setup_row_row_{$counter}' value='{$value[row]}' type='text' style='width: 26px;'></td>";
$query_columns.="<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC;'><input id='report_setup_row_col_{$counter}' value='{$value[col]}' type='text' style='width: 26px;'></td>";
$query_columns.="<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC;'><select id='report_setup_row_style_{$counter}' value='{$value[style]}' style='width: 80px;'><option {$is_selected_style1}>Normal</option><option {$is_selected_style2}>Compress</option><option {$is_selected_style3}>Medium </option><option {$is_selected_style4}>Wide</option></select></td>";
$query_columns.="<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC;'><input {$is_ul_checked} id='report_setup_row_ul_{$counter}' value='{$value[ul]}' type='checkbox' style='width: 20px;'></td>";
$query_columns.="<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC;'><input {$is_bold_checked} id='report_setup_row_bold_{$counter}' value='{$value[bold]}' type='checkbox' style='width: 20px;'></td>";
$query_columns.="<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC;'><select id='report_setup_row_alignment_{$counter}' value='{$value[alignment]}' style='width: 80px;'><option value='0'>Select</option><option {$is_selected_alignment1}>Left</option><option {$is_selected_alignment2}>Center</option><option {$is_selected_alignment3}>Right</option></select></td>";
$query_columns.="<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC;'><input id='report_setup_row_width_{$counter}' value='{$value[width]}' type='text' style='width: 26px;'></td>";
$query_columns.="<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC;'><input {$is_title_checked} id='report_setup_row_title_{$counter}' value='{$value[title]}' type='checkbox' style='width: 20px;'></td>";
$query_columns.="<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC;'><input id='report_setup_row_alias_name_{$counter}'value='{$value[alias_name]}' type='text' style='width: 50px;'></td>";
$query_columns.="<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC;' ><input id='report_setup_row_sep_len_{$counter}'value='{$value[sep_len]}' type='text' style='width: 50px;'></td>";
$query_columns.="<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC;'><input id='report_setup_row_sep_text_{$counter}'value='{$value[sep_text]}' type='text' style='width: 50px;'></td>";
$query_columns.="</tr>";
$counter++;
$k++;
}
$query_columns.="</table>";
$arr['counter']=$counter;
$arr['details_html']=$query_columns;
}
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"Success");
}
function GetReportSetupColumnDetails($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$input_qry= stripslashes(trim($aobj_context->mobj_data["input_qry"]));
$lobj_input_qry = $aobj_context->mobj_db->GetRow($input_qry);
$header_row=array_keys($lobj_input_qry);
$query_columns.="<div class='ui-widget-header ui-corner-all sub-tab-header' align='left' style='padding: 2px; font-size: 1.4em; height:15px; width:838px;'>Query Columns</div>";
$query_columns.="<table align='center' cellspacing='0' style='font-size: 1.4em;' cellpadding='0' border='0' width='100%'>";
$query_columns.="<tr colspan='16' class='ui-state-default ui-jqgrid-hdiv'>";
$query_columns.="<td align='center' style='padding:2px; width:190px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC;'>Columns</td>";
$query_columns.="<td align='center' style='padding:2px; width:84px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC;'>Hide</td>";
$query_columns.="<td align='center' style='padding:2px; width:84px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC;'>Total</td>";
$query_columns.="<td align='center' style='padding:2px; width:120px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC;'>Picture</td>";
$query_columns.="<td align='center' style='padding:2px; width:120px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC;'>Subtotal</td>";
$query_columns.="<td align='center' style='padding:2px; width:84px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC;'>Row</td>";
$query_columns.="<td align='center' style='padding:2px; width:84px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC;'>Col</td>";
$query_columns.="<td align='center' style='padding:2px; width:100px; border-left:px solid #C5DBEC; border-right:1px solid #C5DBEC;'>Style</td>";
$query_columns.="<td align='center' style='padding:2px; width:90px; border-left:px solid #C5DBEC; border-right:1px solid #C5DBEC;'>UL</td>";
$query_columns.="<td align='center' style='padding:2px; width:90px; border-left:px solid #C5DBEC; border-right:1px solid #C5DBEC;'>Bold</td>";
$query_columns.="<td align='center' style='padding:2px; width:90px; border-left:px solid #C5DBEC; border-right:1px solid #C5DBEC;'>Alignment</td>";
$query_columns.="<td align='center' style='padding:2px; width:90px; border-left:px solid #C5DBEC; border-right:1px solid #C5DBEC;'>Width</td>";
$query_columns.="<td align='center' style='padding:2px; width:90px; border-left:px solid #C5DBEC; border-right:1px solid #C5DBEC;'>Title</td>";
$query_columns.="<td align='center' style='padding:2px; width:110px; border-left:px solid #C5DBEC; border-right:1px solid #C5DBEC;'>Alias</td>";
$query_columns.="<td align='center' style='padding:2px; width:90px; border-left:px solid #C5DBEC; border-right:1px solid #C5DBEC;'>Sep.Len</td>";
$query_columns.="<td align=' center' style='padding:2px; width:90px; border-left:px solid #C5DBEC; border-right:1px solid #C5DBEC;'>Sep.Test</td>";
$query_columns.="</tr>";
$counter=0;
$col_ctr=1;
$k=0;
foreach($header_row as $key=> $value)
{
if($k%2==0)
$class='tbl_row';
else
$class='tbl_row1';
$query_columns.="<tr>";
$query_columns.="<td style='border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px;' id='report_setup_row_column_{$counter}' style='width: 50px;'>{$value}</td>";
$query_columns.="<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC;'><input id='report_setup_row_hide_{$counter}' value='' type='checkbox' style='width: 20px;'></td>";
$query_columns.="<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC;'><input id='report_setup_row_total_{$counter}' value='' type='checkbox' style='width: 20px;'></td>";
$query_columns.="<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC;'><input id='report_setup_row_picture_{$counter}' type='text' style='width: 60px;'></td>";
$query_columns.="<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC;'><select id='report_setup_row_sub_total_{$counter}' style='width: 80px;'><option value='0'>Select</option><option value='1'>1</option><option value='2'>2</option><option value='3'>3</option></select></td>";
$query_columns.="<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC;'><input id='report_setup_row_row_{$counter}' value='1' type='text' style='width: 26px;'></td>";
$query_columns.="<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC;'><input id='report_setup_row_col_{$counter}' value='{$col_ctr}' type='text' style='width: 26px;'></td>";
$query_columns.="<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC;'><select id='report_setup_row_style_{$counter}' style='width: 80px;'><option>Normal</option><option>Compress</option><option>Medium</option><option>Wide</option></select></td>";
$query_columns.="<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC;'><input id='report_setup_row_ul_{$counter}' value ='' type='checkbox' style='width: 20px;'></td>";
$query_columns.="<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC;'><input id='report_setup_row_bold_{$counter}' value ='' type='checkbox' style='width: 20px;'></td>";
$query_columns.="<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC;'><select id='report_setup_row_alignment_{$counter}' value='' style='width: 80px;'><option value='0'>Select</option><option>Left</option><option>Center</option><option>Right</option></select></td>";
$query_columns.="<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC;'><input id='report_setup_row_width_{$counter}' value='' type='text' style='width: 26px;'></td>";
$query_columns.="<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC;'><input id='report_setup_row_title_{$counter}' value='' type='checkbox' style='width: 20px;'></td>";
$query_columns.="<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC;'><input id='report_setup_row_alias_name_{$counter}'value='Value' type='text' style='width: 50px;'></td>";
$query_columns.="<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC;'><input id='report_setup_row_sep_len_{$counter}'value='' type='text' style='width: 50px;'></td>";
$query_columns.="<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC;'><input id='report_setup_row_sep_text_{$counter}'value='' type='text' style='width: 50px;'></td>";
$query_columns.="</tr>";
$counter++;
$col_ctr++;
$k++;
}
$query_columns.="</table>";
$arr['counter']=$counter;
$arr['html']=$query_columns;
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"Success");
}
function saveReportSetupDetails($aobj_context)
{
include_once("/JSON.php");
$json = new Services_JSON();
$internal_code=stripslashes(trim($aobj_context->mobj_data["internal_code"]));
$report_id=stripslashes(trim($aobj_context->mobj_data["report_setup_report_names"]));
$main_report_names=trim($aobj_context->mobj_data["main_report_names"]);
$report_setup_report_title1=stripslashes(trim($aobj_context->mobj_data["report_setup_report_title1"]));
$report_setup_report_title2=stripslashes(trim($aobj_context->mobj_data["report_setup_report_title2"]));
$report_setup_report_query=stripslashes(trim($aobj_context->mobj_data["report_setup_report_query"]));
//new fileds
$report_setup_page_orientation=stripslashes(trim($aobj_context->mobj_data["report_setup_page_orientation"]));
$report_setup_print_scale=stripslashes(trim($aobj_context->mobj_data["report_setup_print_scale"]));
$report_setup_header_report_x=stripslashes(trim($aobj_context->mobj_data["report_setup_header_report_x"]));
$report_setup_header_report_y=stripslashes(trim($aobj_context->mobj_data["report_setup_header_report_y"]));
$report_setup_hide_grid_lines=stripslashes(trim($aobj_context->mobj_data["report_setup_hide_grid_lines"]));
$report_setup_freez_panes=stripslashes(trim($aobj_context->mobj_data["report_setup_freez_panes"]));
$report_setup_print_row_column_header=stripslashes(trim($aobj_context->mobj_data["report_setup_print_row_column_header"]));
$report_setup_page_sizes=stripslashes(trim($aobj_context->mobj_data["report_setup_page_sizes"]));
$lstr_param = stripslashes($aobj_context->mobj_data["report_setup_data"]);
$mobj_jsondata = $json->decode($lstr_param);
$larr_report_setup_data = get_object_vars($mobj_jsondata);
$get_int_code="select internal_code from report_setup_header where report_id='{$report_id}' and report_name = '{$main_report_names}' ";
$lobj_get_int_code = $aobj_context->mobj_db->GetRow($get_int_code);
$internal_code_rpt_header= $lobj_get_int_code['internal_code'];
$del_report="delete from report_setup_header where report_id='{$report_id}' and report_name = '{$main_report_names}' ";
$lobj_del_report = $aobj_context->mobj_db->Execute($del_report);
$insert_report_setup_header="insert into report_setup_header(
report_name,
report_id,
title_1,
title_2,
query,
page_orientation,
print_scale,
header_report_x,
header_report_y,
hide_grid_lines,
freeze_panes,
print_row_col_header,
page_size
) values
(
\"{$main_report_names}\",
\"{$report_id}\",
\"{$report_setup_report_title1}\",
\"{$report_setup_report_title2}\",
\"{$report_setup_report_query}\",
\"{$report_setup_page_orientation}\",
\"{$report_setup_print_scale}\",
\"{$report_setup_header_report_x}\",
\"{$report_setup_header_report_y}\",
\"{$report_setup_hide_grid_lines}\",
\"{$report_setup_freez_panes}\",
\"{$report_setup_print_row_column_header}\",
\"{$report_setup_page_sizes}\"
)";
// echo $insert_report_setup_header; die();
$lobj_insert_report_setup_header = $aobj_context->mobj_db->Execute($insert_report_setup_header);
//echo $insert_report_setup_header; die();
$last_inserted_id = $aobj_context->mobj_db->Insert_ID();
$del_qry="delete from report_setup_details where ref_report_setup_header_code={$internal_code_rpt_header}";
$lobj_del_qry = $aobj_context->mobj_db->Execute($del_qry);
for( $i = 0; $i < count($larr_report_setup_data); $i++ )
{
$report_setup_row_sep_len=empty($larr_report_setup_data[$i]->report_setup_row_sep_len)?0:$larr_report_setup_data[$i]->report_setup_row_sep_len;
$report_setup_row_width=empty($larr_report_setup_data[$i]->report_setup_row_width)?10:$larr_report_setup_data[$i]->report_setup_row_width;
$insert_report_setup_details="insert into report_setup_details(
ref_report_setup_header_code,
query_columns,
hide,
total,
picture,
sub_total,
row,
col,
style,
ul,
bold,alignment,width,
title,alias_name,
sep_len,sep_text)
values
(
{$last_inserted_id},
'{$larr_report_setup_data[$i]->report_setup_row_column}',
'{$larr_report_setup_data[$i]->report_setup_row_hide}',
'{$larr_report_setup_data[$i]->report_setup_row_total}',
'{$larr_report_setup_data[$i]->report_setup_row_picture}',
'{$larr_report_setup_data[$i]->report_setup_row_sub_total}',
'{$larr_report_setup_data[$i]->report_setup_row_row}',
'{$larr_report_setup_data[$i]->report_setup_row_col}',
'{$larr_report_setup_data[$i]->report_setup_row_style}',
'{$larr_report_setup_data[$i]->report_setup_row_ul}',
'{$larr_report_setup_data[$i]->report_setup_row_bold}',
'{$larr_report_setup_data[$i]->report_setup_row_alignment}',
'{$report_setup_row_width}',
'{$larr_report_setup_data[$i]->report_setup_row_title}',
'{$larr_report_setup_data[$i]->report_setup_row_alias_name}',
'{$report_setup_row_sep_len}',
'{$larr_report_setup_data[$i]->report_setup_row_sep_text}'
)";
$lobj_insert_report_setup_details = $aobj_context->mobj_db->Execute($insert_report_setup_details);
}
if($lobj_insert_report_setup_header)
{
$rdata = "Report Setup Details inserted Successfully.";
print_r($aobj_context->mobj_output->ToJSONEnvelope($rdata,0,"success"));
return $rdata;
}
else
{
$rdata = "insertion Failed.";
print_r($aobj_context->mobj_output->ToJSONEnvelope($rdata,-1,"Failure"));
return $rdata;
}
}
//popup reportsetup
function showGridForReportSetup($aobj_context)
{
$json = new Services_JSON();
$limit = $_GET['rows'];
$sidx = $_GET['sidx'];
$sord = $_GET['sord'];
$page = $_GET['page'];
$report_id = $_GET['report_id'];
//echo $report_id ; die();
if(!$sidx)
$sidx =1;
$search =$aobj_context->mobj_data["_search"];
$filter_toolbal_cond="";
if($search)
{
$grid_report_name=$aobj_context->mobj_data["grid_report_name"];
if(isset($grid_report_name) && !empty($grid_report_name))
$filter_toolbal_cond.=" and grid_report_name like '{$grid_report_name}%'";
}
if($search)
{
$count_id="select count(*) as count from
(select internal_code as id, report_name as grid_report_name
from report_setup_header where report_id={$report_id})a
where 1=1 {$filter_toolbal_cond}";
}
else
{
$count_id="select count(*) as count from
report_setup_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($search)
{
$SQL="select * from (select internal_code as id, report_name as grid_report_name
from report_setup_header where report_id={$report_id} )a
where 1=1 {$filter_toolbal_cond}
ORDER BY $sidx $sord LIMIT $start,$limit";
}
else
{
$SQL = "select internal_code as id, report_name as grid_report_name
from report_setup_header where report_id='{$report_id}'
ORDER BY $sidx $sord LIMIT $start , $limit";
//echo $SQL; die();
}
//echo $SQL;
$result = mysql_query( $SQL ) or die("Could not execute query.".mysql_error());
$responce->page = $page;
$responce->total = $total_pages;
$responce->records = $count;
$i=0; while($row = mysql_fetch_array($result,MYSQL_ASSOC))
{ $responce->rows[$i]['id']=$row[id]; //id
$responce->rows[$i]['cell']=array($row[grid_report_name]);
$i++;
}
echo json_encode($responce);
}
function getReportSetupValue($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$ref_report_id=$aobj_context->mobj_data["internal_code"];
$get_report_name="select internal_code, report_name as value
from report_setup_header where internal_code='{$ref_report_id}'";
$lobj_get_report_name = $aobj_context->mobj_db->GetRow($get_report_name);
$arr['rpt_setup']=$lobj_get_report_name;
if($lobj_get_report_name)
print_r($aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"));
else
print_r($aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure"));
return;
}
?>
|