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


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

/*
 *
 * FOR THE STUDENT ENTRY FORM
 * PROGRAMED BY NAVEEN
 * DATE: 13/03/09
 * TIME: 1:15 PM
 *
 */
$g_se_degree = "";
$g_se_exam = "";
function returnMonthValue(val) {
  var month_array = new Array();
  month_array["Jan"] = "01";
  month_array["Feb"] = "02";
  month_array["Mar"] = "03";
  month_array["Apr"] = "04";
  month_array["May"] = "05";
  month_array["Jun"] = "06";
  month_array["Jul"] = "07";
  month_array["Aug"] = "08";
  month_array["Sep"] = "09";
  month_array["Oct"] = "10";
  month_array["Nov"] = "11";
  month_array["Dec"] = "12";

  return month_array[val];
}
function returnMonthName(val) {
  var month_array = new Array();
  month_array["Jan"] = "01";
  month_array["Feb"] = "02";
  month_array["Mar"] = "03";
  month_array["Apr"] = "04";
  month_array["May"] = "05";
  month_array["Jun"] = "06";
  month_array["Jul"] = "07";
  month_array["Aug"] = "08";
  month_array["Sep"] = "09";
  month_array["Oct"] = "10";
  month_array["Nov"] = "11";
  month_array["Dec"] = "12";

  return month_array[val];
}

function dateTab() {
  /* if(document.getElementById('student_entry_dob').value != '')
	{
		if(isValidDate(document.getElementById('student_entry_dob').value))  //  in validate.js File
		{							
			document.getElementById('student_entry_gender').focus();
		}
		else
		{	
			document.getElementById('student_entry_dob').value = '';		
			document.getElementById('student_entry_dob').focus();
			return false;
		}
	} */
}
function LoadstudentEntryRURNew(type) {
  $("#page_main_div").load(
    "../html_modules/admission_entry_rur_new.html?v=19092016",
    function () {
      $g_student_retain_per_mode = 1;
      $g_remaining_counter_inc = "";
      $g_remaining_counter_inc = 0;
      $g_clicked_subject_id = 0;
      $("#student_entry_exam").val("A");

      document.getElementById("display_module_name").innerHTML =
        "Student Entry";
      document.getElementById("module_name_for_save").value = "StudentEntry";
      document.getElementById("is_add_edit").value = type;
      getDefaultHeadFooterLinks("Admission Entry RUR");

      //	clearStudentEntry();
      $("#student_entry_degree_code").focus();
      $("#student_entry_exam").val("A");
      $("#error_msg").html("");
      $("#print_row").hide();
      $("#student_entry_admdate").val(getDate());
      var option = "<option value=''>-Select-</option>";
      for (var j = 2021; j > 1980; j--) {
        option += "<option value='" + j + "'>" + j + "</option>";
      }
      $("#year").append(option);
      $("#year10").append(option);
      populateBoards();
      loadAdmDegCode();
      state_options = '<option value="0">--Select--</option>';
      states.forEach(function (state) {
        state_options += `<option value="${state}">${state}</option>`;
      });

      $(".selstate").html(state_options);

      //getHonoursNames();
      DeletedRecords = 0;

      document.getElementById("student_entry_nationality").value = "INDIAN";

      if (type == "Add") {
        getCategoryNames("degree_category");
        //multifileUpload();
        //getHonoursNames();
        $g_se_degree = "";
        $geditinternalcode = "";
      }
      if (type == "Edit") {
        $(document).ready(function () {
          EditStudentDetailsForUpdate($geditinternalcode, $g_se_degree);
          //getCategoryNames('degree_category');
        });
      }
    }
  );
  $("#module_details_div").hide();
}

function loadAdmDegCode() {
  $.ajax({
    type: "POST",
    async:false,
    url: $host_url + "loadAdmDegCode",
    success: function ($responce) {
      $responce = eval("(" + $responce + ")");
      if ($responce.error_code == 0) {
        let degcode = $responce.data["degcode"];
        document.getElementById("student_entry_degree_code").options.length = 0;
        var $lobj_Option = document.createElement("OPTION");
        $lobj_Option.value = "";
        $lobj_Option.text = "--Select--";
        document.getElementById("student_entry_degree_code").options[0] =
          $lobj_Option;
        for ($i = 0; $i < degcode.length; $i++) {
          $op = new Option(degcode[$i]["value"], degcode[$i]["internal_code"]);
          $op.id = degcode[$i]["internal_code"]; //specifying the id  for options
          document.getElementById("student_entry_degree_code").options.add($op);
        }
      } else {
        alert($responce.data);
        return;
      }
    },
  });
}

function getHonoursNames(degreeCode) {
  $.ajax({
    type: "POST",
    //async:false,
    url: $host_url + "getHonoursNames",
    data: "degree=" + encodeURIComponent(degreeCode),
    success: function ($responce) {
      $responce = eval("(" + $responce + ")");
      if ($responce.error_code == 0) {
        /*var arr = $responce.data;
					document.getElementById('degree_honours').options.length=0;
					jQuery.each(arr, function(k, v) {	 
					var op = new Option(v['name'], v['code']);
					op.id=v['code'];
					document.getElementById('degree_honours').options.add(op);
				});*/
        document.getElementById("degree_honours").options.length = 0;
        var $lobj_Option = document.createElement("OPTION");
        $lobj_Option.value = "";
        $lobj_Option.text = "Select Honours";
        document.getElementById("degree_honours").options[0] = $lobj_Option;
        for ($i = 0; $i < $responce.data.length; $i++) {
          $op = new Option(
            $responce.data[$i]["value"],
            $responce.data[$i]["internal_code"]
          );
          $op.id = $responce.data[$i]["internal_code"]; //specifying the id  for options
          document.getElementById("degree_honours").options.add($op);
        }
      }
    },
  });
}

function GetCombination(degcode) {
  $.ajax({
    type: "POST",
    //async:false,
    url: $host_url + "getCombinationNames",
    data: "&degree=" + encodeURIComponent(trim(degcode)),
    success: function ($responce) {
      $responce = eval("(" + $responce + ")");
      if ($responce.error_code == 0) {
        document.getElementById("combination").options.length = 0;
        var $lobj_Option = document.createElement("OPTION");
        $lobj_Option.value = "";
        $lobj_Option.text = "Select Combination";
        document.getElementById("combination").options[0] = $lobj_Option;
        for ($i = 0; $i < $responce.data.mascomb.length; $i++) {
          $op = new Option(
            $responce.data.mascomb[$i]["value"],
            $responce.data.mascomb[$i]["internal_code"]
          );
          $op.id = $responce.data.mascomb[$i]["internal_code"]; //specifying the id  for options
          document.getElementById("combination").options.add($op);
        }

        if ($("#ugpg").val() == "PG") {
          document.getElementById("seTypeOfQualifyingExam").options.length = 0;
          var $lobj_Option = document.createElement("OPTION");
          $lobj_Option.value = "";
          $lobj_Option.text = "Select Degree";
          document.getElementById("seTypeOfQualifyingExam").options[0] =
            $lobj_Option;
          for ($i = 0; $i < $responce.data.degree.length; $i++) {
            $op = new Option(
              $responce.data.degree[$i]["value"],
              $responce.data.degree[$i]["internal_code"]
            );
            $op.id = $responce.data.degree[$i]["internal_code"]; //specifying the id  for options
            document.getElementById("seTypeOfQualifyingExam").options.add($op);
          }
        } else {
          var prevdeg = `<option selected="selected" value="0">--Select--</option>
							<option>P.U.C.</option>
							<option>I.T.I.</option>
							<option>10+2</option>
              <option>Diploma</option>
              <option>BA</option>
							<option>BSC</option>
							<option>BCOM</option>
							<option>BSW</option>
							<option>BBA</option>
							<option>BCA</option>							
							<option>UG_Degree</option>
							<option>PG_Degree</option>
              `;
          $("#seTypeOfQualifyingExam").empty();
          $("#seTypeOfQualifyingExam").append(prevdeg);
        }
      } else {
        document.getElementById("combination").options.length = 0;
        var $lobj_Option = document.createElement("OPTION");
        $lobj_Option.value = "";
        $lobj_Option.text = "Select Combination";
        document.getElementById("combination").options[0] = $lobj_Option;
      }
    },
  });
  console.log("hii");
  // $.ajax({
  //     type: "POST",
  //     //async:false,
  //     url: $host_url + "GetUploadedStudentDocuments",
  //     data:
  //       "&degree=" +
  //       encodeURIComponent(trim(degcode)) ,
  //     success: function(responce) {
  //       responce = eval("(" + responce + ")");

  //       $("#sedocs_div").html(responce.data);
  //     }
  //   });
}

function GetCombinationSubjectList1() {
  if (jQuery.trim($("#student_entry_degree_code").val()) != "") {
    $sl_no = "";

    $sl_no = encodeURIComponent(trim($("#student_entry_slno").val()));
    $.ajax({
      type: "POST",
      //async:false,
      url: $host_url + "getCombinationSubjectVKU.demo",
      data:
        "degree_code=" +
        $("#student_entry_degree_code").val() +
        "&exam=" +
        $("#student_entry_exam").val() +
        "&honours=" +
        $("#degree_honours").val() +
        "&combcode=" +
        $("#honours_combination").val() +
        "&sl_no=" +
        $sl_no +
        "&pmode=" +
        $g_student_retain_per_mode +
        "&sub_degree=" +
        encodeURIComponent(trim($("#student_entry_sub_degree_code").val())),
      success: function ($responce) {
        $responce = eval("(" + $responce + ")");
        $g_subject_appearing = $responce.data;
        $g_remaining_counter_inc = $responce.data.remaining_count;
        $("#subject_appearing").show();
        $("#subject_appearing").html($responce.data.html);
      },
    });
  }
}
function chkStudentEditAdd() {
  if (document.getElementById("is_add_edit").value == "Add") {
    if (trim($("#student_entry_degree_code").val()) != "") {
      generateAutoIncrementSlNo();
      setAdmLoginCntr();
    }
  } else if (
    document.getElementById("is_add_edit").value == "Edit" ||
    document.getElementById("is_add_edit").value == "Delete"
  ) {
    //	document.getElementById("student_entry_slno").disabled=false;
    getStudentSlNo();
  }
  /* else if(document.getElementById('is_add_edit').value =='Delete')
	{
	document.getElementById("student_entry_slno").disabled=false; 
	getStudentSlNo();
	} */
}
// thu
function assignDefaultName() {
  if (trim(document.getElementById("student_entry_nationality").value) == "")
    document.getElementById("student_entry_nationality").value = "INDIAN";
}
function copyAddress() {
  if (
    $("#student_entry_per_add1").val() == "" &&
    $("#student_entry_per_add2").val() == ""
  ) {
    $("#student_entry_per_add1").val($("#student_entry_comm_addr1").val());
    $("#student_entry_per_add2").val($("#student_entry_comm_addr2").val());
    $("#student_entry_per_add3").val($("#student_entry_comm_addr3").val());
    $("#student_entry_per_add4").val($("#student_entry_comm_addr4").val());
  }
}
// end thu
//--wed naveen
function generateAutoIncrementSlNo() {
  $.ajax({
    type: "POST",
    //async:false,
    url: $host_url + "generateAutoIncrementSlNo.demo",
    data:
      "degree=" +
      encodeURIComponent(trim($("#student_entry_degree_code").val())),
    success: generateAutoIncrementSlNoResponse,
  });
}
function generateAutoIncrementSlNoResponse($responce) {
  // to get value and edit of pertiqular student
  $responce = eval("(" + $responce + ")");
  if ($responce.error_code == 0) {
    //$("#student_entry_slno").val($responce.data)
  } else {
    //alert('SL No Not Exstis');
    //document.getElementById("student_entry_slno").focus();
  }
}
// for key press in the degree code field displaying sub appareing table

function GetCombinationSubjectListRUR() {
  if (jQuery.trim($("#student_entry_degree_code").val()) != "") {
    $sl_no = "";

    $sl_no = encodeURIComponent(trim($("#student_entry_admno").val()));
    $.ajax({
      type: "POST",
      //async:false,
      url: $host_url + "GetCombinationSubjectListRUR",
      data:
        "degree_code=" +
        $("#student_entry_degree_code").val() +
        "&exam=" +
        $("#student_entry_exam").val() +
        "&sl_no=" +
        $sl_no +
        "&pmode=" +
        $g_student_retain_per_mode,
      success: subjectAppearingTotalResponse,
    });
  }
}
function subjectAppearingTotalResponse($responce) {
  $responce = eval("(" + $responce + ")");
  $g_subject_appearing = $responce.data;
  $g_remaining_counter_inc = $responce.data.remaining_count;
  $("#subject_appearing").show();
  $("#subject_appearing").html($responce.data.html);
}
// from here to  subject popup

