0xV3NOMx
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.143.17.175


Current Path : /var/www/html/stph/js/
Upload File :
Current File : /var/www/html/stph/js/report_setup.js

$g_report_setup_columns='';
function EnableReportSetup()
{
  //alert('calling');
	$geditinternalcode=0;
	window.enable_proper_module="EnableRemittance";
	document.getElementById('module_name_for_save').value = 'saveReportSetup';	
	document.getElementById('display_module_name').innerHTML = 'ReportSetup';
	$('#page_main_div').load("html_modules/report_setup.html");		
	
	 $.ajax({
		 type: "POST",
		 url: $host_url+"GetReportNames.demo",		 
		 success: GetReportNamesResponce
		});  	
    }
	
 function GetReportNamesResponce($responce)
   {                                                
    $responce = eval('(' + $responce + ')'); 
	$g_link_details_array="";
	$g_link_details_array=$responce.data['links_data'];
	if( $responce.error_code=='0')
	{
		document.getElementById('report_setup_report_names').options.length=0;
		$op = new Option('Select One', '0');
		$op.id='0';
		document.getElementById('report_setup_report_names').options.add($op);
		for($i=0;$i < $responce.data['rpt'].length;$i++)                                  
		{            
		$op = new Option($responce.data['rpt'][$i]['report_names'], $responce.data['rpt'][$i]['internal_code']);
		$op.id=$responce.data['rpt'][$i]['internal_code'];//specifying the id  for options
		document.getElementById('report_setup_report_names').options.add($op);
		} 				
	}
	
    $("#header_td_id").html($g_link_details_array['header_link']);
	$("#footer_td_id").html($g_link_details_array['footer_link']);
	$("#page_header").show();
	$("#page_footer").show();	
 } 
 
 function getParameterDetails()
 {
    $list_data ="main_report_names="+$("#main_report_names").val();		
    $list_data +="&ref_s_user_schema_code="+$("#report_setup_report_names").val();		
	 $.ajax({
		 type: "POST",
		 url: $host_url+"getParameterDetails.demo",
         data: $list_data,		 
		 success: getParameterDetailsResponce
		}); 
		
	document.getElementById('report_setup_report_title1').value='';	
	document.getElementById('report_setup_report_title2').value='';	
	document.getElementById('report_setup_report_query').value='';		
	document.getElementById('report_setup_get_columns').innerHTML='';	
  } 
  
function getParameterDetailsResponce($responce)
 {                                                
    $responce = eval('(' + $responce + ')'); 
	if( $responce.error_code=='0')
	{	
	document.getElementById('report_setup_report_parameter').value = $responce.data.parameter.ele_field_name;	
	if($responce.data.header!='')
	{	
	document.getElementById('report_setup_report_title1').value = $responce.data.header.title_1;
	document.getElementById('report_setup_report_title2').value = $responce.data.header.title_2;	
	document.getElementById('report_setup_report_query').value =  $responce.data.header.query;
	document.getElementById('report_setup_page_orientation').value =  $responce.data.header.page_orientation;	
	document.getElementById('report_setup_print_scale').value =  $responce.data.header.print_scale;
	document.getElementById('report_setup_header_report_x').value =  $responce.data.header.header_report_x;
	document.getElementById('report_setup_header_report_y').value =  $responce.data.header.header_report_y;
	document.getElementById('report_setup_hide_grid_lines').value =  $responce.data.header.hide_grid_lines;
	document.getElementById('report_setup_freez_panes').value =  $responce.data.header.freeze_panes;
	document.getElementById('report_setup_print_row_column_header').value =  $responce.data.header.print_row_col_header;
	document.getElementById('report_setup_page_sizes').value =  $responce.data.header.page_size;
	
	document.getElementById('report_setup_get_columns').innerHTML=$responce.data.details_html;
	$("#report_setup_get_columns").show();	
	 }	
    }
 } 
function GetReportSetupColumnDetails()
{
    //alert('calling');    
	 $g_report_setup_columns="";
	$lstr_query_string="&input_qry="+encodeURIComponent(trim(document.getElementById('report_setup_report_query').value));
	 $.ajax({
		 type: "POST",
		 url: $host_url+"GetReportSetupColumnDetails.demo",
         data: $lstr_query_string,		 
		 success: GetReportSetupColumnDetailsResponce
		});  
}
function GetReportSetupColumnDetailsResponce($responce)
{  
    $responce = eval('(' + $responce + ')'); 
	if( $responce.error_code=='0')
	{		
	  document.getElementById('report_setup_get_columns').innerHTML= $responce.data.html;
	  $("#report_setup_get_columns").show();
      $g_report_setup_columns=$responce.data.counter;	 		      
	}                                          

}

