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


Current Path : /var/www/html/stph/js/
Upload File :
Current File : /var/www/html/stph/js/room_allotment_datewise.js

//10561 10655
function CallEnableRoomAllotmentDatewise() {
  $("#page_main_div").load(
    "html_modules/room_allotment_datewise.html",
    function() {
      document.getElementById("display_module_name").innerHTML =
        "Room Allotment Datewise";
      document.getElementById("module_name_for_save").value =
        "Room Allotment Datewise";
      getDefaultHeadFooterLinks("Room Allotment Datewise");
      getRoomdetails();
    }
  );
}

function getRoomdetails() {
  $.ajax({
    type: "POST",
    async: false,
    url: $host_url + "getRoomdetails",
    success: function(responce) {
      $responce = eval("(" + responce + ")");
      document.getElementById("ra_from").options.length = 0;
      for ($i = 0; $i < $responce.data.length; $i++) {
        $op = new Option($responce.data[$i]["value"], $responce.data[$i]["id"]);
        $op.id = $responce.data[$i]["id"]; //specifying the id  for options
        document.getElementById("ra_from").options.add($op);
      }
      document.getElementById("ra_to").options.length = 0;
      for ($i = 0; $i < $responce.data.length; $i++) {
        $op = new Option($responce.data[$i]["value"], $responce.data[$i]["id"]);
        $op.id = $responce.data[$i]["id"]; //specifying the id  for options
        document.getElementById("ra_to").options.add($op);
      }
    }
  });
}

function DisplayRoomAllotmentDetatilsDatewise() {
  //$.blockUI({ message: "<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>" });

  if (date_format($("#frm_date").val()) == "") {
    alert("Enter Date");
    $("#frm_date").focus();
    return false;
  }

  if (date_format($("#session").val()) == "") {
    alert("Select Session.");
    $("#session").focus();
    return false;
  }

  if ($("#deggrp").val() == "") {
    alert("Select Faculty.");
    $("#deggrp").focus();
    return false;
  }

  $.blockUI({
    message:
      "<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>"
  });
  $.ajax({
    type: "POST",
    async: true,
    data:
      "frm_date=" +
      trim($("#frm_date").val()) +
      "&session=" +
      trim($("#session").val()) +
      "&ra_from=" +
      trim($("#ra_from").val()) +
      "&ra_to=" +
      trim($("#ra_to").val()) +
      "&deggrp=" +
      trim($("#deggrp").val()),
    url: $host_url + "DisplayRoomAllotmentDetatilsDatewise",
    success: DisplayRoomAllotmentDetatilsDatewiseResponse
  });
}

function DisplayRoomAllotmentDetatilsDatewiseResponse(responce) {
  $.unblockUI();
  responce = eval("(" + responce + ")");
  if (responce.error_code == 0) {
    alert("Room Allotment Done successfully.");
    var datastring =
      "&frm_date=" +
      trim($("#frm_date").val()) +
      "&session=" +
      trim($("#session").val()) +
      "&deggrp=" +
      trim($("#deggrp").val());
    window.location.href =
      $host_url + "Generateroomallotmantsummary" + datastring;

    /*$("#room_allotment").html("");
		$("#room_allotment").html(responce.data['html']);*/
  } else {
    alert(responce.data);
  }
}

function CaclulateRaGrandTotal() {
  var grand_total = 0;
  var table_obj = $("input[id*='ra_input_']");
  jQuery.each(table_obj, function(k, v) {
    i_total = $(this).val();
    grand_total = eval(grand_total + parseFloat(i_total));
  });
  $("#ra_total").val(grand_total);
}

function SaveRoomAllotmentDatewise() {
  var qp_code = $("#abs_entry_qp_code").val();
  var ra_stu_cnt = $("#ra_stu_cnt").val();
  var total_rooms = $("#total_rooms").val();
  var FSESSION = $("#ra_time").val();
  var FDOE = date_format($("#ra_date").val());
  var ra_total = $("#ra_total").val();
  var faculty = $("#faculty").val();

  if (date_format($("#frm_date").val()) == "") {
    alert("Enter Date");
    $("#frm_date").focus();
    return false;
  }

  if (date_format($("#session").val()) == "") {
    alert("Select Session.");
    $("#session").focus();
    return false;
  }

  /* if(ra_total != ra_stu_cnt)
		{
			alert("Alloted Student count should be equal to Total Student Count");		 
			return false;
		} */

  var inputFileds = document.getElementsByTagName("input");

  var chkCnt = 0;
  var rowCnt = 0;
  var hall_arr = {};
  for (var counter = 0; counter < inputFileds.length; counter++) {
    if (
      inputFileds[counter].type.toUpperCase() == "TEXT" &&
      inputFileds[counter].name == "HALL"
    ) {
      ++rowCnt;
      ++chkCnt;
      //alert(document.getElementById(rowCnt+'_hallno').value);
      hall_arr[chkCnt] = new Object();
      hall_arr[chkCnt]["hallno"] = document.getElementById(
        rowCnt + "_hallno"
      ).value;
      hall_arr[chkCnt]["roomname"] = document.getElementById(
        rowCnt + "_roomname"
      ).value;
      hall_arr[chkCnt]["capacity"] = document.getElementById(
        rowCnt + "_capacity"
      ).value;
      hall_arr[chkCnt]["qpcode"] = document.getElementById(
        rowCnt + "_qpcode"
      ).value;
      hall_arr[chkCnt]["count"] = document.getElementById(
        rowCnt + "_count"
      ).value;
      hall_arr[chkCnt]["remaing"] = document.getElementById(
        rowCnt + "_remaing"
      ).value;
      hall_arr[chkCnt]["alloted"] = document.getElementById(
        rowCnt + "_alloted"
      ).value;
      hall_arr[chkCnt]["notalloted"] = document.getElementById(
        rowCnt + "_notalloted"
      ).value;
      hall_arr[chkCnt]["fdoe"] = document.getElementById(
        rowCnt + "_fdoe"
      ).value;
      hall_arr[chkCnt]["sestion"] = document.getElementById(
        rowCnt + "_sestion"
      ).value;
      hall_arr[chkCnt]["subcode"] = document.getElementById(
        rowCnt + "_subcode"
      ).value;
    }
  }
  $.blockUI({
    message:
      "<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>"
  });
  $.ajax({
    type: "POST",
    async: true,
    data:
      "&hall_arr=" +
      encodeURIComponent(JSON.stringify(hall_arr)) +
      "&faculty=" +
      faculty,
    url: $host_url + "SaveRoomAllotmentDatewise",
    success: SaveRoomAllotmentDatewiseResponse
  });
}

function SaveRoomAllotmentDatewiseResponse(responce) {
  responce = eval("(" + responce + ")");
  $.unblockUI();
  if (responce.error_code == 0) {
    alert(responce.data);
  } else {
    alert(responce.data);
  }
}