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


Current Path : /proc/thread-self/root/var/www/oasis/js_old/
Upload File :
Current File : //proc/thread-self/root/var/www/oasis/js_old/markentry_subjectwise.js

/*********************************************************************************************************|
 *      	                   			Programmer Name :   Beemaraj.V				                          |
 *						  			Module :   Mark Entry Subject wise                                	  |
 *			                        Date  :  14.03.2009					                                  |
 **********************************************************************************************************/

$g_student_entry_default_data = "";
$g_mes_valid_reg_no = 0;
$g_mes_edit_valid_marks_flag = 0;
$g_mes_save_after_error_flag = 0;
$g_abs_table_header = "";
$g_m_1_2_type = "1";
function AlertMarks1NotEntered(reg_no) {
  alert("Marks1 is not enterd for " + reg_no);
}

function ValidateMarks1WithMarks2(this_obj, check_m1) {
  var m2_val = parseFloat($("#" + this_obj["id"]).val());
  var m1_val = parseFloat(check_m1);

  if (m2_val != -1 && m1_val != -1 && m2_val != m1_val) {
    reg_no_obj = this_obj["id"].split("_");
    reg_no = reg_no_obj[2];
    alert("Marks2 is not matching with Marks1 for " + reg_no);
  }
}

function callmarksentrysubjectwise(e_type) {
  if (empty(e_type)) e_type = "1";
  $g_m_1_2_type = e_type;

  $g_mes_valid_reg_no = 0;
  $geditinternalcode = 0;
  $g_mes_save_after_error_flag = 0;
  $g_mes_edit_valid_marks_flag = 0;
  $limit_start = 0;
  $limit = 0;
  window.enable_proper_module = "markentrystudetwise";
  $("#page_main_div").load(
    "../html_modules/markentry_subjectwise.html?v=25052018",
    function() {
      document.getElementById("display_module_name").innerHTML =
        "Mark Entry Subjectwise " + $g_m_1_2_type;
      document.getElementById("module_name_for_save").value =
        "SaveMarkEntrySubjectwise";
      getDefaultHeadFooterLinks("Mark Entry (Subjectwise)");
      $("#main_mark_entry_div").hide();
      document.getElementById("markentery_subwise_regno_1").disabled = false;
      BindSubCategoryDropDown();
      clearsubjectentrytextbox();
      document.getElementById("SubCategory").focus();
      $("#print_row").hide();
      document.getElementById("mark_entry_shortname").disabled = false;
      $("#error_msg").html("");
      $g_student_entry_default_data = "";
      RemovingTrFromTable("entry_table_header");
      $g_abs_table_header = $("#abs_entry_table_header").html();
    }
  );
  $("#module_details_div").hide();
}

function clearsubjectentrytextbox() {
  $("#markentry_sub_degree_code").val("");
  $("#markentry_sub_degree_name").val("");
  $("#markentry_sub_Examno").val("");
  $("#markentry_sub_Exam_name").val("");
  $("#markentry_sub_final_subcode").val("");
  document.getElementById("markentry_sub_fsubname").value = "";
  document.getElementById("markentry_sub_fssubname").value = "";
  document.getElementById("mark_entry_shortname").value = "";
  document.getElementById("markentry_sub_maxmark").value = "";
  document.getElementById("mes_default_reg_div").innerHTML = "";
  document.getElementById("markentery_subwise_regno_1").value = "";
  document.getElementById("markentery_subwise_stuname_1").innerHTML = "";
  document.getElementById("markentery_subwise_mark_1").value = -1;
  document.getElementById("markentery_subwise_preabs_1").value = "";
  RemovingTrFromTable("entry_table_header");
}

function BindSubCategoryDropDown() {
  $.ajax({
    type: "POST",
    data: "type=" + $g_screen_type,
    url: $host_url + "GetSubSubjectCategory.demo",
    success: FillDropDownData
  });
}

