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


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

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

function clrs_data() {
	$(function () {
		$("#txtworkdat1").datepicker({ dateFormat: "dd/mm/yy" });
	});
	$(function () {
		$("#txtworkdat2").datepicker({ dateFormat: "dd/mm/yy" });
	});
	$("#page-container-grid").empty();
	document.getElementById("txtrepttype").focus();
	document.getElementById("txtworkdat1").value = get_today_date();
	document.getElementById("txtworkdat2").value = get_today_date();
	document.getElementById("txtrepttype").value = "0";
}

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

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


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

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

	if (document.getElementById("txtrepttype").value == 0) {
		alert("Select report type");
		txtrepttype.focus();
		return false;
	}

    if (document.getElementById("txtrepttype").value == "work_done_list") {
		report_work_done_list();
	}

    if (document.getElementById("txtrepttype").value == "work_done_assn") {
		report_work_done_assn();
	}

    if (document.getElementById("txtrepttype").value == "work_done_empl") {
		report_work_done_empl();
	}

    // if (document.getElementById("txtrepttype").value == "work_done_stat") {
	// 	report_work_done_stat();
	// }



}

function report_work_done_stat() {
	$host = "oums";
	$.ajax({
		type: "POST",
		url: "src/work_entry_report_work_done_stat.php",
		dataType: "json",
		data: {
			dept_code: document.getElementById("txtdeptcode").value,
			empl_code: document.getElementById("txtemplcode").value,
			work_dat1: document.getElementById("txtworkdat1").value,
			work_dat2: document.getElementById("txtworkdat2").value,
		},
		cache: false,
		beforeSend: function () {
			show_process();
		},
		success: function (data) {
			hide_process();
			if (data.stat != "F") {
				window.open("src/" + data.file,'_blank');
			} else {
				alert(data.mesg);
			}
			//$('#page-container-grid').html('Error: '+data);
		},
		error: function (data) {
			hide_process();
			//$('#page-container-grid').html('Error: '+data);
		},
	});
}

function report_work_done_list() {
	$host = "oums";
	$.ajax({
		type: "POST",
		url: "src/work_entry_report_work_done_list.php",
		dataType: "json",
		data: {
			dept_code: document.getElementById("txtdeptcode").value,
			empl_code: document.getElementById("txtemplcode").value,
			work_dat1: document.getElementById("txtworkdat1").value,
			work_dat2: document.getElementById("txtworkdat2").value,
		},
		cache: false,
		beforeSend: function () {
			show_process();
		},
		success: function (data) {
			hide_process();
			if (data.stat != "F") {
				window.open("src/" + data.file,'_blank');
			} else {
				alert(data.mesg);
			}
			//$('#page-container-grid').html('Error: '+data);
		},
		error: function (data) {
			hide_process();
			//$('#page-container-grid').html('Error: '+data);
		},
	});
}


function report_work_done_assn() {
	$host = "oums";
	$.ajax({
		type: "POST",
		url: "src/work_entry_report_work_done_assigned.php",
		dataType: "json",
		data: {
			dept_code: document.getElementById("txtdeptcode").value,
			empl_code: document.getElementById("txtemplcode").value,
			work_dat1: document.getElementById("txtworkdat1").value,
			work_dat2: document.getElementById("txtworkdat2").value,
		},
		cache: false,
		beforeSend: function () {
			show_process();
		},
		success: function (data) {
			hide_process();
			if (data.stat != "F") {
				window.open("src/" + data.file,'_blank');
			} else {
				alert(data.mesg);
			}
			//$('#page-container-grid').html('Error: '+data);
		},
		error: function (data) {
			hide_process();
			//$('#page-container-grid').html('Error: '+data);
		},
	});
}


function report_work_done_empl() {
	$host = "oums";
	$.ajax({
		type: "POST",
		url: "src/work_entry_report_work_done_employee.php",
		dataType: "json",
		data: {
			dept_code: document.getElementById("txtdeptcode").value,
			empl_code: document.getElementById("txtemplcode").value,
			work_dat1: document.getElementById("txtworkdat1").value,
			work_dat2: document.getElementById("txtworkdat2").value,
		},
		cache: false,
		beforeSend: function () {
			show_process();
		},
		success: function (data) {
			hide_process();
			if (data.stat != "F") {
				window.open("src/" + data.file,'_blank');
			} else {
				alert(data.mesg);
			}
			//$('#page-container-grid').html('Error: '+data);
		},
		error: function (data) {
			hide_process();
			//$('#page-container-grid').html('Error: '+data);
		},
	});
}