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


Current Path : /var/www/html/stph/js/
Upload File :
Current File : /var/www/html/stph/js/student_entry_24112017.js

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

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

}
 
function dateTab()
{
	/* if(document.getElementById('student_entry_dob').value != '')
	{
		if(isValidDate(document.getElementById('student_entry_dob').value))  //  in validate.js File
		{							
			document.getElementById('student_entry_gender').focus();
		}
		else
		{	
			document.getElementById('student_entry_dob').value = '';		
			document.getElementById('student_entry_dob').focus();
			return false;
		}
	} */	
}
function LoadstudentEntry(type)
{
    $("#page_main_div").load('html_modules/admission_entry.html', function()
	{
	$g_student_retain_per_mode=1;
	$g_remaining_counter_inc = '';
	$g_remaining_counter_inc=0;
	$g_clicked_subject_id=0;
	$("#student_entry_exam").val("A") ;
	 $('#pdname').hide();
	 $('#esk').hide();
	document.getElementById('display_module_name').innerHTML = 'Student Entry';
	document.getElementById('module_name_for_save').value = 'StudentEntry';
	document.getElementById('is_add_edit').value = type;	
	getDefaultHeadFooterLinks('Admission Entry');  
	clearStudentEntry();
	$("#student_entry_degree_code").focus();
	$("#student_entry_exam").val('A');
	$("#error_msg").html("");		
	$("#print_row").hide();	
	getCategoryNames('degree_category');
	DeletedRecords=0;
 
	document.getElementById("student_entry_nationality").value = "INDIAN";
	 
		if(type=='Add')
		{
		$g_se_degree='';
		$geditinternalcode='';
		} 
		if(type=='Edit')
		{
		EditStudentDetailsForUpdate($geditinternalcode,$g_se_degree);
		} 
	}
	);
	$('#module_details_div').hide();
		
}
 
function chkStudentEditAdd()
{	
	if(document.getElementById('is_add_edit').value =='Add' )
	{
	 if(trim($("#student_entry_degree_code").val())!='')
		{			
			generateAutoIncrementSlNo();
			//document.getElementById("add_row").setAttribute("class", "tarkabutton-disabled");
			//disableButton();
			
		}		
	}
	else if(document.getElementById('is_add_edit').value =='Edit' || document.getElementById('is_add_edit').value =='Delete')
	{
//	document.getElementById("student_entry_slno").disabled=false; 
	getStudentSlNo();
	}
	/* else if(document.getElementById('is_add_edit').value =='Delete')
	{
	document.getElementById("student_entry_slno").disabled=false; 
	getStudentSlNo();
	} */	
}
// thu
function assignDefaultName()
{
	if(trim(document.getElementById("student_entry_nationality").value) == '')
	    document.getElementById("student_entry_nationality").value = "INDIAN";
}
function copyAddress()
{
	if($("#student_entry_per_add1").val() == '' && $("#student_entry_per_add2").val() == '' )	
	{
		$("#student_entry_per_add1").val($("#student_entry_comm_addr1").val());
		$("#student_entry_per_add2").val($("#student_entry_comm_addr2").val());
		$("#student_entry_per_add3").val($("#student_entry_comm_addr3").val());
		$("#student_entry_per_add4").val($("#student_entry_comm_addr4").val());
	}

}
// end thu
//--wed naveen
function generateAutoIncrementSlNo()
{ 
	$.ajax({
				type: "POST",
				//async:false,
				url: $host_url+"generateAutoIncrementSlNo.demo", 
				data:"degree="+encodeURIComponent(trim($("#student_entry_degree_code").val())),
				success: generateAutoIncrementSlNoResponse
			}); 	
}
function generateAutoIncrementSlNoResponse($responce)  // to get value and edit of pertiqular student
{
	$responce = eval('(' + $responce + ')');
	if($responce.error_code==0)
	{
	$("#student_entry_slno").val($responce.data)
	}
	else
	{
	//alert('SL No Not Exstis');
	//document.getElementById("student_entry_slno").focus();
	}
	
}  	
// for key press in the degree code field displaying sub appareing table

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

