0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 3.142.198.148


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

/*
 *
 * FOR THE CANDIDATE list ENTRY FORM
 * PROGRAMED BY Natesha
 * DATE: 13/03/09
 * TIME: 1:15 PM
 *
 */
$g_total_count_of_each_div = 0;
$g_student_reg_no_exam_details = "";
window.location.g_FeePopUpExamNo = "";
window.location.fee_exam_A = "";
window.location.fee_exam_B = "";
window.location.fee_exam_C = "";
window.location.fee_exam_D = "";
window.location.fee_exam_E = "";
window.location.fee_exam_F = "";
window.location.fee_exam_G = "";
window.location.fee_exam_H = "";
window.location.fee_exam_I = "";
window.location.fee_exam_J = "";
var stuDegree = "";
function LoadcandidateList() {
  $("#page_main_div").load("../html_modules/candidate_list.html", function() {
    window.location.g_FeePopUpExamNo = "";
    //	$("#go").attr("disabled", false);
    //$("span").css("pointer-events", "auto");

    document.getElementById("display_module_name").innerHTML = "Candidate List";
    document.getElementById("module_name_for_save").value = "candidate_list";
    document.getElementById("is_add_edit").value = "Add";

    clearcandidateList();
    $("#candidate_list_reg_no").focus();
    $("#error_msg").html("");
    $("#candidate_list_reg_no_details").html("");
    $("#candidate_list_reg_no_details").hide();

    $g_total_count_of_each_div = 0;
    $g_student_reg_no_exam_details = "";
    getDefaultHeadFooterLinks("Application Form");

    enableCandidateHeaderFields();
    $("#candidate_list_exam_A_details").hide();
    $("#candidate_list_exam_B_details").hide();
    $("#candidate_list_exam_C_details").hide();
    $("#candidate_list_exam_D_details").hide();
    $("#candidate_list_exam_E_details").hide();
    $("#candidate_list_exam_F_details").hide();
    $("#candidate_list_exam_G_details").hide();
    $("#candidate_list_exam_H_details").hide();
    $("#candidate_list_exam_I_details").hide();
    $("#candidate_list_exam_J_details").hide();
    $("#candidate_list_footer_details").hide();
    $("#candidate_list_photo").css(
      "left",
      $("#candidate_list_category").position()["left"] + 220
    );
    $("#student_entry_upload")
      .parent()
      .css("left", $("#candidate_list_category").position()["left"] + 220);
  });
  $("#candidate_list_reg_no").focus();
  $("#module_details_div").hide();
}

function PopulateExamTypeListCategory() {
  /* var degree=$("#candidate_list_degree_code").val();
	var reg_no=$("#candidate_list_reg_no").val();
	if(empty(degree))
	{
	alert("Degree cannot be empty");
	}
		$.ajax({
		type: "POST",
		data:"degree="+degree+"&reg_no="+reg_no,
		url: $host_url+"PopulateExamTypeListCategory",
		success: PopulateExamTypeListCategoryResponce
		}); */

  ckeakexamdate();
}
function PopulateExamTypeListCategoryResponce(responce) {
  responce = eval("(" + responce + ")");

  document.getElementById("candidate_list_category").options.length = 0;
  document.getElementById("FCONSTYPE").options.length = 0;
  var category = responce.data["category"];
  var FFEETYPE = responce.data["FFEETYPE"];

  var FCATEGORY = responce.data["FCATEGORY"];

  var FCONSTYPE = responce.data["FCONSTYPE"];

  $op = new Option("Select", 0);
  $op.id = 0; //specifying the id  for options
  document.getElementById("candidate_list_category").options.add($op);
  for ($i = 0; $i < category.length; $i++) {
    $op = new Option(category[$i]["value"], category[$i]["internal_code"]);
    $op.id = category[$i]["internal_code"]; //specifying the id  for options
    document.getElementById("candidate_list_category").options.add($op);
  }

  $op = new Option("Select", "");
  $op.id = 0; //specifying the id  for options
  document.getElementById("FCONSTYPE").options.add($op);
  document.getElementById("FCONSTYPE").options.length = 1;
  for ($i = 0; $i < FCONSTYPE.length; $i++) {
    $op = new Option(FCONSTYPE[$i]["value"], FCONSTYPE[$i]["internal_code"]);
    $op.id = FCONSTYPE[$i]["internal_code"]; //specifying the id  for options
    document.getElementById("FCONSTYPE").options.add($op);
  }

  if (FCATEGORY != "0") {
    $("#candidate_list_category").val(FCATEGORY);
  }
  $("#FCONSTYPE").val(FFEETYPE);
}

function clearcandidateList() {
  $("#candidate_list_degree_code").val("");
  $("#candidate_list_degree_name").val("");
  $("#candidate_list_reg_no").val("");
  $("#candidate_list_reg_name").val("");
  $("#Candidate_total_fee").html("");
  $("#candidate_list_date").val("");
  $("#candidate_list_receipt_no").val("");
  $("#candidate_list_remarks").val("");
  $g_total_exam_details = "";
  window.location.fee_exam_A = "";
  window.location.fee_exam_B = "";
  window.location.fee_exam_C = "";
  window.location.fee_exam_D = "";
  window.location.fee_exam_E = "";
  window.location.fee_exam_F = "";
  window.location.fee_exam_G = "";
  window.location.fee_exam_H = "";
  window.location.fee_exam_I = "";
  window.location.fee_exam_J = "";
}