function FillDropDownData($responce) {
  $responce = eval("(" + $responce + ")");
  switch (document.getElementById("module_name_for_save").value) {
    case "SaveMarkEntrySubjectwise":
      document.getElementById("SubCategory").options.length = 0;
      for ($i = 0; $i < $responce.data.length; $i++) {
        $op = new Option(
          $responce.data[$i]["Name"],
          $responce.data[$i]["Code"]
        );
        $op.id = $responce.data[$i]["Name"]; //specifying the id  for options
        document.getElementById("SubCategory").options.add($op);
      }
      break;
    case "SaveMarkEntryStudentwise":
      document.getElementById("StudentEntry_SubCategory").options.length = 0;
      for ($i = 0; $i < $responce.data.length; $i++) {
        $op = new Option(
          $responce.data[$i]["Name"],
          $responce.data[$i]["Code"]
        );
        $op.id = $responce.data[$i]["Name"]; //specifying the id  for options
        document.getElementById("StudentEntry_SubCategory").options.add($op);
      }
      break;
  }
}

function SaveMarkEntryStudetwise() {
  var $i, reg_no_id, count_marks, $length_of_marks;
  var hidden_field, html_objects;
  $list_data = "Fdegree=" + $("#markentry_sub_degree_code").val();
  $list_data += "&FExamno=" + $("#markentry_sub_Examno").val();
  $list_data += "&Fsubcode=" + $("#markentry_sub_final_subcode").val();
  $list_data += "&type=" + $("#is_add_edit").val();
  $list_data += "&test=" + $("#test").val();
  $list_data += "&g_m_1_2_type=" + $g_m_1_2_type;

  $length_of_marks = $("input[id*='hidden_']").length;

  $markentry_setup_subwise = new Object();
  $mes_all_reg_nos = "";
  count_marks = 0;
  html_objects = $("input[id*='hidden_']");

  for ($i = 0; $i < $length_of_marks; $i++) {
    hidden_field = html_objects[$i]["id"];
    var reg_no_id = hidden_field.replace("hidden_", "");

    if ($("#" + hidden_field).val() == "1") {
      $mes_all_reg_nos += "'" + $("#reg_" + reg_no_id).val() + "',";
      $markentry_setup_subwise[count_marks] = new Object();
      $markentry_setup_subwise[count_marks]["FRegno"] = $(
        "#reg_" + reg_no_id
      ).val();
      $markentry_setup_subwise[count_marks]["Fmark"] = $(
        "#mes_marks_" + reg_no_id
      ).val();
      $markentry_setup_subwise[count_marks]["Fpersent"] = $(
        "#mes_present_" + reg_no_id
      ).val();
      count_marks++;
    }
  }
  var myJSONText = encodeURIComponent(JSON.stringify($markentry_setup_subwise));
  $list_data +=
    "&output_details=" +
    myJSONText +
    "&all_reg_nos=" +
    encodeURIComponent($mes_all_reg_nos);
  $.ajax({
    type: "POST",
    async: false,
    url: $host_url + "saveMarkEntrySubjectwise.demo",
    data: $list_data,
    success: saveMarkEntrySubjectwiseResponce
  });
}

function saveMarkEntrySubjectwiseResponce($responce) {
  $responce = eval("(" + $responce + ")");
  if ($responce.error_code == 0) {
    alert($responce.data);
    $("#markentry_sub_degree_code").focus;
    $g_mes_save_after_error_flag = 0;
  } else {
    alert($responce.data);
    $g_mes_save_after_error_flag = 1;
  }
  $("#mes_default_reg_div").hide();
}

function MarkEntrySubGetDegreeCode(evt, id, DegCode) {
  var kC = evt.which ? evt.which : evt.keyCode;
  if (kC == 113) {
    degreeDetailsPopup(DegCode);
  }
}

