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


Current Path : /proc/thread-self/root/var/www/html/stph/custom_js/
Upload File :
Current File : //proc/thread-self/root/var/www/html/stph/custom_js/practical_marks_mis.js

function practicalmarksmis()
{   
   $("#page_main_div").load('html_modules/practical_marks_misc.html?v=31082019',function()
	{ 
		$geditinternalcode=0;
		
		document.getElementById('display_module_name').innerHTML = 'Practical Marks Entry(Misc)';
		document.getElementById('module_name_for_save').value = 'Practical marks misc';
		document.getElementById('is_add_edit').value = 'Edit';	
		getDefaultHeadFooterLinks("Practical marks misc"); 	
		$("#btc_default_reg_div").hide();
	});	 
}
 
function GetPracticalMarksRegNos()
{
	if($("#degree_code").val()=="")
	{
		 alert("Please Enter Degree Name");
		 $("#batch_sub_degree_code").focus();
		 return;
	}
	if($("#subcode").val()=="")
	{
		 alert("Please Enter Subject Code");
		 $("#batch_sub_final_subcode").focus();
		 return;
	}
	if($("#Examno").val()=="")
	{
		 alert("Please Enter Examno");
		 $("#batch_sub_Examno").focus();
		 return;
	}
	var bw_condition;
	if($("#batch_sub_range").val() == 'B/W')
	{
		condition_name = " between ";
		condition_val = "'"+$("#batch_sub_range_from").val()+"'"+" and "+"'"+$("#batch_sub_range_to").val()+"'";
	}
	else 
	{
		condition_name = "like ";
		condition_val = $("#batch_sub_range_bw").val();	
		
	}
	$.blockUI({ message: "<h1 class='h1' style='font-size:12px'>Saving... <img src='images/spinner.gif' border='0'></h1>" }); 	
	$.ajax({
			type: "POST",
			url: $host_url+"checksubfreez", 
			data:"degcode="+$("#degree_code").val()+"&subcode="+$("#subcode").val()+"&examno="+$("#Examno").val()+"&vivasubcode="+$("#batch_viva_subject_code").val(),
			success: function($responce)
			{
				$responce = eval('(' + $responce + ')'); 
				
				if($responce.error_code == 0)
				{
					$.unblockUI();
					/* var viva_sub_code=$("#batch_viva_subject_code").val();
					if(viva_sub_code == '')
					{
						var colspan = 'colspan = \'3\'';
						var vivamarks ="<td style='padding:2px; width:50px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;' >";
						 vivamarks +="<input type = 'text' id= '1AT3'  style = 'width:50px' onkeydown = 'addrow(event,this.id)' onkeypress='return acceptNumbersOnlyForModule(event);'>";
					}
					else
					{
						colspan = 'colspan = \'4\'';
						var vivacol ="<td  style='padding:2px; width:60px; border-left:1px solid #C5DBEC;'><center>Viva. Marks</center></td>";
						var vivamarks ="<td style='padding:2px; width:50px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;' >";
						vivamarks +="<input type = 'text' id= '1AT3'  style = 'width:50px' onkeypress='return acceptNumbersOnlyForModule(event);'></td>";
						vivamarks +="<td style='padding:2px; width:50px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;' >";
						vivamarks +="<input type = 'text' id= '1AT4'  style = 'width:50px' onkeydown = 'addrow(event,this.id)' onkeypress='return acceptNumbersOnlyForModule(event);'>";
					}

					$("#btc_default_reg_div").show();
					
						var table = "<table width='600px;' id = 'table1' cellspacing='0' style = 'margin-left:45px;' class='tr_ventor_row' cellpadding='0' border='0'>";
						table += "<th align='left' "+colspan+" class='ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper' style='font-size:12px; padding-left:6px; height:24px;' >Marks Entry</th>";
						table +="<tr class='ui-state-default ui-jqgrid-hdiv' >";
						table +="<td  style='padding:2px; width:60px; border-left:1px solid #C5DBEC;'><center>Reg. No.</center></td>"
						table +="<td  style='padding:2px; width:60px; border-left:1px solid #C5DBEC;'><center>Student Name</center></td>";
						table +="<td  style='padding:2px; width:60px; border-left:1px solid #C5DBEC;'><center>prct. Marks</center></td>";
						if(viva_sub_code != '')
						{
							table +=vivacol;
						}
						table +="</tr>";
						table +="<tr>";
						table +="<td style='padding:2px; width:50px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'  >";
						table +="<input type = 'text' id= '1AT1' style = 'width:80px' onkeydown = 'getstudentname(this.id,event)' name='prmicmarks'  >";
						table +="</td>";
						table +="<td style='padding:2px; width:150px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;' >";
						table +="<input type = 'text' id= '1AT2'  style = 'width:470px' readonly>";
						table +="</td>";
						table +=vivamarks;
						table +="</td>";
						table +="<tr></table>"; */
					$("#btc_default_reg_div").show();
					$("#btc_default_reg_div").html($responce.data);
					addrowdy();
					//alert($responce.data);
					//document.getElementById("1AT1").focus();
				}else
				{
					$("#btc_default_reg_div").show();
					$.unblockUI();
					document.getElementById('btc_default_reg_div').innerHTML = $responce.data;
					//$("#btc_default_reg_div").html($responce.data);
					addrowdy();
				}
			}
		});
}