/* window.location.$g_popup_sub_code='';
function subjectAppearing_PopUp($id)
{
var url = "../ui/SubjectAppearingPopup.html?height=200&width=400&id="+$id;
					tb_show("College Details", url);
	//$subCode = 
	window.location.$g_popup_sub_code=$id;
} */
window.location.$g_popup_sub_code_field_id = "";
function keyboardsubjectAppearing_PopUp(evt, $id) {
  var kC = evt.which ? evt.which : evt.keyCode;
  //alert(id);
  if (kC == 112) {
    //F1 Key code
    var url = "../ui/SubjectAppearingPopup.html?height=200&width=400&id=" + $id;
    tb_show("College Details", url);
    //$subCode =
    window.location.$g_popup_sub_code_field_id = $id;
    return false;
  }
}
// upt to hereselect category
/*function SaveStudentEntry_prev()
{  
  if(DeletedRecords==0)
  { 
	var exam_det = $("#upload_table input[id*='ed']");
			  
				 jQuery.each(exam_det,function (ak,av){
						var id=av['id'].split("_").pop();
						var cert=$("#upload_table #doc_upload_"+id).html();
						var file= ($("#upload_table #ed_"+id).val());
						 if(empty(file))
						 {
							alert("Upload "+cert);
							$("#upload_table #ed_"+id).focus();
							return false;
						 }
				 });
				 
	var  date_student;
		if(trim(document.getElementById('student_entry_degree_code').value) == '' )
		{
			alert(' Enter the degree code');
			document.getElementById('student_entry_degree_code').focus();
			return;
		}
		else if(trim(document.getElementById('student_entry_name').value) == '' )
		{
			alert(' Enter the student name');
			document.getElementById('student_entry_name').focus();
			return;
		}	
		else if(trim(document.getElementById('student_entry_marital').value) == '' )
		{
			alert(' Select the marital status ');
			document.getElementById('student_entry_marital').focus();
			return;
		}	
		if(($("#student_entry_dob_date").val() != '1' || $("#student_entry_dob_month").val() != 'Jan') &&  $("#student_entry_dob_year").val() == '')
		{
		    alert(' Enter the Year..!');
			document.getElementById('student_entry_dob_year').focus();
			return;
		}
		if($("#student_entry_dob_year").val() != '')
		{
			date_student = $("#student_entry_dob_year").val()+'-'+returnMonthValue($("#student_entry_dob_month").val())+'-'+$("#student_entry_dob_date").val();
		}	
		else if($("#student_entry_dob_year").val() == '')
		{
		    date_student = '0000-00-00';
		}
		
		if(trim(document.getElementById('student_entry_fname').value) == '' )
		{
			alert(' Enter the father\'s name');
			document.getElementById('student_entry_fname').focus();
			return;
		}
		
		if(trim(document.getElementById('student_entry_fname').value) == '' )
		{
			alert(' Enter the father\'s name');
			document.getElementById('student_entry_fname').focus();
			return;
		}else if(trim(document.getElementById('student_entry_father_occupation').value) == '' )
		{
			alert(' Enter the father\'s occupation');
			document.getElementById('student_entry_father_occupation').focus();
			return;
		}else if(trim(document.getElementById('student_entry_mname').value) == '' )
		{
			alert(' Enter the mother\'s name');
			document.getElementById('student_entry_mname').focus();
			return;
		}else if(trim(document.getElementById('student_entry_mather_occupation').value) == '' )
		{
			alert(' Enter the mothers\'s occupation ');
			document.getElementById('student_entry_mather_occupation').focus();
			return;
		}
	    if($("#student_entry_dob").val() == '')
		{
			 alert(' Enter the valid date of birth ');
			document.getElementById('student_entry_dob').focus();
			return;
		}
		if(trim(document.getElementById('student_entry_nationality').value) == '' )
		{
			alert(' Enter the nationality');
			document.getElementById('student_entry_nationality').focus();
			return;
		}
		
		if(trim(document.getElementById('student_entry_state').value) == '' )
		{
			alert(' Select state');
			document.getElementById('student_entry_state').focus();
			return;
		}
		if(trim(document.getElementById('sltBelongsToKarnatakaBy').value) == '' )
		{
			alert(' Select belongs to Karnataka by ?');
			document.getElementById('sltBelongsToKarnatakaBy').focus();
			return;
		} 
		if(trim(document.getElementById('student_entry_religion').value) == '' )
		{
			alert(' Select the religion');
			document.getElementById('student_entry_religion').focus();
			return;
		}
		if(trim(document.getElementById('degree_category').value) == '' )
		{
			alert(' Select Category by birth ');
			document.getElementById('degree_category').focus();
			return;
		}
		if(trim(document.getElementById('student_entry_caste').value) == '' )
		{
			alert(' Select caste ');
			document.getElementById('student_entry_caste').focus();
			return;
		}
		if(trim(document.getElementById('txtUnvRegFee').value) == '' )
		{
			alert(' Enter the email id');
			document.getElementById('txtUnvRegFee').focus();
			return;
		}
		if(trim(document.getElementById('txtUnvRegReceiptNo').value) == '' )
		{
			alert(' Enter the email id');
			document.getElementById('txtUnvRegReceiptNo').focus();
			return;
		}
		

		if(trim(document.getElementById('student_entry_email').value) == '' )
		{
			alert('Enter the Email Id');
			document.getElementById('student_entry_email').focus();
			return; 
		}
		
		if(trim(document.getElementById('student_entry_mobile_no').value) == '' )
		{
			alert('Enter the mobile no');
			document.getElementById('student_entry_mobile_no').focus();
			return; 
		}
		if(trim(document.getElementById('seExamRegNo10').value) == '' )
		{
			alert('Enter the SSLC Reg no.');
			document.getElementById('seExamRegNo10').focus();
			return; 
		}
		if(trim(document.getElementById('pnrno10').value) == '' )
		{
			alert('Enter the SSLC PRN no.');
			document.getElementById('pnrno10').focus();
			return; 
		}
		if(trim(document.getElementById('seInstitutionName10').value) == '' )
		{
			alert('Enter the SSLC College Name');
			document.getElementById('seInstitutionName10').focus();
			return; 
		}
		if(trim(document.getElementById('seUniversityName10').value) == '' )
		{
			alert('Select the SSLC Board Name');
			document.getElementById('seUniversityName10').focus();
			return; 
		}
		if(trim(document.getElementById('univaddres10').value) == '' )
		{
			alert('Enter the SSLC Board Address');
			document.getElementById('univaddres10').focus();
			return; 
		}
		if(trim(document.getElementById('univphoneno10').value) == '' )
		{
			alert('Enter the SSLC Board Phoneno');
			document.getElementById('univphoneno10').focus();
			return; 
		}

		if(trim(document.getElementById('maxmarks10').value) == '' )
		{
			alert('Enter the SSLC Maximum Marks');
			document.getElementById('maxmarks10').focus();
			return; 
		}
		if(trim(document.getElementById('secmarks10').value) == '' )
		{
			alert('Enter the SSLC Secured Marks');
			document.getElementById('secmarks10').focus();
			return; 
		}
		if(trim(document.getElementById('seTypeOfQualifyingExam').value) == '' )
		{
			alert('Enter Qualifying Exam');
			document.getElementById('seTypeOfQualifyingExam').focus();
			return; 
		}
		if(trim(document.getElementById('seExamRegNo').value) == '' )
		{
			alert('Select Qualifying Exam Reg No.');
			document.getElementById('seExamRegNo').focus();
			return; 
		}
		if(trim(document.getElementById('pnrno').value) == '' )
		{
			alert('Enter Qualifying Exam PNR No.');
			document.getElementById('pnrno').focus();
			return; 
		}
		if(trim(document.getElementById('seInstitutionName').value) == '' )
		{
			alert('Enter Qualifying Exam College Name');
			document.getElementById('seInstitutionName').focus();
			return; 
		}
		if(trim(document.getElementById('seUniversityName').value) == '' )
		{
			alert('Select Qualifying Exam University Name');
			document.getElementById('seUniversityName').focus();
			return; 
		}
		if(trim(document.getElementById('univaddres').value) == '' )
		{
			alert('Enter Qualifying Exam University Address');
			document.getElementById('univaddres').focus();
			return; 
		}
		if(trim(document.getElementById('univphoneno').value) == '' )
		{
			alert('Enter Qualifying Exam University Phone No');
			document.getElementById('univphoneno').focus();
			return; 
		}
		if(trim(document.getElementById('maxmarks').value) == '' )
		{
			alert('Enter the Qualifying Exam Maximum Marks');
			document.getElementById('maxmarks').focus();
			return; 
		}
		if(trim(document.getElementById('secmarks').value) == '' )
		{
			alert('Enter the Qualifying Exam Secured Marks');
			document.getElementById('secmarks').focus();
			return; 
		}
		
		$lstr_data="add_edit="+document.getElementById('is_add_edit').value;
		$lstr_data+="&degree_code="+encodeURIComponent($("#student_entry_degree_code").val());
		$lstr_data+="&degree_description="+encodeURIComponent($("#student_entry_degree_name").val());
		$lstr_data+="&degree_exam="+encodeURIComponent($("#student_entry_exam").val());
		$lstr_data+="&degree_slno="+encodeURIComponent($("#student_entry_slno").val());
		$lstr_data+="&student_entry_name="+encodeURIComponent($("#student_entry_name").val());
		$lstr_data+="&degree_fname="+encodeURIComponent($("#student_entry_fname").val());
		$lstr_data+="&degree_mname="+encodeURIComponent($("#student_entry_mname").val());		
		//$lstr_data+="&degree_dob="+date_student;
		$lstr_data+="&degree_gender="+encodeURIComponent($("#student_entry_gender").val());	
		$lstr_data+="&degree_english="+encodeURIComponent($("#student_entry_english").val());
		$lstr_data+="&degree_nationality="+encodeURIComponent($("#student_entry_nationality").val());
		$lstr_data+="&degree_category="+encodeURIComponent($("#degree_category").val());
		$lstr_data+="&student_entry_comm_addr1="+encodeURIComponent($("#student_entry_comm_addr1").val());
		$lstr_data+="&student_entry_comm_addr2="+encodeURIComponent($("#student_entry_comm_addr2").val());
		$lstr_data+="&student_entry_comm_addr3="+encodeURIComponent($("#student_entry_comm_addr3").val());
		$lstr_data+="&student_entry_comm_addr4="+encodeURIComponent($("#student_entry_comm_addr4").val());
		$lstr_data+="&student_entry_per_add1="+encodeURIComponent($("#student_entry_per_add1").val());	
		$lstr_data+="&student_entry_per_add2="+encodeURIComponent($("#student_entry_per_add2").val());	
		$lstr_data+="&student_entry_per_add3="+encodeURIComponent($("#student_entry_per_add3").val());	
		$lstr_data+="&student_entry_per_add4="+encodeURIComponent($("#student_entry_per_add4").val());
		$lstr_data+="&degree_honours="+encodeURIComponent($("#degree_honours").val());	
		$lstr_data+="&honours_combination="+encodeURIComponent($("#honours_combination").val());

		//Added for Pondicheri Req Starts 
		$lstr_data+="&sub_degree="+encodeURIComponent($("#student_entry_sub_degree_code").val());
		$lstr_data+="&rec_order_no="+encodeURIComponent($("#student_entry_recognition_order_no").val());
		$lstr_data+="&rec_order_date="+date_format($("#student_entry_recognition_date").val());
		$lstr_data+="&aff_order_no="+encodeURIComponent($("#student_entry_affiliation_order_no").val());
		$lstr_data+="&aff_order_date="+date_format($("#student_entry_affiliation_date").val());
		$lstr_data+="&father_occ="+encodeURIComponent($("#student_entry_father_occupation").val());
		$lstr_data+="&mother_occ="+encodeURIComponent($("#student_entry_mather_occupation").val());
		$lstr_data+="&email="+encodeURIComponent($("#student_entry_email").val());
		$lstr_data+="&contact="+encodeURIComponent($("#student_entry_phone_no").val());
		$lstr_data+="&blood_group="+encodeURIComponent($("#student_entry_blood_group").val());
		$lstr_data+="&mobile="+encodeURIComponent($("#student_entry_mobile_no").val());
		$lstr_data+="&collrsch="+encodeURIComponent($("#student_entry_college").val());
		$lstr_data+="&passyear="+encodeURIComponent($("#student_entry_passyear").val());
		$lstr_data+="&totalper="+encodeURIComponent($("#student_entry_percent").val());
		$lstr_data+="&boardRuniv="+encodeURIComponent($("#student_entry_board").val());
		
		if($("#student_entry_board").val() =='Others')
			$lstr_data+="&othboardRuniv="+encodeURIComponent($("#student_entry_otherBoard").val());
		else
			$lstr_data+="&othboardRuniv=' '";
		
		if(document.getElementById('migration_certy').checked	 ==true)
			$lstr_data+="&mgdocno="+encodeURIComponent($("#student_entry_docno").val());
		else
			$lstr_data+="&mgdocno=' '";
			
		var student_entry_reg_fee=parseFloat(empty($("#student_entry_reg_fee").val())?0.0:$("#student_entry_reg_fee").val());
		var student_entry_exam_fee=parseFloat(empty($("#student_entry_exam_fee").val())?0.0:$("#student_entry_exam_fee").val());
		var student_entry_grade_card_fee=parseFloat(empty($("#student_entry_grade_card_fee").val())?0.0:$("#student_entry_grade_card_fee").val());
		var student_entry_total_fee=parseFloat(empty($("#student_entry_total_fee").val())?0.0:$("#student_entry_total_fee").val());
		$lstr_data+="&student_entry_reg_fee="+encodeURIComponent($("#student_entry_reg_fee").val());
		$lstr_data+="&student_entry_exam_fee="+encodeURIComponent($("#student_entry_exam_fee").val());
		$lstr_data+="&student_entry_grade_card_fee="+encodeURIComponent($("#student_entry_grade_card_fee").val());
		$lstr_data+="&student_entry_total_fee="+encodeURIComponent($("#student_entry_total_fee").val());
		$lstr_data+="&rec_date="+date_format(trim($("#rec_date").val()));
		$lstr_data+="&rec_no="+encodeURIComponent($("#rec_no").val());
		$lstr_data+="&fee_remarks="+encodeURIComponent($("#fee_remarks").val());
		$lstr_data+="&fee_paid="+encodeURIComponent($("#fee_paid").val());
	
		$lstr_data+="&religion="+encodeURIComponent($("#student_entry_religion").val());
		$lstr_data+="&unlink_file="+encodeURIComponent($("#student_entry_photo").attr('src'));
		
		var fee_com = new Object();
		var z=0;
		var obj=$("input[id*='fee_paying_']");
	 
		jQuery.each(obj, function(k, v) {
			 
			fee_com[z]= new Object();
				var sl_no=v['id'].split("_")[2];
				fee_com[z]['fee_paid']=$("#"+v['id']).val();
				fee_com[z]['head_id']=$("#head_"+sl_no).html();
				z++;
		});	
		
		var fee_com = encodeURIComponent(JSON.stringify(fee_com));
		var valid_file_extentions = new Array("jpeg","jpg",'png','gif');
		var ext=$("#student_entry_upload").val();
			filepath=ext;
		 ext = ext.substring(ext.length-3,ext.length);
		 ext = ext.toLowerCase();  
		if(ext != "" && !in_array(ext,valid_file_extentions))
	    {	      
			alert(" Select the Valid Photo!");
			return false;
		}
		$.blockUI({ message: "<h1 class='h1' style='font-size:12px'><img src='images/ajax-loader.gif' border='0'></h1>" });
		$lstr_data+="&filepath="+filepath;	
		$upload = $host_url+"saveStudentEntry.demo&"+$lstr_data+"&fee_com="+fee_com;	
	
		document.getElementById("form_module_image_upload").setAttribute("action",$upload);
		return AIM.submit(document.getElementById("form_module_image_upload"), 'report_display',{'onComplete' : saveStudentEntryResponse});
	}
	else
	{
	   alert(" This record is already deleted..!!");
	}    
}*/

function saveStudentEntryResponse($responce) {
  $responce = eval("(" + $responce + ")");
  $.unblockUI();
  if ($responce.error_code == 0) {
    alert($responce.data);
    $("#student_entry_degree_code").focus();
    clearStudentEntryAfterSave();
    document.getElementById("is_add_edit").value = "Add";
  } else if ($responce.error_code == -9) {
    alert($responce.data);
    loadMasters();
  } else alert($responce.data);
}