function GetMarkEntrySubGetExamNO($Examno) {
  switch (document.getElementById("module_name_for_save").value) {
    case "SaveMarkEntrySubjectwise":
      $degcode = document.getElementById("markentry_sub_degree_code").value;
      if ($degcode == "") {
        alert("please Enter Degree Code");
        document.getElementById("markentry_sub_degree_code").focus();
        return;
      }
      PopupMarkEntrySubGetExamNO($degcode, $Examno);
      break;

    case "SaveMarkEntryStudentwise":
      $degcode = document.getElementById("markentry_stu_degree_code").value;
      if ($degcode == "") {
        alert("please Enter Degree Code");
        document.getElementById("markentry_stu_degree_code").focus();
        return;
      }
      PopupMarkEntrySubGetExamNO($degcode, $Examno);
      break;

    case "SaveAbsentEntrySubjectwise":
      $degcode = document.getElementById("abs_entry_sub_degree_code").value;
      if ($degcode == "") {
        alert("please Enter Degree Code");
        document.getElementById("abs_entry_sub_degree_code").focus();
        return;
      }
      PopupMarkEntrySubGetExamNO($degcode, $Examno);
      break;

    case "ReportAdmissionList":
      $degcode = document.getElementById("report_degree_code").value;
      if ($degcode == "") {
        alert("please Enter Degree Code");
        document.getElementById("report_degree_code").focus();
        return;
      }
      PopupMarkEntrySubGetExamNO($degcode, $Examno);
      break;

    case "SaveBatchSetup":
      $degcode = document.getElementById("batch_sub_degree_code").value;
      if ($degcode == "") {
        alert("please Enter Degree Code");
        document.getElementById("batch_sub_degree_code").focus();
        return;
      }
      PopupMarkEntrySubGetExamNO($degcode, $Examno);
      break;
  }
}

function MarkEntrySubGetSubjectNames($evt, $id) {
  var kC = window.evt ? $evt.keyCode : $evt.keyCode;
  if (kC == 113) {
    $degcode = $("#markentry_sub_degree_code").val();
    $examno = $("#markentry_sub_Examno").val();

    if ($degcode == "") {
      alert("Please Enter Degree Code");
      document.getElementById("markentry_sub_degree_code").focus();
      return;
    }
    if ($examno == "") {
      alert("Please Enter ExamNo");
      document.getElementById("markentry_sub_Examno").focus();
      return;
    }
    PopupMarkEntrySubGetSubjectDetails();
  }
}

function MarkEntrySubGetSubShortName(evt, id) {
  var kC = evt.which ? evt.which : evt.keyCode;
  if (kC == 113) {
    $degcode = $("#markentry_sub_degree_code").val();
    $examno = $("#markentry_sub_Examno").val();
    if ($degcode == "") {
      alert("Please Enter Degree Code");
      document.getElementById("markentry_sub_degree_code").focus();
      return;
    }
    if ($examno == "") {
      alert("Please Enter ExamNo");
      document.getElementById("markentry_sub_Examno").focus();
      return;
    }
    PopupMarkEntrySubGetsubShortName();
  }
}

function MarkEntrySubGetRegno(evt, id) {
  var kC = evt.which ? evt.which : evt.keyCode;
  if (kC == 113) {
    $degcode = $("#markentry_sub_degree_code").val();
    $examno = $("#markentry_sub_Examno").val();

    if ($degcode == "") {
      alert("Please Enter Degree Code");
      document.getElementById("markentry_sub_degree_code").focus();
      return;
    }
    if ($examno == "") {
      alert("Please Enter ExamNo");
      document.getElementById("markentry_sub_Examno").focus();
      return;
    }
    PopupMarkEntrySubGetRegno();
  }
}

function enableNewMarksEntry() {
  $("#mes_default_reg_div").hide();
  var maxmarks = document.getElementById("markentry_sub_maxmark").value;
  if ($("#markentry_sub_degree_code").val() == "") {
    alert("Please Enter Degree Name");
    $("#markentry_sub_degree_code").focus();
    return;
  }
  if ($("#markentry_sub_final_subcode").val() == "") {
    alert("Please Enter Subject Code");
    $("#markentry_sub_final_subcode").focus();
    return;
  }
  if ($("#markentry_sub_Examno").val() == "") {
    alert("Please Enter Examno");
    $("#markentry_sub_Examno").focus();
    return;
  }
  if (maxmarks == "") {
    alert("valmax not updated Please Check.");
    $("#markentry_sub_maxmark").focus();
    return;
  }

  var bw_condition;
  if ($("#markentry_sub_range").val() == "B/W") {
    condition_name = " between ";
    condition_val =
      "'" +
      $("#markentry_sub_range_from").val() +
      "'" +
      " and " +
      "'" +
      $("#markentry_sub_range_to").val() +
      "'";
  } else {
    condition_name = "like ";
    condition_val = $("#markentry_sub_range_bw").val();
  }

  $list_data = "Degcode=" + $("#markentry_sub_degree_code").val();
  $list_data += "&Subcode=" + $("#markentry_sub_final_subcode").val();
  $list_data += "&Examno=" + $("#markentry_sub_Examno").val();
  $list_data += "&fsection=" + $("#fsection").val();

  $list_data += "&test=" + $("#test").val();

  $list_data += "&limit_start=" + $limit_start;
  $list_data += "&condition_name=" + condition_name;
  $list_data += "&condition_val=" + condition_val;
  $list_data += "&g_m_1_2_type=" + $g_m_1_2_type;
  $type = $("#is_add_edit").val();
  $.ajax({
    type: "POST",
    url: $host_url + "getDisplayMarksEntrySubjectRegNos.demo",
    data: $list_data + "&type=" + $type + "&limit=" + $limit,
    success: getDisplayMarksEntrySubjectRegNosResponse
  });
}