function displayCandidateEntryRegNoDetails() {
  //document.getElementById('go').disabled = true;
  //$("#go").attr("disabled", true);
  //$("span").css("pointer-events", "none");
  //$("span#go").off("click");
  //$("#go").hide();
  //$("#exam").hide();
  if (trim(document.getElementById("candidate_list_reg_no").value) == "") {
    alert("Please enter the Reg No");
    document.getElementById("candidate_list_reg_no").focus();
    return;
  }
  if (
    $("#candidate_list_category").val() == "0" ||
    empty($("#candidate_list_category").val())
  ) {
    return;
  }

  if (
    trim(document.getElementById("FCONSTYPE").value) == "" ||
    trim(document.getElementById("FCONSTYPE").value) == "0"
  ) {
    alert("Please Select Fee Type");
    //document.getElementById('FCONSTYPE').focus();
    return;
  }

  $.blockUI({
    message:
      "<h1 class='h1' style='font-size:12px'><img src='images/ajax-loader.gif' border='0'></h1>"
  });
  disableCandidateHeaderFields();
  $.ajax({
    type: "POST",
    async: false,
    data:
      "Regno=" +
      $("#candidate_list_reg_no").val() +
      "&degree=" +
      $("#candidate_list_degree_code").val() +
      "&category=" +
      $("#candidate_list_category").val() +
      "&li=" +
      $("#FCONSTYPE").val(),
    url: $host_url + "displayCandidateEntryRegNoDetails.demo",
    success: displayCandidateEntryRegNoDetailsResponse
  });
}

