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


Current Path : /proc/thread-self/root/var/www/html/reva/js/
Upload File :
Current File : //proc/thread-self/root/var/www/html/reva/js/attreport.js

function callAttReport() {
  $("#page_main_div").load("../html_modules/attReport.html?", function () {
    document.getElementById("display_module_name").innerHTML =
      "Attendance Report";
    document.getElementById("module_name_for_save").value = "Attendance Report";
    getDefaultHeadFooterLinks("Attendance Report");
  });

  loadteachnameReport();
  //loadAttReportClass();
}

function loadteachnameReport() {
  $.ajax({
    type: "POST",
    url: $host_url + "loadteachname",
    success: function (response) {
      var res = JSON.parse(response);
      // if (res.data.length == 1) {
      //   var teachnameoptions = "";
      //   $("#teachname").prop("disabled", true);
      // } else {
      //   $("#teachname").prop("disabled", false);
      // }
      console.log(res);
      var teachnameoptions = "<option value=''>---Select Teacher---</option>";
      for (var i = 0; i < res.data.length; i++) {
        teachnameoptions += `<option value='${res.data[i].teachcode}'>${res.data[i].teachcode} - ${res.data[i].teachname}</option>`;
      }
      console.log(teachnameoptions);
      $("#teachname").html(teachnameoptions);
    },
  });
}

function GenerateAttReport() {
  let fromdate = $("#fromdate").val();
  let todate = $("#todate").val();
  let classnameoption = $("#classid").val();
  let rtype = $("#rtype").val();

  if (rtype == "") {
    alert("Select Report Type");
    $("#rtype").focus();
    return;
  }

  if (fromdate == "") {
    alert("From Date");
    $("#fromdate").focus();
    return;
  }

  if (todate == "") {
    alert("To Date");
    $("#todate").focus();
    return;
  }

  if (classnameoption == "") {
    alert("Select Class Name");
    $("#classnameoption").focus();
    return;
  }

  let classid = classnameoption.split("-");

  if (rtype == "datewise") {
    var parameters =
      "&classid=" +
      classnameoption +
      "&datefrom=" +
      fromdate +
      "&dateto=" +
      todate;
    window.location.href = $host_url + "pdfAttDateWiseReport" + parameters;
  } else if (rtype == "Summary") {
    var parameters =
      "&classid=" +
      classnameoption +
      "&datefrom=" +
      fromdate +
      "&dateto=" +
      todate;
    window.location.href = $host_url + "monthwiseAttXlreport" + parameters;
  } else if (rtype == "datewiseexcel") {
    var parameters =
      "&classid=" +
      classnameoption +
      "&datefrom=" +
      fromdate +
      "&dateto=" +
      todate;
    window.location.href = $host_url + "AttDateWiseReportexcel" + parameters;
  }
}

function loadAttReportClass() {
  var techcode = document.getElementById("teachname").value;

  $.ajax({
    type: "GET",
    url: $host_url + "loadclassname",
    data: "&techcode=" + techcode,
    success: function (response) {
      var res = JSON.parse(response);
      var classnameoptions =
        "<option value=''>---Select Class Name---</option>";
      for (var i = 0; i < res.data.length; i++) {
        classnameoptions += `<option value='${res.data[i].fclassid}'>${res.data[i].fclassname} - ${res.data[i].fclassid}</option>`;
      }

      $("#classid").html(classnameoptions);
    },
  });
}