/* window.location.$g_popup_sub_code='';
function subjectAppearing_PopUp($id)
{
var url = "../ui/SubjectAppearingPopup.html?height=200&width=400&id="+$id;
					tb_show("College Details", url);
	//$subCode = 
	window.location.$g_popup_sub_code=$id;
} */
window.location.$g_popup_sub_code_field_id='';
function keyboardsubjectAppearing_PopUp(evt,$id)
{
	var kC  = (evt.which) ? evt.which : evt.keyCode;
 //alert(id);
	if(kC==112) //F1 Key code
	{
		var url = "../ui/SubjectAppearingPopup.html?height=200&width=400&id="+$id;
					tb_show("College Details", url);
	//$subCode = 
	window.location.$g_popup_sub_code_field_id=$id;			
		return false;
	} 
}
// upt to hereselect category
function SaveStudentEntry()
{  
  if(DeletedRecords==0)
  { 	
		var  date_student;
		if(trim(document.getElementById('student_entry_degree_code').value) == '' )
		{
			alert('Please enter the Degree. Code');
			document.getElementById('student_entry_degree_code').focus();
			return;
		}
		else if(trim(document.getElementById('student_entry_name').value) == '' )
		{
			alert('Please enter the Student Name');
			document.getElementById('student_entry_name').focus();
			return;
		}	
		else if(trim(document.getElementById('student_entry_fname').value) == '' )
		{
			alert('Please enter the Father\'s Name');
			document.getElementById('student_entry_fname').focus();
			return;
		}else if(trim(document.getElementById('student_entry_father_occupation').value) == '' )
		{
			alert('Please enter the Father\'s Occupation Name');
			document.getElementById('student_entry_father_occupation').focus();
			return;
		}else if(trim(document.getElementById('student_entry_mname').value) == '' )
		{
			alert('Please enter the Mother\'s Name');
			document.getElementById('student_entry_mname').focus();
			return;
		}else if(trim(document.getElementById('student_entry_mather_occupation').value) == '' )
		{
			alert('Please enter the Mothers\'s Occupation Name');
			document.getElementById('student_entry_mather_occupation').focus();
			return;
		}else if(trim(document.getElementById('student_entry_slno').value) == '' )
		{
			alert('Please enter the SL No');
			document.getElementById('student_entry_slno').focus();
			return;
		} 
	    if(($("#student_entry_dob_date").val() != '1' || $("#student_entry_dob_month").val() != 'Jan') &&  $("#student_entry_dob_year").val() == '')
		{
		    alert('Please Enter the Year..!');
			document.getElementById('student_entry_dob_year').focus();
			return;
		}
		else if($("#student_entry_dob_year").val() == '' || $("#student_entry_dob_year").val().length<4)
		{
			 alert('Please Enter the Valid Year..!');
			document.getElementById('student_entry_dob_year').focus();
			return;
		}
		else if(trim(document.getElementById('student_entry_email').value) == '' )
		{
			alert('Please enter the Email Id');
			document.getElementById('student_entry_email').focus();
			return;
		} else if(trim(document.getElementById('student_entry_english').value) == '' )
		{
			alert('Please enter the Medium Of Instructions');
			document.getElementById('student_entry_english').focus();
			return;
		} else if(trim(document.getElementById('degree_category').value) == '' )
		{
			alert('Select category');
			document.getElementById('degree_category').focus();
			return;
		} 
		else if(trim(document.getElementById('cast_name').value) == '' )
		{
			alert('Select Cast Name');
			document.getElementById('cast_name').focus();
			return;
		}
		else if(trim(document.getElementById('aadhaar').value) == '' )
		{
			alert('Enter Aadhaar No.'); 
			document.getElementById('aadhaar').focus();
			return;
		}
		else if(trim(document.getElementById('cast_name').value) == '' )
		{
			alert('Select Cast Name');
			document.getElementById('cast_name').focus();
			return;
		}
		
		/* if(trim(document.getElementById('local').value) == '' )
		{
			alert('Select Out of State or University');
			document.getElementById('local').focus();
			return;
		} */
		else if(trim(document.getElementById('student_entry_religion').value) == '' )
		{
			alert('Please enter the Religion');
			document.getElementById('student_entry_religion').focus();
			return;
		}  else if(trim(document.getElementById('student_entry_nationality').value) == '' )
		{
			alert('Please enter the Nationality');
			document.getElementById('student_entry_nationality').focus();
			return;
		}  else if(trim(document.getElementById('student_entry_contact_no').value) == '' )
		{
			alert('Please enter the Contact No');
			document.getElementById('student_entry_contact_no').focus();
			return;
		}  else if(trim(document.getElementById('student_entry_comm_addr1').value) == '' )
		{
			alert('Please enter the Address(For Communication):');
			document.getElementById('student_entry_comm_addr1').focus();
			return;
		} else if(trim(document.getElementById('student_entry_upload').value) == '9999999999' && document.getElementById('is_add_edit').value=='Add')
		{
			alert('Please Upload Student Photo');
			document.getElementById('student_entry_upload').focus();
			return;
		}  else if(trim(document.getElementById('student_entry_per_add1').value) == '' )
		{
			alert('Please enter the Address(Permanent):');
			document.getElementById('student_entry_per_add1').focus();
			return;
		} 
		else if($("#student_entry_dob_year").val() != '')
		{
			date_student = $("#student_entry_dob_year").val()+'-'+returnMonthValue($("#student_entry_dob_month").val())+'-'+$("#student_entry_dob_date").val();
		}	
		else if($("#student_entry_dob_year").val() == '')
		{
		    date_student = '0000-00-00';
		}
	    /* if(document.getelementbyid('sq').checked == true)
		{	
			if(trim(document.getelementbyid('esk').value) == '' )
			{
				
				alert('ex service quota');
				document.getelementbyid('esk').focus();
				return;
			}
		} */
		if(document.getElementById('pd').checked == true)
		{	
			if(trim(document.getElementById('pdname').value) == '' )
			{
				
				alert('nature of disability');
				document.getElementById('pdname').focus();
				return;
			}
		}
		if(trim(document.getElementById('student_entry_upload').value) == '' && document.getElementById('is_add_edit').value=='Add')
		{
			alert( 'Upload Photo');
			document.getElementById('student_entry_upload').focus();
			return;
		} 
		$start_indx=$g_subject_appearing.total_count-$g_remaining_counter_inc;	
		var subject_alert_flag=false;
		var alert_cnt=0;		
		for($m=$start_indx;$m<$g_subject_appearing.total_count;$m++)
		{
			if(trim($("#se_sub_code_"+$m).val())=='')
			{
			subject_alert_flag=true;
			alert_cnt++;
			/* alert('Please Enter the All Subjects');
			document.getElementById("se_sub_code_"+$m).focus();
			return; */
			}
		}
		if(subject_alert_flag)
		alert("You have not entered all Subjects!!!!!!");
	
	var esq = 'F';
	if(document.getElementById('esq').checked == true)
		esq = 'T';
	
	var gd = 'F';
	if(document.getElementById('gd').checked == true)	
		gd = 'T';

	$lstr_data="add_edit="+document.getElementById('is_add_edit').value;
	$lstr_data+="&degree_code="+encodeURIComponent($("#student_entry_degree_code").val());
	$lstr_data+="&degree_description="+encodeURIComponent($("#student_entry_degree_name").val());
	$lstr_data+="&degree_exam="+encodeURIComponent($("#student_entry_exam").val());
	$lstr_data+="&degree_slno="+encodeURIComponent($("#student_entry_slno").val());
	$lstr_data+="&student_entry_name="+encodeURIComponent($("#student_entry_name").val());
	$lstr_data+="&degree_fname="+encodeURIComponent($("#student_entry_fname").val());
	$lstr_data+="&degree_mname="+encodeURIComponent($("#student_entry_mname").val());		
	$lstr_data+="&degree_dob="+date_student;
	$lstr_data+="&degree_gender="+encodeURIComponent($("#student_entry_gender").val());	
	$lstr_data+="&degree_english="+encodeURIComponent($("#student_entry_english").val());
	$lstr_data+="&degree_nationality="+encodeURIComponent($("#student_entry_nationality").val());
	$lstr_data+="&degree_category="+encodeURIComponent($("#degree_category").val());
	$lstr_data+="&cast_name="+encodeURIComponent($("#cast_name").val());
	$lstr_data+="&aadhaar="+encodeURIComponent($("#aadhaar").val());
	$lstr_data+="&pdname="+encodeURIComponent($("#pdname").val());
	$lstr_data+="&local="+encodeURIComponent($("#local").val());
	$lstr_data+="&esq="+esq;	
	$lstr_data+="&gd="+gd;
	$lstr_data+="&basicqal="+encodeURIComponent($("#basicqal").val());
	$lstr_data+="&combcode="+encodeURIComponent($("#combcode").val());
	
	$lstr_data+="&student_entry_comm_addr1="+encodeURIComponent($("#student_entry_comm_addr1").val());
	$lstr_data+="&student_entry_comm_addr2="+encodeURIComponent($("#student_entry_comm_addr2").val());
	$lstr_data+="&student_entry_comm_addr3="+encodeURIComponent($("#student_entry_comm_addr3").val());
	$lstr_data+="&student_entry_comm_addr4="+encodeURIComponent($("#student_entry_comm_addr4").val());
	
	$lstr_data+="&student_entry_per_add1="+encodeURIComponent($("#student_entry_per_add1").val());	
	$lstr_data+="&student_entry_per_add2="+encodeURIComponent($("#student_entry_per_add2").val());	
	$lstr_data+="&student_entry_per_add3="+encodeURIComponent($("#student_entry_per_add3").val());	
	$lstr_data+="&student_entry_per_add4="+encodeURIComponent($("#student_entry_per_add4").val());

	
//Added for Pondicheri Req Starts
	 
	$lstr_data+="&sub_degree="+encodeURIComponent($("#student_entry_sub_degree_code").val());
	$lstr_data+="&rec_order_no="+encodeURIComponent($("#student_entry_recognition_order_no").val());
	$lstr_data+="&rec_order_date="+date_format($("#student_entry_recognition_date").val());
	$lstr_data+="&aff_order_no="+encodeURIComponent($("#student_entry_affiliation_order_no").val());
	$lstr_data+="&aff_order_date="+date_format($("#student_entry_affiliation_date").val());
	$lstr_data+="&father_occ="+encodeURIComponent($("#student_entry_father_occupation").val());
	$lstr_data+="&mother_occ="+encodeURIComponent($("#student_entry_mather_occupation").val());
	$lstr_data+="&email="+encodeURIComponent($("#student_entry_email").val());
	$lstr_data+="&contact="+encodeURIComponent($("#student_entry_contact_no").val());
	$lstr_data+="&blood_group="+encodeURIComponent($("#student_entry_blood_group").val());
	 
	var student_entry_reg_fee=parseFloat(empty($("#student_entry_reg_fee").val())?0.0:$("#student_entry_reg_fee").val());
	var student_entry_exam_fee=parseFloat(empty($("#student_entry_exam_fee").val())?0.0:$("#student_entry_exam_fee").val());
	var student_entry_grade_card_fee=parseFloat(empty($("#student_entry_grade_card_fee").val())?0.0:$("#student_entry_grade_card_fee").val());
	var student_entry_total_fee=parseFloat(empty($("#student_entry_total_fee").val())?0.0:$("#student_entry_total_fee").val());
	$lstr_data+="&student_entry_reg_fee="+encodeURIComponent($("#student_entry_reg_fee").val());
	$lstr_data+="&student_entry_exam_fee="+encodeURIComponent($("#student_entry_exam_fee").val());
	$lstr_data+="&student_entry_grade_card_fee="+encodeURIComponent($("#student_entry_grade_card_fee").val());
	$lstr_data+="&student_entry_fine_fee="+encodeURIComponent($("#student_entry_fine_fee").val()); 
	$lstr_data+="&student_entry_total_fee="+encodeURIComponent($("#student_entry_total_fee").val());

	
	var lateral_entry=0;
	if(document.getElementById("is_lateral_entry").checked==true)
	lateral_entry=1;	
	$lstr_data+="&lateral_entry="+lateral_entry;
	$lstr_data+="&religion="+encodeURIComponent($("#student_entry_religion").val());
	$lstr_data+="&unlink_file="+encodeURIComponent($("#student_entry_photo").attr('src'));
	//end

	
	
	$sub_arr = new Object();
	$n=0;
		for($m=0;$m<$g_subject_appearing.total_count;$m++)
		{

			$sub_arr[$n]= new Object();
			$sub_arr[$n]['sub_code']=trim($("#se_sub_code_"+$m).val());
			$n++;
		}

		var myJSONText = encodeURIComponent(JSON.stringify($sub_arr));
		
		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;
		}
		$lstr_data+="&filepath="+filepath;	
		$upload = $host_url+"saveStudentEntry.demo&"+$lstr_data+"&sub_arr="+myJSONText;	
	
	 document.getElementById("form_module_image_upload").setAttribute("action",$upload);
		//return AIM.submit(document.getElementById("form_student_entry"), '_new',{'onComplete' : saveStudentEntryResponse});
		 return AIM.submit(document.getElementById("form_module_image_upload"), 'report_display',{'onComplete' : saveStudentEntryResponse});
		 //return AIM.submit(document.getElementById("form_module_image_upload"), 'new_tab',{'onComplete' : saveStudentEntryResponse});
		 
		/* $.ajax({
					type: "POST",
					//async:false,
					url: $host_url+"saveStudentEntry.demo",   
					data:$lstr_data+"&sub_arr="+myJSONText,	
					success:saveStudentEntryResponse
		}); */
		
  }
  else
  {
    alert(" You Can't Save.. This Record Already Deleted..!!");
  }
}

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


