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.17.78.184


Current Path : /proc/thread-self/root/var/www/html/gcw/custom_js/
Upload File :
Current File : //proc/thread-self/root/var/www/html/gcw/custom_js/report_setup_popup.js


function ReportSetupPopupDetails($field_id)
{   
    window.$reportsetupfieldid=$field_id;
	getEmployeeFormulaMappingValueForReportSetup();	
    getGridForReportSetup();		
	$('#dialog').dialog('open');
	$("#dialog").data("width.dialog", 402);
	$('#ui-dialog-title-dialog').html('Report Details');	

}

	
function getGridForReportSetup($col1,$col2,$id,$field_name,$module_id)
{  
		
	$main="<table id='table_grid2' class='scroll'  ondblclick='SelectReportSetupPopupRow();'></table> <div id='sub_grid_div2' class='scroll' style='text-align:center;'></div>";
    document.getElementById('dialog').innerHTML=$main;
	$t="colNames:[$a,$b],";
	var open_emp_salary_popup =jQuery("#table_grid2").jqGrid(
		{
		url:$host_url+'showGridForFormulaMapping&id='+$id+"&field_name="+$field_name+"&module_id="+$module_id+"&search_by_user_map="+$("#emp_report_criteria_"+window.$reportsetupfieldid).val(),
		datatype: "json",
		colNames:[$col1,$col2],
		colModel:[
		{name:'grid_data1',index:'grid_data1', width:115},
		{name:'grid_data2',index:'grid_data2', width:115}
		 ],
		rowNum:10,
		rowList:[5,10,15,20,25,30],
		imgpath:$image_path,
		pager: jQuery('#sub_grid_div2'),
		sortname: 'id',
		height:'100',
		width:'400',
		viewrecords: true,	 
		sortorder: "desc",
		cellEdit: true,
		multiselect: false,		
		addCaption: "Add Recordddd"		
}
 ).navGrid('#sub_grid_div2',{edit:false,add:false,del:false,search:true},{},{},{},{multipleSearch:true}).
 
   navButtonAdd('#sub_grid_div2',{caption:"Select",    
   onClickButton:function()
	{  
	SelectEmployeePopupRow(); }
	});
	 open_emp_salary_popup.filterToolbar(); 
	 $('.ui-search-toolbar').bind('keydown',function(evt) 
		{
	    var kC  = (evt.which) ? evt.which : evt.keyCode;				 
		   if(kC==40)
			jQuery('#table_grid2').editCell(0,0,false);					
		});
		$("#gs_grid_data1").focus();
 	
 }	

function SelectReportSetupPopupRow()
{
	var id=jQuery("#table_grid2").getGridParam('selrow'); 
	if(id > 0) 
	{ 
 
		$.ajax({
	       type: "POST",
		   async:false,
	       data: "internal_code="+id+"&ele_id="+$g_ref_data_arr_map_for_report.data.internal_code ,
	       url: $host_url+"getAddedMappedValue",
 	       success: populategetAddedMappedValueForReport
	    });
	 
	} 
	else
	{ 
		alert("Please select row");  
	} 
}

function populategetAddedMappedValueForReport($responce)
{ 
 	$responce = eval('(' + $responce + ')');
	$('#dialog').dialog('close');
	 $("#emp_report_criteria_"+window.$reportsetupfieldid).val($responce.data.result);
	 if($responce.data.ref_module_code=='0')
	 {
 	 $("#hidden_employee_salary_process_int_code").val(0);
 	 $("#hidden_employee_salary_process_module_code").val(0);
	 }
	 else
	 {
	  $("#hidden_employee_salary_process_int_code").val($responce.data.internal_code);
	   $("#hidden_employee_salary_process_module_code").val($responce.data.ref_module_code);
	 } 	
}


function getEmployeeFormulaMappingValueForReportSetup()
 {
	 $.ajax({
			 type: "POST",
			 //async: false,
			  url: $host_url+"getEmployeeFormulaMappingValue",
			   data:"emp_ele_name="+window.$reportsetupfieldid,
			   success:  ReportsetuppopupResponse
	});
}

function ReportsetuppopupResponse($responce)
	{
		$responce = eval('(' + $responce + ')');
		 $g_ref_data_arr_map_for_report=$responce ;
		if($responce.data['ref_module_code']!='0')
		{
		 $check_index_result = $responce.data['name'].indexOf("-ele-");
		if($check_index_result>=0)
		{		 
		$data=$responce.data['name'].split('-ele-');
		$col1=$data[0];
		$col2=$data[1];
		$table_name=$responce.data.table_name;
		$field_name=$responce.data.field_name;
	$field_name_split=$field_name.split(',\'-\',');
		//making as grid_name1 so it can come in Dynamic from table
		$field_name_split_value=$field_name_split[0]+' as grid_data1'+' , '+$field_name_split[1]+' as grid_data2';
		getGridForReportSetup($col1,$col2,$responce.data['internal_code'],$field_name_split_value,$responce.data['ref_module_code']);
		}
		else 
		{
		 
		$data=$responce.data['name'].split('-ele-');
		$col1=$data[0];
		$col2='';
		$table_name=$responce.data.table_name;
		$field_name=$responce.data.field_name;
		$field_name_split=$field_name.split(',');
		//making as grid_name1 so it can come in Dynamic from table
		$field_name_split_value=$field_name+' as grid_data1'+' , '+'\' \' as grid_data2';
	
		getGridForReportSetup($col1,$col2,$responce.data['internal_code'],$field_name_split_value,$responce.data['ref_module_code']);
		}
		}
else
		{
		getGridForReportSetup($responce.data['name'],'',$responce.data['internal_code'],'',0);
		}
		
		
	}