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


Current Path : /proc/thread-self/root/var/www/student/reva/js/
Upload File :
Current File : //proc/thread-self/root/var/www/student/reva/js/candidate2_list.js

 //var lsp_tot = 0;
//var lprevcode="";

 function DisplayStudentSubjectDetails(r,c,li)
 {
	 var funivcode = getCookie('univcode');
	$("#index_main_page_result").load('candidate_list.html',function()
	{		
		clearcandidateList();	
	$("#candidate_list_reg_no").focus();
	 
	$("#candidate_list_reg_no_details").html("");
	$("#candidate_list_reg_no_details").hide();
	 
	$g_total_count_of_each_div=0;
	//$g_FUNIVCODE='';
	funivcode='';
	 //if(funivcode=='003D' || funivcode=='003U')
	//{
		$g_variation_arr='';
	//} 	
	$g_student_reg_no_exam_details='';
 
	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();
	
		$.ajax({
		type: "POST",
		async:false,
		data:"r="+r+"&c="+trim(c)+"&li="+trim(li),
		url: $host_url+"DisplayStudentSubjectDetails",
		success: DisplayStudentSubjectDetailsResponce
		});
	});
}
	var stuDegree = '';
	var prevPhotoStatus = 0;
function DisplayStudentSubjectDetailsResponce($responce)
{
	var	funivcode = getCookie('univcode');
	if(funivcode=='003D')
		prevPhotoStatus = 0;
	
		$responce = eval('(' + $responce + ')'); 
		$("#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('');	
		
	if($responce.error_code==0)
	{
		var payMode_type=$responce.data['paymode_type'];  
		
		setCookie("funivcode",funivcode,1);
		document.getElementById('payment_type').options.length = 0;
		$op = new Option("Select Payment", "");$op.id="";
		document.getElementById('payment_type').options.add($op);

		for($i=0;$i < payMode_type.length;$i++)                                  
		{            
			$op = new Option(payMode_type[$i]['bank_name'], payMode_type[$i]['payment_type']);
			$op.id=payMode_type[$i]['payment_type'];//specifying the id  for options
			document.getElementById('payment_type').options.add($op);
		}
		disableCandidateHeaderFields();
		$g_total_count_of_each_div=$responce.data.total_count_of_each_div;
		$g_student_reg_no_exam_details=$responce.data.table_data;
		funivcode=$responce.data.FUNIVCODE;
		$("#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);
		$("#student_info").val('');
		
		 if(funivcode=='016' || funivcode=='026')
		stuDegree = $responce.data.table_data.FDEGREE; 
		
	
		if(funivcode == '003D' || funivcode=='003U')
		{	
			$g_variation_arr=$responce.data.variation_arr;
			$("#candidate_addr1").val($responce.data.table_data.FCURRADD1);
			$("#candidate_addr2").val($responce.data.table_data.FCURRADD2);
			$("#candidate_addr3").val($responce.data.table_data.FCURRADD3);
			$("#candidate_addr4").val($responce.data.table_data.FCURRADD4);
			$("#candidate_mobile").val($responce.data.table_data.FMOBILE);
		}
		$("#student_info").html($responce.data['student_info']);
		$("#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);
		 if(funivcode=='018')
		{
			for($c_code=65;$c_code<75;$c_code++)
			{
				$char_code=String.fromCharCode($c_code);
				alert($char_code);
				var fresh_exam=$("#fresh_exam_"+$char_code).val();
				showExamNosDiv('candidate_list_exam_'+fresh_exam+'_details');
			}
			$("#candidate_list_footer_details").show();		
			document.getElementById("cand_entry_A").checked=false;	
		} 
		if(funivcode == '003D')
		{
			if($responce.data.photo_path != 'img/default_photo.jpg')
			{
				$("#student_entry_photo").attr("src",$responce.data.photo_path);
				$("#student_entry_upload").hide();
				prevPhotoStatus = 1;
			}
			else
			{
				$("#student_entry_photo").attr("src",$responce.data.photo_path);
			}
		}
		showExamNosDiv('candidate_list_exam_A_details');
		$("#candidate_list_footer_details").show();	
		document.getElementById("cand_entry_A").checked=false;
			
	}
	
	
		else if(funivcode=='003D')
		{	
			if($responce.error_code== -9)
			{
			$("#download_admtcard_enable").hide();
			$("#candidate_list_reg_no_details").html($responce.data.data);
			$("#hTabTopmainEach").hide();
			}
			else
			{
				$("#download_admtcard_enable").show();
				var adm_ticket = $responce.data.adm_ticket;
				if(adm_ticket =='true')
				{
					var photo_present = $responce.data.photo_present;
					if(photo_present == 'true')
					{
						$("#uploadPhotoToAdmcard").hide();
						$("#downloadAdm").show();
					}
					else
					{
						$("#uploadPhotoToAdmcard").show();
						$("#downloadAdm").hide();
					}	
				}
				$("#candidate_list_reg_no_details").html($responce.data.data);
				$("#hTabTopmainEach").hide();
			}	
		}	
		else
		{
			var adm_ticket = $responce.data.adm_ticket;
			if(adm_ticket =='true')
			{
				$("#downloadAdm").show();
			}
			$("#candidate_list_reg_no_details").html($responce.data.data);
			$("#hTabTopmainEach").hide();
		}
		$("#candidate_list_reg_no_details").html($responce.data.data);
			$("#hTabTopmainEach").hide();
}		
	 
function enableCandidateHeaderFields()
{
	var	funivcode = getCookie('univcode');
	
	$("#candidate_list_reg_no").val('');	
	$("#candidate_list_reg_name").val('');	
	$("#Candidate_total_fee").html('');	
 
	$g_total_exam_details='';
	window.location.fee_exam_J='';
	hideAllDivs();
}
function clearcandidateList()
{
	var	funivcode = getCookie('univcode');
	$("#candidate_list_degree_code").val('');		
	$("#candidate_list_degree_name").val('');	
	$("#candidate_list_reg_no").val('');	
	$("#candidate_list_reg_name").val('');	
	$("#Candidate_total_fee").html('');	
 
	$g_total_exam_details='';
}


function hideAllDivs()
{
		var	funivcode = getCookie('univcode');
		$("#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)
{
	
	var	funivcode = getCookie('univcode');
	$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();
	if(funivcode=='018')
	{
		var fresh_exam=$("#fresh_exam_"+$char_code).val();
		if(fresh_exam == $char_code)
		{	
			document.getElementById($id+'^'+$char_code).checked = true;
			checkAllCandidateSemisterSub($id+'^'+$char_code);
		}	
	}
		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 saveCandidateEntryDetails()
{
	//################Check Empty Subjects Starts################################# 
	var	funivcode = getCookie('univcode');
	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(trim($("#"+$input_id).val())=='0' || trim($("#"+$input_id).val())=='None')
				{
					showExamNosDiv($div_id);
					alert("Select all subjects in Exam "+$char_code);
					$("#"+$input_id).focus();
					return;
				} 
				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(!isDate(document.getElementById($div_id_date).value,'d/M/y'))
					{
					alert("Please enter the date format as dd/mm/yyy");
					showExamNosDiv($div_id);
					return;
					} */
					
			}
			var fresh_exam=$("#fresh_exam_"+$char_code).val();
			if($checked_flag==0 && $exam_fee>0)
			{
				alert("Select atleast one subject as you have entered Exam Fee");
				showExamNosDiv($div_id);
				$("#"+$div_id_total).focus();
				return;
			}
			if(funivcode=='018')
			{
				if(($checked_flag==1 && ($exam_fee==0.00 || $exam_fee==0)) && $char_code != fresh_exam)
				alert("Exam fee cannot be zero for Exam "+$char_code);
				showExamNosDiv($div_id);
				$("#"+$div_id_total).focus();
				return;
			}	
			if($checked_flag==1 && ($exam_fee==0.00 || $exam_fee==0))
			{
				alert("Exam fee cannot be zero for Exam "+$char_code);
				showExamNosDiv($div_id);
				$("#"+$div_id_total).focus();
				return;
			} 
		}
	}
		
		if(funivcode=='003D'|| funivcode=='003U')
		{
			if(trim(document.getElementById('payment_type').value) == '' || document.getElementById('payment_type').value.length <= 0)
			{
			alert('Select Payment Type');
			document.getElementById('payment_type').focus();
			return;
			} 	
			var candidateMobile = document.getElementById('candidate_mobile').value;
			if(trim(candidateMobile) == '' || candidateMobile.length != 10)
			{
			alert('Enter the Valid 10 digit Mobile No');
			document.getElementById('candidate_mobile').focus();
			return;
			} 
			if(trim(document.getElementById('candidate_addr1').value) == '' || document.getElementById('candidate_addr1').value.length <= 0)
			{
			alert('Enter Address');
			document.getElementById('candidate_addr1').focus();
			return;
			} 	
			if(prevPhotoStatus == 0)
			{
				if(document.getElementById('student_entry_upload').value == '' || $("#student_entry_photo").attr("src") =='img/default_photo.jpg')
				{
				alert('Upload Your Photo');
				return;
				} 
			}
			var payment_type=$("#payment_type").val();
		}	
		
		else
		{	
			var payment_type=$("#payment_type").val();
			if(payment_type=="")
			{
				alert('Select payment type');
				document.getElementById('payment_type').focus();
				return;
			}
		}
		
//################Check Empty Subjects ENDS################################# 		
	showExamNosDiv('candidate_list_exam_A_details') 
	url_object=GetUrlParameters();
	$reg_no=trim(url_object['r']);	
	if(funivcode == '003D' || funivcode=='003U')
		$reg_no=$reg_no.toUpperCase();
	 
	$total_fee=parseFloat(trim(document.getElementById('Candidate_total_fee').innerHTML));	
	$details  = new Object();
	$fee_details  = new Object();
	$sub_details  = new Object();
	if(funivcode!='018') 
	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();
		   
		  	  $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()); 
			  
				 
				$n=0;
				for($k=0;$k<$total_rows;$k++)
				{
					fi="exam_"+$char_code+"_fi_"+$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]['fi']=trim($("#"+fi).val());
						 $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;
			 
				 
			}
				else
				{
				$details[$char_code]='';
				$sub_fee[$char_code] =0;
				$sub_fee[$char_code] =0;
				$sub_fee[$char_code] =0;
				 
				}
			} 
	 
		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=$("#"+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;
				});
		degree='';
		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)) ;
			data+="&c="+url_object['c']; ;		
			data+="&li="+url_object['li']; ;		
			data+="&payment_type="+payment_type; ;		
			if(funivcode=='003D' || funivcode=='003U')
				data+="&candidate_addr1="+$("#candidate_addr1").val();
				data+="&candidate_addr2="+$("#candidate_addr2").val();
				data+="&candidate_addr3="+$("#candidate_addr3").val();
				data+="&candidate_addr4="+$("#candidate_addr4").val();
				data+="&candidate_mobile="+candidateMobile;
				data+="&prevPhotoStatus="+prevPhotoStatus;
				data+="&student_entry_photo_path="+encodeURIComponent($("#student_entry_photo").attr("src"));
			//console.log(data);return;
	 
		 $.ajax({
	       type: "POST",
		     url: $host_url+"saveCandidateEntryDetails",
			async:false,
	       data:data,	     
 	       success: saveCandidateEntryDetailsResponse
		   });
		   
	 
		 
}	 

 function saveCandidateEntryDetailsResponse($responce)
 {
	 var funivcode = getCookie('univcode');
	$responce = eval('(' + $responce + ')'); 	
	if($responce.error_code==-1)
	{
		alert($responce.data['data']);return false;
	}
	else
	{
		 $("#candidate_list").html($responce.data);
	}	
		
 }//BM111116
 function UpdateExamFeeForEachSelectedSubject()
 {
	var	funivcode = getCookie('univcode');
	for($c_code=65;$c_code<75;$c_code++)
	{
			 var th_count = 0;
			var pr_count = 0;
		  $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();
						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();
									if(funivcode=='003D')
									{		
									th_count+=parseFloat($("#exam_"+$char_code+"_th_cnt_"+$k).val());
									pr_count+=parseFloat($("#exam_"+$char_code+"_pr_cnt_"+$k).val());
									}		
									sub_cnt++;
								}
							}
							 
						}
						 
					}					
				}
				 
						variation_obj=$g_variation_arr[$char_code];
					
						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_");
						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 fee_name=$("#tfh_"+$char_code+"_02").html();
						//var fee_sp=$("#tfh_"+$char_code+"_10").html();
						 
						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);
								 
							});
							
							var fresh_exam=$("#fresh_exam_"+$char_code).val();
							
							// if($g_FUNIVCODE=="003" && fee_sp=="10 Special Fee")
							// {
								// lsp_tot=lsp_tot + 1000;
								// if(lprevcode=="")
								// {
									// lprevcode=$char_code;
								// }
							// }
							
							
							// if($g_FUNIVCODE=="003" && fee_sp=="10 Special Fee" && lsp_tot>1000 && $char_code!=lprevcode)
							// {
								// f_val=0;
							// }
							if(funivcode=="026" && fee_name=="01 EXAM FEE" && fresh_exam!=$char_code && sub_cnt>1)// handling specificallly for univ code
							{
							 if(sub_cnt==2 && f_val<minnfee_val)
								{
									if(stuDegree.toUpperCase() =='BED' || stuDegree.toUpperCase() =='BED1')
									{
										f_val=300;
									}
									else
									{
										f_val=300;
									}
								}
								else if(sub_cnt>2)
								{
									f_val=minnfee_val;
								}
							}
							
							if(funivcode=="026" && fee_name=="02 EXAM FEE" && fresh_exam!=$char_code && sub_cnt>1)// handling specificallly for univ code
							{
								 if(sub_cnt==2 && f_val<minnfee_val)
								 {
									f_val=250;
								 }
								 else if(sub_cnt>2)
								 {
									f_val=minnfee_val;
								 }
							}
							else if(input_id=="nfee_"+$char_code+"_02" && !empty(variation_obj) && sub_cnt>0)
							{
						
								var trf_val = 0;
								var prf_val = 0;
								var var_obj_sub_cnt=th_count;
								if(th_count > 7)
								{
									var_obj_sub_cnt="MT";
									trf_val=parseFloat($g_variation_arr[$char_code][var_obj_sub_cnt]['THFEE']);
								}
								else if(th_count > 0)
								{
									trf_val=parseFloat($g_variation_arr[$char_code][var_obj_sub_cnt]['THFEE']);
								}
								
								var var_obj_sub_cnt=pr_count;
								if(pr_count > 7)
								{
									var_obj_sub_cnt="MT";
									prf_val=parseFloat($g_variation_arr[$char_code][var_obj_sub_cnt]['PRFEE']);
								}
								else if(pr_count > 0)
								{
									prf_val=parseFloat($g_variation_arr[$char_code][var_obj_sub_cnt]['PRFEE']);
								}
								
								f_val =parseFloat(trf_val)+parseFloat(prf_val);
								
							}
							if(funivcode=="018" && fresh_exam==$char_code)
							{
								 f_val=0;
								 $("#"+input_id).val(f_val); 
							}
						    else
							{ 
								if(parseFloat(f_val)>minnfee_val)
								 {
									f_val=parseFloat(minnfee_val);
									$("#"+input_id).val(f_val); 
								 }
								 else
								  $("#"+input_id).val(f_val);  
							}
						}
					});
				}
			 
	}
		 CalculateNewwFeeTotals();	
 }
 
 function CalculateNewwFeeTotals()
 {
 var funivcode = getCookie('univcode');
var grand_total=0;
if(funivcode != '016')
	var sp_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 input_id_l=fv['id'].split("_")[2];
		 
		
		if(funivcode == '016')
		{
			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));
			}
		}
		else
		{
			if(input_id_l!='total')
		{
			var f_val=$("#"+input_id).val();
			if(input_id == 'nfee_'+char_id+'_10')
			{
				sp_fee_tot=sp_fee_tot+parseFloat(f_val);
			}
			
			if(input_id == 'nfee_'+char_id+'_10' && sp_fee_tot>1000)
			{
				f_val=0;
				$('#nfee_'+char_id+'_10').val(0);
			}
			if(funivcode!='003D')
			{	
				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 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("Select atleast one 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("Enter the Exam Fee since you have already selected subjects");
					showExamNosDiv($div_id);
					$("#"+$div_id_total).focus();
					return;
					}
				}
}
 
 
 function getSubjectNamesForSelectedSub(int_code,val,degree_code,exam)
 {
		var sub_code_id="exam_"+exam+"_ce_sub_code_"+int_code; 
		var sub_short_id="exam_"+exam+"_ce_short_name_"+int_code;
		var desc_id="exam_"+exam+"_ce_desc_"+int_code;
		var ch_box_id="exam_"+exam+"_ce_pass_"+int_code;
		var th_cnt_id="exam_"+exam+"_th_cnt_"+int_code; 
		var pr_cnt_id="exam_"+exam+"_pr_cnt_"+int_code; 
		var finserted_id="exam_"+exam+"_fi_"+int_code; 
		var exsiting_sub_code_arr=new Array();
		var e_obj=$("[id*='exam_"+exam+"_ce_sub_code']") 
			jQuery.each(e_obj, function(k, v) {
			var e_int_code=$(this).attr("id").split("_").pop();
				if(e_int_code!=int_code)
				{
				exsiting_sub_code_arr.push($(this).val());
				}
			});
			 
	 if(in_array(val,exsiting_sub_code_arr))
	 {
		alert("This Subject is already selected");
		$("#"+sub_code_id).val("None");
		$("#"+sub_short_id).html("");						 
		$("#"+desc_id).html("");$("#"+ch_box_id).attr("checked", false);
		$("#"+th_cnt_id).val(0);
		$("#"+pr_cnt_id).val(0);
		$("#"+finserted_id).val("F");
		return false;
	 }
	if(val=="None")
	{
		
		$("#"+ch_box_id).attr("checked", false);
		$("#"+sub_short_id).html("");						 
		$("#"+desc_id).html("");	
		$("#"+th_cnt_id).val(0);
		$("#"+pr_cnt_id).val(0);$("#"+finserted_id).val("F");
		UpdateExamFeeForEachSelectedSubject();
		CalculateNewwFeeTotals();
		return;	
	}
	$.ajax({
	       type: "POST",	 
	       data: "degree_code="+degree_code+"&exam="+exam+"&subject_code="+val,
	       url: $host_url+"getSubjectNamesForSelectedSub",
 	       success: function getSubjectNamesForSelectedSubResponse(responce)
					{
						responce = eval('(' + responce + ')'); 
						if(responce.error_code==0)
						{						
					
						$("#"+sub_short_id).html(responce.data['FSUBSHORT']);
						 
						$("#"+desc_id).html(responce.data['FSUBNAME']);
						$("#"+th_cnt_id).val(responce.data['th_cnt']);
						$("#"+pr_cnt_id).val(responce.data['pr_cnt']);
						$("#"+finserted_id).val("T");
						$("#"+ch_box_id).attr("checked", "checked"); 
						UpdateExamFeeForEachSelectedSubject();
						CalculateNewwFeeTotals();
						}
						else
						{
						alert("Problem Exists while selecting subject")
						}
					}	
	    }); 
 }
 function PrintApplicationForm(type,app_no)
 {
	if(type=='NEFT')
	PrintApplicationFormNEFT(app_no);
	else if(type=='POSTOFFICE')
	PrintApplicationFormPOSTOFFICE(app_no);
	else
	PrintApplicationFormSBM(app_no);
 }
function PrintApplicationFormSBM(app_no)
{
	window.location.href=$host_url+"PrintApplicationFormSBM&app_no="+app_no;
}function PrintApplicationFormNEFT(app_no)
{
	window.location.href=$host_url+"PrintApplicationFormNEFT&app_no="+app_no;
}
function PrintApplicationFormPOSTOFFICE(app_no)
{
	window.location.href=$host_url+"PrintApplicationFormPOSTOFFICE&app_no="+app_no;
}
function PrintApplicationFormNETBANKING(app_no)
{
	window.location.href=$host_url+"PrintApplicationFormNETBANKING&app_no="+app_no;
}
function validateNumber(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();
		}
	}
}