function displayCandidateEntryRegNoDetailsResponse($responce) {
  /* $responce = eval('(' + $responce + ')'); 
	if($responce.error_code==0)
		{
		disableCandidateHeaderFields();
		$g_total_count_of_each_div=$responce.data.total_count_of_each_div;
		$g_student_reg_no_exam_details=$responce.data.table_data;
		if($("#candidate_list_category").val()=="0")
		$("#candidate_list_category").val($responce.data.table_data.FCATEGORY);
		//$("#candidate_list_gender").val($responce.data.table_data.Fgender);
		$("#candidate_list_reg_no_details").html($responce.data.html_data);
		$("#candidate_list_reg_no_details").show();
		 $("#candidate_list_exam_A_details").html("");
		$("#candidate_list_exam_B_details").html("");
		$("#candidate_list_exam_C_details").html("");
		$("#candidate_list_exam_D_details").html("");
		$("#candidate_list_exam_E_details").html("");
		$("#candidate_list_exam_F_details").html("");
		$("#candidate_list_exam_G_details").html("");
		$("#candidate_list_exam_H_details").html("");
		$("#candidate_list_exam_I_details").html("");
		$("#candidate_list_exam_J_details").html("");
		$("#Candidate_total_fee").html('');	
		$("#candidate_list_date").val('');	
		$("#candidate_list_receipt_no").val('');	
		$("#candidate_list_remarks").val('');

		$("#candidate_list_exam_A_details").html($responce.data.candidate_list_exam_A_details);
		$("#candidate_list_exam_B_details").html($responce.data.candidate_list_exam_B_details);
		$("#candidate_list_exam_C_details").html($responce.data.candidate_list_exam_C_details);
		$("#candidate_list_exam_D_details").html($responce.data.candidate_list_exam_D_details);
		$("#candidate_list_exam_E_details").html($responce.data.candidate_list_exam_E_details);
		$("#candidate_list_exam_F_details").html($responce.data.candidate_list_exam_F_details);
		$("#candidate_list_exam_G_details").html($responce.data.candidate_list_exam_G_details);
		$("#candidate_list_exam_H_details").html($responce.data.candidate_list_exam_H_details);
		$("#candidate_list_exam_I_details").html($responce.data.candidate_list_exam_I_details);
		$("#candidate_list_exam_J_details").html($responce.data.candidate_list_exam_J_details);
		
		$("#candidate_list_date").val($responce.data.date);
		$("#candidate_list_receipt_no").val($g_student_reg_no_exam_details.FRECPTNO);
		$("#candidate_list_date").val(($g_student_reg_no_exam_details.FRECPTDATE));
		$("#candidate_list_remarks").val($g_student_reg_no_exam_details.FREMARKS);
		 
		document.getElementById("cand_entry_A").checked=true;
		showExamNosDiv('candidate_list_exam_A_details');
		$("#candidate_list_footer_details").show();		
		GetCandidateListPhoto();
		} */
  //document.getElementById('go').disabled = false;
  //$("#go").attr("disabled", false);
  //$("span").css("pointer-events", "auto");
  //$("#go").show();
  //$("#exam").show();
  $.unblockUI();
  $responce = eval("(" + $responce + ")");

  if ($responce.error_code == 0) {
    $g_total_count_of_each_div = $responce.data.total_count_of_each_div;
    $g_student_reg_no_exam_details = $responce.data.table_data;
    if ($("#candidate_list_category").val() == "0")
      $("#candidate_list_category").val($responce.data.table_data.FCATEGORY);
    //$("#candidate_list_gender").val($responce.data.table_data.Fgender);
    $("#candidate_list_reg_no_details").html($responce.data.html_data);
    $("#candidate_list_reg_no_details").show();
    $("#candidate_list_exam_A_details").html("");
    $("#candidate_list_exam_B_details").html("");
    $("#candidate_list_exam_C_details").html("");
    $("#candidate_list_exam_D_details").html("");
    $("#candidate_list_exam_E_details").html("");
    $("#candidate_list_exam_F_details").html("");
    $("#candidate_list_exam_G_details").html("");
    $("#candidate_list_exam_H_details").html("");
    $("#candidate_list_exam_I_details").html("");
    $("#candidate_list_exam_J_details").html("");
    $("#Candidate_total_fee").html("");
    $("#candidate_list_date").val("");
    $("#candidate_list_receipt_no").val("");
    $("#candidate_list_remarks").val("");

    $("#candidate_list_exam_A_details").html(
      $responce.data.candidate_list_exam_A_details
    );
    $("#candidate_list_exam_B_details").html(
      $responce.data.candidate_list_exam_B_details
    );
    $("#candidate_list_exam_C_details").html(
      $responce.data.candidate_list_exam_C_details
    );
    $("#candidate_list_exam_D_details").html(
      $responce.data.candidate_list_exam_D_details
    );
    $("#candidate_list_exam_E_details").html(
      $responce.data.candidate_list_exam_E_details
    );
    $("#candidate_list_exam_F_details").html(
      $responce.data.candidate_list_exam_F_details
    );
    $("#candidate_list_exam_G_details").html(
      $responce.data.candidate_list_exam_G_details
    );
    $("#candidate_list_exam_H_details").html(
      $responce.data.candidate_list_exam_H_details
    );
    $("#candidate_list_exam_I_details").html(
      $responce.data.candidate_list_exam_I_details
    );
    $("#candidate_list_exam_J_details").html(
      $responce.data.candidate_list_exam_J_details
    );

    $("#candidate_list_date").val($responce.data.date);
    stuDegree = $responce.data.degree;
    $("#candidate_list_receipt_no").val(
      $g_student_reg_no_exam_details.FRECPTNO
    );
    $("#candidate_list_date").val($g_student_reg_no_exam_details.FRECPTDATE);
    $("#candidate_list_remarks").val($g_student_reg_no_exam_details.FREMARKS);

    document.getElementById("cand_entry_A").checked = true;
    showExamNosDiv("candidate_list_exam_A_details");
    $("#candidate_list_footer_details").show();
    GetCandidateListPhoto();
  }
}
function hideAllDivs() {
  $("#candidate_list_reg_no_details").hide();
  $("#candidate_list_exam_A_details").hide();
  $("#candidate_list_exam_B_details").hide();
  $("#candidate_list_exam_C_details").hide();
  $("#candidate_list_exam_D_details").hide();
  $("#candidate_list_exam_E_details").hide();
  $("#candidate_list_exam_F_details").hide();
  $("#candidate_list_exam_G_details").hide();
  $("#candidate_list_exam_H_details").hide();
  $("#candidate_list_exam_I_details").hide();
  $("#candidate_list_exam_J_details").hide();
  $("#candidate_list_footer_details").hide();
}