function getstudentname(id,evt)
{
	var regno = document.getElementById(id).value;
	
	if(evt.keyCode == '9' || evt.keyCode == '13')
	{
		if(regno == '')
		{
			alert('Enter the register number');
			document.getElementById(id).focus();
			return false;
		}
		var inputFileds = document.getElementsByTagName('input');
		var chkCnt = 0;
		for (var counter=0; counter < inputFileds.length; counter++) 
		{       
			if ( inputFileds[counter].type.toUpperCase()=='TEXT'  && inputFileds[counter].name == "prmicmarks"  )
			{   
				++chkCnt;
				if(id != chkCnt+'AT1')
				{
					if(regno == document.getElementById(chkCnt+'AT1').value)
					{
						alert('Register Number Already selected.');
						document.getElementById(id).value = '';
						document.getElementById(id).focus();
						return false;
					}	
				}	
			}
		}
		
		var subcode = document.getElementById('subcode').value; 
		
		oldreg = regno
		
		if(regno != '')
		{
			$.ajax({
				type: "POST",
				url: $host_url+"getstudentname", 
				data:"regno="+regno+"&id="+id+"&subcode="+subcode,
				success: getstudentnameResponse
			});
		}
	}
}

function getchangecnt(id)
{
	document.getElementById('H'+id).value = 'E';
}

function getstudentnameResponse($responce)
{
	$responce = eval('(' + $responce + ')'); 
	var id = $responce.data['id'];
	var marksid = id.charAt(0);
	if($responce.error_code == '-1')
	{
		
		alert($responce.data['data']);
		document.getElementById(id).value = '';
		document.getElementById(id).focus();
		document.getElementById(marksid+"AT2").value = '';		
		return;
	}else
	{
		document.getElementById(marksid+"AT2").value = $responce.data['name'];
		document.getElementById(marksid+"AT3").focus();
		return;
	}
	
}