function getEnterForSubDetails(evt, type, id, icode) {
  var kC = evt.which ? evt.which : evt.keyCode;
  if (kC == 13) {
    getSubDetails(id, icode);
  }
}
function getStudentSlNo() {
  // for getting student serial number
  if (
    (document.getElementById("is_add_edit").value == "Edit" ||
      document.getElementById("is_add_edit").value == "Delete") &&
    jQuery.trim($("#student_entry_slno").val()) != ""
  ) {
    $.ajax({
      type: "POST",
      //async:false,
      url: $host_url + "getSlNoStudentDetailsVKU.demo",
      data:
        "sl_no=" +
        encodeURIComponent(trim($("#student_entry_slno").val())) +
        "&degree=" +
        encodeURIComponent(trim($("#student_entry_degree_code").val())),
      success: selectStudentDetailsResponse,
    });
  }
}
function selectStudentDetailsResponse($responce) {
  $responce = eval("(" + $responce + ")");
  if ($responce.data["FDELETED"] == "F") {
    DeletedRecords = 0; // non deleted record
    $("#error_msg").html(" ");
  } else {
    DeletedRecords = 1; // deleted Record
  }

  if ($responce.error_code == 0 || $responce.error_code == -1) {
    //getHonoursNames();

    $("#error_msg").html(" ");
    alert($responce.data["FDEGREE"]);
    document.getElementById("student_entry_degree_code").value =
      $responce.data["FDEGREE"];
    document.getElementById("student_entry_degree_name").value =
      $responce.data["FDESCPN"];
    //document.getElementById('student_entry_exam').value = $responce.data['FEXAMNO'];
    document.getElementById("student_entry_slno").value =
      $responce.data["FSLNO"];
    document.getElementById("student_entry_name").value =
      $responce.data["FNAME"];
    document.getElementById("student_entry_fname").value =
      $responce.data["FFATNAME"];
    document.getElementById("student_entry_mname").value =
      $responce.data["FMOTNAME"];
    document.getElementById("student_entry_dob_year").value =
      $responce.data["FDOB_Year"];
    document.getElementById("student_entry_dob_month").value = returnMonthName(
      $responce.data["FDOB_month"]
    );
    document.getElementById("student_entry_dob_date").value =
      $responce.data["FDOB_date"];

    document.getElementById("aqty").value = $responce.data["faqty"];
    document.getElementById("asty").value = $responce.data["fasty"];

    document.getElementById("student_entry_gender").value =
      $responce.data["Fgender"];
    document.getElementById("student_entry_english").value =
      $responce.data["FENGLISH"];
    document.getElementById("student_entry_nationality").value =
      $responce.data["FNATIONAL"];
    document.getElementById("student_entry_comm_addr1").value =
      $responce.data["FCURRADD1"];
    document.getElementById("student_entry_comm_addr2").value =
      $responce.data["FCURRADD2"];
    document.getElementById("student_entry_comm_addr3").value =
      $responce.data["FCURRADD3"];
    document.getElementById("student_entry_comm_addr4").value =
      $responce.data["FCURRADD4"];
    document.getElementById("student_entry_per_add1").value =
      $responce.data["FPERMADD1"];
    document.getElementById("student_entry_per_add2").value =
      $responce.data["FPERMADD2"];
    document.getElementById("student_entry_per_add3").value =
      $responce.data["FPERMADD3"];
    document.getElementById("student_entry_per_add4").value =
      $responce.data["FPERMADD4"];
    document.getElementById("student_entry_sub_degree_code").value =
      $responce.data["FSUBDEGREE"];
    document.getElementById("student_entry_sub_degree").value =
      $responce.data["FSUBDEGREE"];
    document.getElementById("student_entry_recognition_order_no").value =
      $responce.data["FREC_ORDER_NO"];
    document.getElementById("student_entry_recognition_date").value =
      $responce.data["FREC_ORDER_DATE"];
    document.getElementById("student_entry_affiliation_order_no").value =
      $responce.data["FAFF_ORDER_NO"];
    document.getElementById("student_entry_affiliation_date").value =
      $responce.data["FAFF_ORDER_DATE"];
    document.getElementById("student_entry_religion").value =
      $responce.data["FRELIGION"];
    document.getElementById("student_entry_father_occupation").value =
      $responce.data["FFAT_OCC"];
    document.getElementById("student_entry_mather_occupation").value =
      $responce.data["FMOT_OCC"];
    document.getElementById("student_entry_email").value =
      $responce.data["FEMAIL"];
    document.getElementById("student_entry_phone_no").value =
      $responce.data["FCONTACT_NO"];
    document.getElementById("student_entry_blood_group").value =
      $responce.data["FBLOOD_GROUP"];
    document.getElementById("degree_category").value = $responce.data["FCASTE"];
    document.getElementById("rec_date").value = $responce.data["FRECDATE"];
    document.getElementById("rec_no").value = $responce.data["FRECNO"];
    document.getElementById("fee_remarks").value = $responce.data["FREMARKS"];

    //document.getElementById("dobplace").value = $responce.data["FPOB"];
    //document.getElementById("area").value = $responce.data["FAREA"];
    // document.getElementById("phd").value = $responce.data["FHANDICAP"];
    // document.getElementById("ncc").value = $responce.data["FNCC"];
    // document.getElementById("dfp").value = $responce.data["FDEFENCE"];
    // document.getElementById("exs").value = $responce.data["FEXSERVE"];
    // document.getElementById("kai").value = $responce.data["FKASHIMG"];
    // document.getElementById("trg").value = $responce.data["FTRANS"];
    // document.getElementById("univaddres").value = $responce.data["FUNIVADD"];
    //document.getElementById("univphoneno").value = $responce.data["FUNIVPHONE"];
    document.getElementById("institutephoneno").value =
      $responce.data["FCOLLPHONE"];

    GetHonorusCombinationList();
    document.getElementById("honours_combination").value =
      $responce.data["FCOMBCODE"];
    populateBoards();

    /* 	$("#student_entry_photo").attr("src", $responce.data['FPHOTOPATH']);
		if($responce.data.FLATERAL_ENTRY==1)
		{
		document.getElementById('is_lateral_entry').checked=true;
		$("#student_entry_exam").val("C") ;
		}
		else 
		{
		document.getElementById('is_lateral_entry').checked=false;
		$("#student_entry_exam").val("A") ;
		} 
	 
		//getsubjectAppearingTotal($responce.data['FDEGREE']);
	 */
  } else if ($responce.error_code == -2) {
    DeletedRecords = 0;
    //$("#error_msg").html(" In Valid SL Number ");
    alert("In Valid SL Number");
    $("#student_entry_slno").val("");
    document.getElementById("student_entry_slno").focus();
  }
}
function deleteStudentRecord() {
  var ids = jQuery("#view_student_entry").getGridParam("selarrrow");
  var delete_arr = new Object();
  if (ids) {
    for (var p = 0; p < ids.length; p++) {
      var dataset = jQuery("#view_student_entry").getRowData(ids[p]);
      var degree_code = dataset["grid_degree"];
      var exam = dataset["grid_exam"];
      var sl_no = dataset["grid_sl_no"];
      delete_arr[p] = new Object();
      delete_arr[p]["degree_code"] = degree_code;
      delete_arr[p]["exam"] = exam;
      delete_arr[p]["sl_no"] = sl_no;
    }
    var agree = confirm("Would you like to Delete this Record..!!");
    if (agree) {
      var myJSONText = encodeURIComponent(JSON.stringify(delete_arr));
      $.ajax({
        type: "POST",
        //async:false,
        url: $host_url + "disableRecord.demo",
        data: "&delete_arr=" + myJSONText,
        success: disableRecordResponse,
      });
    }
  } else {
    alert(" select row in grid");
    return;
  }
}
function disableRecordResponse($responce) {
  $responce = eval("(" + $responce + ")");
  if ($responce.error_code == 0) {
    alert("Record Deleted Successfully");
    $("#view_student_entry").trigger("reloadGrid");
  }
}

function clearStudentEntry() {
  document.getElementById("student_entry_degree_code").value = "";
  document.getElementById("student_entry_degree_name").value = "";
  document.getElementById("student_entry_slno").disabled = true;
  document.getElementById("student_entry_slno").value = "";
  document.getElementById("student_entry_name").value = "";
  document.getElementById("student_entry_fname").value = "";
  document.getElementById("student_entry_mname").value = "";
  document.getElementById("student_entry_dob_year").value = "";
  //document.getElementById('student_entry_dob_month').value = '';
  document.getElementById("student_entry_dob_date").value = "";
  document.getElementById("student_entry_nationality").value = "";
  document.getElementById("student_entry_comm_addr1").value = "";
  document.getElementById("student_entry_comm_addr2").value = "";
  document.getElementById("student_entry_comm_addr3").value = "";
  document.getElementById("student_entry_comm_addr4").value = "";
  document.getElementById("student_entry_per_add1").value = "";
  document.getElementById("student_entry_per_add2").value = "";
  document.getElementById("student_entry_per_add3").value = "";
  document.getElementById("student_entry_per_add4").value = "";
  document.getElementById("subject_appearing").innerHTML = "";
  $("#student_entry_upload").val("");
  $("#student_entry_photo").attr("src", "images/default_photo.jpg");
  document.getElementById("student_entry_sub_degree_code").value = "";
  document.getElementById("student_entry_sub_degree").value = "";
  document.getElementById("student_entry_recognition_order_no").value = "";
  document.getElementById("student_entry_recognition_date").value = "";
  document.getElementById("student_entry_affiliation_order_no").value = "";
  document.getElementById("student_entry_affiliation_date").value = "";
  document.getElementById("student_entry_religion").value = "";
  document.getElementById("student_entry_english").value = "";
  document.getElementById("student_entry_father_occupation").value = "";
  document.getElementById("student_entry_mather_occupation").value = "";
  document.getElementById("student_entry_email").value = "";
  document.getElementById("student_entry_phone_no").value = "";
  document.getElementById("student_entry_mobile_no").value = "";
  document.getElementById("student_entry_college").value = "";
  document.getElementById("student_entry_passyear").value = "";
  document.getElementById("student_entry_percent").value = "";
  document.getElementById("student_entry_board").value = "";
  document.getElementById("student_entry_otherBoard").value = "";
  document.getElementById("student_entry_docno").value = "";
  document.getElementById("student_entry_blood_group").value = "";
  $("#student_entry_reg_fee").val("0.00");
  $("#student_entry_exam_fee").val("0.00");
  $("#student_entry_grade_card_fee").val("0.00");
  $("#student_entry_total_fee").val("0.00");
  $("#fee_combination_div").html("");
}

function clearStudentEntryAfterSave() {
  document.getElementById("student_entry_slno").value = "";
  document.getElementById("student_entry_slno").disabled = true;
  document.getElementById("student_entry_name").value = "";
  document.getElementById("student_entry_fname").value = "";
  document.getElementById("student_entry_mname").value = "";
  document.getElementById("student_entry_dob_month").value = "Jan";
  document.getElementById("student_entry_dob_year").value = " ";
  document.getElementById("student_entry_dob_date").value = "01";
  document.getElementById("student_entry_comm_addr1").value = "";
  document.getElementById("student_entry_comm_addr2").value = "";
  document.getElementById("student_entry_comm_addr3").value = "";
  document.getElementById("student_entry_comm_addr4").value = "";
  document.getElementById("student_entry_per_add1").value = "";
  document.getElementById("student_entry_per_add2").value = "";
  document.getElementById("student_entry_per_add3").value = "";
  document.getElementById("student_entry_per_add4").value = "";
  $("#student_entry_upload").val("");
  $("#student_entry_photo").attr("src", "images/default_photo.jpg");
  document.getElementById("student_entry_recognition_order_no").value = "";
  document.getElementById("student_entry_recognition_date").value = "";
  document.getElementById("student_entry_affiliation_order_no").value = "";
  document.getElementById("student_entry_affiliation_date").value = "";
  document.getElementById("student_entry_religion").value = "";
  document.getElementById("student_entry_father_occupation").value = "";
  document.getElementById("student_entry_mather_occupation").value = "";
  document.getElementById("student_entry_english").value = "";
  document.getElementById("student_entry_email").value = "";
  document.getElementById("student_entry_phone_no").value = "";
  document.getElementById("student_entry_mobile_no").value = "";
  document.getElementById("student_entry_college").value = "";
  document.getElementById("student_entry_passyear").value = "";
  document.getElementById("student_entry_percent").value = "";
  document.getElementById("student_entry_board").value = "";
  document.getElementById("student_entry_otherBoard").value = "";
  document.getElementById("student_entry_docno").value = "";
  document.getElementById("fee_remarks").value = "";
  document.getElementById("rec_date").value = "";
  document.getElementById("rec_no").value = "";
  document.getElementById("fee_paid").value = "";
  $("#student_entry_blood_group").val("");
  $("#degree_honours").val("");
  document.getElementById("honours_combination").options.length = 0;
  var $lobj_Option = document.createElement("OPTION");
  $lobj_Option.value = "";
  $lobj_Option.text = "Select Combination";
  document.getElementById("honours_combination").options[0] = $lobj_Option;
  $("#degree_category").val("");
  $("#student_entry_reg_fee").val("0.00");
  $("#student_entry_exam_fee").val("0.00");
  $("#student_entry_grade_card_fee").val("0.00");
  $("#student_entry_total_fee").val("0.00");
  $("#fee_combination_div").html("");
}

function ViewStudentDetailsRUR() {
  $main =
    "<table id='view_student_entry' class='scroll' ondblclick='SelectStudentRowIdVKU();'></table> <div id='sub_grid_div' class='scroll' style='text-align:center;'></div>";
  document.getElementById("page_main_div").innerHTML = $main;
  var student_details = jQuery("#view_student_entry")
    .jqGrid({
      url: $host_url + "ViewStudentDetailsVKU",
      datatype: "json",
      colNames: ["Sl No", "Degree", "Exam", "Student Count"],
      colModel: [
        { name: "grid_sl_no", index: "grid_sl_no", width: 40 },
        { name: "grid_degree", index: "grid_degree", width: 200 },
        { name: "grid_exam", index: "grid_exam", width: 40, align: "center" },
        { name: "grid_name", index: "grid_name", width: 50, align: "center" },
      ],
      rowNum: 20,
      rowList: [20, 30, 40, 60],
      imgpath: $img_path,
      pager: jQuery("#sub_grid_div"),
      sortname: "id",
      height: "250",
      viewrecords: true,
      sortorder: "desc",
      multiselect: true,
      cellEdit: true,
      width: "840",
      caption: "Student Details",
    })
    .navGrid(
      "#sub_grid_div",
      { edit: false, add: false, del: false, search: false },
      {},
      {},
      {},
      { multipleSearch: true }
    )
    .navButtonAdd("#sub_grid_div", {
      caption: "Toggle",
      buttonicon: "ui-icon-pin-s",
      onClickButton: function () {
        student_details[0].toggleToolbar();
      },
    })
    .navButtonAdd("#sub_grid_div", {
      caption: "Edit",
      onClickButton: function () {
        SelectStudentRowIdVKU();
      },
    });
  student_details.filterToolbar();
  $("#gs_grid_sl_no").focus();
  $(".ui-search-toolbar").bind("keydown", function (evt) {
    var kC = evt.which ? evt.which : evt.keyCode;
    if (kC == 40) jQuery("#degree_grid").editCell(0, 0, false);
  });
}

function ViewDegreeWiseStudentDetailsVKU(degid) {
  $main =
    "<table id='view_student_entry' class='scroll' ondblclick='SelectDegreeWiseStudentRowId();'></table> <div id='sub_grid_div' class='scroll' style='text-align:center;'></div>";
  document.getElementById("page_main_div").innerHTML = $main;
  var student_details = jQuery("#view_student_entry")
    .jqGrid({
      url: $host_url + "ViewDegreeWiseStudentDetailsVKU" + "&degid=" + degid,
      datatype: "json",
      colNames: ["Sl No", "Degree", "Branch", "Exam", "Name", "Created By"],
      colModel: [
        { name: "grid_sl_no", index: "grid_sl_no", width: 50 },
        { name: "grid_degree", index: "grid_degree", width: 100 },
        { name: "grid_sub_degree", index: "grid_sub_degree", width: 100 },
        { name: "grid_exam", index: "grid_exam", width: 100 },
        { name: "grid_name", index: "grid_name", width: 100 },
        { name: "created_by", index: "created_by", width: 100 },
      ],
      rowNum: 20,
      rowList: [20, 30, 40, 60],
      imgpath: $img_path,
      pager: jQuery("#sub_grid_div"),
      sortname: "id",
      height: "250",
      viewrecords: true,
      sortorder: "desc",
      multiselect: true,
      cellEdit: true,
      width: "840",
      caption: "Student Details",
      editurl: $host_url + "deleteStudentDetails",
    })
    .navGrid(
      "#sub_grid_div",
      { edit: false, add: false, del: false, search: false },
      {},
      {},
      {},
      { multipleSearch: true }
    )
    .navButtonAdd("#sub_grid_div", {
      caption: "Toggle",
      buttonicon: "ui-icon-pin-s",
      onClickButton: function () {
        student_details[0].toggleToolbar();
      },
    })
    .navButtonAdd("#sub_grid_div", {
      caption: "Delete",
      buttonicon: "ui-icon-trash",
      onClickButton: function () {
        deleteStudentRecord();
      },
    })
    .navButtonAdd("#sub_grid_div", {
      caption: "Edit",
      onClickButton: function () {
        SelectDegreeWiseStudentRowId();
      },
    });
  student_details.filterToolbar();
  $("#gs_grid_sl_no").focus();
  $(".ui-search-toolbar").bind("keydown", function (evt) {
    var kC = evt.which ? evt.which : evt.keyCode;
    if (kC == 40) jQuery("#degree_grid").editCell(0, 0, false);
  });
}
/* 
function SelectStudentRowId()
{ 
	var id=jQuery("#view_student_entry").getGridParam('selrow'); 
	if (id) 
	{ 
		$(document).ready(function(){ 
		LoadstudentEntry('Edit');
		var dataset=jQuery("#view_student_entry").getRowData(id);
		$g_se_degree=dataset['grid_degree'];
		$geditinternalcode=id;
		});
	} 
	else
	{
		alert(" select row in grid"); return;
	}
 } */

function SelectStudentRowIdVKU() {
  var id = jQuery("#view_student_entry").getGridParam("selrow");
  if (id) {
    ViewDegreeWiseStudentDetailsVKU(id);
  } else {
    alert("Please select row in grid");
    return;
  }
}

function SelectDegreeWiseStudentRowId() {
  var id = jQuery("#view_student_entry").getGridParam("selrow");
  if (id) {
    LoadstudentEntryRUR("Edit");
    var dataset = jQuery("#view_student_entry").getRowData(id);
    $g_se_degree = dataset["grid_degree"];
    $geditinternalcode = id;
  } else {
    alert("Please select row in grid");
    return;
  }
}