function saveReportSetup()
{
var report_setup_arr = new Object();
for($i=0;$i<$g_report_setup_columns;$i++)
{
var id=$i;

report_setup_arr[$i]= new Object();
report_setup_arr[$i]['id']=id;
    report_setup_arr[$i]['report_setup_row_column']=$("#report_setup_row_column_"+id).html();	
    report_setup_arr[$i]['report_setup_row_picture']=$("#report_setup_row_picture_"+id).val();	
    report_setup_arr[$i]['report_setup_row_sub_total']=$("#report_setup_row_sub_total_"+id).val();	
    report_setup_arr[$i]['report_setup_row_row']=$("#report_setup_row_row_"+id).val();	
    report_setup_arr[$i]['report_setup_row_col']=$("#report_setup_row_col_"+id).val();	
    report_setup_arr[$i]['report_setup_row_style']=$("#report_setup_row_style_"+id).val();	
    report_setup_arr[$i]['report_setup_row_alignment']=$("#report_setup_row_alignment_"+id).val();	
    report_setup_arr[$i]['report_setup_row_width']=$("#report_setup_row_width_"+id).val();	
    report_setup_arr[$i]['report_setup_row_alias_name']=$("#report_setup_row_alias_name_"+id).val();	
    report_setup_arr[$i]['report_setup_row_sep_len']=$("#report_setup_row_sep_len_"+id).val();	
    report_setup_arr[$i]['report_setup_row_sep_text']=$("#report_setup_row_sep_text_"+id).val();	
	
	if(document.getElementById('report_setup_row_hide_'+id).checked==true)
	{
	report_setup_arr[$i]['report_setup_row_hide']='1';
	}
	else report_setup_arr[$i]['report_setup_row_hide']='0';
	
   if(document.getElementById('report_setup_row_total_'+id).checked==true)
	{
	report_setup_arr[$i]['report_setup_row_total']='1';
	}
	else report_setup_arr[$i]['report_setup_row_total']='0';	
	
   if(document.getElementById('report_setup_row_ul_'+id).checked==true)
	{
	report_setup_arr[$i]['report_setup_row_ul']='1';
	}
	else report_setup_arr[$i]['report_setup_row_ul']='0';	
	
   if(document.getElementById('report_setup_row_bold_'+id).checked==true)
	{
	report_setup_arr[$i]['report_setup_row_bold']='1';
	}
   else report_setup_arr[$i]['report_setup_row_bold']='0';		  
	
  if(document.getElementById('report_setup_row_title_'+id).checked==true)
	{
	report_setup_arr[$i]['report_setup_row_title']='1';
	}	
	else report_setup_arr[$i]['report_setup_row_title']='0';	  
 }
//console.log(report_setup_arr);
var myJSONReportSetupText = JSON.stringify(report_setup_arr);  
$lstr_data="report_setup_data="+myJSONReportSetupText; 
$lstr_data+="&report_setup_report_names="+encodeURIComponent(trim(document.getElementById('report_setup_report_names').value));
$lstr_data+="&main_report_names="+encodeURIComponent(trim(document.getElementById('main_report_names').value));
$lstr_data+="&report_setup_report_parameter="+encodeURIComponent(trim(document.getElementById('report_setup_report_parameter').value));
$lstr_data+="&report_setup_report_title1="+encodeURIComponent(trim(document.getElementById('report_setup_report_title1').value));
$lstr_data+="&report_setup_report_title2="+encodeURIComponent(trim(document.getElementById('report_setup_report_title2').value));
$lstr_data+="&report_setup_report_query="+encodeURIComponent(trim(document.getElementById('report_setup_report_query').value));
$lstr_data+="&report_setup_page_orientation="+encodeURIComponent(trim(document.getElementById('report_setup_page_orientation').value));
$lstr_data+="&report_setup_print_scale="+encodeURIComponent(trim(document.getElementById('report_setup_print_scale').value));
$lstr_data+="&report_setup_header_report_x="+encodeURIComponent(trim(document.getElementById('report_setup_header_report_x').value));
$lstr_data+="&report_setup_header_report_y="+encodeURIComponent(trim(document.getElementById('report_setup_header_report_y').value));
$lstr_data+="&report_setup_hide_grid_lines="+encodeURIComponent(trim(document.getElementById('report_setup_hide_grid_lines').value));
$lstr_data+="&report_setup_freez_panes="+encodeURIComponent(trim(document.getElementById('report_setup_freez_panes').value));
$lstr_data+="&report_setup_print_row_column_header="+encodeURIComponent(trim(document.getElementById('report_setup_print_row_column_header').value));
$lstr_data+="&report_setup_page_sizes="+encodeURIComponent(trim(document.getElementById('report_setup_page_sizes').value));

$.ajax({
       type: "POST",
	   async:false,
	    url: $host_url+"saveReportSetupDetails.demo",  
        data:$lstr_data,
       success: saveReportSetupDetailsResponces
    });   
}
function saveReportSetupDetailsResponces($responce)
{  
	$responce = eval('(' + $responce + ')');    
	if ($responce.error_code == 0)                                
	{
		alert($responce.data);
	    ClearReportSetupDetailsAfterSave();
    }
    else
    {   
       alert('Insertion unsuccessfully!!');        
    }
    return;  
}