//DiaplayUserSelectedPhoto()







function getEnterForSubDetails(evt,type,id,icode)
{
	var kC  = (evt.which) ? evt.which : evt.keyCode;
	if(kC == 13)
	{
		getSubDetails(id,icode);
	}
}
function getStudentSlNo() // for getting student serial number
{   	
return;
	if((document.getElementById('is_add_edit').value=='Edit' || document.getElementById('is_add_edit').value=='Delete')  && jQuery.trim($("#student_entry_slno").val())!='')
	{		
		$.ajax({
				type: "POST",
				//async:false,
				url: $host_url+"getSlNoStudentDetails.demo", 
				data:"sl_no="+encodeURIComponent(trim($("#student_entry_slno").val()))+"&degree="+encodeURIComponent(trim($("#student_entry_degree_code").val())),
				success: selectStudentDetailsResponse
			}); 	
	} 
}  
function selectStudentDetailsResponse($responce)
{ 	
	$responce = eval('(' + $responce + ')'); 
	
	if($responce.data['FDELETED'] == 'F')
	{
			DeletedRecords = 0;  // non deleted record
			$("#error_msg").html(" ");			
	}
	else
	{
		DeletedRecords = 1; // deleted Record		
	}
	
	if($responce.error_code == 0 || $responce.error_code == -1)
	{		
		$("#error_msg").html(" ");
		document.getElementById('student_entry_degree_code').value = $responce.data['FDEGREE'];
		 
		 document.getElementById('student_entry_degree_name').value = $responce.data['FDESCPN'];
		//document.getElementById('student_entry_exam').value = $responce.data['FEXAMNO'];
		document.getElementById('student_entry_slno').value = $responce.data['FSLNO'];
		document.getElementById('student_entry_name').value = $responce.data['FNAME'];
		document.getElementById('student_entry_fname').value = $responce.data['FFATNAME'];
		document.getElementById('student_entry_mname').value = $responce.data['FMOTNAME'];
		document.getElementById('student_entry_dob_year').value = $responce.data['FDOB_Year'];
	
		document.getElementById('student_entry_dob_month').value = returnMonthName($responce.data['FDOB_month']);
		document.getElementById('student_entry_dob_date').value = $responce.data['FDOB_date'];		
		
		document.getElementById('student_entry_gender').value = $responce.data['Fgender'];
		document.getElementById('student_entry_english').value = $responce.data['FENGLISH'];
		document.getElementById('student_entry_nationality').value = $responce.data['FNATIONAL'];
		
		document.getElementById('student_entry_comm_addr1').value = $responce.data['FCURRADD1'];
		document.getElementById('student_entry_comm_addr2').value = $responce.data['FCURRADD2'];
		document.getElementById('student_entry_comm_addr3').value = $responce.data['FCURRADD3'];
		document.getElementById('student_entry_comm_addr4').value = $responce.data['FCURRADD4'];
		document.getElementById('student_entry_per_add1').value = $responce.data['FPERMADD1'];
		document.getElementById('student_entry_per_add2').value = $responce.data['FPERMADD2'];
		document.getElementById('student_entry_per_add3').value = $responce.data['FPERMADD3'];
		document.getElementById('student_entry_per_add4').value = $responce.data['FPERMADD4'];		
		document.getElementById('student_entry_sub_degree_code').value= $responce.data['FSUBDEGREE'];
		document.getElementById('student_entry_sub_degree').value =$responce.data['FSUBDEGREE'];
		document.getElementById('student_entry_recognition_order_no').value =$responce.data['FREC_ORDER_NO'];
		document.getElementById('student_entry_recognition_date').value =$responce.data['FREC_ORDER_DATE'];
		document.getElementById('student_entry_affiliation_order_no').value =$responce.data['FAFF_ORDER_NO'];
		document.getElementById('student_entry_affiliation_date').value =$responce.data['FAFF_ORDER_DATE'];
		document.getElementById('student_entry_religion').value =$responce.data['FRELIGION'];		
		
		document.getElementById('student_entry_father_occupation').value =$responce.data['FFAT_OCC'];	
		document.getElementById('student_entry_mather_occupation').value=$responce.data['FMOT_OCC'];	
		document.getElementById('student_entry_email').value=$responce.data['FEMAIL'];	
		document.getElementById('student_entry_contact_no').value =$responce.data['FCONTACT_NO'];	
		document.getElementById('student_entry_blood_group').value =$responce.data['FBLOOD_GROUP'];	
		document.getElementById('degree_category').value = $responce.data['FCASTE'];
	
	
		if($responce.data['FPDNAME'] != '')
		{
			document.getElementById('pd').checked =true;
			$('#pdname').show();	
		}
		
		document.getElementById('cast_name').value =$responce.data['FCASTENAME'];
		document.getElementById('aadhaar').value =$responce.data['FAADHAAR'];
		document.getElementById('pdname').value =$responce.data['FPDNAME'];
		document.getElementById('esq').value = $responce.data['FESQ'];
		document.getElementById('local').value =$responce.data['FLOCAL'];
		document.getElementById('basicqal').value =$responce.data['FBASICQAL'];
		
	if($responce.data['FESQ'] == 'T')
		document.getElementById('esq').checked = true; 
	else
		document.getElementById('esq').checked = false;
	
	if($responce.data['FGENDERDISABILITY'] == 'T')
		document.getElementById('gd').checked = true; 
	else
		document.getElementById('gd').checked = false;	
	
		$.ajax({
			type: "POST",
			//async:false,
			url: $host_url+"getCombinationNames", 
			data:"&degree="+encodeURIComponent($responce.data['FDEGREE']),
			success:function($responces)
			{
				$responces = eval('(' + $responces + ')');
			
				var optionsAsString = "<option value=''> Select Combination</option>";
				for(var i = 0; i < $responces.data.length; i++) {
				if($responces.data[i].internal_code == $responce.data['FCOMBCODE'])
				{
					optionsAsString += "<option value='" + $responces.data[i].internal_code + "' selected>" + $responces.data[i].value + "</option>";
				}
				else
				optionsAsString += "<option value='" + $responces.data[i].internal_code + "'>" + $responces.data[i].value + "</option>";
			}
			$("#combcode" ).append( optionsAsString );
			}
			});
		
		//document.getElementById('combcode').value = $responce.data['FCOMBCODE'];
		document.getElementById('combcode').value = $responce.data['FCOMBCODE'];
		document.getElementById('student_entry_fine_fee').value = $responce.data['FFINE'];
	
		 $("#student_entry_photo").attr("src", $responce.data['FPHOTOPATH']);
		if($responce.data.FLATERAL_ENTRY==1)
		{
		document.getElementById('is_lateral_entry').checked=true;
		$("#student_entry_exam").val("C") ;
		}
		else 
		{
		document.getElementById('is_lateral_entry').checked=false;
		$("#student_entry_exam").val("A") ;
		}
	 
		getsubjectAppearingTotal();
	 
	}	
	else if($responce.error_code == -2)
	{
		DeletedRecords = 0;
		//$("#error_msg").html(" In Valid SL Number ");
		alert('In Valid SL Number');
		$("#student_entry_slno").val('');	
		document.getElementById('student_entry_slno').focus();	
	}
}
function deleteStudentRecord()
{
   var ids=jQuery("#view_student_entry").getGridParam('selarrrow'); 
   	var delete_arr = new Object();   	  	
	if (ids) 
	{
	
		for(var p=0;p<ids.length;p++)
		{
		//alert(ids);
			var dataset=jQuery("#view_student_entry").getRowData(ids[p]);		
			var degree_code=dataset['grid_degree'];			
			var exam=dataset['grid_exam'];		
			var sl_no=dataset['grid_sl_no'];
			//alert(sl_no);
			    delete_arr[p]= new Object();	
			    delete_arr[p]['degree_code']=degree_code;	
			    delete_arr[p]['exam']=exam;	
			    delete_arr[p]['sl_no']=sl_no;			       
		}
		var agree=confirm("Would you like to Delete this Record..!!");  
		if(agree)
		{
			var myJSONText = encodeURIComponent(JSON.stringify(delete_arr)); 
			$.ajax({
						type: "POST",
						//async:false,
						url: $host_url+"disableRecord.demo", 
						data:"&delete_arr="+myJSONText,
						success: disableRecordResponse
					});	
		}		   
	} 
	else
	{
		alert("Please select row in grid"); return;
	}
			
}
function disableRecordResponse($responce)
{
	$responce = eval('(' + $responce + ')'); 
	if($responce.error_code==0)
	{		 
		alert("Record Deleted Successfully");		
		$('#view_student_entry').trigger("reloadGrid"); 
	}	
}
 
