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


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

function callexmAppChallan() {
  $("#page_main_div").load("../html_modules/examAppChallan.html", function() {
    document.getElementById("display_module_name").innerHTML =
      "Exam Application Challan Prep.";
    document.getElementById("module_name_for_save").value =
      "freezeModuleAtAdminCollegeSubject";
    getDefaultHeadFooterLinks("Exam Application Challan Prep.");
  });
}

function getStudentData() {
  if ($("#fmacas_degree_code").val() == "") {
    alert("Please enter Degree");
    $("#fmacas_degree_code").focus();
    return;
  }

  if ($("#fmacas_sub_Examno").val() == "") {
    alert("Please enter the Exam No.");
    $("#fmacas_sub_Examno").focus();
    return;
  }

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

  $.ajax({
    type: "POST",
    data:
      "&degree=" +
      $("#fmacas_degree_code").val() +
      "&exmno=" +
      $("#fmacas_sub_Examno").val(),
    url: $host_url + "getExmAppData",
    success: ExmAppDataRes
  });
}

function ExmAppDataRes(response) {
  $.unblockUI();
  response = eval("(" + response + ")");
  var { error_code, data, status } = response;
  // console.log("resss", error_code, data, status);
  var z = 0;
  if (response.error_code == 0) {
    html = `
    <table border="1" style = "overflow-y: auto;">`;
    html += ` <thead >
    <tr>
    <th width='4%' style = "position: sticky; top: 0;padding: 8px 16px;background:#eee;"><center>Sl. No.</center></th>
    <th width='5%' style = "position: sticky; top: 0;padding: 8px 16px;background:#eee;"><center>Reg. No.</center></th>
    <th width='20%' style = "position: sticky; top: 0;padding: 8px 16px;background:#eee;"><center>Name</center></th>
    <th width='5%' style = "position: sticky; top: 0;padding: 8px 16px;background:#eee;"><center>Amount</center></th>
    <th width='5%' style = "position: sticky; top: 0;padding: 8px 16px;background:#eee;"><center><input type="checkbox" onchange="checkAll()" name="chk[]" id="checkall" />Select</center></th>
    </tr>
    </thead>`;
    data.forEach((el, i) => {
      if (el.applied == "T")
        var check = `Challan Generated (${el.fchallanno}) <a onclick = "printchallan('${el.fchallanno}')" style = "color :blue">Print Challan</a> <input type="checkbox" style = "display:none" id="chk${i}" >`;
      else
        check = `<center><input type="checkbox" id="chk${i}" onchange="ttlAmt(${i},${el.amount})"></center>`;

      html += `<tr>
        <td width='4%'><center>${i + 1}</center></td>
        <td width='5%' id="regno${i}" ><center>${el.fregno}</center></td>
        <td width='20%'>${el.fname}</td>
        <td width='5%' id="amt${i}"><center>${el.amount}</center></td>
        <td width='5%'>
          ${check}
        </td>
      </tr>`;
      z++;
    });
    html += `</table>`;
    studlen = z;
    $("#showTbl").html(html);
  } else {
    alert(response.data);
    return;
  }
}

var studlen = 0;

function ttlAmt(i, amt) {
  var amount = document.getElementById("ttlamt").value;
  if (document.getElementById("chk" + i).checked == true) {
    amount = parseInt(amount) + parseInt(amt);
  } else {
    amount = parseInt(amount) - parseInt(amt);
  }

  document.getElementById("ttlamt").value = amount;
}

function checkAll() {
  var amount = 0;
  if (document.getElementById("checkall").checked == true) {
    for (var i = 0; i < studlen; i++) {
      document.getElementById("chk" + i).checked = true;
      amount = parseInt(amount) + parseInt($("#amt" + i).text());
    }
  } else {
    for (var i = 0; i < studlen; i++) {
      document.getElementById("chk" + i).checked = false;
      amount = 0;
    }
  }
  document.getElementById("ttlamt").value = amount;
}

function saveAnsPrtChallan() {
  if ($("#fmacas_degree_code").val() == "") {
    alert("Please enter Degree");
    $("#fmacas_degree_code").focus();
    return;
  }

  if ($("#fmacas_sub_Examno").val() == "") {
    alert("Please enter the Exam No.");
    $("#fmacas_sub_Examno").focus();
    return;
  }

  var studfeedet = new Array();
  var z = 0;
  for (var i = 0; i < studlen; i++) {
    if (document.getElementById("chk" + i).checked == true) {
      console.log("#regno" + i);
      console.log($("#regno" + i).text());
      console.log($("#amt" + i).text());
      var item = {};
      item["fregno"] = $("#regno" + i).text();
      item["amount"] = $("#amt" + i).text();

      z++;
      studfeedet.push(item);
    }
  }
  // console.log(studfeedet);

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

  $.ajax({
    type: "POST",
    data:
      "&degree=" +
      $("#fmacas_degree_code").val() +
      "&exmno=" +
      $("#fmacas_sub_Examno").val() +
      "&studfeedet=" +
      JSON.stringify(studfeedet) +
      "&studlen=" +
      z +
      "&amount=" +
      $("#ttlamt").val(),
    url: $host_url + "saveAnsPrtChallan",
    success: saveAnsPrtChallanresponse
  });
}

function saveAnsPrtChallanresponse(response) {
  $.unblockUI();
  response = eval("(" + response + ")");

  if (response.error_code == 0) {
    alert("Updated Successfully");
    var datastring = "&app_no=" + response.data;
    getStudentData();
    $("#ttlamt").val("0");
    window.location.href =
      $host_url + "PrintApplicationFormBankChalan" + datastring;

    return;
  } else {
    alert(response.data);
    return;
  }
}

function printchallan(data) {
  var datastring = "&app_no=" + data;
  window.location.href =
    $host_url + "PrintApplicationFormBankChalan" + datastring;
}

function getReportPopup() {
  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("Work Sheet Setup");
  var path = "../html_modules/ExamChallanReport.html";
  $("#batch_dialog").load(path, function() {
    //$("#from_batch").val(trim($("#batch_sub_final_subcode").val()));
    // $("#to_batch").val(trim($("#batch_sub_final_subcode").val()));
  });
}
function getReport() {
  from_deg = trim($("#from_deg").val());
  examno = trim($("#examno").val());
  from_appno = trim($("#from_appno").val());
  // to_appno = trim($("#to_appno").val());
  challanNo = trim($("#challanNo").val());

  //  str = "&from_appno=" + from_appno;
  // str += "&to_appno=" + to_appno;
  var str = "&from_deg=" + from_deg;
  str += "&examno=" + examno;
  str += "&challanNo=" + challanNo;
  console.log({ str });

  window.location.href = $host_url + "GenerateExamChallanReport" + str;
}