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



Your IP : 18.116.10.48


Current Path : /var/www/oasis/css/
Upload File :
Current File : /var/www/oasis/css/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='';
function LoadcandidateList() 
{
	$("#page_main_div").load('../html_modules/candidate_list.html',function()
	{
		window.location.g_FeePopUpExamNo='';
		 
		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");
	} */
	ckeakexamdate();
	/* $.ajax({
	type: "POST",
	data:"degree="+degree+"&reg_no="+reg_no,
	url: $host_url+"PopulateExamTypeListCategory",
	success: PopulateExamTypeListCategoryResponce
	}); */
}
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 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);
		}
		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);
		}
		$("#candidate_list_category").val("GM");
	 
}
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()
{
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;
	$.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)
{
	 var funivcode= getCookie("univcode");

		$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;
	
		//if(funivcode=='005')
		//{

			
			for($c_code=65;$c_code<75;$c_code++)
			{
				
				$char_code=String.fromCharCode($c_code);
				
				console.log($char_code+" - "+$("#candidate_list_exam_"+$char_code+"_details").html());		

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

			/*	if($("#candidate_list_exam_"+$char_code+"_details").html() != '')
				{	
					document.getElementById('candidate_list_exam_'+fresh_exam+'_details^'+fresh_exam).checked=true;
					checkAllCandidateSemisterSub('candidate_list_exam_'+fresh_exam+'_details^'+fresh_exam);
					showExamNosDiv('candidate_list_exam_'+fresh_exam+'_details');
				}
*/
				if($("#candidate_list_exam_"+$char_code+"_details").html() != '')
				{	
					document.getElementById('candidate_list_exam_'+$char_code+'_details^'+$char_code).checked=true;
					checkAllCandidateSemisterSub('candidate_list_exam_'+$char_code+'_details^'+$char_code);
				}
			}
			
		//}
		//else		
		//	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;
		}
//################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.00))
					{
						/* 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.00)
					{
					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;
				}
			} 
	 
		
		
/*	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;
		});

		 $.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+"&new_fee_details="+JSON.stringify(new_fee_details),
	       url: $host_url+"saveCandidateEntryDetails.demo",
 	       success: saveCandidateEntryDetailsResponse
	    }); 
		
		/*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());;	*/
			//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();
		
 }//BM111116
function UpdateExamFeeForEachSelectedSubject()
{	
	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;
		var fresh_exam=$("#fresh_exam_"+$char_code).val();   
		var maxsemfee_val = 0;
		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();

			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')
							{
								var fee_obj=$("input[id^='nfee_"+$char_code+"_']");
								jQuery.each(fee_obj, function(fk, fv) {
								var input_id=fv['id'];
								var maxsemfee_id = input_id.replace("nfee_","maxsemfee_");								
								if(maxsemfee_id != 'maxsemfee_'+$char_code+'_total' )
									maxsemfee_val = parseFloat($("#"+maxsemfee_id).val());
									if(isNaN(maxsemfee_val))
										maxsemfee_val = 0;
								});
								
								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();
							}
						}
					}

				}					
			}

			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;
			
			if(input_id_l!='total')
			{
				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())*pr_cnt;
				if(th_cnt>0)
					th_exam_val=parseFloat($("#"+o_val_input_id).val())*th_cnt;

					f_val=eval(f_val+th_exam_val+pra_exam_val);	
				});		
				if(parseFloat(f_val)>parseFloat(minnfee_val))
				{
					f_val = parseFloat(minnfee_val);
					$("#"+input_id).val(f_val+maxsemfee_val); 
				}
				else
					$("#"+input_id).val(f_val+maxsemfee_val);  
			}

			});
		}
	}
	CalculateNewwFeeTotals();	
 }
 
 function CalculateNewwFeeTotals()
 {
	
	var grand_total=0;
	var sp_fee_tot=0;
	var cnv_fee_tot = 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 maxsemfee_id = input_id.replace("nfee_","maxsemfee_");
			var maxsemfee_val = parseFloat($("#"+maxsemfee_id).val());

			var input_id_l = fv['id'].split("_")[2];		 
			if(input_id_l!='total')
			{
				var f_val = $("#"+input_id).val();				
				//f_val = parseFloat(maxsemfee_val)+parseFloat(f_val);	


				if(input_id == 'nfee_'+char_id+'_03')
				{
					sp_fee_tot=sp_fee_tot+parseFloat(f_val);
				}
				
				if(input_id == 'nfee_'+char_id+'_03' && sp_fee_tot>50)
				{
					f_val=0;
					$('#nfee_'+char_id+'_03').val(0);
				}


				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()
 {
// document.getElementById('candidate_list_degree_code').disabled=true;
 //document.getElementById('candidate_list_reg_no').disabled=true;
 }
 function enableCandidateHeaderFields()
 {
  //document.getElementById('candidate_list_degree_code').disabled=false;
 //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.00)
					{
					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", $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;	
	}
	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
		});
	}
}