function clearStudentEntry()
{
     document.getElementById('student_entry_degree_code').value = '';
	 document.getElementById('student_entry_degree_name').value = '';
	 document.getElementById('student_entry_slno').disabled=true;
	 
	document.getElementById('student_entry_slno').value = '';
	document.getElementById('student_entry_name').value = '';
	document.getElementById('student_entry_fname').value = '';
	document.getElementById('student_entry_mname').value = '';
	 document.getElementById('student_entry_dob_year').value = '';
	//document.getElementById('student_entry_dob_month').value = '';
	document.getElementById('student_entry_dob_date').value = '';
	document.getElementById('student_entry_nationality').value ='';
	document.getElementById('student_entry_comm_addr1').value = '';
	document.getElementById('student_entry_comm_addr2').value = '';
	document.getElementById('student_entry_comm_addr3').value ='';
	document.getElementById('student_entry_comm_addr4').value ='';
	document.getElementById('student_entry_per_add1').value ='';
	document.getElementById('student_entry_per_add2').value = '';
	document.getElementById('student_entry_per_add3').value ='';
	document.getElementById('student_entry_per_add4').value = '';
	document.getElementById('subject_appearing').innerHTML = '';
	$("#student_entry_upload").val("");
	 $("#student_entry_photo").attr("src", "images/default_photo.jpg");
	document.getElementById('student_entry_sub_degree_code').value ='';
	document.getElementById('student_entry_sub_degree').value ='';
	document.getElementById('student_entry_recognition_order_no').value ='';
	document.getElementById('student_entry_recognition_date').value ='';
	document.getElementById('student_entry_affiliation_order_no').value ='';
	document.getElementById('student_entry_affiliation_date').value ='';
	document.getElementById('student_entry_religion').value ='';
	document.getElementById('student_entry_english').value ='';	
	document.getElementById('student_entry_father_occupation').value ='';
	document.getElementById('student_entry_mather_occupation').value ='';
	document.getElementById('student_entry_email').value ='';
	document.getElementById('student_entry_contact_no').value ='';
	document.getElementById('student_entry_blood_group').value ='';
	//document.getElementById('student_entry_fine_fee').value = '';
	$("#student_entry_reg_fee").val("0.00"); 
	$("#student_entry_exam_fee").val("0.00"); 
	$("#student_entry_grade_card_fee").val("0.00"); 
	$("#student_entry_total_fee").val("0.00");  

}