function addrow(evt,id)
{
	var viva_sub_code = $("#batch_viva_subject_code").val();

	if(evt.keyCode == '9')
	{
		if(viva_sub_code == '')
		{
			var marks = parseInt(document.getElementById(id).value);
			var batch_marks = parseInt(document.getElementById('batch_sub_maxmark').value);
			
			if(marks > batch_marks)
			{
				alert('Marks Should be less than maximum marks.');
				document.getElementById(id).value = '';
				document.getElementById(id).focus();
				return;
			}
		}
		else
		{
			var vivaid = id.substring(0, 3);
			var marks = parseInt(document.getElementById(id).value);
			var batch_marks = parseInt(document.getElementById('batch_sub_maxmark').value);
			var vivamarks = parseInt(document.getElementById(vivaid+"3").value);
			var batch_vivamarks = parseInt(document.getElementById('batch_viva_subject_max_marks').value);
			if(marks > batch_marks)
			{
				alert('Marks Should be less than maximum marks.');
				document.getElementById(id).value = '';
				document.getElementById(id).focus();
				return;
			}
			if(vivamarks > batch_marks)
			{
				alert('Marks Should be less than maximum marks.');
				document.getElementById(id).value = '';
				document.getElementById(id).focus();
				return;
			}
		} 
		if(document.getElementById(id).value != '' )
		{
			var inputFileds = document.getElementsByTagName('input');
			var chkCnt = 0;
			for (var counter=0; counter < inputFileds.length; counter++) 
			{       
				if ( inputFileds[counter].type.toUpperCase()=='TEXT'  && inputFileds[counter].name == "prmicmarks"  )
				{   
					++chkCnt;
				}
			}
			if(id == chkCnt+'AT4' || id == chkCnt+'AT3')
			{
				var curindex = chkCnt+1;
				if(viva_sub_code == '')
				{
					var colspan = 'colspan = \'3\'';
					var vivamarks ="<td style='padding:2px; width:50px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;' >";
					 vivamarks +='<input type = "text" id = "'+curindex+'AT3"  style = "width:50px;text-align:center;" onkeydown = "addrow(event,this.id)" onkeypress="return acceptNumbersOnlyForModule(event);"><input type = "hidden" id = "H'+curindex+'AT3" value = "E" >';
				}
				else
				{
					colspan = 'colspan = \'4\'';
					var vivacol ='<td  style="padding:2px; width:60px; border-left:1px solid #C5DBEC;"><center>Viva. Marks</center></td>';
					var vivamarks ='<td style="padding:2px; width:50px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;" >';
					vivamarks +='<input type = "text"  id = "'+curindex+'AT3"  style = "width:50px;text-align:center;" onkeypress="return acceptNumbersOnlyForModule(event);"><input type = "hidden" id = "H'+curindex+'AT3" value = "E" ></td>';
					vivamarks +='<td style="padding:2px; width:50px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;" >';
					vivamarks +='<input type = "text"  id = "'+curindex+'AT4"  style = "width:50px;text-align:center;" onkeydown = "addrow(event,this.id)" onkeypress="return acceptNumbersOnlyForModule(event);">';
				}
				var dyrow =	'<tbody id="prmicmarks'+curindex+'"><tr><td style = "padding:2px; width:100px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;" ><input type="text"  id = "'+curindex+'AT1" style = "width:80px" onkeydown = "getstudentname(this.id,event)" autofocus name="prmicmarks"/></td>'; 
				dyrow += '<td style = "padding:2px; width:100px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;" ><input type="text" id = "'+curindex+'AT2" style = "width:470px"  readonly /></td>';
				//dyrow += '<td style = "padding:2px; width:100px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;" ><input type="text" id = "'+curindex+'AT3" style = "width:50px"   onkeydown = "addrow(event,this.id)" onkeypress="return acceptNumbersOnlyForModule(event);" /></td>'; 
				dyrow += vivamarks;
				dyrow += '</td>';
				dyrow += '</tr></tbody>';
				$("#table1").append(dyrow);
			}
		}
	}
	
}

function addrowdy()
{
	var viva_sub_code = $("#batch_viva_subject_code").val();
	var inputFileds = document.getElementsByTagName('input');
	
			var chkCnt = 0;
			for (var counter=0; counter < inputFileds.length; counter++) 
			{       
				if ( inputFileds[counter].type.toUpperCase()=='TEXT'  && inputFileds[counter].name == "prmicmarks"  )
				{   
					++chkCnt;
				}
			}
			//if(id == chkCnt+'AT4' || id == chkCnt+'AT3')
			//{
				var curindex = chkCnt+1;
				if(viva_sub_code == '')
				{
					var colspan = 'colspan = \'3\'';
					var vivamarks ="<td style='padding:2px; width:50px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;' >";
					 vivamarks +='<input type = "text" id = "'+curindex+'AT3"  style = "width:50px" onkeydown = "addrow(event,this.id)" onkeypress="return acceptNumbersOnlyForModule(event);"><input type = "hidden" id = "H'+curindex+'AT3" value = "E" >';
				}
				else
				{
					colspan = 'colspan = \'4\'';
					var vivacol ='<td  style="padding:2px; width:60px; border-left:1px solid #C5DBEC;"><center>Viva. Marks</center></td>';
					var vivamarks ='<td style="padding:2px; width:50px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;" >';
					vivamarks +='<input type = "text"  id = "'+curindex+'AT3"  style = "width:50px" onkeypress="return acceptNumbersOnlyForModule(event);"><input type = "hidden" id = "H'+curindex+'AT3" value = "E" ></td>';
					vivamarks +='<td style="padding:2px; width:50px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;" >';
					vivamarks +='<input type = "text"  id = "'+curindex+'AT4"  style = "width:50px" onkeydown = "addrow(event,this.id)" onkeypress="return acceptNumbersOnlyForModule(event);">';
				}
				var dyrow =	'<tbody id="prmicmarks'+curindex+'"><tr><td style = "padding:2px; width:100px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;" ><input type="text"  id = "'+curindex+'AT1" style = "width:80px" onkeydown = "getstudentname(this.id,event)" autofocus name="prmicmarks"/></td>'; 
				dyrow += '<td style = "padding:2px; width:100px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;" ><input type="text" id = "'+curindex+'AT2" style = "width:470px"  readonly /></td>';
				//dyrow += '<td style = "padding:2px; width:100px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;" ><input type="text" id = "'+curindex+'AT3" style = "width:50px"   onkeydown = "addrow(event,this.id)" onkeypress="return acceptNumbersOnlyForModule(event);" /></td>'; 
				dyrow += vivamarks;
				dyrow += '</td>';
				dyrow += '</tr></tbody>';
				$("#table1").append(dyrow);
			//}
	
}

