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 : 18.227.46.87


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

function callenableserviceheadfees() {
  $("#page_main_div").load("../html_modules/serviceheadfee.html", function() {
    $("#input_form").hide();

    document.getElementById("display_module_name").innerHTML = "Head Fee";
    document.getElementById("module_name_for_save").value = "HeadFee";
    getDefaultHeadFooterLinks("Head Fees");
    document.getElementById("is_add_edit").value = "view";
    var TFields = ["FDEGREE", "FCATCODE", "FFEECODE", "FFEE"];
    //var TColwidth = ['50','50','50','820','100'];
    var TColwidth = ["40", "100", "100", "680", "100"];
    var THeader = ["Sl.No.", "Degree", "Category", "Fee Description", "Fee"];
    var TWhere = "AND ifnull(FDELETED,'')<>'T'";
    srchHeaderGrid("servfeestr", TFields, TWhere, 1020, TColwidth, THeader, 5);
    $("#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 getserviceheadfeepopup() {
  $.ajax({
    type: "POST",
    url: $host_url + "getservinfeeformation",
    success: getserviceheadfeepopupResponce
  });
}

function getserviceheadfeepopupResponce(responce) {
  responce = eval("(" + responce + ")");
  document.getElementById("T1").options.length = 0;
  document.getElementById("T2").options.length = 0;
  document.getElementById("T3").options.length = 0;

  var degree = responce.data["degree"];
  var category = responce.data["category"];
  var servtype = responce.data["servtype"];

  DropdownValue(degree, "T1", "Degree");
  DropdownValue(category, "T2", "Category");
  DropdownValue(servtype, "T3", "Service");
  /* $op = new Option();
	$op.id=0;
	
	for($i=0;$i < degree.length;$i++)                                  
	{            
		$op = new Option(degree[$i]['value'], degree[$i]['internal_code']);
		$op.id=degree[$i]['internal_code'];//specifying the id  for options
		document.getElementById("T1").options.add($op);
	}
	
	for($i=0;$i < category.length;$i++)                                  
	{            
		$op = new Option(category[$i]['value'], category[$i]['internal_code']);
		$op.id=category[$i]['internal_code'];//specifying the id  for options
		document.getElementById("T2").options.add($op);
	}

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

function DropdownValue(arr, ele_name, def_title) {
  document.getElementById(ele_name).options.length = 0;
  var op = new Option("  Select  " + def_title, "#");
  op.id = "00";
  document.getElementById(ele_name).options.add(op);
  jQuery.each(arr, function(k, v) {
    var op = new Option(v["value"], v["id"]);
    op.id = v["id"];
    document.getElementById(ele_name).options.add(op);
  });
}

function addserviceheadfees() {
  var typeEdit = document.getElementById("is_add_edit").value;
  if (typeEdit == "view") {
    $("#page_main_div").load("../html_modules/serviceheadfee.html", function() {
      fldorder = "T1,T2,T3,T4,T5";
      mandfields = "T1,T2,T3,T4,T5";
      $("#grid_view").hide();
      window.enable_proper_module = "Head Fees";
      document.getElementById("display_module_name").innerHTML = "Head Fee";
      document.getElementById("module_name_for_save").value = "HeadFee";
      getDefaultHeadFooterLinks("Head Fees");
      $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 editHeadFeeMaster(degcode, catcode, feecode) {
  $("#page_main_div").load("../html_modules/serviceheadfee.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 = "Head Fee";
    document.getElementById("module_name_for_save").value = "HeadFee";
    getDefaultHeadFooterLinks("Head Fees");
    document.getElementById("is_add_edit").value = "Edit";
    $("#input_form").show();
    editserviceheadfeesDetailsForUpdate(degcode, catcode, feecode);
    $("#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 deleteserviceheadfee() {
  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 degcode = document.getElementById("T1").value;
      var catcode = document.getElementById("T2").value;
      var feecode = document.getElementById("T3").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 + "disableservicefeeRecord",
        data:
          "&degcode=" + degcode + "&catcode=" + catcode + "&feecode=" + feecode,
        success: function($responce) {
          $.unblockUI();
          $responce = eval("(" + $responce + ")");
          if ($responce.error_code == 0) {
            alert("Record deleted successfully");
            $("#view_servicefeehead_entry").trigger("reloadGrid");
            callenablesserviceheadfees();
          }
        }
      });
    }
  }
}

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

function exitservicefeeheads() {
  home();
}

var myobject;
function saveserviceheadfees() {
  var typeEdit = document.getElementById("is_add_edit").value;
  if (typeEdit == "Edit" || typeEdit == "Add") {
    var degcode = document.getElementById("T1").value;
    $geditinternalcode = degcode;
    var catcode = document.getElementById("T2").value;
    var feecode = document.getElementById("T5").value;
    var fee = document.getElementById("T4").value;
    fldorder = "T1,T2,T3,T5";
    mandfields = "T1,T2,T3,T5";
    myobject = onsavevalidate.call(myobject, 999);
    if (myobject != 999) {
      document.getElementById(myobject).focus();
      return false;
    }
    //var evt = document.createEvent("Event");
    //evt.keyCode = 13;

    $.blockUI({
      message:
        "<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>"
    });
    var datastring =
      "&degcode=" +
      $geditinternalcode +
      "&catcode=" +
      catcode +
      "&feecode=" +
      feecode +
      "&fee=" +
      fee +
      "&add_edit=" +
      document.getElementById("is_add_edit").value;
    $.ajax({
      type: "POST",
      url: $host_url + "saveservicefeeMaster",
      data: datastring,
      success: saveserviceheadfeesMasterSuccess
    });
  }
}

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

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

function editserviceheadfeesDetailsForUpdate(degcode, catcode, feecode) {
  $.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 + "getservicefeeDetails",
    data: "degcode=" + degcode + "&catcode=" + catcode + "&feecode=" + feecode,
    success: editserviceheadfeesDetailsForUpdateResponse
  });
}

function editserviceheadfeesDetailsForUpdateResponse($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("T3").disabled = true;
    document.getElementById("T5").disabled = true;
    document.getElementById("T1").value = $responce.data["FDEGREE"];
    document.getElementById("T2").value = $responce.data["FCATCODE"];
    document.getElementById("T5").value = $responce.data["FFEECODE"];
    document.getElementById("T4").value = $responce.data["FFEE"];
  } else {
    $.unblockUI();
    alert($responce.data);
    callenableserviceheadfees();
  }
}

//************* 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);
      }
    }
  });
}

function loadservfeeheads(servcode) {
  $.ajax({
    type: "POST",
    //async:false,
    url: $host_url + "loadservfeeheads" + "&servcode=" + servcode,
    success: function($responce) {
      $responce = eval("(" + $responce + ")");
      if ($responce.error_code == 0) {
        var servheads = $responce.data["servheads"];
        DropdownValue(servheads, "T5", "Fee Head");
      } else {
        alert($responce.data);
      }
    }
  });
}