function getDisplayMarksEntrySubjectRegNosResponse($responce) {
  $responce = eval("(" + $responce + ")");
  if ($responce.error_code == 0) {
    $("#main_mark_entry_div").hide();
    $("#mes_default_reg_div").show();
    document.getElementById("markentry_sub_degree_code").disabled = true;
    document.getElementById("markentry_sub_Examno").disabled = true;
    document.getElementById("markentry_sub_final_subcode").disabled = true;
    $("#mes_default_reg_div").load($responce.data.filenme);
  }
}

var prev_focus_id;
function marksFlagCheck(id) {
  $focus_id = id;
  var hidden_id = id.replace("mes_marks_", "");
  hidden_id = "hidden_" + hidden_id;
  $("#" + hidden_id).val(1);
  //change the background of the row
  $("#" + prev_focus_id)
    .closest("tr")
    .removeClass("bg-red");
  $("#" + $focus_id)
    .closest("tr")
    .addClass("bg-red");
  prev_focus_id = $focus_id;
}

function CheckMarkEnteryStatus() {}

// ////////////////////Check  Entered  Register Number \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

function CheckEntryRegNo($id, $tr_id) {
  $ids = document.getElementById($id);
  $Regno = $ids.value;

  if ($Regno != "" && $g_mes_save_after_error_flag == 0) {
    $.ajax({
      type: "POST",
      async: false,
      data: "Regno=" + $Regno + "&id=" + $id,
      url: $host_url + "CheckEnteredRegisterNo.demo",
      success: PopulateCheckRegisterNoResponse
    });
  } else {
    $("#markentery_subwise_stuname_" + $tr_id).val("");
    $("#markentery_subwise_regno_" + $tr_id).focus();
    return false;
  }
}

//////////////////////// Check Register Number Response  \\\\\\\\\\\\\\\\\\\\\\\\\\\\

function PopulateCheckRegisterNoResponse($responce) {
  $responce = eval("(" + $responce + ")");
  if ($responce.error_code == 0) {
    $g_mes_valid_reg_no = 1;
    $check_dup = $responce.data.fregno;
    $check_dup_flag = 0;
    $Textbox = document.getElementsByName("mark_entery_subwise");
    $NumTextBox = $Textbox.length;
    for ($m = 1; $m <= $NumTextBox; $m++) {
      if (
        $m != $responce.data.id &&
        $check_dup == $("#markentery_subwise_regno_" + $m).val()
      )
        $check_dup_flag = 1;
    }
    if ($check_dup_flag == 0) {
      document.getElementById(
        "markentery_subwise_stuname_" + $responce.data
      ).innerHTML = $responce.data["fname"];
      //document.getElementById("markentery_subwise_regno_"+$NumTextBox).disabled='true';
      document
        .getElementById("markentery_subwise_mark_" + $responce.data["id"])
        .focus();
      return true;
    } else {
      alert($responce.data["fregno"] + "allready Selected");
      //document.getElementById("markentery_subwise_regno_"+ $responce.data['id']).focus();
      return false;
    }
  } else {
    $g_mes_valid_reg_no = 0;
    alert("Invaild Register Number");
    document.getElementById(
      "markentery_subwise_stuname_" + $responce.data
    ).value = "";
    //document.getElementById("markentery_subwise_regno_"+ $responce.data).value='';
    return false;
  }
}

