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


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

 

function CallEnableUserDefinedReports()
{
   $guser_report_emp_names_arr="";
   $geditinternalcode=0;
	window.enable_proper_module="EnableUserDefinedReports()";
	$schema_id='';	
	$('#page_main_div').load("html_modules/user_reports.html",function () {
	document.getElementById('display_module_name').innerHTML = 'User Reports';
	document.getElementById('module_name_for_save').value = 'UserReports'; 		
	document.getElementById('user_reports_data_div').innerHTML="";	 
	getUserReportsReportName();	
	getUserReportEmployeeDetails("");
	getDefaultHeadFooterLinks('User Reports');	
	PopulateEmployeeFieldMappingValue('employee_wise_user_report_emp_details');	
	});
	
 }
 
 function AssignDateValue($date_value)
 {
 document.getElementById('user_report_setup_end_date').value = $date_value; 	 
 }

function getUserReportsReportName()
 {
	 $.ajax({
		type: "POST",
		 async:false,
		url: $host_url+"getUserReportsReportName",      
		success: populateGetUserReportsReportName			 
	 });		 
 }
  
function populateGetUserReportsReportName($responce)
 {                                                
    $responce = eval('(' + $responce + ')'); 
	if( $responce.error_code=='0')
	{
		document.getElementById('user_reports_report_name').options.length=0;
		$op = new Option('Select One', '0');
		$op.id='0';
		document.getElementById('user_reports_report_name').options.add($op);
		for($i=0;$i < $responce.data['rept_name'].length;$i++)                                  
		{            
		$op = new Option($responce.data['rept_name'][$i]['name'], $responce.data['rept_name'][$i]['internal_code']);
		$op.id=$responce.data['rept_name'][$i]['internal_code'];//specifying the id  for options
		document.getElementById('user_reports_report_name').options.add($op);
		} 				
	}	  
 }  
 
 function getUserReportEmployeeDetails($value)
 {
 var emp_ids=0;  		  	
var int_code=0;  		  	
	 for($i=0;$i<$guser_report_emp_names_arr.length;$i++)
	 {
	 int_code=$guser_report_emp_names_arr[$i].internal_code; 
		if(document.getElementById("emp_user_report_int_code_"+int_code).checked) 
		{
		emp_ids+= int_code+",";
		}
	 }
	 
 	$.ajax({
		type: "POST",
		 async:false,
		url: $host_url+"getUserReportEnableEmp",   
		data:'value='+$value+"&emp_ids="+emp_ids,			
		success:  getUserReportEmployeeDetailsResponce
	});
 }
 
 function getUserReportEmployeeDetailsResponce($responce)
  {                                                
      $responce = eval('(' + $responce + ')');  
      $guser_report_emp_schema_id="";	  
      $guser_report_emp_names_arr="";	  
	  document.getElementById('user_reports_data_div').innerHTML=  $responce.data.html;
	  $("#user_reports_data_div").show();	 	 
	  $guser_report_emp_names_arr=$responce.data.emp_table_data;	  
	  $guser_report_emp_schema_id=$responce.data.schema_id.internal_code;;	  
  } 


function getUserReportsDetails($id)
{
 EnableUserDefinedReports();
 $.ajax({
		type: "POST",
		async:false,
		url: $host_url+"getUserReportsName.demo",   
		data:'internal_code='+$id,	
		success:getUserReportsNameresponse
	}); 
	
 $geditinternalcode=$id;	
}

function getUserReportsNameresponse($responce)
{                                                
  $responce = eval('(' + $responce + ')');
  $("#user_reports_report_name").val($responce.data.report_name);
  $("#user_report_setup_start_date").val($responce.data.from_date);
  $("#user_report_setup_end_date").val($responce.data.to_date); 
  
  document.getElementById("next_row").innerHTML='Generate';
 }
 
function GenerateUserReports()   
 {   
  var report_id=$("#user_reports_report_name").val();
  if(report_id=='0' || report_id==0)
  {
	  alert("Please Select any One Report");
	  $("#user_reports_report_name").focus();
	  return false;
  }
  $schema_id=$guser_report_emp_schema_id;  

  var emp_ids=0;  		  	
	 for($i=0;$i<$guser_report_emp_names_arr.length;$i++)
	 {
	 var int_code=$guser_report_emp_names_arr[$i].internal_code; 
		if(document.getElementById("emp_user_report_int_code_"+int_code).checked) 
		{
		emp_ids+= int_code+",";
		}
	  }	
var cond='';
	if($('#employee_wise_user_report_emp_details').val()!='' && $('#employee_wise_user_report_emp_details').val()!='0')	
	{
	
		cond+=" and m_62_ele_"+$('#employee_wise_user_report_emp_details').val()+"='"+$('#employee_wise_user_report_map_value').val()+"'";
	}  
	 //alert(cond);
	 $data="&emp_ids="+emp_ids+"&cond="+cond+"&schema_id="+$schema_id+'&report_id='+report_id+"&from_date="+date_format($("#user_report_setup_start_date").val())+"&to_date="+date_format($("#user_report_setup_end_date").val());	
	 window.location.href=$host_url+"GenerateFinalReportSetupDetails"+$data; 	 
  }
 function UserReportCheckAllEmp()
{
if(document.getElementById("user_report_check_all").checked)
	{	
	for($i=0;$i<$guser_report_emp_names_arr.length;$i++)
		 {
		  $int_code=$guser_report_emp_names_arr[$i].internal_code; 
			 document.getElementById("emp_user_report_int_code_"+$int_code).checked=true;
			 
		 }
	}
	else
	{
		for($i=0;$i<$guser_report_emp_names_arr.length;$i++)
		 {
		  $int_code=$guser_report_emp_names_arr[$i].internal_code; 
			 document.getElementById("emp_user_report_int_code_"+$int_code).checked=false;
			 
		 }
	}
}