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


Current Path : /var/www/html/pgadm2020/js/admin/
Upload File :
Current File : /var/www/html/pgadm2020/js/admin/reports.js

// var $host_url =
//   "http://" +
//   window.location.host +
//   "/" +
//   window.location.pathname.split("/")[1] +
//   "/app.php?a=";

var $photo_url =
  "http://" +
  window.location.host +
  "/" +
  window.location.pathname.split("/")[1];

$(function () {
  var focusedElement;
  $(document).on("focus", "input", function () {
    if (focusedElement == this) return;
    focusedElement = this;
    setTimeout(function () {
      focusedElement.select();
    }, 100);
  });
});

function loadReports() {
  $.ajax({
    type: "POST",
    url: $host_url + "loadRange",
    async: false,
    success: function (response) {
      //  console.log(response);
      var { error_code, data, status } = JSON.parse(response);
      // console.log(data);
      if (error_code == "0") {
        $("#loadTab").load("reports.html", function () {
          var degrees = data;
          var dept_opt = "";
          for (let deg of degrees) {
            dept_opt += `<option value="${deg.fdegree}">${deg.fdescpn}</option>`;
          }
          $("#fdept").html(dept_opt);
        });
        // var date = getDate();
        // console.log(date);
        // document.getElementById('dtfrom').value = date;
        // document.getElementById('dtto').value = date;
        // $('#dtfrom').val(date);
        // $('#dtto').val(date);
      } else {
        alert("Please try after some time");
        return;
      }
    },
  });
}

function getDate() {
  var today = new Date();
  var dd = today.getDate();
  var mm = today.getMonth() + 1; //January is 0!

  var yyyy = today.getFullYear();
  if (dd < 10) {
    dd = "0" + dd;
  }
  if (mm < 10) {
    mm = "0" + mm;
  }
  var today = dd + "/" + mm + "/" + yyyy;
  return today;
}

function loadreportdet() {
  var reporttype = $("#freports").val();
  var dtfrom = $("#dtfrom").val();
  var dtto = $("#dtto").val();
  var fdept = $("#fdept").val();
  if (reporttype == "applicationlist") {
    console.log(dtfrom, dtto);
    window.open(
      $host_url +
        "ApplicationReport" +
        "&fdept=" +
        fdept +
        "&dtfrom=" +
        dtfrom +
        "&dtto=" +
        dtto,
      "_blank"
    );
  } else if (reporttype == "applicationfeereport") {
    window.open(
      $host_url +
        "Applicationfeereport" +
        "&fdept=" +
        fdept +
        "&dtfrom=" +
        dtfrom +
        "&dtto=" +
        dtto,
      "_blank"
    );
  } else if (reporttype == "applicationfeesummary") {
    window.open(
      $host_url +
        "ApplicationFeeSum" +
        "&fdept=" +
        fdept +
        "&dtfrom=" +
        dtfrom +
        "&dtto=" +
        dtto,
      "_blank"
    );
  } else if (reporttype == "seatAllotdegreewise") {
    window.open(
      $host_url + "Degreewise_SeatAllotedList" + "&fdept=" + fdept,
      "_blank"
    );
  } else if (reporttype == "seatAllotCollegwise") {
    window.open(
      $host_url + "Collegewise_SeatAllotedList" + "&fdept=" + fdept,
      "_blank"
    );
  } else if (reporttype == "seatallotmentdetails") {
    window.open(
      $host_url + "Seat_Allotment_Details" + "&fdept=" + fdept,
      "_blank"
    );
  }
}

function reporttypechange() {
  // console.log('change');
  if (
    $("#freports").val() == "seatAllotCollegwise" ||
    $("#freports").val() == "seatAllotdegreewise" ||
    $("#freports").val() == "seatallotmentdetails"
  ) {
    // console.log('if');
    $("#alootround").show();
    $("#daterangerpt").hide();
  } else {
    $("#alootround").hide();
    $("#daterangerpt").show();
  }
}

function loadMeritList() {
  $.ajax({
    type: "POST",
    url: $host_url + "loadRange",
    async: false,
    success: function (response) {
      //  console.log(response);
      var { error_code, data, status } = JSON.parse(response);
      // console.log(data);
      if (error_code == "0") {
        $("#loadTab").load("merit_list.html", function () {
          var degrees = data;
          var dept_opt = "";
          for (let deg of degrees) {
            dept_opt += `<option value="${deg.fdegree}">${deg.fdescpn}</option>`;
          }
          $("#fdept").html(dept_opt);
        });
        // var date = getDate();
        // console.log(date);
        // document.getElementById('dtfrom').value = date;
        // document.getElementById('dtto').value = date;
        // $('#dtfrom').val(date);
        // $('#dtto').val(date);
      } else {
        alert("Please try after some time");
        return;
      }
    },
  });
  //$("#loadTab").load("merit_list.html", function() {});
}

function genarateMeritList() {
  // var fdegfrom = $("#afrom").val();
  // var fdegto = $("#ato").val();
  // window.open(
  //   $host_url + "MeritList&fdegfrom=" + fdegfrom + "&fdegto=" + fdegto,
  //   "_blank"
  // );
  var fdept = $("#fdept").val();
  $.ajax({
    type: "POST",
    url: $host_url + "updBCUMeritList",
    data: "&fdept=" + fdept,
    async: false,
    success: function (response) {
      //  console.log(response);
      var { error_code, data, status } = JSON.parse(response);
      // console.log(data);
      if (error_code == "0") {
        var db = window.location.pathname.split("/")[2];
        if (db == "bnu-admin") {
          window.open(
            $host_url + "getBnuAdmissionMeritList&fdept=" + fdept,
            "_blank"
          );
        } else {
          window.open(
            $host_url + "getAdmissionMeritList&fdept=" + fdept,
            "_blank"
          );
        }
      } else {
        alert("Please try after some time");
        return;
      }
    },
  });
}