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.145.84.128
Current Path : /var/www/html/oums/js/ |
| Current File : /var/www/html/oums/js/mc_print.js |
function load_page(file_name) {
load_page_data(
window.location.href.substr(window.location.href.lastIndexOf("/") + 1)
);
cncl_data();
load_sele_dept();
load_sele_exam();
load_sele_resn();
load_grid_data(20, 1);
}
function cncl_data() {
$("#btn_addn").show();
$("#btn_save").hide();
$("#btn_cncl").hide();
$("#page-container-main").show();
$("#page-container-grid").show();
$("#page-container-form").hide();
}
function clrs_data() {
$("#btn_addn").hide();
$("#btn_save").show();
$("#btn_cncl").show();
$("#page-container-main").hide();
$("#page-container-grid").hide();
$("#page-container-form").show();
$(function () {
$("#txtexpndate").datepicker({ dateFormat: "dd/mm/yy" });
});
document.getElementById("txtdeptcode").value = "";
document.getElementById("txtdeptname").value = "";
document.getElementById("txtdeptstat").value = "T";
document.getElementById("txtdepthead").value = "0";
document.getElementById("txtattnupdt").value = "F";
document.getElementById("txtsalrcomp").value = "F";
document.getElementById("txtlogitime").value = "0";
document.getElementById("txtlogotime").value = "0";
document.getElementById("txtexpndate").value = "";
document.getElementById("txtcoderate").value = "0";
}
function load_grid_data(page_limt, page_numb) {
$.ajax({
type: "POST",
url: "src/mc_print.php",
data: {
load_data: "grid_data",
page_limt: page_limt,
page_numb: page_numb,
dept_code: document.getElementById("seldeptcode").value,
resn_code: document.getElementById("selresncode").value,
mcpr_stat: document.getElementById("selmcprstat").value,
mcno_find: document.getElementById("txtmcnofind").value,
},
cache: false,
success: function (data) {
$("#page-container-grid").html(data);
},
error: function (data) {
$("#page-container-grid").html("Error: " + data);
},
});
}
function load_page_limt(page_limt) {
load_data_grid(page_limt, 1);
}
function addn_data() {
clrs_data();
document.getElementById("lblpagemode").innerHTML = "Add";
document.getElementById("txtpagemode").value = "add";
document.getElementById("txtdeptcode").disabled = false;
document.getElementById("txtdeptcode").focus();
}
function edit_data(prim_data) {
clrs_data();
document.getElementById("lblpagemode").innerHTML = "Edit";
document.getElementById("txtpagemode").value = "edit";
document.getElementById("txtdeptcode").disabled = true;
document.getElementById("txtdeptname").focus();
$.ajax({
type: "POST",
url: "src/mc_print.php",
data: {
load_data: "disp_data",
dept_code: prim_data,
},
cache: false,
success: function (data) {
var data = JSON.parse(data);
document.getElementById("txtdeptcode").value = data.fdeptcode;
document.getElementById("txtdeptname").value = data.fdeptname;
document.getElementById("txtdepthead").value = data.fdepthead;
document.getElementById("txtdeptstat").value = data.fdeptstat;
document.getElementById("txtattnupdt").value = data.fattnenbl;
document.getElementById("txtsalrcomp").value = data.fsalrenbl;
document.getElementById("txtlogitime").value = data.flogitime;
document.getElementById("txtlogotime").value = data.flogotime;
document.getElementById("txtexpndate").value = get_format_date(
data.fexpndate
);
document.getElementById("txtcoderate").value = data.fcoderate;
document.getElementById("txtdeptbank").value = data.fdeptbank;
},
error: function (data) {
$("#page-container-form").html("Error: " + data);
},
});
}
function dele_data(prim_data) {
var r = confirm("Delete Record?");
if (r == true) {
$.ajax({
type: "POST",
url: "src/mc_print.php",
data: {
load_data: "dele_data",
dele_code: prim_data,
},
success: function (data) {
load_grid_data(20, 1);
},
});
}
}
function save_data() {
if (document.getElementById("txtdeptcode").value == 0) {
alert("Please enter client code!");
txtdeptcode.focus();
return false;
}
if (document.getElementById("txtdeptname").value == "") {
alert("Please enter client name!");
txtdeptname.focus();
return false;
}
if (document.getElementById("txtdepthead").value == 0) {
alert("Please select client head!");
txtdepthead.focus();
return false;
}
if (document.getElementById("txtdeptstat").value == 0) {
alert("Please select status!");
txtdeptstat.focus();
return false;
}
if (document.getElementById("txtsalrcomp").value == 0) {
alert("Salary computation required!");
txtsalrcomp.focus();
return false;
}
$.ajax({
type: "POST",
url: "src/mc_print.php",
dataType: "json",
data: {
load_data: "save_data",
page_mode: document.getElementById("txtpagemode").value,
dept_code: document.getElementById("txtdeptcode").value,
dept_name: document.getElementById("txtdeptname").value,
dept_head: document.getElementById("txtdepthead").value,
dept_stat: document.getElementById("txtdeptstat").value,
attn_updt: document.getElementById("txtattnupdt").value,
salr_comp: document.getElementById("txtsalrcomp").value,
logi_time: document.getElementById("txtlogitime").value,
logo_time: document.getElementById("txtlogotime").value,
expn_date: document.getElementById("txtexpndate").value,
code_rate: document.getElementById("txtcoderate").value,
dept_bank: document.getElementById("txtdeptbank").value,
},
cache: false,
success: function (data) {
alert(data.mesg);
if (data.stat != "F") {
cncl_data();
load_grid_data(20, 1);
}
},
error: function (data) {
$("#page-container-form").html("Error: " + data);
},
});
}
function load_sele_dept() {
$.ajax({
type: "POST",
url: "src/mc_print.php",
data: {
load_data: "dept_data",
},
cache: false,
success: function (data) {
$("#seldeptcode").html(data);
load_sele_exam();
},
error: function (html) {
$("#page-container-main").html("Error: " + data);
},
});
}
function load_sele_exam() {
//alert(document.getElementById("seldeptcode").value);
$.ajax({
type: "POST",
url: "src/mc_print.php",
data: {
load_data: "exam_data",
dept_code: document.getElementById("seldeptcode").value,
},
cache: false,
success: function (data) {
$("#selexamdate").html(data);
load_grid_data(20, 1);
},
error: function (html) {
$("#page-container-main").html("Error: " + data);
},
});
}
function load_sele_resn() {
$.ajax({
type: "POST",
url: "src/mc_print.php",
data: {
load_data: "resn_data",
},
cache: false,
success: function (data) {
$("#selresncode").html(data);
load_grid_data(20, 1);
},
error: function (html) {
$("#page-container-main").html("Error: " + data);
},
});
}
|