function clearStudentEntryAfterSave()
{
     
	 
	document.getElementById('student_entry_slno').value = '';
	 document.getElementById('student_entry_slno').disabled=true;
	document.getElementById('student_entry_name').value = '';
	document.getElementById('student_entry_fname').value = '';
	document.getElementById('student_entry_mname').value = '';
	 document.getElementById('student_entry_dob_year').value = '';
	//document.getElementById('student_entry_dob_month').value = '';
	document.getElementById('student_entry_dob_date').value = '';
 
	document.getElementById('student_entry_comm_addr1').value = '';
	document.getElementById('student_entry_comm_addr2').value = '';
	document.getElementById('student_entry_comm_addr3').value ='';
	document.getElementById('student_entry_comm_addr4').value ='';
	document.getElementById('student_entry_per_add1').value ='';
	document.getElementById('student_entry_per_add2').value = '';
	document.getElementById('student_entry_per_add3').value ='';
	document.getElementById('student_entry_per_add4').value = '';
	document.getElementById('student_entry_fine_fee').value = '';	
	$("#student_entry_upload").val("");
	 $("#student_entry_photo").attr("src", "images/default_photo.jpg");
	 
	 
	 document.getElementById('esq').checked = false;
	 document.getElementById('gd').checked = false;
	 document.getElementById('aadhaar').value = '';
	 document.getElementById('local').value = '';
	 document.getElementById('pdname').value = '';
	 document.getElementById('basicqal').value = '';
	 document.getElementById('combcode').value = '';
	document.getElementById('student_entry_recognition_order_no').value ='';
	document.getElementById('student_entry_recognition_date').value ='';
	document.getElementById('student_entry_affiliation_order_no').value ='';
	document.getElementById('student_entry_affiliation_date').value ='';
	document.getElementById('student_entry_religion').value ='';
 	document.getElementById('student_entry_father_occupation').value ='';
	document.getElementById('student_entry_mather_occupation').value ='';
	document.getElementById('student_entry_email').value ='';
	document.getElementById('student_entry_contact_no').value ='';
	document.getElementById('student_entry_blood_group').value ='';
	$("#student_entry_reg_fee").val("0.00"); 
	$("#student_entry_exam_fee").val("0.00"); 
	$("#student_entry_grade_card_fee").val("0.00"); 
	$("#student_entry_total_fee").val("0.00"); 
	 
}
 

