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


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

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

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

function load_dept_data() {
	$.ajax({
		type: "POST",
		url: "src/salary.php",
		data: {
			load_data: "dept_data",
		},
		cache: false,
		success: function (data) {
			$("#txtdeptcode").html(data);
			load_salr_mnth();
			load_last_updt();
		},
	});
}

function load_salr_mnth() {
	$.ajax({
		type: "POST",
		url: "src/salary.php",
		data: {
			load_data: "salr_mnth",
			dept_code: document.getElementById("txtdeptcode").value,
		},
		cache: false,
		success: function (data) {
			$("#txtsalrmnth").html(data);
			load_last_updt();
		},
	});
}

function load_last_updt() {
	$.ajax({
		type: "POST",
		url: "src/salary.php",
		data: {
			load_data: "last_updt",
			dept_code: document.getElementById("txtdeptcode").value,
			salr_mnth: document.getElementById("txtsalrmnth").value,
		},
		cache: false,
		success: function (data) {
			var data = JSON.parse(data);
			document.getElementById("txtlastupdt").value = data.fupdttime;
		},
	});
}

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

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

	$.ajax({
		type: "POST",
		url: "src/salary.php",
		dataType: "json",
		data: {
			load_data: "save_data",
			dept_code: document.getElementById("txtdeptcode").value,
			salr_mnth: document.getElementById("txtsalrmnth").value,
		},
		cache: false,
		beforeSend: function () {
			show_process();
		},
		success: function (data) {
			hide_process();
			alert(data.mesg);
			//$('#page-container-grid').html('Error: '+data);
		},
	});
}

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

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

	$host = "oums";
	$.ajax({
		type: "POST",
		url: "src/salary.php",
		dataType: "json",
		data: {
			load_data: "view_data",
			dept_code: document.getElementById("txtdeptcode").value,
			salr_mnth: document.getElementById("txtsalrmnth").value,
		},
		cache: false,
		beforeSend: function () {
			show_process();
		},
		success: function (data) {
			hide_process();
			if (data.mesg != "") {
				alert(data.mesg);
			}

			if (data.stat == "T") {
				window.open("src/" + data.file,'_blank');
			}
		},
		error: function (data) {
			hide_process();
			$("#page-container-grid").html("Error: " + data);
		},
	});
}

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

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

	$host = "oums";
	$.ajax({
		type: "POST",
		url: "src/salary.php",
		dataType: "json",
		data: {
			load_data: "view_rept",
			dept_code: document.getElementById("txtdeptcode").value,
			salr_mnth: document.getElementById("txtsalrmnth").value,
		},
		cache: false,
		beforeSend: function () {
			show_process();
		},
		success: function (data) {
			hide_process();
			if (data.mesg != "") {
				alert(data.mesg);
			}

			if (data.stat == "T") {
				window.open("src/" + data.file,'_blank');
			}
		},
		error: function (data) {
			hide_process();
			$("#page-container-grid").html("Error: " + data);
		},
	});
}

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

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

	var r = confirm("Delete Salary?");
	if (r == true) {
		$.ajax({
			type: "POST",
			url: "src/salary.php",
			dataType: "json",
			data: {
				load_data: "dele_data",
				dept_code: document.getElementById("txtdeptcode").value,
				salr_mnth: document.getElementById("txtsalrmnth").value,
			},
			cache: false,
			beforeSend: function () {
				show_process();
			},
			success: function (data) {
				hide_process();
				alert(data.mesg);
			},
		});
	}
}