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


Current Path : /var/www/html/college/js/
Upload File :
Current File : /var/www/html/college/js/attendanceReportForm.js

function loadAttendanceReport() {
  $("#page_main_div").load(
    "../html_modules/attendanceReport.html?",
    function () {
      document.getElementById("display_module_name").innerHTML =
        "Attendance From A & B";
      document.getElementById("module_name_for_save").value =
        "Attendance From A & B";
      getDefaultHeadFooterLinks("Attendance From A & B");
    }
  );
  loadselectDegree();
}

function loadselectDegree() {
  $.ajax({
    type: "GET",
    url: $host_url + "loadAtteDegree",
    success: function (res) {
      // console.log(res);
      // return;
      let response = JSON.parse(res);

      if (response.error_code == 0) {
        var degree = "<option value=''>---Select---</option>";
        for (var i = 0; i < response.data.length; i++) {
          degree += `<option value="${response.data[i].fdegree}">${response.data[i].fdegree} - ${response.data[i].fdescpn}</option>`;
        }
        $("#degree_type").html(degree);
      } else {
        // alert(response.data);
        // return;
      }
    },
  });
}

function loadSemester() {
  var degree = $("#degree_type").val();

  $.ajax({
    type: "GET",
    data: "&sdegree=" + degree,
    url: $host_url + "loadSemester",
    success: function (response) {
      let res = JSON.parse(response);
      // console.log(res);
      // return;
      if (res.error_code == 0) {
        var sem = `<option>---Select---</option>`;
        for (var i = 0; i < res.data.length; i++) {
          sem += `<option value="${res.data[i].fexamno}"> ${res.data[i].fexamname}</option>`;
        }
        $("#sem_type").html(sem);
      } else {
        alert(response.data.msg);
        return;
      }
    },
  });
}

function loadSubject() {
  var sem = $("#sem_type").val();
  var degree = $("#degree_type").val();
  // console.log(sem);
  // return;
  $.ajax({
    type: "GET",
    data: "&semester=" + sem + "&sdegree=" + degree,
    url: $host_url + "loadSubject",
    success: function (response) {
      let res = JSON.parse(response);
      // console.log(res);
      // return;
      if (res.error_code == 0) {
        var sub = `<option>---Select---</option>
        <option value='All'>All</option>`;
        for (var i = 0; i < res.data.length; i++) {
          sub += `<option value="${res.data[i].fcsubcode}">${res.data[i].fcsubcode} - ${res.data[i].fsubname}</option>`;
        }
        $("#sub_type").html(sub);
      } else {
        alert(response.data.msg);
        return;
      }
    },
  });
}

function loadSection() {
  var degree = $("#degree_type").val();
  var sem = $("#sem_type").val();
  // console.log(sem);
  // return;
  $.ajax({
    type: "GET",
    data: "&sdegree=" + degree + "&semester=" + sem,
    url: $host_url + "loadSection",
    success: function (response) {
      let res = JSON.parse(response);
      // console.log(res);
      var sub = "";
      sub = `<option>---Select---</option>
      <option value="All">All</option>`;
      // return;
      if (res.error_code == 0) {
        for (var i = 0; i < res.data.length; i++) {
          sub += `<option value="${res.data[i].fsection}">${res.data[i].fsection}</option>`;
        }
      } else {
        sub = `<option value="All">All</option>`;
      }
      $("#section").html(sub);
    },
  });
}

function getAttendanceReport() {
  var degree = $("#degree_type").val();
  var sem = $("#sem_type").val();
  var subj = $("#sub_type").val();
  var sec = $("#section").val();
  var fregno = $("#from_reg").val();
  var tregno = $("#to_reg").val();
  var fper = $("#from_per").val();
  var tper = $("#to_per").val();

  // console.log();

  if (degree == "") {
    alert("Select Degree");
  } else if (sem == "") {
    alert("Select Semester");
  } else if (subj == "") {
    alert("Select Subject");
  } else if (sec == "") {
    alert("Select Section");
  } else if (fregno == "") {
    alert("Enter From Regno");
  } else if (tregno == "") {
    alert("Enter To Regno");
  } else if (fper == "") {
    alert("Enter From Percentage");
  } else if (tper == "") {
    alert("Enter To Percentage");
  }

  var parameters =
    "&degree=" +
    degree +
    "&sem=" +
    sem +
    "&subj=" +
    subj +
    "&section=" +
    sec +
    "&regfrom=" +
    fregno +
    "&regto=" +
    tregno +
    "&perfrom=" +
    fper +
    "&perto=" +
    tper +
    "&sub=" +
    subj +
    "_blank";

  $.ajax({
    type: "GET",
    data: parameters,
    url: $host_url + "checkData",
    success: function (response) {
      let res = JSON.parse(response);
      console.log(res);
      if (res.error_code == 0) {
        window.open($host_url + "attendancereportformab" + parameters);
      } else {
        alert("No Data Found");
        return;
      }
    },
  });
}