function validateMarks($focus_id) {
  var entered_marks, max_marks, ap_field;

  ap_field = $focus_id.replace("mes_marks_", "mes_present_");

  entered_marks = parseFloat($("#" + $focus_id).val());
  max_marks = parseFloat($("#markentry_sub_maxmark").val());

  if (max_marks >= entered_marks && entered_marks > -3) {
    if (entered_marks == -1) {
      $("#" + ap_field).val(" ");
    }
    if (entered_marks == -2) {
      $("#" + ap_field).val("A");
    }
    if (entered_marks >= 0) {
      $("#" + ap_field).val("P");
    }
  } else {
    alert("Plaese Enter Valid Mark");
    $("#" + $focus_id).val("");
    $("#" + $focus_id).focus();
  }
}

function Popup(evt) {
  var kC = evt.which ? evt.which : evt.keyCode;
  if (kC == 112) {
    $g_mes_popup = 1;
    PopupMarkEntrySubGetRegno();
  }
}

function RemovingTrFromTable($table_id) {
  $("#entry_table_header  tr:gt(2)").remove();
}

var txt_value;
function DisplayTextBox() {
  txt_value = $("#markentry_sub_range").val();
  if (txt_value == "B/W") {
    $("#td_markentry_sub_range_from_to").show();
    $("#td_markentry_sub_range_bw").hide();
  } else if (txt_value == "Like") {
    $("#td_markentry_sub_range_bw").show();
    $("#td_markentry_sub_range_from_to").hide();
  } else if (txt_value == "Select") {
    $("#td_markentry_sub_range_bw").hide();
    $("#td_markentry_sub_range_from_to").hide();
  }
}
function MarksSubjectwiseList() {
  if ($("#markentry_sub_degree_code").val() == "") {
    alert("Please Enter Degree Name");
    $("#markentry_sub_degree_code").focus();
    return;
  }
  if ($("#markentry_sub_final_subcode").val() == "") {
    alert("Please Enter Subject Code");
    $("#markentry_sub_final_subcode").focus();
    return;
  }
  if ($("#markentry_sub_Examno").val() == "") {
    alert("Please Enter Examno");
    $("#markentry_sub_Examno").focus();
    return;
  }
  var dataString = "&degree_code=" + $("#markentry_sub_degree_code").val();
  dataString += "&exam_code=" + $("#markentry_sub_Examno").val();
  dataString +=
    "&subwise_start=" +
    trim($("#markentry_sub_final_subcode").val()) +
    "&subwise_end=" +
    trim($("#markentry_sub_final_subcode").val());
  window.location.href =
    $host_url + "GenerateMarksEntrySubjectWiseReport.demo" + dataString;
}

function getSection() {
  var examno = $("#markentry_sub_Examno").val();
  var degcode = $("#markentry_sub_degree_code").val();

  $.blockUI({
    message:
      "<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>"
  });
  $.ajax({
    type: "POST",
    async: true,
    data: "degcode=" + degcode + "&examno=" + examno,
    url: $host_url + "getSection",
    success: getSectionResponse
  });
}

function getSectionResponse($responce) {
  $responce = eval("(" + $responce + ")");
  $.unblockUI();
  if ($responce.error_code == 0) {
    document.getElementById("fsection").options.length = 0;
    for ($i = 0; $i < $responce.data.length; $i++) {
      $op = new Option(
        $responce.data[$i]["fsection"],
        $responce.data[$i]["fsection"]
      );
      $op.id = $responce.data[$i]["fsection"]; //specifying the id  for options
      document.getElementById("fsection").options.add($op);
    }
  } else if ($responce.error_code == -2) {
    document.getElementById("fsection").options.length = 0;
    $op = new Option("All", "all");
    $op.id = "all"; //specifying the id  for options
    document.getElementById("fsection").options.add($op);
  } else if ($responce.error_code == -3) {
    document.getElementById("fsection").options.length = 0;
    $op = new Option("All", "all");
    $op.id = "all"; //specifying the id  for options
    document.getElementById("fsection").options.add($op);
    for ($i = 0; $i < $responce.data.length; $i++) {
      $op = new Option(
        $responce.data[$i]["fsection"],
        $responce.data[$i]["fsection"]
      );
      $op.id = $responce.data[$i]["fsection"]; //specifying the id  for options
      document.getElementById("fsection").options.add($op);
    }
  } else {
    alert($responce.data);
    $("#markentry_sub_Exam_name").val() == "";
    $("#markentry_sub_Examno").val() == "";
    $("#markentry_sub_Examno").focus();
    document.getElementById("fsection").options.length = 0;
    return;
  }
}