function showExamNosDiv($id) {
  $div_id_split = $id.split("_");
  $char_code = $div_id_split[3];
  document.getElementById("cand_entry_" + $char_code).checked = true;
  $("#candidate_list_exam_A_details").hide();
  $("#candidate_list_exam_B_details").hide();
  $("#candidate_list_exam_C_details").hide();
  $("#candidate_list_exam_D_details").hide();
  $("#candidate_list_exam_E_details").hide();
  $("#candidate_list_exam_F_details").hide();
  $("#candidate_list_exam_G_details").hide();
  $("#candidate_list_exam_H_details").hide();
  $("#candidate_list_exam_I_details").hide();
  $("#candidate_list_exam_J_details").hide();
  $("#" + $id).show();
  CalculateGrandTotal();
}
function CalculateGrandTotal() {
  var grand_total = 0;
  var table_obj = $("table[id*='fee_table_']");
  jQuery.each(table_obj, function(k, v) {
    var char_id = v["id"].split("_")[2];
    i_total = $("#nfee_" + char_id + "_total").val();
    grand_total = eval(grand_total + parseFloat(i_total));
  });
  $("#Candidate_total_fee").html(grand_total);
}
function CalculateSubjectTotalOnchangeofFee() {}
function saveCandidateEntryDetails() {
  if (trim(document.getElementById("candidate_list_reg_no").value) == "") {
    alert("Please enter the Reg No");
    document.getElementById("candidate_list_reg_no").focus();
    return;
  } else if (trim(document.getElementById("candidate_list_date").value) == "") {
    alert("Please enter the Date");
    document.getElementById("candidate_list_date").focus();
    return;
  } else if (
    !isDate(document.getElementById("candidate_list_date").value, "d/M/y")
  ) {
    alert("Please Enter Valid date as dd//mm/yy");
    document.getElementById("candidate_list_date").focus();
    return;
  }
  var candidateMobile = document.getElementById("candidate_mobile").value;

  var parentMobile = document.getElementById("parent_mobile").value;

  var stu_email = document.getElementById("candidate_email").value;

  //################Check Empty Subjects Starts#################################
  for ($c_code = 65; $c_code < 75; $c_code++) {
    $char_code = String.fromCharCode($c_code);
    $div_id = "candidate_list_exam_" + $char_code + "_details";
    $div_id_total = "nfee_" + $char_code + "_total";
    $div_id_date = "exam_" + $char_code + "_date";
    if ($g_total_count_of_each_div[$div_id] > 0) {
      $checked_flag = 0;
      $total_rows = $g_total_count_of_each_div[$div_id];
      $n = 0;
      $exam_fee = parseFloat($("#" + $div_id_total).val());
      for ($k = 0; $k < $total_rows; $k++) {
        $input_id = "exam_" + $char_code + "_ce_sub_code_" + $k;
        $pass_id = "exam_" + $char_code + "_ce_pass_" + $k;
        $year_id = "exam_" + $char_code + "_ce_pass_" + $k;
        if (document.getElementById($year_id).checked == true)
          $checked_flag = 1;
        if (
          ($checked_flag == 0 && $exam_fee > 0) ||
          ($checked_flag == 1 && $exam_fee == 0.0)
        ) {
          /* if(trim($("#"+$input_id).val())=='')
					{
					showExamNosDiv($div_id);
					alert("Please select All Subjects..");
					$("#"+$input_id).focus();
					return;
					} */
        }
        /* if(!isDate(document.getElementById($div_id_date).value,'d/M/y'))
				{
				alert("Please enter the date format as dd/mm/yyy");
				showExamNosDiv($div_id);
				return;
				} */
      }
      if ($checked_flag == 0 && $exam_fee > 0) {
        alert("Please select any subject as you have entered Exam Fee");
        showExamNosDiv($div_id);
        $("#" + $div_id_total).focus();
        return;
      } else if ($checked_flag == 1 && $exam_fee == 0.0) {
        alert(
          "Please Enter the Exam Fee since you have allready selected subjects"
        );
        showExamNosDiv($div_id);
        $("#" + $div_id_total).focus();
        return;
      }
    }
  }
  //################Check Empty Subjects ENDS#################################
  showExamNosDiv("candidate_list_exam_A_details");
  $degree = trim(document.getElementById("candidate_list_degree_code").value);
  $reg_no = trim(document.getElementById("candidate_list_reg_no").value);

  $candidate_list_date = date_format(trim($("#candidate_list_date").val()));
  $candidate_list_receipt_no = encodeURIComponent(
    trim($("#candidate_list_receipt_no").val())
  );
  $candidate_list_remarks = encodeURIComponent(
    trim($("#candidate_list_remarks").val())
  );
  $total_fee = parseFloat(
    trim(document.getElementById("Candidate_total_fee").innerHTML)
  );
  $details = new Object();
  $fee_details = new Object();
  $sub_details = new Object();

  if ($total_fee <= 0) {
    alert("Total fee is Zero!");
    return false;
  }
  for ($c_code = 65; $c_code < 75; $c_code++) {
    $char_code = String.fromCharCode($c_code);
    $div_id = "candidate_list_exam_" + $char_code + "_details";
    $div_id_total = "nfee_" + $char_code + "_total";
    $div_id_receipt_no = "exam_" + $char_code + "_receipt_no";
    $div_id_date = "exam_" + $char_code + "_date";
    $app_id = "FAPPEAR" + $char_code;
    $details[$char_code] = new Object();
    $fee_details[$char_code] = new Object();
    $sub_details[$char_code] = new Object();
    $sub_fee = new Object();

    if (
      $g_total_count_of_each_div[$div_id] > 0 &&
      $g_student_reg_no_exam_details[$app_id] != "N" &&
      $g_student_reg_no_exam_details[$app_id] != "P"
    ) {
      $total_rows = $g_total_count_of_each_div[$div_id];
      $sub_arr = "";
      $sub_arr = "$exam_" + $char_code;
      $sub_arr = new Object();

      $sub_fee = "";
      $sub_fee = "$exam_" + $char_code;
      $sub_fee = new Object();
      $sub_fee[0] = new Object();
      $sub_fee[0]["total_fee"] = trim($("#" + $div_id_total).val());
      $sub_fee[0]["receipt_no"] = trim($("#" + $div_id_receipt_no).val());
      $sub_fee[0]["date"] = date_format(trim($("#" + $div_id_date).val()));
      $fee = "";
      $fee = "$exam_" + $char_code;
      $fee = new Object();

      $fee = eval("window.location.fee_exam_" + $char_code);
      $n = 0;
      for ($k = 0; $k < $total_rows; $k++) {
        $input_id = "exam_" + $char_code + "_ce_sub_code_" + $k;
        $pass_id = "exam_" + $char_code + "_ce_pass_" + $k;
        if (trim($("#" + $input_id).val()) != "") {
          $sub_arr[$n] = new Object();
          $sub_arr[$n]["sub"] = trim($("#" + $input_id).val());
          $sub_arr[$n]["opr"] = document.getElementById($input_id).name;
          $sub_arr[$n]["ex"] = $char_code;
          if (document.getElementById($pass_id).type == "checkbox") {
            if (document.getElementById($pass_id).checked == true)
              $sub_month_year = 1;
            else $sub_month_year = 0;
          } else $sub_month_year = -1;
          $sub_arr[$n]["smy"] = $sub_month_year;
          $n++;
        }
      }
      var myJSONText = "";
      myJSONText = $sub_arr;
      $details[$char_code] = myJSONText;
      var myJSONSubText = "";
      myJSONSubText = $sub_fee;
      $sub_details[$char_code] = myJSONSubText;
      var myJSONFeeText = "";
      myJSONFeeText = $fee;
      $fee_details[$char_code] = myJSONFeeText;
    } else {
      $details[$char_code] = "";
      $sub_fee[$char_code] = 0;
      $sub_fee[$char_code] = 0;
      $sub_fee[$char_code] = 0;
      $fee_details[$char_code] = 0;
    }
  }

  /*  $.ajax({
			 type: "POST",
		async:false,
			 data: "reg_no="+$reg_no+"&degree="+$degree+"&total_fee="+$total_fee+"&details="+encodeURIComponent(JSON.stringify($details))+"&sub_fee="+encodeURIComponent(JSON.stringify($sub_details))+"&fee_details="+encodeURIComponent(JSON.stringify($fee_details))+"&candidate_list_date="+$candidate_list_date+"&candidate_list_receipt_no="+$candidate_list_receipt_no+"&candidate_list_remarks="+$candidate_list_remarks,
			 url: $host_url+"saveCandidateEntryDetails.demo",
				 success: saveCandidateEntryDetailsResponse
		}); */

  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("Please Select the Valid Photo!");
    return false;
  }

  var new_fee_details = new Object();
  var table_obj = $("table[id*='fee_table_']");
  jQuery.each(table_obj, function(k, v) {
    var char_id = v["id"].split("_")[2];
    new_fee_details[char_id] = new Object();
    exam_fee_details = new Object();
    var fee_obj = $("td[id^='tfh_" + char_id + "_']");
    var i_total = 0;
    jQuery.each(fee_obj, function(fk, fv) {
      var input_id = fv["id"];
      var head_code = encodeURIComponent($("#" + input_id).text());
      var exam_code = fv["id"].split("_")[2];

      exam_fee_details[head_code] = $(
        "#nfee_" + char_id + "_" + exam_code
      ).val();
    });

    new_fee_details[char_id] = exam_fee_details;
  });

  var data =
    "&reg_no=" +
    $reg_no +
    "&degree=" +
    $degree +
    "&total_fee=" +
    $total_fee +
    "&details=" +
    JSON.stringify($details) +
    "&sub_fee=" +
    JSON.stringify($sub_details) +
    "&new_fee_details=" +
    JSON.stringify(new_fee_details) +
    "&candidate_list_date=" +
    $candidate_list_date +
    "&candidate_list_receipt_no=" +
    $candidate_list_receipt_no +
    "&candidate_list_remarks=" +
    $candidate_list_remarks;
  data += "&filepath=" + filepath;
  data +=
    "&unlink_file=" + encodeURIComponent($("#student_entry_photo").attr("src"));
  data +=
    "&category=" + encodeURIComponent($("#candidate_list_category").val());
  data += "&li=" + encodeURIComponent($("#FCONSTYPE").val());
  data += "&candidate_mobile=" + candidateMobile;
  data += "&parent_mobile=" + parentMobile;
  data += "&stu_email=" + stu_email;
  //console.log(data);return;
  var full_url = $host_url + "saveCandidateEntryDetails.demo&" + data;
  //console.log(full_url);
  document
    .getElementById("form_module_image_upload")
    .setAttribute("action", full_url);
  return AIM.submit(
    document.getElementById("form_module_image_upload"),
    "report_display",
    { onComplete: saveCandidateEntryDetailsResponse }
  );
  //return AIM.submit(document.getElementById("candidate_list_form"), 'new_tab',{'onComplete' : saveCandidateEntryDetailsResponse});report_display
  //form_module_image_upload
}