function ViewStudentDetails()
{
 $main="<table id='view_student_entry' class='scroll' ondblclick='SelectStudentRowId();'></table> <div id='sub_grid_div' class='scroll' style='text-align:center;'></div>";
	document.getElementById('page_main_div').innerHTML=$main;
	var student_details=jQuery("#view_student_entry").jqGrid(
	{
		url:$host_url+'ViewStudentDetails',
		datatype: "json",
		colNames:['Sl No','Degree','Branch','Exam','Name','Created By'],
		colModel:[
		{name:'grid_sl_no',index:'grid_sl_no', width:50,sorttype:'integer', searchoptions:{sopt:['eq','ne','le','lt','gt','ge']} },		
		{name:'grid_degree',index:'grid_degree', width:100,sorttype:'integer', searchoptions:{sopt:['eq','ne','le','lt','gt','ge']} },		
		{name:'grid_sub_degree',index:'grid_sub_degree', width:100,sorttype:'integer', searchoptions:{sopt:['eq','ne','le','lt','gt','ge']} },		
		{name:'grid_exam',index:'grid_exam', width:100,sorttype:'integer', searchoptions:{sopt:['eq','ne','le','lt','gt','ge']} },		
		{name:'grid_name',index:'grid_name', width:100,sorttype:'integer', searchoptions:{sopt:['eq','ne','le','lt','gt','ge']} },
		{name:'created_by',index:'created_by', width:100,sorttype:'integer', searchoptions:{sopt:['eq','ne','le','lt','gt','ge']} }],
		rowNum:500,
		rowList:[20,30,40,60],
		imgpath:$img_path,
		pager: jQuery('#sub_grid_div'),
		sortname: 'id',
		height:'250',
		viewrecords: true,
		viewrecords: true,
		searchOperators : true,
		sortorder: "desc",
		multiselect: true,
		cellEdit: true,
		gridview: true,
		width:'840',
		search:true,
		caption:"Student Details",
		editurl:$host_url+'deleteStudentDetails'
	},'filterToolbar',{searchOperators : true}).navGrid('#sub_grid_div',{edit:false,add:false,del:false,search:true},{},{},{},{multipleSearch:true})
			.navButtonAdd('#sub_grid_div',{caption:"Toggle",
			buttonicon :'ui-icon-pin-s', onClickButton:function(){ student_details[0].toggleToolbar() } }).
			navButtonAdd('#sub_grid_div',{caption:"Delete",
			buttonicon :'ui-icon-trash', onClickButton:function(){ deleteStudentRecord() } }).
    navButtonAdd('#sub_grid_div',{caption:"Edit", 
    onClickButton:function()
    {
	 SelectStudentRowId();
    }	     
    }); 
	//jQuery("#view_student_entry").jqGrid();
     student_details.filterToolbar(); 	
		$("#gs_grid_sl_no").focus();
			   $('.ui-search-toolbar').bind('keydown',function(evt) 
				{
					var kC  = (evt.which) ? evt.which : evt.keyCode;
				 	if(kC==40)
					jQuery('#degree_grid').editCell(0,0,false);	
				});	
  }

