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 : 18.224.57.25
Current Path : /var/www/html/oums/js/ |
| Current File : /var/www/html/oums/js/expense_advance2.js |
function load_page(file_name) {
load_page_data(window.location.href.substr(window.location.href.lastIndexOf("/") + 1));
cncl_data();
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 () {
$("#txtadvndate").datepicker({ dateFormat: "mm/yy" });
});
document.getElementById("txtadvndate").value = "";
document.getElementById("txtadvndesc").value = "";
document.getElementById("txtadvnamnt").value = "0.00";
}
function load_grid_data(page_limt, page_numb) {
$.ajax({
type: "POST",
url: "src/expense_advance2.php",
data: {
load_data: "grid_data",
page_limt: page_limt,
page_numb: page_numb,
dept_code: document.getElementById("seldeptcode").value,
advn_mnth: document.getElementById("seladvnmnth").value,
advn_find: document.getElementById("txtadvnfind").value,
},
cache: false,
beforeSend: function () {
show_process();
},
success: function (data) {
hide_process();
$("#page-container-grid").html(data);
},
error: function (data) {
hide_process();
$("#page-container-grid").html("Error: " + data);
},
});
}
function load_page_limt(page_limt) {
load_grid_data(page_limt, 1);
}
function addn_data() {
clrs_data();
document.getElementById("lblpagemode").innerHTML = "Add";
document.getElementById("txtpagemode").value = "add";
document.getElementById("txtdeptcode").focus();
var today = new Date();
var mm = today.getMonth() + 1;
var yyyy = today.getFullYear();
document.getElementById("txtadvndate").value = mm + "/" + yyyy;
document.getElementById("txtadvndate").disabled = false;
}
function edit_data(prim_data) {
clrs_data();
document.getElementById("lblpagemode").innerHTML = "Edit";
document.getElementById("txtpagemode").value = "edit";
document.getElementById("txtadvndesc").focus();
document.getElementById("txtadvndate").disabled = true;
$.ajax({
type: "POST",
url: "src/expense_advance2.php",
data: {
load_data: "disp_data",
disp_code: prim_data,
},
cache: false,
success: function (data) {
var data = JSON.parse(data);
document.getElementById("txtadvncode").value = data.fadvncode;
document.getElementById("txtdeptcode").value = data.fdeptcode;
document.getElementById("txtadvndate").value = data.fadvndate.substr(5, 2) + "/" + data.fadvndate.substr(0, 4);
document.getElementById("txtadvndesc").value = data.fadvndesc;
document.getElementById("txtadvnamnt").value = data.fadvnamnt;
},
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/expense_advance2.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 == "") {
alert("Please select client!");
txtdeptcode.focus();
return false;
}
if (document.getElementById("txtadvndate").value == "") {
alert("Please select date!");
txtadvndate.focus();
return false;
}
if (document.getElementById("txtadvndesc").value == "") {
alert("Please enter advance description!");
txtadvndesc.focus();
return false;
}
if (document.getElementById("txtadvnamnt").value == "") {
alert("Please enter advance amount!");
txtadvnamnt.focus();
return false;
}
$.ajax({
type: "POST",
url: "src/expense_advance2.php",
dataType: "json",
data: {
load_data: "save_data",
page_mode: document.getElementById("txtpagemode").value,
advn_code: document.getElementById("txtadvncode").value,
dept_code: document.getElementById("txtdeptcode").value,
advn_date: document.getElementById("txtadvndate").value,
advn_desc: document.getElementById("txtadvndesc").value,
advn_amnt: document.getElementById("txtadvnamnt").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);
},
});
}
|