function saveCandidateEntryDetailsResponse($responce) {
  $responce = eval("(" + $responce + ")");
  alert($responce.data);
  $("#student_entry_photo").attr("src", "images/default_photo.jpg");
  /* var confirm_tag=confirm("Do You Want to Print Admission Ticket?")
	if(confirm_tag)
	{
	printCandidateAdmTicketRecord();
	} 
	else*/
  enableCandidateHeaderFields();
  candidateList();
} //BM111116
function UpdateExamFeeForEachSelectedSubject() {
  var degree = $("#candidate_list_degree_code").val();
  for ($c_code = 65; $c_code < 75; $c_code++) {
    $char_code = String.fromCharCode($c_code);
    $div_id = "candidate_list_exam_" + $char_code + "_details";

    $div_id_receipt_no = "exam_" + $char_code + "_receipt_no";
    $div_id_date = "exam_" + $char_code + "_date";
    $app_id = "FAPPEAR" + $char_code;

    if (
      $g_total_count_of_each_div[$div_id] > 0 &&
      $g_student_reg_no_exam_details[$app_id] != "N" &&
      $g_student_reg_no_exam_details[$app_id] != "P"
    ) {
      $total_rows = $g_total_count_of_each_div[$div_id];
      $sub_month_year = 0;
      var subject_wise_thr_pr_arr = new Object();
      var sub_cnt = 0;
      for ($k = 0; $k < $total_rows; $k++) {
        $input_id = "exam_" + $char_code + "_ce_sub_code_" + $k;
        $pass_id = "exam_" + $char_code + "_ce_pass_" + $k;
        if (trim($("#" + $input_id).val()) != "") {
          var sub_code = $("#" + $input_id).val();
          //alert(sub_code);
          if (document.getElementById($pass_id).type == "checkbox") {
            if (document.getElementById($pass_id).checked == true) {
              $sub_month_year = eval($sub_month_year + 1);
              if (sub_code != "None") {
                subject_wise_thr_pr_arr[sub_code] = new Object();
                subject_wise_thr_pr_arr[sub_code]["th_cnt"] = $(
                  "#exam_" + $char_code + "_th_cnt_" + $k
                ).val();
                subject_wise_thr_pr_arr[sub_code]["pr_cnt"] = $(
                  "#exam_" + $char_code + "_pr_cnt_" + $k
                ).val();
                sub_cnt++;
              }
            }
          }
        }
      }
      var fee_obj = $("input[id^='nfee_" + $char_code + "_']");
      jQuery.each(fee_obj, function(fk, fv) {
        var input_id = fv["id"];

        var min_val_input_id = input_id.replace("nfee_", "minnfee_");
        var o_val_input_id = input_id.replace("nfee_", "o_fee_");
        //alert($("#"+o_val_input_id).val());

        var prfee_input_id = input_id.replace("nfee_", "prfee_");
        var minnfee_val = parseFloat($("#" + min_val_input_id).val());

        var input_id_l = fv["id"].split("_")[2];
        var f_val = 0;

        var fresh_exam = $("#fresh_exam_" + $char_code).val();

        if (input_id_l != "total") {
          console.log("subject_wise_thr_pr_arr==>", subject_wise_thr_pr_arr);
          jQuery.each(subject_wise_thr_pr_arr, function(fkk, fvv) {
            pr_cnt = parseFloat(fvv["pr_cnt"]);

            th_cnt = parseFloat(fvv["th_cnt"]);

            var pra_exam_val = 0;
            var th_exam_val = 0;

            if (pr_cnt > 0)
              pra_exam_val = parseFloat(
                $("#" + prfee_input_id)
                  .val()
                  .trim()
              ); //*pr_cnt
            if (th_cnt > 0)
              th_exam_val = parseFloat(
                $("#" + o_val_input_id)
                  .val()
                  .trim()
              ); //*th_cnt

            if (fresh_exam != $char_code) {
              th_exam_val = parseFloat(
                $("#" + o_val_input_id)
                  .val()
                  .trim()
              );
            }
            console.log(
              "$char_code==>",
              $char_code,
              "==pr_cnt==>",
              pr_cnt,
              "==pra_exam_val==>",
              pra_exam_val
            );
            console.log(
              "$char_code==>",
              $char_code,
              "==th_cnt==>",
              th_cnt,
              "==th_exam_val==>",
              th_exam_val
            );

            f_val = eval(f_val + th_exam_val + pra_exam_val);
            console.log("f_val===eval==", f_val);
          });
          console.log("f_val===outside loop==", f_val);

          var fresh_exam = $("#fresh_exam_" + $char_code).val();

          /*if (fresh_exam != $char_code)// handling specificallly for univ code
					{
						if (degree == 'BBM' || degree == 'BBM2' || degree == 'BCA' || degree == 'BCA2') {
							if (sub_cnt >= 1) {
								f_val = minnfee_val;
							}
						}
						else if (sub_cnt > 2) {
							f_val = minnfee_val;
						}
					}*/

          if (parseFloat(f_val) > minnfee_val) {
            f_val = parseFloat(minnfee_val);
            //console.log('minnfee_val: '+f_val);
            $("#" + input_id).val(f_val);
          } else {
            $("#" + input_id).val(f_val);
            console.log("val:== ", input_id, f_val);
          }
        }
      });
    }
  }
  CalculateNewwFeeTotals();
}

