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


Current Path : /var/www/oasis/js_old/
Upload File :
Current File : /var/www/oasis/js_old/servicehead.js

function callenableservicefeeheads() {
  $("#page_main_div").load("../html_modules/servicehead.html", function() {
    $("#input_form").hide();
    document.getElementById("display_module_name").innerHTML =
      "Services Fee Heads";
    document.getElementById("module_name_for_save").value = "ServicesFeeHeads";
    getDefaultHeadFooterLinks("Services Fee Heads");
    document.getElementById("is_add_edit").value = "view";
    var TFields = [
      "FFEECODE",
      "FFEEDESC",
      "FSERVNAME",
      "servfee.FORDER as FORDER"
    ];
    var TColwidth = ["50", "100", "400", "360", "100"];
    var THeader = ["Sl.No.", "Fee Code", "Fee Description", "Service", "Order"];
    var TPK = ["FSERVCODE", "FFEECODE"];
    var TWhere =
      "AND ifnull(servfee.FDELETED,'') <> 'T' AND servtype.FSERVCODE = servfee.FSERVCODE";
    srchHeaderGrid(
      "servfee,servtype",
      TFields,
      TWhere,
      1070,
      TColwidth,
      THeader,
      5,
      TPK
    );
    $("#header_save").css("color", "#717171");
    //$('#header_save').css('cursor','default');
    $("#header_cancel").css("color", "#717171");
    $("#header_cancel").css("cursor", "default");
    $("#header_delete").css("color", "#717171");
    $("#header_delete").css("cursor", "default");
    $("#grid_view").show();
  });
}

function getserviceheadpopup() {
  $.ajax({
    type: "POST",
    url: $host_url + "getservinformation",
    success: getserviceheadpopupResponce
  });
}

function getserviceheadpopupResponce(responce) {
  responce = eval("(" + responce + ")");
  document.getElementById("T1").options.length = 0;
  var servcode = responce.data["servcode"];
  $op = new Option();
  $op.id = 0;

  for ($i = 0; $i < servcode.length; $i++) {
    $op = new Option(servcode[$i]["value"], servcode[$i]["internal_code"]);
    $op.id = servcode[$i]["internal_code"]; //specifying the id  for options
    document.getElementById("T1").options.add($op);
  }
}

function addservicefeeheads() {
  var typeEdit = document.getElementById("is_add_edit").value;
  if (typeEdit == "view") {
    $("#page_main_div").load("../html_modules/servicehead.html", function() {
      fldorder = "T1,T2,T3,T4,T5";
      mandfields = "T1,T2,T3,T4,T5";
      $("#grid_view").hide();
      window.enable_proper_module = "Services Fee Heads";
      document.getElementById("display_module_name").innerHTML =
        "Services Fee Heads";
      document.getElementById("module_name_for_save").value =
        "ServicesFeeHeads";
      getDefaultHeadFooterLinks("Services Fee Heads");
      $geditinternalcode = "";
      document.getElementById("is_add_edit").value = "Add";
      $("#input_form").show();
      $("#header_add").css("color", "#717171");
      $("#header_add").css("cursor", "default");
      $("#header_report").css("color", "#717171");
      $("#header_report").css("cursor", "default");
      $("#header_delete").css("color", "#717171");
      $("#header_delete").css("cursor", "default");
      document.getElementById("T1").focus();
    });
  }
}
//editServicesFeeHeadsMaster
function editServicesFeeHeadsMaster(servcode) {
  $("#page_main_div").load("../html_modules/servicehead.html", function() {
    fldorder = "T1,T2,T3,T4";
    mandfields = "T1,T2,T3,T4";
    window.enable_proper_module = "Services Fee Heads";
    document.getElementById("display_module_name").innerHTML =
      "Services Fee Heads";
    document.getElementById("module_name_for_save").value = "ServicesFeeHeads";
    getDefaultHeadFooterLinks("Services Fee Heads");
    document.getElementById("is_add_edit").value = "Edit";
    $("#input_form").show();
    editservicefeeheadsDetailsForUpdate(servcode);
    $("#header_add").css("color", "#717171");
    $("#header_add").css("cursor", "default");
    $("#header_report").css("color", "#717171");
    $("#header_report").css("cursor", "default");
    document.getElementById("T2").focus();
    return;
  });
}

function deleteservicefeeheads() {
  var typeEdit = document.getElementById("is_add_edit").value;
  if (typeEdit == "Edit") {
    var r = confirm("Do you want to delete this record ?");
    if (r == true) {
      var delete_arr = new Object();
      delete_arr[0] = new Object();
      var servicecode = document.getElementById("T2").value;
      delete_arr[0]["servicecode"] = servicecode;
      $.blockUI({
        message:
          "<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>"
      });
      var myJSONText = encodeURIComponent(JSON.stringify(delete_arr));
      $.ajax({
        type: "POST",
        //async:false,
        url: $host_url + "disableservicefeeheadRecord",
        data: "&delete_arr=" + myJSONText,
        success: function($responce) {
          $.unblockUI();
          $responce = eval("(" + $responce + ")");
          if ($responce.error_code == 0) {
            alert("Record deleted successfully");
            $("#view_servicefeehead_entry").trigger("reloadGrid");
            callenableservicefeeheads();
          }
        }
      });
    }
  }
}

