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


Current Path : /var/www/oasis/Report_details_old/
Upload File :
Current File : /var/www/oasis/Report_details_old/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;
		
		$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;	
			break;
		}
		$path = $this->aobj_context->main_src.'/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.fdegree = mak.fdegree and 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} 
						group by stu.FREGNO  order by stu.FREGNO limit   1000";					
		
		$lobj_get_records = $this->aobj_context->mobj_db->GetAll($get_records);
		
		$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.fdegree = mak.fdegree and 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} 
						group by stu.FREGNO  order by stu.FREGNO limit   300";					
		 
		$obj_get_viva_records = $this->aobj_context->mobj_db->GetAll($get_viva_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' )
				$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>Reg No</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];
				$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"];
		
		$extname = $this->aobj_context->mobj_data["extname"];
		$batch_no = $this->aobj_context->mobj_data["batch_no"];
		$intname = $this->aobj_context->mobj_data["intname"];
		
		$User_code = $_SESSION['usr']; 
		
		$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);	

			$j = 0;
			$query = "update practical_entry_freeze set fintexamcode = '{$intname}' ,fextexamcode = '{$extname}',fbatchcnt = '{$batchcnt}',fpresent = '{$j}'
				where FCOLLCODE = '{$College_Code}' and 
				FDEGREE = '{$Degcode}' and
				FEXAM = '{$Examno}' and
				FCSUBCODE = '{$Subcode}' and FBATCH = '{$batch_no}'";
				//var_dump($query);
				$result = $this->aobj_context->mobj_db->Execute($query);
			$batchcnt =  count($pra_save_obj_details);
			for( $i = 0; $i<count($pra_save_obj_details); $i++ )
			{
				$update_record = " update marks_pr set FMARKS11='{$pra_save_obj_details[$i]->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}' ";
				$lobj_insert_qry = $this->aobj_context->mobj_db->Execute($update_record);	
				if($pra_save_obj_details[$i]->marks != '-1' && $pra_save_obj_details[$i]->marks != '-2')	
					$j++;
			}
			
			if(!empty($viva_save_obj_details))
			{
				for( $i = 0; $i<count($viva_save_obj_details); $i++ )
				{
					$update_record = " update marks_pr set FMARKS11='{$viva_save_obj_details[$i]->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);	
							 
				}		 			
			}
			/* $query = "update practical_entry_freeze set fintexamcode = '{$intname}' ,fextexamcode = '{$extname}',fbatchcnt = '{$batchcnt}',fpresent = '{$j}'
				where FCOLLCODE = '{$College_Code}' and 
				FDEGREE = '{$Degcode}' and
				FEXAM = '{$Examno}' and
				FCSUBCODE = '{$Subcode}' and FBATCH = '{$batch_no}'";
				//var_dump($query);
				$result = $this->aobj_context->mobj_db->Execute($query);	 */
			if($lobj_insert_qry)
			{
				$query = "update practical_entry_freeze set fintexamcode = '{$intname}' ,fextexamcode = '{$extname}',fbatchcnt = '{$batchcnt}',fpresent = '{$j}'
				where FCOLLCODE = '{$College_Code}' and 
				FDEGREE = '{$Degcode}' and
				FEXAM = '{$Examno}' and
				FCSUBCODE = '{$Subcode}' and FBATCH = '{$batch_no}'";
				//var_dump($query);
				$result = $this->aobj_context->mobj_db->Execute($query);
			}		
			if($result)
			{
				$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 getteachdetails()
	{
		$query = "select FTEACHCODE as id, concat(FTEACHCODE,' - ',FTEACHNAME) as value from masteach 
			where ifnull(fdeleted,'') <>'T' order by FTEACHCODE";
		$rst = 	$this->aobj_context->mobj_db->getAll($query);	//forder,
		echo $this->aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success");
	}	
}	
	

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();
}

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

?>