function ClearReportSetupDetailsAfterSave()
{
$("#report_setup_report_names").val('');
$("#report_setup_report_parameter").val('');
$("#report_setup_report_title1").val('');
$("#report_setup_report_title2").val('');
$("#main_report_names").val('');
$("#report_setup_report_query").val('');
$("#report_setup_page_orientation").val('');
$("#report_setup_print_scale").val('');
$("#report_setup_header_report_x").val('');
$("#report_setup_header_report_y").val('');
$("#report_setup_hide_grid_lines").val('');
$("#report_setup_freez_panes").val('');
$("#report_setup_print_row_column_header").val('');
$("#report_setup_page_sizes").val('');
$("#report_setup_get_columns").hide();
}

//Show Report Setup Names Popup.

function GetReportSetupFormatPopUpDetails()
{

		  ShowGridForReportSetupPopup();
			var s = $("#main_report_names").position();	
			var Left = s.left;
			if(Left>500)
			{
			Left=Left-(425-$("#main_report_names").width());
			}
			var Top = s.top+100;

	$('#dialog').dialog('open');
	$("#dialog").data("width.dialog", 402);
	$('#ui-dialog-title-dialog').html('Report Names');

}


function ShowGridForReportSetupPopup()
{
    $main="<table id='table_grid_report_setup' class='scroll' ondblclick='getReportSetupMappedIds();'></table> <div id='sub_grid_div_report_setup' class='scroll' style='text-align:center;'></div>";
	document.getElementById('dialog').innerHTML=$main;
	var open_report_setup_popup =jQuery("#table_grid_report_setup").jqGrid(
		{
		url:$host_url+'showGridForReportSetup.demo&report_id='+$("#report_setup_report_names").val(),
		datatype: "json",
		colNames:['Report Name'],
		colModel:[
		{name:'grid_report_name',index:'grid_report_name', width:115}		
		 ],
		rowNum:10,
		rowList:[5,10,15,20,25,30],
		imgpath:$image_path,
		pager: jQuery('#sub_grid_div_report_setup'),
		sortname: 'id',
		height:'100',
		width:'400',
		viewrecords: true,
		sortorder: "desc",
		cellEdit: true,
		multiselect: false,		
		addCaption: "Add Recordddd"
		//editurl:$host_url+'deleteFormulaSalarySetup.demo' 
    }
 ).navGrid('#sub_grid_div_report_setup',{edit:false,add:false,del:true,search:true},{},{},{},{multipleSearch:true})
			.navButtonAdd('#sub_grid_div_report_setup',{caption:"Toggle",
			buttonicon :'ui-icon-pin-s', onClickButton:function(){ open_report_setup_popup[0].toggleToolbar() } }).
  navButtonAdd('#sub_grid_div_report_setup',{caption:"Select",    
    onClickButton:function()
{ var gsr = jQuery("#table_grid_report_setup").getGridParam('selrow');
 if(gsr){ getReportSetupMappedIds(); } else { alert("Please select Row") } }
 });
open_report_setup_popup.filterToolbar(); 

 $('.ui-search-toolbar').bind('keydown',function(evt) 
				{
					var kC  = (evt.which) ? evt.which : evt.keyCode;
				 
				if(kC==40)
					jQuery('#table_grid_report_setup').editCell(0,0,false);					
				} );
			$("#gs_grid_report_name").focus();	
}	

function getReportSetupMappedIds()
{
var id=jQuery("#table_grid_report_setup").getGridParam('selrow'); 
		if(id > 0) 
		{ 
		AssignReportSetupValue(id);
		}
		else
		{ 
			alert("Please select row");  
		} 			
}

function AssignReportSetupValue(id)
{
		$.ajax({
	       type: "POST",
			async:false,
	       data: "internal_code="+id ,
	       url: $host_url+"getReportSetupValue.demo",
 	       success: populategetAddedSalaryMappedValue
	    });
}

function populategetAddedSalaryMappedValue($responce)
{  
	$responce = eval('(' + $responce + ')');	
	 $("#main_report_names").val($responce.data['rpt_setup'].value);
	 getParameterDetails();
	 $('#dialog').dialog('close');
}