function CalculateNewwFeeTotals() {
  var grand_total = 0;
  var table_obj = $("table[id*='fee_table_']");
  jQuery.each(table_obj, function(k, v) {
    var char_id = v["id"].split("_")[2];
    var fee_obj = $("input[id^='nfee_" + char_id + "_']");
    var i_total = 0;
    jQuery.each(fee_obj, function(fk, fv) {
      var input_id = fv["id"];

      var min_val_input_id = input_id.replace("nfee_", "minnfee_");
      var minnfee_val = parseFloat($("#" + min_val_input_id).val());
      var input_id_l = fv["id"].split("_")[2];

      if (input_id_l != "total") {
        var f_val = $("#" + input_id).val();
        if (parseFloat(f_val) > minnfee_val) {
          f_val = parseFloat(minnfee_val);
          $("#" + input_id).val(f_val);
        }

        i_total = eval(i_total + parseFloat(f_val));
      }
    });

    grand_total = eval(grand_total + parseFloat(i_total));
    $("#nfee_" + char_id + "_total").val(i_total);
    $("#ssub_fee_" + char_id).html(i_total);
  });
  $("#Candidate_total_fee").html(grand_total);
}
function disableCandidateHeaderFields() {
  //FCONSTYPE
  document.getElementById("FCONSTYPE").disabled = true;
  document.getElementById("candidate_list_category").disabled = true;
  document.getElementById("candidate_list_degree_code").disabled = true;
  document.getElementById("candidate_list_reg_no").disabled = true;
}
function enableCandidateHeaderFields() {
  document.getElementById("FCONSTYPE").disabled = false;
  document.getElementById("candidate_list_category").disabled = false;
  document.getElementById("candidate_list_degree_code").disabled = true;
  document.getElementById("candidate_list_reg_no").disabled = false;

  $("#candidate_list_reg_no").val("");
  $("#candidate_list_reg_name").val("");
  $("#Candidate_total_fee").html("");
  $("#candidate_list_date").val("");
  $("#candidate_list_receipt_no").val("");
  $("#candidate_list_remarks").val("");
  $g_total_exam_details = "";
  window.location.fee_exam_A = "";
  window.location.fee_exam_B = "";
  window.location.fee_exam_C = "";
  window.location.fee_exam_D = "";
  window.location.fee_exam_E = "";
  window.location.fee_exam_F = "";
  window.location.fee_exam_G = "";
  window.location.fee_exam_H = "";
  window.location.fee_exam_I = "";
  window.location.fee_exam_J = "";
  hideAllDivs();
  document.getElementById("candidate_list_degree_code").focus();
}
function checkAllCandidateSemisterSub($full_div_id) {
  $div_id_split = $full_div_id.split("^");
  $div_id = $div_id_split[0];
  $div_name = $div_id_split[1];
  if (document.getElementById($full_div_id).checked == true) {
    for ($k = 0; $k < $g_total_count_of_each_div[$div_id]; $k++) {
      document.getElementById(
        "exam_" + $div_name + "_ce_pass_" + $k
      ).checked = true;
    }
  } else if (document.getElementById($full_div_id).checked == false) {
    for ($k = 0; $k < $g_total_count_of_each_div[$div_id]; $k++) {
      document.getElementById(
        "exam_" + $div_name + "_ce_pass_" + $k
      ).checked = false;
    }
  }
  UpdateExamFeeForEachSelectedSubject();
}
function CheckCheckBoxIsChecked($div_id) {
  $div_id_split = $div_id.split("_");
  $char_code = $div_id_split[3];
  $div_id_total = $div_id + "_total";
  $exam_fee = parseFloat($("#" + $div_id_total).val());
  $checked_flag = 0;

  if ($g_total_count_of_each_div[$div_id] > 0) {
    $total_rows = $g_total_count_of_each_div[$div_id];
    for ($k = 0; $k < $total_rows; $k++) {
      $input_id = "exam_" + $char_code + "_ce_pass_" + $k;

      if (document.getElementById($input_id).checked == true) $checked_flag = 1;
    }
    if ($checked_flag == 0 && $exam_fee > 0) {
      alert("Please select any subject as you have entered Exam Fee");
      showExamNosDiv($div_id);
      $("#" + $div_id_total).focus();
      document.getElementById($div_id_total).focus();
      return;
    } else if ($checked_flag == 1 && $exam_fee == 0.0) {
      alert(
        "Please Enter the Exam Fee since you have allready selected subjects"
      );
      showExamNosDiv($div_id);
      $("#" + $div_id_total).focus();
      return;
    }
  }
}
function GetFeePopUp($exam) {
  window.location.g_FeePopUpExamNo = $exam;

  $("#dialog").dialog("open");
  $("#dialog").data("width.dialog", 430);
  //$("#dialog").css({height:195});
  $path = "../html_modules/GetFeePopUp.html";
  $("#ui-dialog-title-dialog").html("Fee Details");
  $("#dialog").html("");
  $("#dialog").load($path);

  /* var url = "../html_modules/GetFeePopUp.html?height=100&width=400";
	tb_show("Fee Details", url);  */
}