function SavePracticalEntryMarksmisc()
{
	var list_data ="&Degcode="+$("#degree_code").val();
	list_data+="&Subcode="+$("#subcode").val();
	list_data+="&VivaSubcode="+$("#subject_code").val();
	list_data+="&Examno="+$("#Examno").val();
	list_data+="&VivaSubcode="+$("#batch_viva_subject_code").val();
	
	var pract_sub_code=$("#batch_sub_final_subcode").val();
	//var viva_sub_code=$("#batch_viva_subject_code").val();
		
		
	var inputFileds = document.getElementsByTagName('input');
	var chkCnt = 0;
	var rowCnt = 0;
	var regno_arr = {};
	for (var counter=0; counter < inputFileds.length; counter++) 
	{       
		if(inputFileds[counter].type.toUpperCase()=='TEXT'  && inputFileds[counter].name == "prmicmarks"  )
		{   
			++rowCnt;	
			if(document.getElementById(rowCnt+'AT1').value != '' && document.getElementById(rowCnt+'AT3').value != '' &&  document.getElementById(rowCnt+'AT3').value != '-1' &&  document.getElementById('H'+rowCnt+'AT3').value == 'E')
			{
				++chkCnt;
				regno_arr[chkCnt] = new Object();
				regno_arr[chkCnt]['regno'] = document.getElementById(rowCnt+'AT1').value;
				regno_arr[chkCnt]['name'] = document.getElementById(rowCnt+'AT2').value;
				regno_arr[chkCnt]['marks']   = document.getElementById(rowCnt+'AT3').value;
				if($("#batch_viva_subject_code").val() != '')
					regno_arr[chkCnt]['vivamarks']   = document.getElementById(rowCnt+'AT4').value;
			}
		}
	}
		var dataString ="&regno_arr="+encodeURIComponent(JSON.stringify(regno_arr))+"&list_data="+list_data;
		$.ajax({
		type:"POST",
		url:$host_url+"SavePracticalEntryMarksmisc",
		data:dataString,
		cache:false,
		success:function($responce)
		{	
			$responce = eval('('+$responce+')');
			if($responce.error_code == 0)
			{
				alert($responce.data);
				practicalmarksmis();
			}
			else
				alert($responce.data);
		}	
		});	
		
}
 
function ReoprtPracticalEntryMarksmisc()
{
	var list_data ="&Degcode="+$("#degree_code").val();
	list_data+="&Subcode="+$("#subcode").val();
	list_data+="&Examno="+$("#Examno").val();
	list_data+="&VivaSubcode="+$("#batch_viva_subject_code").val();
	
	window.location.href = $host_url+"ReoprtPracticalEntryMarksmisc&Degcode="+$("#degree_code").val()+"&Subcode="+$("#subcode").val()+"&Examno="+$("#Examno").val()+"&VivaSubcode="+$("#batch_viva_subject_code").val()+"&Degree_name="+$("#degree_name").val(); 
	
}