function EditStudentDetailsForUpdate(id) {
  $.ajax({
    type: "POST",
    //async:false,
    url: $host_url + "getSlNoStudentDetailsVKU.demo",
    data: "sl_no=" + id + "&degree=" + $g_se_degree,
    success: EditStudentDetailsForUpdateResponse,
  });
}

function EditStudentDetailsForUpdateResponse($responce) {
  $responce = eval("(" + $responce + ")");
  document.getElementById("is_add_edit").value = "Edit";
  if ($responce.data.studdet["FDELETED"] == "F") {
    DeletedRecords = 0; // non deleted record
    $("#error_msg").html(" ");
  } else {
    DeletedRecords = 1; // deleted Record
  }

  if ($responce.error_code == 0 || $responce.error_code == -1) {
    $("#error_msg").html(" ");
    //alert("aa");
    document.getElementById("student_entry_admno").value =
      $responce.data.studdet["FSLNO"];
    document.getElementById("student_entry_degree_code").value =
      $responce.data.studdet["FDEGREE"];
    document.getElementById("student_entry_degree_code").disabled = true;
    // document.getElementById("student_entry_degree_name").disabled = true;
    // document.getElementById("student_entry_degree_name").value =
    //   $responce.data.studdet["FDESCPN"];
    document.getElementById("student_entry_name").value =
      $responce.data.studdet["FNAME"];

    if ($responce.data.studdet["Fgender"] == "Male")
      $("#student_entry_genderm").attr("checked", true);
    if ($responce.data.studdet["Fgender"] == "Female")
      $("#student_entry_genderf").attr("checked", true);

    if ($responce.data.studdet["Fgender"] == "Transgender")
      $("#student_entry_gendert").attr("checked", true);

    document.getElementById("student_entry_dob").value =
      $responce.data.studdet["FDOBirth"];
    document.getElementById("student_entry_nationality").value =
      $responce.data.studdet["FNATIONAL"];
    // document.getElementById("student_entry_national").value =
    //   $responce.data.studdet["FNATCANDIDATE"];
    document.getElementById("student_entry_state").value =
      $responce.data.studdet["FSTATE"];
    //		document.getElementById('sltBelongsToKarnatakaBy').value = $responce.data.studdet['FKARBIRTH'];
    document.getElementById("student_entry_religion").value =
      $responce.data.studdet["FRELIGION"];
    document.getElementById("degree_category").value =
      $responce.data.studdet["FCATBIRTH"];
    document.getElementById("student_entry_caste").value =
      $responce.data.studdet["FCASTE"];

    // document.getElementById("combination").value =
    //   $responce.data.studdet["FCOMBCODE"];
    document.getElementById("student_entry_admdate").value =
      $responce.data.studdet["FADMISDATE"];

    document.getElementById("student_entry_fname").value =
      $responce.data.studdet["FFATNAME"];
    document.getElementById("student_entry_fincome").value =
      $responce.data.studdet["FFATINCOME"];
    document.getElementById("student_entry_mname").value =
      $responce.data.studdet["FMOTNAME"];

    document.getElementById("student_entry_phone").value =
      $responce.data.studdet["FCONTACT_NO"];
    document.getElementById("student_entry_comm_addr1").value =
      $responce.data.studdet["FCURRADD1"];
    document.getElementById("student_entry_comm_addr2").value =
      $responce.data.studdet["FCURRADD2"];
    document.getElementById("student_entry_comm_addr3").value =
      $responce.data.studdet["FCURRADD3"];
    document.getElementById("student_entry_comm_addr4").value =
      $responce.data.studdet["FCURRADD4"];
    document.getElementById("student_entry_per_add1").value =
      $responce.data.studdet["FPERMADD1"];
    document.getElementById("student_entry_per_add2").value =
      $responce.data.studdet["FPERMADD2"];
    document.getElementById("student_entry_per_add3").value =
      $responce.data.studdet["FPERMADD3"];
    document.getElementById("student_entry_per_add4").value =
      $responce.data.studdet["FPERMADD4"];
    document.getElementById("student_entry_religion").value =
      $responce.data.studdet["FRELIGION"];
    document.getElementById("student_entry_email").value =
      $responce.data.studdet["FEMAIL"];
    document.getElementById("student_entry_mobile").value =
      $responce.data.studdet["FMOBILE_NO"];

    document.getElementById("seAadharNumber").value =
      $responce.data.studdet["FAADHARNO"];
    document.getElementById("degree_category").value =
      $responce.data.studdet["FCATBIRTH"];

    //   document.getElementById("txtUnvRegFee").value =
    //   $responce.data.studdet["FUNIVFEE"];
    // document.getElementById("txtUnvRegReceiptNo").value =
    //   $responce.data.studdet["FUNIVRECNO"];
    // document.getElementById("txtAdmnFee").value =
    //   $responce.data.studdet["FLATADMFEE"];
    // document.getElementById("txtAdmnReceiptNo").value =
    //   $responce.data.studdet["FLATRECNO"];

    //console.log($responce.data.studdet['FPOB']);
    //document.getElementById("dobplace").value = $responce.data.studdet["FPOB"];

    //document.getElementById("area").value = $responce.data.studdet["FAREA"];

    // if ($responce.data.studdet["FHANDICAP"] == "Yes")
    //   $("#phd").attr("checked", true);

    // if ($responce.data.studdet["FNCC"] == "Yes")
    //   $("#ncc").attr("checked", true);

    // if ($responce.data.studdet["FDEFENCE"] == "Yes")
    //   $("#dfp").attr("checked", true);

    // if ($responce.data.studdet["FEXSERVE"] == "Yes")
    //   $("#exs").attr("checked", true);

    // if ($responce.data.studdet["FKASHIMG"] == "Yes")
    //   $("#kai").attr("checked", true);

    // if ($responce.data.studdet["FTRANS"] == "Yes")
    //   $("#trg").attr("checked", true);

    // if ($responce.data.studdet["FWOBSATE"] == "Yes")
    //   $("#osb").attr("checked", true);

    // if ($responce.data.studdet["FOBSATE"] == "Yes")
    //   $("#obs").attr("checked", true);

    document.getElementById("month").value = $responce.data.studdet["FQMONTH"];
    document.getElementById("year").value = $responce.data.studdet["FQYEAR"];
    document.getElementById("maxmarks").value =
      $responce.data.studdet["FQMAXMARKS"];
    document.getElementById("secmarks").value =
      $responce.data.studdet["FQSECMARKS"];
    document.getElementById("percentage").value =
      $responce.data.studdet["FQPERCENTAGE"];

    // document.getElementById("univaddres").value =
    //   $responce.data.studdet["FUNIVADD"];
    // document.getElementById("univphoneno").value =
    //   $responce.data.studdet["FUNIVPHONE"];
    document.getElementById("institutephoneno").value =
      $responce.data.studdet["FCOLLPHONE"];
    //document.getElementById("pnrno").value = $responce.data.studdet["FPRNNO"];
    document.getElementById("student_entry_blood_grp").value =
      $responce.data.studdet["FBLOOD_GROUP"];

    /*
     ***********************SSLC DETAILS UPDATE ****************
     */

    // document.getElementById("seExamRegNo10").value =
    //   $responce.data.studdet["FQUALEXREGNO10"];
    // document.getElementById("pnrno10").value =
    //   $responce.data.studdet["FPRNNO10"];
    // document.getElementById("seInstitutionName10").value =
    //   $responce.data.studdet["FINSTNAME10"];
    // document.getElementById("seLocation10").value =
    //   $responce.data.studdet["FCOLLADD10"];
    // document.getElementById("institutephoneno10").value =
    //   $responce.data.studdet["FCOLLPHONE10"];
    // document.getElementById("sePADState10").value =
    //   $responce.data.studdet["FCOLLSTATE10"];
    // document.getElementById("univaddres10").value =
    //   $responce.data.studdet["FUNIVADD10"];
    // document.getElementById("univphoneno10").value =
    //   $responce.data.studdet["FUNIVPHONE10"];
    // document.getElementById("month10").value =
    //   $responce.data.studdet["FQMONTH10"];
    // document.getElementById("year10").value =
    //   $responce.data.studdet["FQYEAR10"];
    // document.getElementById("maxmarks10").value =
    //   $responce.data.studdet["FQMAXMARKS10"];
    // document.getElementById("secmarks10").value =
    //   $responce.data.studdet["FQSECMARKS10"];
    // document.getElementById("percentage10").value =
    //   $responce.data.studdet["FQPERCENTAGE10"];

    $.ajax({
      type: "POST",
      url: $host_url + "getCategoryNames.demo",
      data: "id=" + "degree_category",
      success: function ($responceCat) {
        $responceCat = eval("(" + $responceCat + ")");
        console.log("hi after cat");
        if ($responceCat.error_code == 0) {
          var optionsAsString = "<option value=''> Select Category </option>";
          for (var i = 0; i < $responceCat.data.length; i++) {
            if (
              $responceCat.data[i].internal_code ==
              $responce.data.studdet["FCATBIRTH"]
            ) {
              optionsAsString +=
                "<option value='" +
                $responceCat.data[i].internal_code +
                "' selected>" +
                $responceCat.data[i].value +
                "</option>";
            } else
              optionsAsString +=
                "<option value='" +
                $responceCat.data[i].internal_code +
                "'>" +
                $responceCat.data[i].value +
                "</option>";
          }

          $("#degree_category").append(optionsAsString);
        }
      },
    });

    // $.ajax({
    //   type: "POST",
    //   async: false,
    //   url: $host_url + "getCombinationNamesVKU",
    //   data: "&degree=" + encodeURIComponent($responce.data.studdet["FDEGREE"]),
    //   success: function($responces) {
    //     $responces = eval("(" + $responces + ")");

    //     var optionsAsString = "<option value=''> Select Combination</option>";
    //     for (var i = 0; i < $responces.data.mascomb.length; i++) {
    //       /*if($responces.data.mascomb[i].internal_code == $responce.data['mascomb'])
    // 		{
    // 			optionsAsString += "<option value='" + $responces.data.mascomb[i].internal_code + "' selected>" + $responces.data.mascomb[i].value + "</option>";
    // 		}
    // 		else*/
    //       optionsAsString +=
    //         "<option value='" +
    //         $responces.data.mascomb[i].internal_code +
    //         "'>" +
    //         $responces.data.mascomb[i].value +
    //         "</option>";
    //     }
    //     $("#combination").append(optionsAsString);
    //   }
    // });

    // document.getElementById("combination").value =
    //   $responce.data.studdet["FCOMBCODE"];

    $.ajax({
      type: "POST",
      //async:false,
      url: $host_url + "GetUploadedStudentDocuments",
      data:
        "&degree=" +
        encodeURIComponent($responce.data.studdet["FDEGREE"]) +
        "&appno=" +
        encodeURIComponent($responce.data.studdet["FSLNO"]),
      success: function (responce) {
        responce = eval("(" + responce + ")");

        $("#sedocs_div").html(responce.data);
      },
    });

    // document.getElementById("sePADState").value =
    //   $responce.data.studdet["FSTATEQUALEXM"];
    document.getElementById("seTypeOfQualifyingExam").value =
      $responce.data.studdet["FTYPEQUALEXAM"];
    document.getElementById("seInstitutionName").value =
      $responce.data.studdet["FINSTNAME"];
    document.getElementById("seLocation").value =
      $responce.data.studdet["FINSTLOCAT"];
    //document.getElementById('seUniversityName').value = $responce.data.studdet['FUNIVNAME'];
    document.getElementById("seExamRegNo").value =
      $responce.data.studdet["FQUALEXREGNO"];

    // document.getElementById("txtEligbFee").value =
    //   $responce.data.studdet["FELIGFEE"];
    // document.getElementById("txtEligbRecNo").value =
    //   $responce.data.studdet["FELIGRECNO"];

    if ($responce.data.studdet["FHK"] == "HK") {
      document.getElementById("chkHydKar").checked = true;
    }

    $("#seWeightedAverage").html($responce.data.studdet["FWGHTAVGMARKS"]);

    //yearof_pass  mnth_pass  marks_sec  marks_total marks_per

    $("#student_entry_photo").attr("src", $responce.data.studdet["FPHOTOPATH"]);
    // $("#student_signature_photo").attr(
    //   "src",
    //   $responce.data.studdet["FSIGNPATH"]
    // );
    //document.getElementById('wghtAvgPer').value = $responce.data.studdet['FWGHTAVGMARKS'];
    $("#qalsemdet").hide();
    if ($responce.data.qualcount > 0) {
      $("#qalsemdet").show();
      var j = 0;
      var trRow = "";
      for (var i = 1; i <= $responce.data.qualcount; i++, j++) {
        trRow += `
					<tr style='font-size:12px;' id = "${i}" class='ui-widget-content jqgrow'>
					<td class='tbl_row_new tdfirst'>${i}.</td>
					<td class='tbl_row_new'>
						<input type="text" name="subsem1_${i}" value = "${$responce.data.qualdet[j]["fsubname"]}" id = "subsem1_${i}" style="width: 175px !important;">
					</td>
					<td class='tbl_row_new'>
						<input type="text" name="subsem1mo_${i}" onchange = "gettoal('${i}')"  value = "${$responce.data.qualdet[j]["fsecmarksa"]}" id = "subsem1mo_${i}">
					</td>
					<td class='tbl_row_new'>
						<input type="text" name="subsem1mm_${i}" onchange = "gettoal('${i}')" value = "${$responce.data.qualdet[j]["fmaxmarksa"]}" id = "subsem1mm_${i}">
					</td>
					<td class='tbl_row_new'  >
						<input type="text" name="subsem2mo_${i}" onchange = "gettoal('${i}')" value = "${$responce.data.qualdet[j]["fsecmarksb"]}" id = "subsem2mo_${i}">
					</td>
					<td class='tbl_row_new' width="50px">
						<input type="text" name="subsem2mm_${i}" onchange = "gettoal('${i}')" value = "${$responce.data.qualdet[j]["fmaxmarksb"]}" id = "subsem2mm_${i}">
					</td>
					<td class='tbl_row_new' >
						<input type="text" name="subsem3mo_${i}" onchange = "gettoal('${i}')" value = "${$responce.data.qualdet[j]["fsecmarksc"]}" id = "subsem3mo_${i}">
					</td>
					<td class='tbl_row_new' >
						<input type="text" name="subsem3mm_${i}" onchange = "gettoal('${i}')" value = "${$responce.data.qualdet[j]["fmaxmarksc"]}" id = "subsem3mm_${i}">
					</td>
					<td class='tbl_row_new' >
						<input type="text" name="subsem4mo_${i}" onchange = "gettoal('${i}')" value = "${$responce.data.qualdet[j]["fsecmarksd"]}" id = "subsem4mo_${i}">
					</td>
					<td class='tbl_row_new' >
						<input type="text" name="subsem4mm_${i}" onchange = "gettoal('${i}')"  value = "${$responce.data.qualdet[j]["fmaxmarksd"]}" id = "subsem4mm_${i}">
					</td>
					<td class='tbl_row_new' >
						<input type="text" name="subsem5mo_${i}" onchange = "gettoal('${i}')" value = "${$responce.data.qualdet[j]["fsecmarkse"]}" id = "subsem5mo_${i}">
					</td>
					<td class='tbl_row_new'>
						<input type="text" name="subsem5mm_${i}" onchange = "gettoal('${i}')"  value = "${$responce.data.qualdet[j]["fmaxmarkse"]}" id = "subsem5mm_${i}">
					</td>
					<td class='tbl_row_new' >
						<input type="text" name="subsem6mo_${i}" onchange = "gettoal('${i}')" value = "${$responce.data.qualdet[j]["fsecmarksf"]}" id = "subsem6mo_${i}">
					</td>
					<td class='tbl_row_new' >
						<input type="text" name="subsem6mm_${i}" onchange = "gettoal('${i}')" value = "${$responce.data.qualdet[j]["fmaxmarksf"]}" id = "subsem6mm_${i}">
					</td>
					<td class='tbl_row_new'>
						<input type="text" name="subtotalmo_${i}" readonly maxlength = '4' value = "${$responce.data.qualdet[j]["ftotsecmarks"]}" id = "subtotalmo_${i}">
					</td>
					<td class='tbl_row_new'>
						<input type="text" name="subtotalmm_${i}" readonly maxlength = '4' value = "${$responce.data.qualdet[j]["ftotmaxmarks"]}" id = "subtotalmm_${i}">
					</td>
					<td class='tbl_row_new'>
						<input type="text" name="subpercentagemm_${i}" readonly maxlength = '5' value = "${$responce.data.qualdet[j]["fsubpercent"]}" style="width: 40px !important;" id = "subpercentagemm_${i}">
					</td>
					<td class='tbl_row_new'>
						<span onclick="adddyrow()"><img src='images/add.png' style="width:22px; height:25px;"></span>
						<span onclick="removedyrow('${i}')">
							<img src='images/remove.png' style="float: right;width:22px;height:26px;">
						</span>
					</td>
				</tr>`;
      }
      $("#qalsemdet tbody tr").remove();
      $("#qalsemdet").append(trRow);
    }
    var Vmode = 1;
    //GetCombinationFeeList($responce.data.studdet['FSLNO'],$responce.data.studdet['FEXAMNO'],$responce.data.studdet['FDEGREE'],$responce.data.studdet['FCASTE'],Vmode);
    GetCombinationSubjectListRUR();
    GetCombinationFeeListRUR();
    // document.getElementById("seUniversityName").value =
    //   $responce.data.studdet["FUNIVNAME"];
    // document.getElementById("seUniversityName10").value =
    //   $responce.data.studdet["FUNIVNAME10"];
  } else if ($responce.error_code == -2) {
    DeletedRecords = 0;
    //$("#error_msg").html(" In Valid SL Number ");
    alert("In Valid SL Number");
    $("#student_entry_slno").val("");
    document.getElementById("student_entry_slno").focus();
  }
}