function SelectStudentRowId()
{ 
	var id=jQuery("#view_student_entry").getGridParam('selrow'); 
	if (id) 
	{ 
		 
		LoadstudentEntry('Edit');
		var dataset=jQuery("#view_student_entry").getRowData(id);
		$g_se_degree=dataset['grid_degree'];
		$geditinternalcode=id;
		
	} 
	else
	{
		alert("Please select row in grid"); return;
	}
 }
 
 
 function EditStudentDetailsForUpdate(id)
 {
  
 
   		$.ajax({
				type: "POST",
				//async:false,
				url: $host_url+"getSlNoStudentDetails.demo", 
				data:"sl_no="+id+"&degree="+$g_se_degree,
				success: EditStudentDetailsForUpdateResponse
			}); 
 }
 
 function EditStudentDetailsForUpdateResponse($responce)
{ 	
	$responce = eval('(' + $responce + ')'); 
		document.getElementById('is_add_edit').value = 'Edit';
	if($responce.data['FDELETED'] == 'F')
	{
			DeletedRecords = 0;  // non deleted record
			$("#error_msg").html(" ");			
	}
	else
	{
		DeletedRecords = 1; // deleted Record		
	}
	
	if($responce.error_code == 0 || $responce.error_code == -1)
	{		
		$("#error_msg").html(" ");
		document.getElementById('student_entry_degree_code').value = $responce.data['FDEGREE'];
		
		 document.getElementById('student_entry_degree_name').value = $responce.data['FDESCPN'];
		//document.getElementById('student_entry_exam').value = $responce.data['FEXAMNO'];
		document.getElementById('student_entry_slno').value = $responce.data['FSLNO'];
		document.getElementById('student_entry_name').value = $responce.data['FNAME'];
		document.getElementById('student_entry_fname').value = $responce.data['FFATNAME'];
		document.getElementById('student_entry_mname').value = $responce.data['FMOTNAME'];
		 document.getElementById('student_entry_dob_year').value = $responce.data['FDOB_Year'];
		document.getElementById('student_entry_dob_month').value =  ($responce.data['FDOB_month']);
		document.getElementById('student_entry_dob_date').value = $responce.data['FDOB_date'];		
		
		document.getElementById('student_entry_gender').value = $responce.data['Fgender'];
		document.getElementById('student_entry_english').value = $responce.data['FENGLISH'];
		document.getElementById('student_entry_nationality').value = $responce.data['FNATIONAL'];
		document.getElementById('degree_category').value = $responce.data['FCASTE'];
		document.getElementById('student_entry_comm_addr1').value = $responce.data['FCURRADD1'];
		document.getElementById('student_entry_comm_addr2').value = $responce.data['FCURRADD2'];
		document.getElementById('student_entry_comm_addr3').value = $responce.data['FCURRADD3'];
		document.getElementById('student_entry_comm_addr4').value = $responce.data['FCURRADD4'];
		document.getElementById('student_entry_per_add1').value = $responce.data['FPERMADD1'];
		document.getElementById('student_entry_per_add2').value = $responce.data['FPERMADD2'];
		document.getElementById('student_entry_per_add3').value = $responce.data['FPERMADD3'];
		document.getElementById('student_entry_per_add4').value = $responce.data['FPERMADD4'];		
		document.getElementById('student_entry_sub_degree_code').value= $responce.data['FSUBDEGREE'];
		document.getElementById('student_entry_sub_degree').value =$responce.data['FSUBDEGREE'];
		document.getElementById('student_entry_recognition_order_no').value =$responce.data['FREC_ORDER_NO'];
		document.getElementById('student_entry_recognition_date').value =$responce.data['FREC_ORDER_DATE'];
		document.getElementById('student_entry_affiliation_order_no').value =$responce.data['FAFF_ORDER_NO'];
		document.getElementById('student_entry_affiliation_date').value =$responce.data['FAFF_ORDER_DATE'];
		document.getElementById('student_entry_religion').value =$responce.data['FRELIGION'];
		//GetCombination($responce.data['FDEGREE']);
		document.getElementById('cast_name').value =$responce.data['FCASTENAME'];
		document.getElementById('aadhaar').value =$responce.data['FAADHAAR'];
		if($responce.data['FPDNAME'] != '')
		{
			document.getElementById('pd').checked =true;
			$('#pdname').show();	
		}
		document.getElementById('pdname').value =$responce.data['FPDNAME'];
		document.getElementById('basicqal').value =$responce.data['FBASICQAL'];
		document.getElementById('local').value =$responce.data['FLOCAL'];		
		
		if($responce.data['FESQ'] == 'T')
			document.getElementById('esq').checked = true; 
		else
			document.getElementById('esq').checked = false;
	
		if($responce.data['FGENDERDISABILITY'] == 'T')
			document.getElementById('gd').checked = true; 
		else
			document.getElementById('gd').checked = false;	
		$.ajax({
			type: "POST",
			//async:false,
			url: $host_url+"getCombinationNames", 
			data:"&degree="+encodeURIComponent($responce.data['FDEGREE']),
			success:function($responces)
			{
			$responces = eval('(' + $responces + ')');
			
			var optionsAsString = "<option value=''> Select Combination</option>";
			for(var i = 0; i < $responces.data.length; i++) {
				if($responces.data[i].internal_code == $responce.data['FCOMBCODE'])
				{
					optionsAsString += "<option value='" + $responces.data[i].internal_code + "' selected>" + $responces.data[i].value + "</option>";
				}
				else
				optionsAsString += "<option value='" + $responces.data[i].internal_code + "'>" + $responces.data[i].value + "</option>";
			}
			$("#combcode" ).append( optionsAsString );
			}
			});
		
		//document.getElementById('combcode').value = $responce.data['FCOMBCODE'];
		document.getElementById('combcode').value = $responce.data['FCOMBCODE'];
		
		document.getElementById('student_entry_father_occupation').value =$responce.data['FFAT_OCC'];	
		document.getElementById('student_entry_mather_occupation').value=$responce.data['FMOT_OCC'];	
		document.getElementById('student_entry_email').value=$responce.data['FEMAIL'];	
		document.getElementById('student_entry_contact_no').value =$responce.data['FCONTACT_NO'];	
		document.getElementById('student_entry_blood_group').value =$responce.data['FBLOOD_GROUP'];	
		$("#student_entry_reg_fee").val($responce.data['REG_FEE']); 
		$("#student_entry_exam_fee").val($responce.data['EXAM_FEE']); 
		$("#student_entry_grade_card_fee").val($responce.data['GRADE_CARD_FEE']); 
		$("#student_entry_total_fee").val($responce.data['TOTAL_FEE']); 
	
		document.getElementById('student_entry_fine_fee').value = $responce.data['FFINE'];
	
		 $("#student_entry_photo").attr("src", $responce.data['FPHOTOPATH']);
		if($responce.data.FLATERAL_ENTRY==1)
		{
		document.getElementById('is_lateral_entry').checked=true;
		$("#student_entry_exam").val("C") ;
		}
		else 
		{
		document.getElementById('is_lateral_entry').checked=false;
		$("#student_entry_exam").val("A") ;
		}
		getsubjectAppearingTotal();
		 
	}	
	else if($responce.error_code == -2)
	{
		DeletedRecords = 0;
		//$("#error_msg").html(" In Valid SL Number ");
		alert('In Valid SL Number');
		$("#student_entry_slno").val('');	
		document.getElementById('student_entry_slno').focus();	
	}
}
function CalculateSETotalFee()
{
	var student_entry_reg_fee=parseFloat(empty($("#student_entry_reg_fee").val())?0.0:$("#student_entry_reg_fee").val());
	var student_entry_exam_fee=parseFloat(empty($("#student_entry_exam_fee").val())?0.0:$("#student_entry_exam_fee").val());
	var student_entry_grade_card_fee=parseFloat(empty($("#student_entry_grade_card_fee").val())?0.0:$("#student_entry_grade_card_fee").val());
	var student_entry_fine_fee=parseFloat(empty($("#student_entry_fine_fee").val())?0.0:$("#student_entry_fine_fee").val());
	var total_fee=parseFloat(student_entry_reg_fee+student_entry_exam_fee+student_entry_grade_card_fee+student_entry_fine_fee);
	$("#student_entry_total_fee").val(total_fee);
}