function printCandidateAdmTicketRecord() {
  window.location.href =
    $host_url +
    "generateAdmissionTicket.demo&degree_code=" +
    trim($("#candidate_list_degree_code").val()) +
    "&reg_starts=" +
    trim($("#candidate_list_reg_no").val()) +
    "&reg_ends=" +
    trim($("#candidate_list_reg_no").val());
  //myRef = window.open(window.location.g_rem_rpt,'mywin','left=20,top=20,width=500,height=500,toolbar=1,resizable=0');

  //window.location.href = $host_url+"generateAdmissionTicket.demo&degree_code="+trim(($("#candidate_list_degree_code").val()))+"&reg_starts="+trim(($("#candidate_list_reg_no").val()))+"&reg_ends="+trim(($("#candidate_list_reg_no").val()));
  //window.open(myRef,'welcome','width=300,height=200,menubar=yes,status=yes, location=yes,toolbar=yes,scrollbars=yes');
}
function GetCandidateListPhoto() {
  var degree = trim(
    document.getElementById("candidate_list_degree_code").value
  );
  var reg_no = trim(document.getElementById("candidate_list_reg_no").value);
  $.ajax({
    type: "POST",
    async: false,
    data: "degree=" + degree + "&reg_no=" + reg_no,
    url: $host_url + "GetCandidateListPhoto",
    success: GetCandidateListPhotoResponse
  });
}