function CalculateSETotalFee() {
  var student_entry_reg_fee = parseFloat(
    empty($("#student_entry_reg_fee").val())
      ? 0.0
      : $("#student_entry_reg_fee").val()
  );
  var student_entry_exam_fee = parseFloat(
    empty($("#student_entry_exam_fee").val())
      ? 0.0
      : $("#student_entry_exam_fee").val()
  );
  var student_entry_grade_card_fee = parseFloat(
    empty($("#student_entry_grade_card_fee").val())
      ? 0.0
      : $("#student_entry_grade_card_fee").val()
  );
  var total_fee = parseFloat(
    student_entry_reg_fee +
      student_entry_exam_fee +
      student_entry_grade_card_fee
  );
  $("#student_entry_total_fee").val(total_fee);
}

function getLateralEntrySubjects() {
  if (document.getElementById("is_lateral_entry").checked == true) {
    $("#student_entry_exam").val("C");
    getsubjectAppearingTotal();
  } else {
    $("#student_entry_exam").val("A");
    getsubjectAppearingTotal();
  }
}

function GetCombinationFeeList(slno, exam, degree, category, vmode) {
  if (vmode == 1) {
    var lstr_str = "&fsl_no=" + slno;
    lstr_str += "&fexamno=" + exam;
    lstr_str += "&fdegree=" + degree;
    lstr_str += "&fcatcode=" + category;
  } else {
    var fdegree = $("#student_entry_degree_code").val();

    if (empty(fdegree)) {
      alert(" Select Degree");
      $("#student_entry_degree_code").focus();
      return false;
    }
    var fexamno = "A";
    var fcatcode = $("#degree_category").val();
    var fcombcode = $("#degree_combination").val();
    var lstr_str = "&fdegree=" + fdegree;
    lstr_str += "&fexamno=" + fexamno;
    lstr_str += "&fcombcode=" + fcombcode;
    lstr_str += "&fcatcode=" + fcatcode;
    lstr_str += "&fsl_no=" + $("#student_entry_slno").val();
  }
  $.ajax({
    type: "POST",
    //async:false,
    url: $host_url + "GetCombinationFeeList",
    data: lstr_str,
    success: GetCombinationFeeListResponse,
  });
}

function GetCombinationFeeListResponse($responce) {
  $responce = eval("(" + $responce + ")");
  $("#fee_combination_div").html("");
  $("#tbl_menu").show();
  $("#fee_total_div").show();
  $("#fee_combination_div").html($responce.data.html);
  CalculateTotalFeePaid();
}

function CalculateTotalFeePaid() {
  var obj = $("input[id*='fee_paying_']");
  var tot_paid = 0;
  jQuery.each(obj, function (k, v) {
    tot_paid = tot_paid + parseFloat($("#" + v["id"]).val());
  });
  $("#fee_paid").val(tot_paid);
  $("#total_fee_paid").html(tot_paid);
}

function getotherBoardname() {
  var board = document.getElementById("student_entry_board").value;
  if (board == "Others") {
    $("#label_othboard").show();
    $("#field_othboard").show();
  } else {
    $("#label_othboard").hide();
    $("#field_othboard").hide();
  }
}

function enterDocNumber() {
  if (document.getElementById("migration_certy").checked == true) {
    $("#label_docno").show();
    $("#field_docno").show();
  } else {
    $("#label_docno").hide();
    $("#field_docno").hide();
  }
}

function multifileUpload(degree) {
  var lstr_query_string = "degree=" + degree;
  $.ajax({
    type: "POST",
    url: $host_url + "GetCMSAmountValue",
    data: lstr_query_string,
    success: function GetCMSAmountValueResponce(responce) {
      try {
        responce = eval("(" + responce + ")");
        $("#sedocs_div").html(responce.data["doc_arr"]);
        $("#exam_table tbody input").inputmask({
          mask: "9",
          repeat: 3,
          greedy: false,
        });
      } catch (err) {
        txt = err.message;
        $.unblockUI();
      }
    },
  });
}

function UploadEmployeeDocuments(doc_type_int_code, file_name) {
  var ext = $("#ed_" + doc_type_int_code).val();
  var filepath = ext;

  if (empty(filepath)) {
    alert("please select the file!");
    return false;
  }

  var list_data = "";
  list_data = $host_url + "UploadEmployeeDocuments";
  list_data += "&filepath=" + filepath;
  list_data += "&doc_type_int_code=" + doc_type_int_code;
  list_data += "&file_name=" + file_name;
  $.blockUI({
    message:
      "<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>",
  });

  document
    .getElementById("form_module_image_upload")
    .setAttribute("action", list_data);
  return AIM.submit(
    document.getElementById("form_module_image_upload"),
    "report_display",
    { onComplete: UploadEmployeeDocumentsResponce }
  );
}
function UploadEmployeeDocumentsResponce(responce) {
  responce = eval("(" + trim(responce) + ")");
  $.unblockUI();
  var int_code = responce.data["id"];
  var path = responce.data["path"];
  var file_name = responce.data["file_name"];
  var html =
    '<a target="_blank" href="' +
    path +
    '" style="color:#AB45F9; padding-right:5px;">' +
    file_name +
    "</a>";
  $("#attach_td_" + int_code).html(html);
  $("#ed_" + int_code).focus();
}
var funivcode = "";

function UploadEditEmployeeDocuments(
  doc_type_int_code,
  file_name,
  degree,
  collcode,
  slno,
  univcode
) {
  funivcode = univcode;
  var ext = $("#ed_" + doc_type_int_code).val();
  var filepath = ext;

  if (empty(filepath)) {
    alert("please select the file!");
    return false;
  }

  var list_data = "";
  list_data = $host_url + "UploadEditEmployeeDocuments";
  list_data += "&filepath=" + filepath;
  list_data += "&doc_type_int_code=" + doc_type_int_code;
  list_data += "&file_name=" + file_name;
  list_data += "&degree=" + degree;
  list_data += "&collcode=" + collcode;
  list_data += "&slno=" + slno;

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

  document
    .getElementById("form_module_image_upload")
    .setAttribute("action", list_data);
  return AIM.submit(
    document.getElementById("form_module_image_upload"),
    "report_display",
    { onComplete: UploadEditEmployeeDocumentsResponce }
  );
}
function UploadEditEmployeeDocumentsResponce(responce) {
  responce = eval("(" + trim(responce) + ")");
  $.unblockUI();
  var int_code = responce.data["id"];
  var path = responce.data["path"];
  var s3_url = "https://admission-certificates.s3.ap-south-1.amazonaws.com/";
  var doc_url = s3_url + funivcode + "/" + path;

  var file_name = responce.data["file_name"];
  var html =
    '<a target="_blank" href="' +
    doc_url +
    '" style="color:#AB45F9; padding-right:5px;">' +
    file_name +
    "</a>";
  $("#attach_td_" + int_code).html(html);
  $("#ed_" + int_code).focus();
}
function setAdmLoginCntr() {
  $.ajax({
    type: "POST",
    //async:false,
    url: $host_url + "setAdmLoginCntr",
    // data: lstr_query_string,
    success: function setLoginCntrResponce(responce) {
      try {
        responce = eval("(" + responce + ")");
      } catch (err) {
        /* txt= err.message;
					$.unblockUI();
					bootbox.alert(txt); */
      }
    },
  });
}

function DisplayUserSelectedSignature() {
  var valid_file_extentions = new Array("jpeg", "jpg");
  var ext = $("#student_entry_signupload").val();
  filepath = ext;
  ext = ext.substring(ext.length - 3, ext.length);
  ext = ext.toLowerCase();
  if (ext != "" && !in_array(ext, valid_file_extentions)) {
    alert("Select valid photo!");
    $("#student_entry_signupload").val("");
    return false;
  }

  $.blockUI({
    message:
      "<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>",
  });
  var lstr_data = "&filepath=" + filepath;
  $upload = $host_url + "DiaplayUserSelectedSignature&" + lstr_data;

  document
    .getElementById("form_module_image_upload")
    .setAttribute("action", $upload);
  return AIM.submit(
    document.getElementById("form_module_image_upload"),
    "report_display",
    { onComplete: DiaplayUserSelectedSignatureResponse }
  );
}

function DiaplayUserSelectedSignatureResponse($responce) {
  $.unblockUI();
  $responce = eval("(" + $responce + ")");
  if ($responce.error_code == 0)
    $("#student_signature_photo").attr("src", $responce.data);
  else if ($responce.error_code == -1)
    $("#student_signature_photo").attr("src", "images/sign_logo.png");
  else if ($responce.error_code == -2) {
    alert($responce.data);
    $("#student_signature_photo").attr("src", "images/sign_logo.png");
    $("#student_entry_signupload").val("");
  }
}