function cancelservicefeeheads() {
  var typeEdit = document.getElementById("is_add_edit").value;
  if (typeEdit == "Edit" || typeEdit == "Add") {
    var s = confirm("Confirm Cancel?");
    if (s == true) {
      callenableservicefeeheads();
    }
  }
}

function exitservicefeeheads() {
  home();
}

var myobject;
function saveservicefeeheads() {
  var typeEdit = document.getElementById("is_add_edit").value;
  if (typeEdit == "Edit" || typeEdit == "Add") {
    fldorder = "T1,T2,T3,T4";
    mandfields = "T1,T2,T3,T4";
    var sercode = document.getElementById("T1").value;
    $geditinternalcode = sercode;
    var feecode = document.getElementById("T2").value;
    var feedesc = document.getElementById("T3").value;
    var order = document.getElementById("T4").value;
    myobject = onsavevalidate.call(myobject, 999);
    if (myobject != 999) {
      document.getElementById(myobject).focus();
      return false;
    }
    var mandatory = "F";
    if (document.getElementById("T5").checked == true) mandatory = "T";
    $.blockUI({
      message:
        "<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>"
    });
    var datastring =
      "&sercode=" +
      $geditinternalcode +
      "&feecode=" +
      feecode +
      "&feedesc=" +
      feedesc +
      "&order=" +
      order +
      "&mandatory=" +
      mandatory;
    datastring += "&add_edit=" + document.getElementById("is_add_edit").value;
    $.ajax({
      type: "POST",
      url: $host_url + "saveservicefeeheadsMaster",
      data: datastring,
      success: saveservicefeeheadsMasterSuccess
    });
  }
}

function saveservicefeeheadsMasterSuccess($responce) {
  $responce = eval("(" + $responce + ")");
  $.unblockUI();
  if ($responce.error_code == 0) {
    callenableservicefeeheads();
    alert($responce.data);
  } else {
    alert($responce.data);
    document.getElementById("T1").focus();
  }
}

function SelectservicefeeheadsRowId(id) {
  var idlength = id.length;
  if (idlength == 4) {
    $geditinternalcode = id;
    Callenableservicefeeheads("Edit");
  }
}

function editservicefeeheadsDetailsForUpdate(id) {
  $.blockUI({
    message:
      "<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>"
  });
  $.ajax({
    type: "POST",
    //async:false,
    url: $host_url + "getservicefeecodeDetails",
    data: "sercode=" + id,
    success: editservicefeeheadsDetailsForUpdateResponse
  });
}

function editservicefeeheadsDetailsForUpdateResponse($responce) {
  $responce = eval("(" + $responce + ")");

  if ($responce.error_code == 0) {
    if ($responce.data["FDELETED"] == "T") {
      alert("This service code is already deleted!!");
      return false;
    }
    $.unblockUI();
    document.getElementById("T1").disabled = true;
    document.getElementById("T2").disabled = true;
    document.getElementById("T1").value = $responce.data["FSERVCODE"];
    document.getElementById("T2").value = $responce.data["FFEECODE"];
    document.getElementById("T3").value = $responce.data["FFEEDESC"];
    document.getElementById("T4").value = $responce.data["FORDER"];
    if ($responce.data["FMANDATORY"] == "T")
      document.getElementById("T5").checked = true;
  } else {
    alert($responce.data);
  }
}

//************* Validations ************

function Servicefocus(e, id) {
  if (e.keyCode == 13 || e.keyCode == 9 || e.keyCode == 38 || e.keyCode == 40) {
    var rtfocus = onfocusvalidate(e, 999);
    if (rtfocus != 999) {
      return false;
    }
  }
}

function reportSupplier() {
  var typeEdit = document.getElementById("is_add_edit").value;
  if (typeEdit == "view") {
    var win_width = window.screen.width;
    $("#batch_dialog").dialog("open");
    $("#batch_dialog").data("width.dialog", 400);
    $("#batch_dialog").data("position.dialog", [(win_width - 400) / 2, 90]);
    $("#ui-dialog-title-batch_dialog").html("Supplier Report");
    var path = "../html_modules/supplier_report_popup.html";
    $("#batch_dialog").load(path, function() {
      document.getElementById("generate").focus();
    });
  }
}

function GenerateReportSupplierMasterDetails() {
  florder = "SR1,SR2";
  mandfields = "SR1,SR2";
  var rtfocus = onsavevalidate.call(myobject, 999);
  if (rtfocus != 999) {
    return false;
  }
  from_supplier = trim($("#SR1").val());
  to_supplier = trim($("#SR2").val());
  var str = "&from_supplier=" + from_supplier;
  str += "&to_supplier=" + to_supplier;
  //window.location.href = $host_url+"generateReportSupplierMaster"+str;
  $.ajax({
    type: "POST",
    //async:false,
    url: $host_url + "generateReportSupplierMaster",
    data: str,
    success: function($responce) {
      $responce = eval("(" + $responce + ")");
      if ($responce.error_code == 0) {
        viewReportToPrint($responce.data);
      } else {
        alert($responce.data);
      }
    }
  });
}