function GetCandidateListPhotoResponse($responce) {
  $responce = eval("(" + $responce + ")");
  if ($responce.error_code == 0)
    $("#student_entry_photo").attr(
      "src",
      "http://logisys.net.in/gug/" + $responce.data
    );
  else if ($responce.error_code == -1)
    $("#student_entry_photo").attr("src", "images/default_photo.jpg");
}

/* function ckeakexamdate()
{
	$.ajax({
			type: "POST",
			//async:false,
			url: $host_url+"ckeakexamdate", 
			data:"degree="+trim(($("#candidate_list_degree_code").val())),
			success: ckeakexamdateResponse
	}); 
	
} 

function ckeakexamdateResponse($responce)
{
	$responce = eval('(' + $responce + ')');
	if($responce.error_code == '-1')
	{
		alert($responce.data);
		$("#candidate_list_reg_no").val('');	
		$("#candidate_list_reg_name").val('');	
		$("#Candidate_total_fee").html('');	
		$("#candidate_list_date").val('');	
		$("#candidate_list_receipt_no").val('');	
		$("#candidate_list_remarks").val('');	
		$("#candidate_list_degree_code").val('');
		$("#candidate_list_degree_name").val('');
		$g_total_exam_details='';
		window.location.fee_exam_A='';
		window.location.fee_exam_B='';
		window.location.fee_exam_C='';
		window.location.fee_exam_D='';
		window.location.fee_exam_E='';
		window.location.fee_exam_F='';
		window.location.fee_exam_G='';
		window.location.fee_exam_H='';
		window.location.fee_exam_I='';
		window.location.fee_exam_J='';
		hideAllDivs();
		document.getElementById('candidate_list_reg_no').focus();
		return;	
	}
} 
 */
function ckeakexamdate() {
  $.ajax({
    type: "POST",
    url: $host_url + "ckeakexamdate",
    data: "degree=" + trim($("#candidate_list_degree_code").val()),
    success: ckeakexamdateResponse
  });
}

function ckeakexamdateResponse($responce) {
  $responce = eval("(" + $responce + ")");
  if ($responce.error_code == "-1") {
    alert($responce.data);
    $("#candidate_list_reg_no").val("");
    $("#candidate_list_reg_name").val("");
    $("#Candidate_total_fee").html("");
    $("#candidate_list_date").val("");
    $("#candidate_list_receipt_no").val("");
    $("#candidate_list_remarks").val("");
    $("#candidate_list_degree_code").val("");
    $("#candidate_list_degree_name").val("");
    $g_total_exam_details = "";
    window.location.fee_exam_A = "";
    window.location.fee_exam_B = "";
    window.location.fee_exam_C = "";
    window.location.fee_exam_D = "";
    window.location.fee_exam_E = "";
    window.location.fee_exam_F = "";
    window.location.fee_exam_G = "";
    window.location.fee_exam_H = "";
    window.location.fee_exam_I = "";
    window.location.fee_exam_J = "";
    hideAllDivs();
    document.getElementById("candidate_list_reg_no").focus();
    return;
  }
  if ($responce.error_code == "1") {
    var degree = $("#candidate_list_degree_code").val();
    var reg_no = $("#candidate_list_reg_no").val();
    if (empty(degree)) {
      alert("Degree cannot be empty");
    }
    $.ajax({
      type: "POST",
      data: "degree=" + degree + "&reg_no=" + reg_no,
      url: $host_url + "PopulateExamTypeListCategory",
      success: PopulateExamTypeListCategoryResponce
    });
  }
}