//photo upload 28/04/2015



var filepath;
function DisplayUserSelectedPhoto()
{
	
  		var valid_file_extentions = new Array("jpg");

		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!");
			$("#student_entry_upload").val('')
			return false;
		}
		var lstr_data="&filepath="+filepath;
		$upload = $host_url+"DiaplayUserSelectedPhoto&"+lstr_data;	
	    document.getElementById("form_module_image_upload").setAttribute("action",$upload);		
		return AIM.submit(document.getElementById("form_module_image_upload"), 'same_tab',{'onComplete' : DiaplayUserSelectedPhotoResponse});		 



}

function DiaplayUserSelectedPhotoResponse($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", "img/default_photo.jpg"); 

	 else if($responce.error_code==-2)	

	 {

		alert($responce.data);

		$("#student_entry_photo").attr("src", "img/default_photo.jpg");

		$("#student_entry_upload").val("");

	 }

}

//photo upload for Admission Ticket download 22/09/2015

var filepath;
function DisplayUserSelectedPhotoAtDwn()
{
	
  		var valid_file_extentions = new Array("jpg");

		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!");
			$("#student_entry_upload").val('')
			return false;
		}
		var lstr_data="&filepath="+filepath;
		$upload = $host_url+"DiaplayUserSelectedPhoto&"+lstr_data;	
		$.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",$upload);		
		return AIM.submit(document.getElementById("form_module_image_upload"), 'same_tab',{'onComplete' : DiaplayUserSelectedPhotoAtDwResponse});		 



}