function SaveStudentEntryRUR() {
  if (DeletedRecords == 0) {
    var ugpg = $("#ugpg").val();
    if (ugpg == "PG") {
      rgMultiMarks = [];
      $("#qalsemdet tr.ui-widget-content").each((i, el) => {
        var rgQal = $(el).find("td input");
        var rgTr = [];
        $.each(rgQal, (j, val) => {
          var item = {};
          item["name"] = val.name;
          item["value"] = val.value;
          rgTr.push(item);
        });
        //console.log(rgTr);
        rgMultiMarks.push(rgTr);
      });
    }

    var date_student;

    if (
      trim(document.getElementById("student_entry_degree_code").value) == ""
    ) {
      alert("Enter the degree code");
      document.getElementById("student_entry_degree_code").focus();
      return;
    }

    if (trim(document.getElementById("student_entry_name").value) == "") {
      alert("Enter the candidate name");
      document.getElementById("student_entry_name").focus();
      return;
    }
    if (trim(document.getElementById("student_entry_fname").value) == "") {
      alert("Enter father's name");
      document.getElementById("student_entry_fname").focus();
      return;
    }
    if (trim(document.getElementById("student_entry_mname").value) == "") {
      alert("Enter Mother Name.");
      document.getElementById("student_entry_mname").focus();
      return;
    }
    if ($("#student_entry_dob").val() == "") {
      alert("Enter the valid date of birth ");
      document.getElementById("student_entry_dob").focus();
      return;
    }
    // if ($("#dobplace").val() == "") {
    //   alert("Enter the Place of birth");
    //   document.getElementById("dobplace").focus();
    //   return;
    // }
    if (trim(document.getElementById("student_entry_blood_grp").value) == "") {
      alert("select Blood Group");
      document.getElementById("student_entry_blood_grp").focus();
      return;
    }
    if (
      trim(document.getElementById("student_entry_nationality").value) == ""
    ) {
      alert("Enter the nationality");
      document.getElementById("student_entry_nationality").focus();
      return;
    }

    if (trim(document.getElementById("student_entry_religion").value) == "") {
      alert(" Select the religion");
      document.getElementById("student_entry_religion").focus();
      return;
    }

    if (trim(document.getElementById("degree_category").value) == "") {
      alert(" Select Category by birth ");
      document.getElementById("degree_category").focus();
      return;
    }
    if (trim(document.getElementById("student_entry_caste").value) == "0") {
      alert(" Select caste ");
      document.getElementById("student_entry_caste").focus();
      return;
    }
    if (trim(document.getElementById("student_entry_state").value) == "") {
      alert(" Select state");
      document.getElementById("student_entry_state").focus();
      return;
    }
    if (trim(document.getElementById("student_entry_email").value) == "") {
      alert("Enter Email Id.");
      document.getElementById("student_entry_email").focus();
      return;
    }

    if (trim(document.getElementById("student_entry_mobile").value) == "") {
      alert("Enter Mobile No.");
      document.getElementById("student_entry_mobile").focus();
      return;
    }
    $start_indx = $g_subject_appearing.total_count - $g_remaining_counter_inc;
    var subject_alert_flag = false;
    var alert_cnt = 0;
    for ($m = $start_indx; $m < $g_subject_appearing.total_count; $m++) {
      if (trim($("#se_sub_code_" + $m).val()) == "") {
        subject_alert_flag = true;
        alert_cnt++;
        alert("Please Enter the All Subjects");
        document.getElementById("se_sub_code_" + $m).focus();
        return;
      }
    }
    if (subject_alert_flag) {
      alert("You have not entered all Subjects!!!!!!");
      var agree = confirm("Would you like to Save this Record..!!");
      if (!agree) {
        return false;
      }
    }

    if (trim(document.getElementById("student_entry_admdate").value) == "") {
      alert(" Enter date of admission ");
      document.getElementById("student_entry_admdate").focus();
      return;
    }

    // if (trim(document.getElementById("seExamRegNo10").value) == "") {
    //   alert("Enter the SSLC Reg no.");
    //   document.getElementById("seExamRegNo10").focus();
    //   return;
    // }
    // if (trim(document.getElementById("pnrno10").value) == "") {
    //   alert("Enter the SSLC PRN no.");
    //   document.getElementById("pnrno10").focus();
    //   return;
    // }
    // if (trim(document.getElementById("seInstitutionName10").value) == "") {
    //   alert("Enter the SSLC College Name");
    //   document.getElementById("seInstitutionName10").focus();
    //   return;
    // }
    // if (trim(document.getElementById("seUniversityName10").value) == "") {
    //   alert("Select the SSLC Board Name");
    //   document.getElementById("seUniversityName10").focus();
    //   return;
    // }
    // if (trim(document.getElementById("univaddres10").value) == "") {
    //   alert("Enter the SSLC Board Address");
    //   document.getElementById("univaddres10").focus();
    //   return;
    // }
    // if (trim(document.getElementById("univphoneno10").value) == "") {
    //   alert("Enter the SSLC Board Phoneno");
    //   document.getElementById("univphoneno10").focus();
    //   return;
    // }

    // if (trim(document.getElementById("maxmarks10").value) == "") {
    //   alert("Enter the SSLC Maximum Marks");
    //   document.getElementById("maxmarks10").focus();
    //   return;
    // }
    // if (trim(document.getElementById("secmarks10").value) == "") {
    //   alert("Enter the SSLC Secured Marks");
    //   document.getElementById("secmarks10").focus();
    //   return;
    // }
    if (trim(document.getElementById("seTypeOfQualifyingExam").value) == "") {
      alert("Enter Qualifying Exam");
      document.getElementById("seTypeOfQualifyingExam").focus();
      return;
    }
    if (trim(document.getElementById("seExamRegNo").value) == "") {
      alert("Select Qualifying Exam Reg No.");
      document.getElementById("seExamRegNo").focus();
      return;
    }
    // if (trim(document.getElementById("pnrno").value) == "") {
    //   alert("Enter Qualifying Exam PNR No.");
    //   document.getElementById("pnrno").focus();
    //   return;
    // }
    if (trim(document.getElementById("seInstitutionName").value) == "") {
      alert("Enter Qualifying Exam College Name");
      document.getElementById("seInstitutionName").focus();
      return;
    }
    // if (trim(document.getElementById("seUniversityName").value) == "") {
    //   alert("Select Qualifying Exam University Name");
    //   document.getElementById("seUniversityName").focus();
    //   return;
    // }
    // if (trim(document.getElementById("univaddres").value) == "") {
    //   alert("Enter Qualifying Exam University Address");
    //   document.getElementById("univaddres").focus();
    //   return;
    // }
    // if (trim(document.getElementById("univphoneno").value) == "") {
    //   alert("Enter Qualifying Exam University Phone No");
    //   document.getElementById("univphoneno").focus();
    //   return;
    // }
    if (trim(document.getElementById("maxmarks").value) == "") {
      alert("Enter the Qualifying Exam Maximum Marks");
      document.getElementById("maxmarks").focus();
      return;
    }
    if (trim(document.getElementById("secmarks").value) == "") {
      alert("Enter the Qualifying Exam Secured Marks");
      document.getElementById("secmarks").focus();
      return;
    }

    if (document.getElementById("is_add_edit").value == "Add") {
      var loaded_html = window.location.href.substring(
        eval(window.location.href.lastIndexOf("/") + 1)
      );
      if (document.getElementById("student_entry_upload").value == "") {
        alert("Browse for photo..!!");
        document.getElementById("student_entry_upload").focus();
        return;
      }

      // var loaded_html = window.location.href.substring(
      //   eval(window.location.href.lastIndexOf("/") + 1)
      // );
      // if (document.getElementById("student_entry_signupload").value == "") {
      //   alert("Browse for signature..!!");
      //   document.getElementById("student_entry_signupload").focus();
      //   return;
      // }
    }

    var list_data = $host_url + "SaveCertificateDetailsRUR";
    list_data += "&add_edit=" + document.getElementById("is_add_edit").value;
    list_data +=
      "&edit_app_no=" + document.getElementById("student_entry_admno").value;
    list_data +=
      "&stud_admno=" + encodeURIComponent($("#student_entry_admno").val());
    var degree = $("#student_entry_degree_code").val();
    list_data += "&degree=" + degree;
    var candidate_name = $("#student_entry_name").val();
    list_data += "&candidate_name=" + candidate_name;
    if (ugpg == "PG")
      list_data += "&rgMultiMarks=" + JSON.stringify(rgMultiMarks);
    var wrtExamLanguage = $(
      'input[name="student_entry_rdbLanguage"]:checked',
      "#form_module_image_upload"
    ).val();
    list_data += "&wrtExamLanguage=" + wrtExamLanguage;

    var gender = $(
      'input[name="student_entry_gender"]:checked',
      "#form_module_image_upload"
    ).val();
    list_data += "&gender=" + gender;

    var board = $(
      'input[name="board"]:checked',
      "#form_module_image_upload"
    ).val();
    list_data += "&board=" + board;

    // var phd = $('input[name="phd"]:checked', "#form_module_image_upload").val();
    // list_data += "&phd=" + phd;

    // var ncc = $('input[name="ncc"]:checked', "#form_module_image_upload").val();
    // list_data += "&ncc=" + ncc;

    // var nss = $('input[name="nss"]:checked', "#form_module_image_upload").val();
    // list_data += "&nss=" + nss;

    // var dfp = $('input[name="dfp"]:checked', "#form_module_image_upload").val();
    // list_data += "&dfp=" + dfp;

    // var exs = $('input[name="exs"]:checked', "#form_module_image_upload").val();
    // list_data += "&exs=" + exs;

    // var kai = $('input[name="kai"]:checked', "#form_module_image_upload").val();
    // list_data += "&kai=" + kai;

    // var trg = $('input[name="trg"]:checked', "#form_module_image_upload").val();
    // list_data += "&trg=" + trg;

    // var spr = $('input[name="spr"]:checked', "#form_module_image_upload").val();
    // list_data += "&spr=" + spr;

    // var obs = $('input[name="obs"]:checked', "#form_module_image_upload").val();
    // list_data += "&obs=" + obs;

    // var osb = $('input[name="osb"]:checked', "#form_module_image_upload").val();
    // list_data += "&osb=" + osb;

    var institutephoneno = $("#institutephoneno").val();
    list_data += "&institutephoneno=" + institutephoneno;
    var univaddres = $("#univaddres").val();
    list_data += "&univaddres=" + univaddres;
    // var univphoneno = $("#univphoneno").val();
    // list_data += "&univphoneno=" + univphoneno;
    // var pnrno = $("#pnrno").val();
    // list_data += "&pnrno=" + pnrno;

    // var area = $("#area").val();
    // list_data += "&area=" + area;
    // var dobplace = $("#dobplace").val();
    // list_data += "&dobplace=" + dobplace;

    var dob = date_format($("#student_entry_dob").val());
    list_data += "&dob=" + dob;
    var nationality = $("#student_entry_nationality").val();
    list_data += "&nationality=" + nationality;
    // var candidateNational = $("#student_entry_national").val();
    // list_data += "&candidateNational=" + candidateNational;
    var state = $("#student_entry_state").val();
    list_data += "&state=" + state;

    var religion = $("#student_entry_religion").val();
    list_data += "&religion=" + religion;
    var categoryByBirth = $("#degree_category").val();
    list_data += "&categoryByBirth=" + categoryByBirth;
    var caste = $("#student_entry_caste").val();
    list_data += "&caste=" + caste;
    var bloodgrp = encodeURIComponent($("#student_entry_blood_grp").val());
    list_data += "&bloodgrp=" + bloodgrp;

    var sltCombination = $("#combination").val();
    list_data += "&sltCombination=" + sltCombination;

    var admdate = date_format($("#student_entry_admdate").val());
    list_data += "&admdate=" + admdate;
    var admintake = $("#student_entry_Intake").val();
    list_data += "&admintake=" + admintake;

    var fname = $("#student_entry_fname").val();
    list_data += "&fname=" + fname;
    var fincome = $("#student_entry_fincome").val();
    list_data += "&fincome=" + fincome;
    var mname = $("#student_entry_mname").val();
    list_data += "&mname=" + mname;

    var phoneno = $("#student_entry_phone").val();
    list_data += "&phoneno=" + phoneno;
    var peradd1 = $("#student_entry_per_add1").val();
    list_data += "&peradd1=" + peradd1;
    var peradd2 = $("#student_entry_per_add2").val();
    list_data += "&peradd2=" + peradd2;
    var peradd3 = $("#student_entry_per_add3").val();
    list_data += "&peradd3=" + peradd3;
    var peradd4 = $("#student_entry_per_add4").val();
    list_data += "&peradd4=" + peradd4;
    var commaddr1 = $("#student_entry_comm_addr1").val();
    list_data += "&commaddr1=" + commaddr1;
    var commaddr2 = $("#student_entry_comm_addr2").val();
    list_data += "&commaddr2=" + commaddr2;
    var commaddr3 = $("#student_entry_comm_addr3").val();
    list_data += "&commaddr3=" + commaddr3;
    var commaddr4 = $("#student_entry_comm_addr4").val();
    list_data += "&commaddr4=" + commaddr4;
    var email = $("#student_entry_email").val();
    list_data += "&email=" + email;
    var mobile = $("#student_entry_mobile").val();
    list_data += "&mobile=" + mobile;
    //var lingMinority = $("#seLinguisticMinority").val();list_data+="&lingMinority="+lingMinority;
    //var regMinority = $("#seReligiousMinority").val();list_data+="&regMinority="+regMinority;
    var aadharno = $("#seAadharNumber").val();
    list_data += "&aadharno=" + aadharno;

    // var padState = $("#sePADState").val();
    // list_data += "&padState=" + padState;
    var typequlexam = $("#seTypeOfQualifyingExam").val();
    list_data += "&typequlexam=" + typequlexam;
    var instname = $("#seInstitutionName").val();
    list_data += "&instname=" + instname;
    var location = $("#seLocation").val();
    list_data += "&location=" + location;
    var univname = $("#seUniversityName").val();
    list_data += "&univname=" + univname;

    var examregno = $("#seExamRegNo").val();
    list_data += "&examregno=" + examregno;

    //var entexammarks = $("#entranceExamMarks").val();list_data+="&entexammarks="+entexammarks;
    // var unvregfee = $("#txtUnvRegFee").val();
    // list_data += "&unvregfee=" + unvregfee;
    // var unvregrecno = $("#txtUnvRegReceiptNo").val();
    // list_data += "&unvregrecno=" + unvregrecno;
    // var admfee = $("#txtAdmnFee").val();
    // list_data += "&admfee=" + admfee;
    // var admrecno = $("#txtAdmnReceiptNo").val();
    // list_data += "&admrecno=" + admrecno;
    // var phtype = $("#student_entry_Ph").val();
    // list_data += "&phtype=" + phtype;
    // var eligbFee = $("#txtEligbFee").val();
    // list_data += "&eligbFee=" + eligbFee;
    // var eligbRecNo = $("#txtEligbRecNo").val();
    // list_data += "&eligbRecNo=" + eligbRecNo;
    if (document.getElementById("chkHydKar").checked == true) {
      var chkHydKar = $("#chkHydKar").val();
      list_data += "&chkHydKar=" + chkHydKar;
    } else list_data += "&chkHydKar=" + "";

    var month = $("#month").val();
    list_data += "&month=" + month;
    var year = $("#year").val();
    list_data += "&year=" + year;
    var maxmarks = $("#maxmarks").val();
    list_data += "&maxmarks=" + maxmarks;
    var secmarks = $("#secmarks").val();
    list_data += "&secmarks=" + secmarks;
    var percentage = $("#percentage").val();
    list_data += "&percentage=" + percentage;
    /*
     ******************	SSLC Details Begin**********************
     */
    // var examregno10 = $("#seExamRegNo10").val();
    // list_data += "&examregno10=" + examregno10;
    // var pnrno10 = $("#pnrno10").val();
    // list_data += "&pnrno10=" + pnrno10;
    // var instname10 = $("#seInstitutionName10").val();
    // list_data += "&instname10=" + instname10;
    // var location10 = $("#seLocation10").val();
    // list_data += "&location10=" + location10;
    // var padState10 = $("#sePADState10").val();
    // list_data += "&padState10=" + padState10;
    // var institutephoneno10 = $("#institutephoneno10").val();
    // list_data += "&institutephoneno10=" + institutephoneno10;
    // var univname10 = $("#seUniversityName10").val();
    // list_data += "&univname10=" + univname10;
    // var univaddres10 = $("#univaddres10").val();
    // list_data += "&univaddres10=" + univaddres10;
    // var univphoneno10 = $("#univphoneno10").val();
    // list_data += "&univphoneno10=" + univphoneno10;
    // var month10 = $("#month10").val();
    // list_data += "&month10=" + month10;
    // var year10 = $("#year10").val();
    // list_data += "&year10=" + year10;
    // var maxmarks10 = $("#maxmarks10").val();
    // list_data += "&maxmarks10=" + maxmarks10;
    // var secmarks10 = $("#secmarks10").val();
    // list_data += "&secmarks10=" + secmarks10;
    // var percentage10 = $("#percentage10").val();
    // list_data += "&percentage10=" + percentage10;

    /*
     ******************	SSLC Details End**********************
     */
    /* var wghtAvgMarks = (parseInt($("#marks_secTot").val()) / parseInt($("#marks_subtotal").val())) * 100;
			wtAvgMarks = wghtAvgMarks.toFixed(2); */
    /*
     ******************	Subject Details Begin **********************
     */

    $sub_arr = new Object();
    $n = 0;
    for ($m = 0; $m < $g_subject_appearing.total_count; $m++) {
      $sub_arr[$n] = new Object();
      $sub_arr[$n]["sub_code"] = trim($("#se_sub_code_" + $m).val());
      $n++;
    }

    var myJSONText = encodeURIComponent(JSON.stringify($sub_arr));
    list_data += "&sub_arr=" + myJSONText;

    var fee_com = new Object();
    var z = 0;
    var obj = $("input[id*='fee_paying_']");

    jQuery.each(obj, function (k, v) {
      fee_com[z] = new Object();
      var sl_no = v["id"].split("_")[2];
      fee_com[z]["fee_paid"] = $("#" + v["id"]).val();
      fee_com[z]["head_id"] = $("#head_" + sl_no).html();
      z++;
    });
    var fee_com = encodeURIComponent(JSON.stringify(fee_com));
    list_data += "&fee_com=" + fee_com;
    /*
     ******************	Subject Details End **********************
     */

    //list_data += '&yrpass='+yrpass+'&mnthpass='+mnthpass+'&mrksecure='+mrksecure+'&mrktotal='+mrktotal+'&mrkper='+mrkper;
    //list_data +="&wghtAvgMarks="+$("#wghtAvgPer").val();

    $.blockUI({
      message:
        "<h1 class='h1' style='font-size:12px'><img src='img/ajax-loader.gif' border='0'></h1>",
    });
    document
      .getElementById("form_module_image_upload")
      .setAttribute("action", list_data);
    return AIM.submit(
      document.getElementById("form_module_image_upload"),
      "same_tab",
      {
        onComplete: SaveCertificateDetailsRURResponse,
      }
    );
  } else {
    alert(" This record is already deleted..!!");
  }
}

function SaveCertificateDetailsRURResponse(responce) {
  try {
    responce = eval("(" + trim(responce) + ")");
    $.unblockUI();

    if (responce.error_code == 0) {
      alert(responce.data["message"]);

      // var r = confirm("Do you want take printout?");
      // if (r == true) {
      //   var parameters =
      //     "&degree_code=" +
      //     trim(responce.data["fdegree"]) +
      //     "&exam_no=" +
      //     trim("A") +
      //     "&appfrom=" +
      //     trim(responce.data["fappno"]) +
      //     "&appto=" +
      //     trim(responce.data["fappno"]);
      //   window.location.href = $host_url + "printApplication.demo" + parameters;
      // }

      $("#student_entry_degree_code").focus();
      LoadstudentEntryRUR("Add");
      document.getElementById("is_add_edit").value = "Add";
    } else {
      alert(responce.data);
    }
  } catch (err) {
    txt = err.message;
    alert(txt + "<br>" + responce);
  }
}

