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


Current Path : /var/www/html/oums/js/
Upload File :
Current File : /var/www/html/oums/js/expense_report_summary.js

function load_page()
{
	load_page_data(window.location.href.substr(window.location.href.lastIndexOf('/')+1));	
	clrs_data();	
	load_dept_data();	
	load_head_desc();		
	
}

function clrs_data()
{	
	$('#page-container-grid').empty();
	document.getElementById("txtdeptcode").focus();		
}

function load_dept_data() 
{
	$.ajax({
		type: "POST",
		url: "phpscript/expense_report_summary.php",
		data: 
		{
			load_data:"dept_data"
		},
		cache: false,
		success: function(data) 
		{
			$("#txtdeptcode").html(data);
			load_empl_data($('#txtdeptcode').val());

		}		
	});
}

function load_empl_data() 
{
	$.ajax({
		type: "POST",
		url: "phpscript/expense_report_summary.php",
		data: 
		{
			load_data:"empl_data",
			dept_code:document.getElementById("txtdeptcode").value
		},
		cache: false,
		success: function(data) 
		{
			$("#txtemplcode").html(data);
		}
	});
}

function load_head_desc() 
{
	$.ajax({
		type: "POST",
		url: "phpscript/expense_report_summary.php",
		data: 
		{
			load_data:"head_desc",
			acnt_type:document.getElementById("txtacnttype").value
		},
		cache: false,
		success: function(data) 
		{
			$("#txtheaddesc").html(data);
		}
	});
}

function view_data()
{
	if(document.getElementById("txtdeptcode").value == 0) 
	{
		alert("Please select department!");
		txtdeptcode.focus();
		return false;
	}		

	if(document.getElementById("txtemplcode").value == 0) 
	{
		alert("Please select employee!");
		txtemplcode.focus();
		return false;
	}		

	if(document.getElementById("txtacnttype").value == 0) 
	{
		alert("Please select account type!");
		txtacnttype.focus();
		return false;
	}		

	if(document.getElementById("txtheaddesc").value == 0) 
	{
		alert("Please select head description!");
		txtheaddesc.focus();
		return false;
	}		

	load_data="view_rept"
	dept_code=document.getElementById("txtdeptcode").value
	empl_code=document.getElementById("txtemplcode").value
	acnt_type=document.getElementById("txtacnttype").value
	head_desc=document.getElementById("txtheaddesc").value
	expn_dat1=document.getElementById("txtexpndat1").value	
	expn_dat2=document.getElementById("txtexpndat2").value		
	rept_type=document.getElementById("txtrepttype").value		

	$host="oums";
	$.ajax({
		type: "POST",
		url: "phpscript/expense_report_summary.php",
		dataType: "json",				
		data: 
		{
			load_data:load_data,
			dept_code:dept_code,
			empl_code:empl_code,
			acnt_type:acnt_type,
			head_desc:head_desc,
			expn_dat1:expn_dat1,
			expn_dat2:expn_dat2,
			rept_type:rept_type
		},
		cache: false,
		beforeSend: function() 
		{
			$('#page-container-grid').html('<img src="images/animate_progress_bar.gif" alt="Processing..." height="50">');
		},
		success: function(data) 
		{
			$('#page-container-grid').empty();
			if(data.stat!='F')
			{
				window.location.href="phpscript/"+data.file; 
			}
			else
			{
				alert(data.mesg);						
			}				
		},
		error: function(data) 
		{
			$('#page-container-grid').html('Error: '+data);			
		}		
	});
}

function get_today_date()
{
	var today = new Date();
	var dd = today.getDate();
	var mm = today.getMonth()+1; //January is 0!
	var yyyy = today.getFullYear();
	
	if(dd<10){dd='0'+dd} 
	if(mm<10){mm='0'+mm} 
	
	var today = dd+'-'+mm+'-'+yyyy;
	return today;
}

function get_format_date(date)
{
	if(date!='0000-00-00')
	{
		var date = new Date(date);
		var days = date.getDate();
		var mnth = date.getMonth()+1; //January is 0!
		var year = date.getFullYear();
		
		if(days<10){days='0'+days} 
		if(mnth<10){mnth='0'+mnth} 
		
		var date = days+'-'+mnth+'-'+year;
	}
	else
	{
		var date = '00'+'-'+'00'+'-'+'0000';
	}
	return date;	
}