function getLateralEntrySubjects()
{
	if(document.getElementById("is_lateral_entry").checked==true)
	{
		$("#student_entry_exam").val("C") ;
		getsubjectAppearingTotal();
	}
	else
	{
		$("#student_entry_exam").val("A") ;
		getsubjectAppearingTotal();
	}
}
function checkdisability()
{
	if(document.getElementById('pd').checked == true)
		$('#pdname').show();
	else
		$('#pdname').hide();
		
}
function checkesk()
{
	if(document.getElementById('sq').checked == true)
		$('#esk').show();
	else
		$('#esk').hide();
}

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


function GetCombinationSubjectList()
{
	if( jQuery.trim($("#student_entry_degree_code").val())!='')
	{
		$sl_no='';
		
		$sl_no=encodeURIComponent(trim($("#student_entry_admno").val()));
		$.ajax({
				type: "POST",
				//async:false,
				url: $host_url+"getsubjectAppearingTotal.demo", 
				data:"degree_code="+$("#student_entry_degree_code").val()+"&exam="+$("#student_entry_exam").val() +
				"&sl_no="+$sl_no+"&pmode="+$g_student_retain_per_mode+
				"&sub_degree="+encodeURIComponent(trim($("#student_entry_sub_degree_code").val()))+
				"&combination="+$("#combcode").val(),
				success: subjectAppearingTotalResponse
			});	
	}	
}


function subjectAppearingTotalResponse($responce)
{
	$responce = eval('(' + $responce + ')'); 
	$g_subject_appearing=$responce.data;
	$g_remaining_counter_inc=($responce.data.remaining_count);
	$("#subject_appearing").show();
	$("#subject_appearing").html($responce.data.html);	

}