function DiaplayUserSelectedPhotoAtDwResponse($responce)
{

	$responce = eval('(' + $responce + ')'); 
	 $.unblockUI();
	if($responce.error_code==0)	{
		
	 $("#student_entry_atphoto").attr("src", $responce.data);
		}
	 else if($responce.error_code==-1)	

	 $("#student_entry_atphoto").attr("src", "img/default_photo.jpg"); 

	 else if($responce.error_code==-2)	

	 {

		alert($responce.data);

		$("#student_entry_atphoto").attr("src", "img/default_photo.jpg");

		$("#student_entry_upload").val("");

	 }

}

function uploadAdmissionTicketPhoto()
{	
	
	if($("#student_entry_atphoto").attr("src") =='img/default_photo.jpg')
		{
			alert('Upload Photo');
			return;
		}
	url_object=GetUrlParameters();
	$reg_no=trim(url_object['r']);	
	$reg_no=$reg_no.toUpperCase(); 
	 	
	var data="&reg_no="+$reg_no+"&student_entry_photo_path="+encodeURIComponent($("#student_entry_atphoto").attr("src"));	
	$.ajax({
	       type: "POST",
		     url: $host_url+"uploadAdmissionTicketPhoto",
			async:false,
	       data:data,	     
 	       success: uploadAdmissionTicketPhotoResponse
		   }); 
		

}

function uploadAdmissionTicketPhotoResponse($responce)
{
	$responce = eval('(' + $responce + ')'); 
	alert($responce.data);	
	$("#uploadPhotoToAdmcard").hide();
	$("#downloadAdm").show();
				
}
	
 
/* Function Call to Student Admission Ticket download */
	
function GenerateAdmissionTicket()
{
	url_object=GetUrlParameters();
	var reg_no=trim(url_object['r']);	
	window.location.href = $host_url+"generateAdmissionTicket.demo&regno="+reg_no; 
}
function setCookie(c_name,value,expiredays)
{
	var exdate=new Date()
	exdate.setDate(exdate.getDate()+expiredays)
	document.cookie=c_name+ "=" +escape(value)+
	((expiredays==null) ? "" : ";expires="+exdate.toGMTString())
}

function getCookie(c_name)
{
	if (document.cookie.length>0)
	  {
	  c_start=document.cookie.indexOf(c_name + "=")
	  if (c_start!=-1)
		{ 
		c_start=c_start + c_name.length+1 
		c_end=document.cookie.indexOf(";",c_start)
		if (c_end==-1) c_end=document.cookie.length
		return unescape(document.cookie.substring(c_start,c_end))
		} 
	  }
	return "";
}

/* End */