function showDegreeMarkEntry() {
  var yscnt = $("#nosemYear").val();
  var ystable = "";
  ystable +=
    "<tr  class='ui-state-default ui-jqgrid-hdiv' style = 'height:25px;'><td style='width:100px;padding:2px;  border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Sem / Year</td><td style='width:100px;padding:2px;  border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Month of Passing</td><td style='width:100px;padding:2px;  border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Year of Passing</td><td style='width:100px;padding:2px;  border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Secured Marks</td><td style='width:100px;padding:2px;  border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Maximum Marks</td><td style='padding:2px;  border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>% of Marks</td></tr>";
  for (var i = 1; i <= yscnt; i++) {
    ystable +=
      "<tr class='ui-widget-content jqgrow'><td class='tbl_row_new' align='center' style='border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px;'><input type='text' readonly id='semyear" +
      i +
      "' value=" +
      i +
      " style='width:100px;text-align:center;padding:5px 5px;'/></td><td class='tbl_row_new' align='center' style='border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px;'><input type='text' id='mnth_pass" +
      i +
      "' maxlength=3 style='width:100px;padding:5px 5px;text-transform: uppercase;'/></td><td class='tbl_row_new' align='center' style='border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px;'><input type='text' id='yearof_pass" +
      i +
      "' onkeypress='return acceptNumbersOnlyForModule(event);' maxlength='4' style='width:100px;padding:5px 5px;'/></td><td class='tbl_row_new' align='center' style='border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px;'><input type='text' id='marks_sec" +
      i +
      "' onkeypress='return acceptNumbersOnlyForModule(event);' style='width:100px;padding:5px 5px;'/></td><td class='tbl_row_new' align='center' style='border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px;'><input type='text' onkeypress='return acceptNumbersOnlyForModule(event);' id='marks_total" +
      i +
      "' onblur='calcuPercent(" +
      i +
      ")' style='width:100px;padding:5px 5px;'/></td><td class='tbl_row_new' align='center' style='border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px;'><input readonly id='marks_per" +
      i +
      "' style='padding:5px 5px;'></td></tr>";
  }
  ystable +=
    "<tr class='ui-widget-content jqgrow'><td style='padding:2px;  border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;;font-size:16px;text-align:center;' colspan='3'>Total </td><td class='tbl_row_new' align='center' style='border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px;'><input readonly type='text' id='marks_secTot' style='width:100px;padding:5px 5px;'/></td><td class='tbl_row_new' align='center' style='border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px;'><input type='text' readonly id='marks_subtotal'  style='width:100px;padding:5px 5px;'/></td><td ><input readonly id='marks_Avgper' style='padding:5px 5px;'></td></tr>";
  $("#symdytable").html(ystable);
}
var avgTotalPer = 0;
function calcuPercent(index) {
  var secrmarks = $("#marks_sec" + index).val();
  var maxmarks = $("#marks_total" + index).val();

  if (parseInt(maxmarks) < parseInt(secrmarks)) {
    alert("Maximum marks should be greater than Secured marks");
    $("#wghtAvgPer").val("");
    $("#marks_per" + index).val("");
    $("#marks_total" + index).val("");
    $("#marks_total" + index).focus();
    return false;
  }
  if (secrmarks != "" && maxmarks != "") {
    var pertage = (parseInt(secrmarks) / parseInt(maxmarks)) * 100;
    pertage = pertage.toFixed(2);
    $("#marks_per" + index).val(pertage);
  }

  var yscnt = $("#nosemYear").val();
  var secureTotal = 0;
  var maxTotal = 0;
  for (var j = 1; j <= yscnt; j++) {
    var secureVal = 0;
    var secure = $("#marks_sec" + j).val();
    if (secure != "") {
      secureVal = parseInt($("#marks_sec" + j).val());
    }
    secureTotal += secureVal;
    $("#marks_secTot").val(secureTotal);

    var maxMarks = $("#marks_total" + j).val();
    var maxVMarksVal = 0;
    if (maxMarks != "") {
      maxVMarksVal = parseInt($("#marks_total" + j).val());
    }
    maxTotal += maxVMarksVal;
    $("#marks_subtotal").val(maxTotal);
  }

  if (maxTotal != 0 && secureTotal != 0) {
    var totalpertage = (parseInt(secureTotal) / parseInt(maxTotal)) * 100;
    totalpertage = totalpertage.toFixed(2);
    avgTotalPer = totalpertage;
    //$("#seWeightedAverage").html(totalpertage);
    $("#marks_Avgper").val(totalpertage);
  }
}

function calcuWeightedAverageMarks() {
  var entrExamMarks = $("#entranceExamMarks").val();
  if (entrExamMarks > 0) {
    var wghtAvgTotalPer = (parseInt(avgTotalPer) + parseInt(entrExamMarks)) / 2;
    wghtAvgTotalPer = wghtAvgTotalPer.toFixed(2);
    //$("#seWeightedAverage").html(wghtAvgTotalPer);
    $("#wghtAvgPer").val(wghtAvgTotalPer);
  } else {
    //$("#seWeightedAverage").html(avgTotalPer);
    $("#wghtAvgPer").val(avgTotalPer);
  }
}

function acceptNumbersOnlyForModule(ev) {
  var keyCode = window.event ? ev.keyCode : ev.which;

  //codes for 0-9
  if (keyCode < 48 || keyCode > 57) {
    //codes for backspace, delete, enter
    if (keyCode != 0 && keyCode != 8 && keyCode != 13 && !ev.ctrlKey) {
      ev.preventDefault();
    }
  }
}

var boardDetails = [
  {
    Board: "Assam Higher Secondary Education Council",
    Address: "Bamunimaidam, Guwahati- 781 021.",
  },
  { Board: "Assam Sanskrit Board", Address: "Guwahati-781 019." },
  { Board: "BanasthaliVidyapeeth", Address: "Rajasthan." },
  { Board: "BanasthaliVidyapith", Address: "P.o.Banasthali Vidyapith-304022." },
  {
    Board: "Bihar School Examination Board Budh Marg",
    Address: "atna-800 001.",
  },
  {
    Board: "Bihar State Madrasa Education Board 5",
    Address: "idyapati Marg,Patana-800 001",
  },
  {
    Board: "Board of Intermediate Education (Andhra Pradesh)",
    Address: "VidyaBhavanNampally, Hyderabad-500001.",
  },
  {
    Board: "Board of School Education Haryana Hansi Road",
    Address: "Bhiwani-127 021.",
  },
  {
    Board: "Board of School Education Uttarakhand Ram Nagar",
    Address: "Nainital-244715",
  },
  {
    Board: "Board of Secondary Education Andhra Pradesh",
    Address: "Andhra Pradesh Chapel Road Nampally Hyderabad – 500001.",
  },
  {
    Board: "Board of Secondary Education Madhya Pradesh",
    Address: "Madhya Pradesh, Shivaji Nagar Bhopal - 462011",
  },
  {
    Board: "Board of Secondary Education Manipur",
    Address: "Manipur Imphal-795001",
  },
  {
    Board: "Board of Secondary Education Orissa",
    Address: "Orissa Bajrakabati Road, Cuttack-753001",
  },
  {
    Board: "Board of Secondary Education Assam",
    Address: "Bamunimaidam, Guwahati- 21.",
  },
  {
    Board: "Board of Secondary Education Rajasthan Jaipur Road",
    Address: "Ajmer 305001 (Rajasthan)",
  },
  {
    Board: "Central Board of Secondary Education 2",
    Address: "Community Centre, Shiksha Kendra, PreetVihar, Delhi-110301",
  },
  { Board: "Chattisgarh Madyamik Shiksha Mandal", Address: "" },
  {
    Board: "Chhatisgarh Board of Secondary Educa-tion",
    Address: "Pension Bada, Raipur- 492001",
  },
  {
    Board: "Chhatisgarh Madrasa Board",
    Address: "A-55, Street No. 4, KatoraTalab, (C.g.)",
  },
  {
    Board: "Chhatisgarh Sanskrit Board ",
    Address: "Raipur Pension Bada, Raipur - 492001",
  },
  {
    Board: "Chhatisgarh State Open School",
    Address: "Old Dpi office Building, Pension Bada, Raipur-492001",
  },
  {
    Board: "Council For The Indian School Certificate Examinations",
    Address: "Pragati House,3rd Floor 47/48, Nehru Place, New Delhi- 110 505..",
  },
  {
    Board: "Council of Higher Secondary Education Manipur",
    Address: "Manipur Babupura, Imphal (West) -795001",
  },
  {
    Board: "Council of Higher Secondary Education Orissa",
    Address: "Orissa, C-2 Pragnyapith, Samantapur Bhubaneshwar-751013.",
  },
  { Board: "Dayalbagh Educational Institute", Address: "Agra." },
  {
    Board: "Goa Board of Secondary And Higher Secondary Education Alto Betim",
    Address: "Berdez Goa – 403521.",
  },
  {
    Board: "Govt. of Karnataka Dept. of Pre-university Education",
    Address: "18th Cross, Sampige Road Malleswaram, Banglore 560012.",
  },
  {
    Board: "Gujarat Secondary And Higher Second ary Education Board",
    Address: "Sector 10b Near Old Sachivalaya, Gandhinagar- 382 010.",
  },
  {
    Board: "H P Board of School Education GayanaLokParisar",
    Address: "Civil Lines Dharamsala, Kangra(h.p) 176700.",
  },
  {
    Board: "J & K State Board of School Education Rehari Colony",
    Address: "Jammu-180 005.",
  },
  { Board: "JamiaMiliaIslamia", Address: "New Delhi." },
  {
    Board: "Jharkhand Academic Council",
    Address: "anchiGyandeep Campus,Bargawan,Namkum, Ranchi- 834 010.",
  },
  {
    Board: "Karnataka Secondary Education Examination Board",
    Address: "6th Cross Malleswaram, Bangalore-560003",
  },
  {
    Board: "Kerala Board of Higher Secondary Edu-cation",
    Address:
      "Housing Board, Buildings, Santhi Nagar Thiruvananthapuram-695001.",
  },
  {
    Board: "Kerala Board of Public Examination PareekshaBhawan",
    Address:
      "Poojapura, Thiruvananthapuram - 695012 Thiruvananthapuram, Kerala.",
  },
  {
    Board:
      "M. P. State Open School School Education Department Govt. of MpShivaji Nagar",
    Address: "Bhopal- 462011 . (M.P.)",
  },
  {
    Board:
      "Maharashtra State Board of Secondary And Higher Secondary Educa-tion",
    Address:
      "S. R. No. 832 A, Final Plot No. 178, 179, Near Balchitravani, Behind AgharkarReserachInstitue, Bhamburda, Shivajinagar , Pune-411004",
  },
  {
    Board: "Maharishi Patanjali Sanskrit Sansthan (Dept. of School Education",
    Address: "Govt. of M.p.) Tulsinagar, Bhopal (M. P.) 462003",
  },
  {
    Board: "Meghalaya Board of School Education West Garo Hills",
    Address: "Tura, Meghalaya 794001",
  },
  { Board: "Mizoram Board of School Education", Address: "Aizawl-796012" },
  {
    Board: "Nagaland Board of School Education",
    Address: "Post Box 613 Kohima - 797001",
  },
  {
    Board: "National Institute of Open Schooling",
    Address:
      "A-24-25 institutional Area, Nh-24 Sector-62,Noida- 201309 Distt.-gautamBudh Nagar(up)",
  },
  {
    Board: "Punjab School Education Board VidhyaBhawan",
    Address: "Sas Nagar Phase-8, Mohali- 160059",
  },
  {
    Board: "Rajasthan State Open School",
    Address: "Jaipur 2-2 A, JhalanaDoongri, Jaipur - 302004 (Rajsthan)",
  },
  {
    Board:
      "Tamilnadu State Board of School Exami nations & Board of Higher Secondary Examinations",
    Address:
      "Tamil Nadu Directorate of Govt. Examinations College Road, Chennai 600006.",
  },
  {
    Board:
      "Tripura Board of Secondary Education Pandit Nehru Complex (GurkhaBasti)",
    Address: "P.o.Kunjaban, Agartala-799006, Tripura West.",
  },
  {
    Board: "U.p. Board of High School & Intermedi-ate Education",
    Address: "Allahabad -211001.",
  },
  { Board: "UttaranchalShiksha EVAM ParikshaParishad.", Address: "" },
  { Board: "VishwaBharti University", Address: "Shantiniketan, Birbhoom, WB." },
  {
    Board: "West Bengal Board of Madrasah Education",
    Address:
      "Begum RokaiyaBhavan 19 Haji Md. Mohsin, Square, Kolkata - 700016.",
  },
  {
    Board:
      "West Bengal Board of Primary Education AcharyaPrafullaChanderBhavanDk 7/1",
    Address: "Sector-2, Salt Lake City, Kolkata-700091.",
  },
  {
    Board: "West Bengal Board of Secondary Educa-tion",
    Address: "NiveditaBhawan, Dj8, Sector Ii, Salt Lake, Kolkata-700091",
  },
  {
    Board: "West Bengal Council of Higher Secondary Education",
    Address:
      "VidyaSagar Bhavan,9/ 2,D.j.block, Sector-ii , Bidhannagar, Kolkata 700091",
  },
  {
    Board: "West Bengal Council of Rabindra OpenSchooling",
    Address: "BikashBhavan (2nd Floor, East Block) Salt Lake, Kolkata-700091.",
  },
];

function populateBoards() {
  //seUniversityName
  var options = `<option value="">--Select--</option>`;

  boardDetails.sort(function (a, b) {
    var nameA = a.Board.toLowerCase(),
      nameB = b.Board.toLowerCase();
    if (nameA < nameB)
      //sort string ascending
      return -1;
    if (nameA > nameB) return 1;
    return 0;
  });
  boardDetails.forEach(function (board) {
    options += `<option value="${board.Board}">${board.Board}</option>`;
  });
  $("#seUniversityName").html(options);
  $("#seUniversityName10").html(options);
}

function GetBoardAddress(obj) {
  var matchedBoard = boardDetails.filter(function (board) {
    return board.Board == obj.value;
  });

  $("#univaddres").val(matchedBoard[0].Address);
}

function GetBoardAddress10(obj) {
  var matchedBoard = boardDetails.filter(function (board) {
    return board.Board == obj.value;
  });

  $("#univaddres10").val(matchedBoard[0].Address);
}

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 calcPercent() {
  if ($("#maxmarks").val() == "") {
    alert("Enter Maximum Marks");
    return;
  }
  if ($("#secmarks").val() == "") {
    alert("Enter Secured Marks");
    return;
  }
  $("#percentage").val(
    (
      (parseFloat($("#secmarks").val()) * 100) /
      parseFloat($("#maxmarks").val())
    ).toFixed(2)
  );
}

function calcPercent10() {
  if ($("#maxmarks10").val() == "") {
    alert("Enter SSLC Maximum Marks");
    return;
  }
  if ($("#secmarks10").val() == "") {
    alert("Enter Secured Marks");
    return;
  }
  $("#percentage10").val(
    (
      (parseFloat($("#secmarks10").val()) * 100) /
      parseFloat($("#maxmarks10").val())
    ).toFixed(2)
  );
}

var states = [
  "Andhra Pradesh",
  "Arunachal Pradesh",
  "Assam",
  "Bihar",
  "Chhattisgarh",
  "Goa",
  "Gujarat",
  "Haryana",
  "Himachal Pradesh",
  "Jammu and Kashmir",
  "Jharkhand",
  "Karnataka",
  "Kerala",
  "Madhya Pradesh",
  "Maharashtra",
  "Manipur",
  "Meghalaya",
  "Mizoram",
  "Nagaland",
  "Odisha",
  "Punjab",
  "Rajasthan",
  "Sikkim",
  "Tamil Nadu",
  "Telangana",
  "Tripura",
  "Uttar Pradesh",
  "Uttarakhand",
  "West Bengal",
  "Andaman and Nicobar Islands",
  "Chandigarh",
  "Dadra and Nagar Haveli",
  "Daman and Diu",
  "Lakshadweep",
  "National Capital Territory of Delhi",
  "Puducherry (Pondicherry)",
];

function boardPopHtml(evt, type) {
  gtype = type;
  var kC = evt.which ? evt.which : evt.keyCode;
  if (kC == 112 || kC == 1) {
    //F1 Key code
  } else {
    return;
  }
  $search = false;
  $("#dialog").dialog("open");
  $("#dialog").data("height.dialog", 222);
  $(".ui-dialog").css({ width: 460 });
  $("#ui-dialog-title-dialog").html("Board Details");

  $main =
    "<table id='table_grid3' class='scroll' ondblclick='SelectBoardCode();'></table>";
  $main +=
    "<div  id='sub_grid_div3' class='scroll' style='text-align:center;'></div>";
  document.getElementById("dialog").innerHTML = $main;

  var college = jQuery("#table_grid3")
    .jqGrid({
      url: $host_url + "BoardDetailsPopup.demo&search=" + $search,
      datatype: "json",
      colNames: ["Code", "State", "Board Name"],
      colModel: [
        { name: "fboardcode", index: "fboardcode", width: 10 },
        { name: "fboardsate", index: "fboardsate", width: 20 },
        { name: "fboardname", index: "fboardname", width: 70 },
      ],
      rowNum: 10,
      rowList: [5, 10, 15, 20, 25, 30],
      imgpath: $image_path,
      pager: jQuery("#sub_grid_div3"),
      sortname: "id",
      height: "119",
      width: "457",
      viewrecords: true,
      sortorder: "",
      multiselect: false,
      cellEdit: true,
      addCaption: "Add Recordddd",
    })
    .navGrid(
      "#sub_grid_div3",
      { edit: false, add: false, del: true, search: true },
      {},
      {},
      {},
      { multipleSearch: true }
    )
    .navButtonAdd("#sub_grid_div3", {
      caption: "Search",
      buttonicon: "ui-icon-search",
      onClickButton: function () {
        college[0].toggleToolbar();
      },
    })
    .navButtonAdd("#sub_grid_div3", {
      caption: "Select",
      onClickButton: function () {
        SelectBoardCode();
      },
    });

  college.filterToolbar();
}

function SelectBoardCode() {
  var id = jQuery("#table_grid3").getGridParam("selrow");
  if (id != null) {
    $.ajax({
      type: "POST",
      async: false,
      url: $host_url + "getBoardNames.demo",
      data: "board_id=" + id,
      success: PopulateBoardResponse,
    });
    $("#dialog").dialog("close");
  } else {
    alert("Please select row");
  }
  return;
}

function PopulateBoardResponse($responce) {
  $responce = eval("(" + $responce + ")");

  if ($responce.error_code == 0) {
    //univphoneno10
    if (gtype == "10") {
      document.getElementById("seUniversityid10").value =
        $responce.data["fboardcode"];
      document.getElementById("seUniversityName10").value =
        $responce.data["fboardname"];
      document.getElementById("univaddres10").value =
        $responce.data["faddress"];
      document.getElementById("univphoneno10").value =
        $responce.data["fphoneno"];
      document.getElementById("sePADState10").value =
        $responce.data["fboardsate"];
    } else if (gtype == "puc") {
      document.getElementById("seUniversityid").value =
        $responce.data["fboardcode"];
      document.getElementById("seUniversityName").value =
        $responce.data["fboardname"];
      //document.getElementById("univaddres").value = $responce.data["faddress"];
      //document.getElementById("univphoneno").value = $responce.data["fphoneno"];
      // document.getElementById("sePADState").value =
      //   $responce.data["fboardsate"];
    }
  }
}
var gtype = "";
function getBoardNames(type) {
  var id = null;
  gtype = type;
  if (type == "10") {
    id = $("#seUniversityid10").val();
  } else if (type == "puc") {
    id = $("#seUniversityid").val();
  }

  if (id != null) {
    $.ajax({
      type: "POST",
      async: false,
      url: $host_url + "getBoardNames.demo",
      data: "board_id=" + id,
      success: PopulateBoardResponse,
    });
  } else {
    alert("Please select row");
  }
  return;
}

function adddyrow() {
  if ($("#qalsemdet tr").length > 0)
    var last_row_id = $("#qalsemdet tr.ui-widget-content td input");

  var ids = $("#qalsemdet tr").length;

  var rowIncrId = parseInt(ids) - 1;
  var i = parseInt(ids) - 2;
  var semsub = $("#subsem1_" + i).val();
  var semmo1 = $("#subsem1mo_" + i).val();
  var semmm1 = $("#subsem1mm_" + i).val();
  var semmo2 = $("#subsem2mo_" + i).val();
  var semmm2 = $("#subsem2mm_" + i).val();
  var semmo3 = $("#subsem3mo_" + i).val();
  var semmm3 = $("#subsem3mm_" + i).val();
  var semmo4 = $("#subsem4mo_" + i).val();
  var semmm4 = $("#subsem4mm_" + i).val();
  var semmo5 = $("#subsem5mo_" + i).val();
  var semmm5 = $("#subsem5mm_" + i).val();
  var semmo6 = $("#subsem6mo_" + i).val();
  var semmm6 = $("#subsem6mm_" + i).val();

  if (
    semmo1 == "" ||
    semmo2 == "" ||
    semmo3 == "" ||
    semmo4 == "" ||
    semmo5 == "" ||
    semmo6 == "" ||
    semmm1 == "" ||
    semmm2 == "" ||
    semmm3 == "" ||
    semmm4 == "" ||
    semmm5 == "" ||
    semmm6 == "" ||
    semsub == ""
  ) {
    alert("Please enter all the details");
    return;
  }

  var trRow = `
	<tr style='font-size:12px;' id = "${rowIncrId}" class='ui-widget-content jqgrow'>
				<td class='tbl_row_new tdfirst'>${rowIncrId}.</td>
				<td class='tbl_row_new'>
					<input type="text" name="subsem1_${rowIncrId}"  id = "subsem1_${rowIncrId}" style="width: 175px !important;">
				</td>
				<td class='tbl_row_new'>
					<input type="text" name="subsem1mo_${rowIncrId}" onchange = "gettoal('${rowIncrId}')"  maxlength="3" onkeypress="return acceptNumbersOnlyForModule(event);" id = "subsem1mo_${rowIncrId}">
				</td>
				<td class='tbl_row_new'>
					<input type="text" name="subsem1mm_${rowIncrId}" onchange = "gettoal('${rowIncrId}')" maxlength="3" onkeypress="return acceptNumbersOnlyForModule(event);" id = "subsem1mm_${rowIncrId}">
				</td>
				<td class='tbl_row_new'  >
					<input type="text" name="subsem2mo_${rowIncrId}" onchange = "gettoal('${rowIncrId}')" maxlength="3" onkeypress="return acceptNumbersOnlyForModule(event);" id = "subsem2mo_${rowIncrId}">
				</td>
				<td class='tbl_row_new' width="50px">
					<input type="text" name="subsem2mm_${rowIncrId}" onchange = "gettoal('${rowIncrId}')" maxlength="3" onkeypress="return acceptNumbersOnlyForModule(event);" id = "subsem2mm_${rowIncrId}">
				</td>
				<td class='tbl_row_new' >
					<input type="text" name="subsem3mo_${rowIncrId}" onchange = "gettoal('${rowIncrId}')" maxlength="3" onkeypress="return acceptNumbersOnlyForModule(event);" id = "subsem3mo_${rowIncrId}">
				</td>
				<td class='tbl_row_new' >
					<input type="text" name="subsem3mm_${rowIncrId}" onchange = "gettoal('${rowIncrId}')" maxlength="3" onkeypress="return acceptNumbersOnlyForModule(event);" id = "subsem3mm_${rowIncrId}">
				</td>
				<td class='tbl_row_new' >
					<input type="text" name="subsem4mo_${rowIncrId}" onchange = "gettoal('${rowIncrId}')" maxlength="3" onkeypress="return acceptNumbersOnlyForModule(event);" id = "subsem4mo_${rowIncrId}">
				</td>
				<td class='tbl_row_new' >
					<input type="text" name="subsem4mm_${rowIncrId}" onchange = "gettoal('${rowIncrId}')" maxlength="3" onkeypress="return acceptNumbersOnlyForModule(event);" id = "subsem4mm_${rowIncrId}">
				</td>
				<td class='tbl_row_new' >
					<input type="text" name="subsem5mo_${rowIncrId}" onchange = "gettoal('${rowIncrId}')" maxlength="3" onkeypress="return acceptNumbersOnlyForModule(event);" id = "subsem5mo_${rowIncrId}">
				</td>
				<td class='tbl_row_new'>
					<input type="text" name="subsem5mm_${rowIncrId}" onchange = "gettoal('${rowIncrId}')" maxlength="3" onkeypress="return acceptNumbersOnlyForModule(event);" id = "subsem5mm_${rowIncrId}">
				</td>
				<td class='tbl_row_new' >
					<input type="text" name="subsem6mo_${rowIncrId}" onchange = "gettoal('${rowIncrId}')" maxlength="3" onkeypress="return acceptNumbersOnlyForModule(event);" id = "subsem6mo_${rowIncrId}">
				</td>
				<td class='tbl_row_new' >
					<input type="text" name="subsem6mm_${rowIncrId}" onchange = "gettoal('${rowIncrId}')" maxlength="3" onkeypress="return acceptNumbersOnlyForModule(event);" id = "subsem6mm_${rowIncrId}">
				</td>
				<td class='tbl_row_new'>
					<input type="text" name="subtotalmo_${rowIncrId}" maxlength="4" readonly onkeypress="return acceptNumbersOnlyForModule(event);" id = "subtotalmo_${rowIncrId}">
				</td>
				<td class='tbl_row_new'>
					<input type="text" name="subtotalmm_${rowIncrId}" maxlength="4" readonly onkeypress="return acceptNumbersOnlyForModule(event);" id = "subtotalmm_${rowIncrId}">
				</td>
				<td class='tbl_row_new'>
					<input type="text" name="subpercentagemm_${rowIncrId}" maxlength="5" readonly onkeypress="return acceptNumbersOnlyForModule(event);" style="width: 40px !important;" id = "subpercentagemm_${rowIncrId}">
				</td>
				<td class='tbl_row_new'>
					<span onclick="adddyrow()"><img src='images/add.png' style="width:22px; height:25px;"></span>
					<span onclick="removedyrow('${rowIncrId}')">
						<img src='images/remove.png' style="float: right;width:22px;height:26px;">
					</span>
				</td>
			</tr>`;

  $("#qalsemdet").append(trRow);
}

function removedyrow(id) {
  var r = confirm("Are you sure you want to delete the Record");

  if (r) {
    $("#" + id).remove();
  } else {
  }

  $("#qalsemdet tr.ui-widget-content").each((i, el) => {
    $(el)
      .find("td.tdfirst")
      .html(++i + ".");
  });
}

function gettoal(i) {
  var semmo1 = $("#subsem1mo_" + i).val();
  var semmm1 = $("#subsem1mm_" + i).val();

  if (semmo1 > semmm1 && semmm1 != "") {
    alert("sem 1 obtained marks is greater than the max. marks");
    $("#subsem1mm_" + i).val("");
    $("#subsem1mo_" + i).val("");
    $("#subsem1mo_" + i).focus();
    return;
  }
  var semmo2 = $("#subsem2mo_" + i).val();
  var semmm2 = $("#subsem2mm_" + i).val();

  if (semmo2 > semmm2 && semmm2 != "") {
    alert("sem 2 obtained marks is greater than the max. marks");
    $("#subsem2mm_" + i).val("");
    $("#subsem2mo_" + i).val("");
    $("#subsem2mo_" + i).focus();
    return;
  }

  var semmo3 = $("#subsem3mo_" + i).val();
  var semmm3 = $("#subsem3mm_" + i).val();

  if (semmo3 > semmm3 && semmm3 != "") {
    alert("sem 3 obtained marks is greater than the max. marks");
    $("#subsem3mm_" + i).val("");
    $("#subsem3mo_" + i).val("");
    $("#subsem3mo_" + i).focus();
    return;
  }

  var semmo4 = $("#subsem4mo_" + i).val();
  var semmm4 = $("#subsem4mm_" + i).val();

  if (semmo4 > semmm4 && semmm4 != "") {
    alert("sem 4 obtained marks is greater than the max. marks");
    $("#subsem4mm_" + i).val("");
    $("#subsem4mo_" + i).val("");
    $("#subsem4mo_" + i).focus();
    return;
  }

  var semmo5 = $("#subsem5mo_" + i).val();
  var semmm5 = $("#subsem5mm_" + i).val();

  if (semmo5 > semmm5 && semmm5 != "") {
    alert("sem 5 obtained marks is greater than the max. marks");
    $("#subsem5mm_" + i).val("");
    $("#subsem5mo_" + i).val("");
    $("#subsem5mo_" + i).focus();
    return;
  }

  var semmo6 = $("#subsem6mo_" + i).val();
  var semmm6 = $("#subsem6mm_" + i).val();

  if (semmo6 > semmm6 && semmm6 != "") {
    alert("sem 6 obtained marks is greater than the max. marks");
    $("#subsem6mm_" + i).val("");
    $("#subsem6mo_" + i).val("");
    $("#subsem6mo_" + i).focus();
    return;
  }

  var totobt = "";
  var totmarks = "";

  if (
    semmo1 != "" &&
    semmo2 != "" &&
    semmo3 != "" &&
    semmo4 != "" &&
    semmo5 != "" &&
    semmo6 != ""
  ) {
    totobt =
      parseInt(semmo1) +
      parseInt(semmo2) +
      parseInt(semmo3) +
      parseInt(semmo4) +
      parseInt(semmo5) +
      parseInt(semmo6);
    $("#subtotalmo_" + i).val(totobt);
  }

  if (
    semmm1 != "" &&
    semmm2 != "" &&
    semmm3 != "" &&
    semmm4 != "" &&
    semmm5 != "" &&
    semmm6 != ""
  ) {
    totmarks =
      parseInt(semmm1) +
      parseInt(semmm2) +
      parseInt(semmm3) +
      parseInt(semmm4) +
      parseInt(semmm5) +
      parseInt(semmm6);
    $("#subtotalmm_" + i).val(totmarks);
    var totpercetage = (parseInt(totobt) / parseInt(totmarks)) * 100;
    $("#subpercentagemm_" + i).val(totpercetage);
  }
}

function getstudfee() {
  $.ajax({
    type: "POST",
    async: false,
    url: $host_url + "getstudfee",
    data:
      "aqty=" +
      $("#aqty").val() +
      "&asty=" +
      $("#asty").val() +
      "&degree=" +
      $("#student_entry_degree_code").val(),
    success: getstudfeeResponse,
  });
}

function getstudfeeResponse($responce) {
  $responce = eval("(" + $responce + ")");

  if ($responce.error_code == 0) {
    $("#txtUnvRegFee").val($responce.data.fee);
  }
}

function GetCombinationFeeListRUR() {
  if (jQuery.trim($("#student_entry_degree_code").val()) != "") {
    $sl_no = encodeURIComponent(trim($("#student_entry_admno").val()));
    $.ajax({
      type: "POST",
      async: false,
      url: $host_url + "GetCombinationFeeListRUR",
      data:
        "degree_code=" +
        $("#student_entry_degree_code").val() +
        "&exam=" +
        $("#student_entry_exam").val() +
        "&state=" +
        $("#student_entry_state").val(),
      success: GetCombinationFeeListRURResponse,
    });
  }
}
function GetCombinationFeeListRURResponse($responce) {
  $responce = eval("(" + $responce + ")");

  $("#fee_combination_div").html($responce.data.html);
}

function loadAdmStudDoc() {
  $.ajax({
    type: "POST",
    async: false,
    url: $host_url + "GetUploadedStudentDocumentsRUR",
    data:
      "&degree=" +
      $("#student_entry_degree_code").val() +
      "&appno=" +
      $("#student_entry_admno").val(),
    success: function (responce) {
      responce = eval("(" + responce + ")");

      $("#sedocs_div").html(responce.data);
    },
  });
}



function loadNEPSubdet() {
  if (jQuery.trim($("#student_entry_degree_code").val()) != "") {
    $sl_no = encodeURIComponent(trim($("#student_entry_admno").val()));
    $.ajax({
      type: "POST",
      async: false,
      url: $host_url + "loadNEPSubdet",
      data:
        "degree_code=" +
        $("#student_entry_degree_code").val() +
        "&exam=" +
        $("#student_entry_exam").val() ,
      success: loadNEPSubdetResponse,
    });
  }
}

function loadNEPSubdetResponse(responce) {
  responce = eval("(" + responce + ")");

  $('#nepsubject_appearing').html(responce.data['html']); 
  let madsub = responce.data['madsub'];

  madsub.forEach(element => {
    let sub = element.subcode.split(",");
    let fsubtype = element.fsubtype;
    let sublen = sub.length;
    let z =0;

    for(let i =1;i<=element.ftotsub;i++)
    {
      if(z < sublen)
      {
        $(`#${fsubtype}${i}`).val(sub[z]);
        document.getElementById(`${fsubtype}${i}`).disabled = true;
      }else
      {

      }  
      z++;
    }
  });
 let  $sub_arr2 = new Object();
  let $n=0;
  $("#nepsubject_appearing select").each(function()
  {
    $sub_arr2[$n] = new Object();
    $sub_arr2[$n]["sub_code"] = $(this).val();
    $n++;
  });

  var myJSONText = encodeURIComponent(JSON.stringify($sub_arr2));
  list_data = "&sub_arr2=" + myJSONText;
  console.log(list_data);

}