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


Current Path : /proc/thread-self/root/var/www/html/reva/src/
Upload File :
Current File : //proc/thread-self/root/var/www/html/reva/src/studSubIdent.php

<?php

	function getDegreeGroup($aobj_context)
	{
		
		$query = "SELECT DISTINCT(fdeggrp) AS internal_code,fdeggrp AS VALUE FROM degree 
		WHERE ifnull(fdeggrp,'') <> ''";
		
		$results = $aobj_context->mobj_db->GetAll($query);

		$arr['deggrp']=$results;
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 

	}
	
	function getDegreeNames($aobj_context)
	{

		$deg = $aobj_context->mobj_data["degtype"];
		//var_dump($deg );
		$query1="SELECT DISTINCT(fdegree) AS internal_code,CONCAT(fdegree,' - ',fdescpn) AS VALUE FROM degree where fdeggrp='{$deg}' ";
		//var_dump($query1);
		$results1=$aobj_context->mobj_db->GetAll($query1);
		$arr['degree']=$results1;
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 

	}

	function getExamAppDegName($aobj_context)
	{
		session_start();
		$collcode=$_SESSION['collcode'];
	
		//var_dump($deg );
		$query1="SELECT DISTINCT d.fdegree AS internal_code,CONCAT(d.fdegree,' - ',d.fdescpn) AS VALUE FROM degree d
		 inner join candsum r on d.fdegree = r.fdegree 
		where r.fcollcode = '{$collcode}'";
		
		$results1=$aobj_context->mobj_db->GetAll($query1);
		$arr['degree']=$results1;
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 

	}

	function getExamDegreeExamName($aobj_context)
	{
		session_start();
		$collcode=$_SESSION['collcode'];
		$degree = $aobj_context->mobj_data["degree"];
		//var_dump($deg );
		$query1="SELECT DISTINCT d.fexamno AS internal_code,CONCAT(d.fexamno,' - ',d.fexamname) AS VALUE FROM degree d 
		inner join candsum r on d.fdegree = r.fdegree 
		and d.fexamno = r.ffreshexam
		where r.fcollcode = '{$collcode}' and r.fdegree = '{$degree}'";
		$results1=$aobj_context->mobj_db->GetAll($query1);
		$arr['degexam']=$results1;

		$query1="SELECT DISTINCT fsection AS internal_code,fsection AS VALUE FROM student 
		where fcollcode = '{$collcode}' and fdegree = '{$degree}'
		and ifnull(fsection,'') <> ''";
		$results1=$aobj_context->mobj_db->GetAll($query1);
		$arr['section']=$results1;

		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 

	}

	

	function displayStudList($aobj_context)
	{
		session_start();
		$collcode=$_SESSION['collcode'];
		$degree = $aobj_context->mobj_data["degree"];
		$exam = $aobj_context->mobj_data["degexam"];
		$section = $aobj_context->mobj_data["section"];
		
		$cnd = "and stu.fsection = '{$section}'";
		
		if($section == 'All')
		{
			$cnd = "";
		}

		$query1="select stu.FREGNO, stu.FNAME,d.ftotsub,group_concat(cd.fsubcode,'-',ifnull(cd.finserted,'F')) as subcode
		FROM student stu inner join candsum mak ON stu.fdegree = mak.fdegree 
		and stu.FREGNO=mak.FREGNO and mak.Fdegree='{$degree}' 
		and mak.ffreshexam='{$exam}' and mak.FCOLLCODE='{$collcode}'
		inner join degree d on d.FDEGREE =mak.FDEGREE 
		and  d.Fexamno=mak.Fexamno and d.FMEYEAR=mak.FYEAR 
		and d.FMEEXAMTYP=mak.FEXAMTYPE
		inner join canddet cd on mak.fregno = cd.fregno and mak.fdegree = cd.fdegree 
		and mak.fcollcode = cd.fcollcode and mak.ffreshexam = cd.fexamno
		WHERE stu.FREGNO != ''  
		and mak.ffreshexam='{$exam}'
		{$cnd}
		group by mak.fregno
		order by stu.FREGNO"; 
		
		$results1=$aobj_context->mobj_db->GetAll($query1);
		
		$ftotsub = $results1[0]['ftotsub'];
		
		$query = "select distinct fsubcode,fsubname,fsubshort from subject 
		where fdegree = '{$degree}' and fexamno = '{$exam}' 
		and ifnull(fsuspend,'') <> 'T'
		group by fsubcode";	
		$res=$aobj_context->mobj_db->GetAll($query);
		$opt = "<option>--Select--</option>";
		foreach($res as $value)
		{
			$opt .= "<option value = '{$value['fsubcode']}'>".$value['fsubcode']." - ".$value['fsubshort']." - ".$value['fsubname']."</option>";
		}

		$id = 2+$ftotsub;
		//var_dump($query);
		$e_data.="<table  width='95%' id = 'showteachsub' cellspacing='0' class='tr_ventor_row' cellpadding='0' border='0' >";
		$e_data.="<th align='left' colspan='{$id}' class='ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper' style='font-size:12px; padding-left:6px; height:24px;'>Subject Identification</th>";			
		$e_data.="<tr class='ui-state-default ui-jqgrid-hdiv'>";	
		$e_data.="<td  style='padding:2px; width:20px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><center>Sl.<br>No.</center></td>";
		$e_data.="<td  style='padding:2px; width:50px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><center>Reg No</center></td>";
			
		for($i=1;$i<=$ftotsub;$i++)
		{
			$e_data.="<td  style='padding:2px; width:30px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><center>Subject {$i}</center></td>";
		}

		$e_data.="</tr>";
		$k=1;
		$border_bottom="border-bottom:1px solid #C5DBEC;";
		foreach($results1 as $value)
		{

			$e_data.="<tr class='ui-widget-content jqgrow' style = 'height:25px;'>";
			$e_data.="<td tabindex=-1   align='center' style='{$border_bottom}; border-left:1px solid #C5DBEC;border-right:1px solid #C5DBEC; padding:2px;'>{$k}</td>";
			$e_data.="<td tabindex=-1   align='center' style='{$border_bottom}; border-left:1px solid #C5DBEC;border-right:1px solid #C5DBEC; padding:2px;'>
				<input tabindex=-1  {$inp_class} type=text name='Regno' style='width:80px;border:none;' readonly id='reg_{$value[FREGNO]}' value='{$value[FREGNO]}'> </td>";
			
			for($i=1;$i<=$ftotsub;$i++)
			{
				$e_data.="<td  style='padding:2px; width:30px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>
				<select style='width:100px;border:none;' id = '$value[FREGNO]_$i' onchange = 'getupdate(this.id)'>";
				$e_data.=$opt;
				$e_data.="</select>
				<input type ='hidden' id = 'h_$value[FREGNO]_$i' value = ''>
				<input type ='hidden' id = 'o_$value[FREGNO]_$i' value = ''>
				</td>";
			}
		
			$k++;
			
			$e_data.="</tr>";

		}

		$arr['tabledata'] = $e_data;
		$arr['totsub'] = $ftotsub;
		$arr['mandsub'] = $results1;
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 

	}


	function saveStudSubIdent($aobj_context)
	{
		session_start();
		include("error_log.php");
		$collcode=$_SESSION['collcode'];
		$FLOGNAME = $_SESSION['usr']; 
		$degree = $aobj_context->mobj_data["degree"];
		$exam = $aobj_context->mobj_data["degexam"];
		$subarry = $aobj_context->mobj_data["subarry"];
		$fsubarry = json_decode($subarry);
		
		$check_adminsion_freeze = "select distinct d.fmeyear, d.fmeexamtyp from degree d
		where d.FDEGREE='{$degree}'";
		$lobj_check_adminsion_freeze = $aobj_context->mobj_db->getRow($check_adminsion_freeze);

		// var_dump($fsubarry);
		// die();
		
		foreach($fsubarry as $value)
		{
			$reg_no = $value->regno;
			$subcode = $value->subcode;
			$osubcode = $value->osubcode;


			$qry = "select distinct * from candsum c
			where c.FDEGREE='{$degree}'
			and c.fregno = '{$reg_no}'
			and ifnull(ffreshexam,'') ='{$exam}'";
			$res = $aobj_context->mobj_db->getRow($qry);

			$college_code = $res['FCOLLCODE'];

			$semexamfee = $res["FEXAMFEE{$exam}"]; 

			$prs = "";
			if($semexamfee > 0)
			{	
				$prs = "P";
			}	
			
			if($osubcode == '')
			{

				$query="insert into canddet
						(FDEGREE,
						FEXAMNO,
						FCOLLCODE,
						FREGNO,
						FSUBCODE,
						FINSERTED,
						FPRESENT, fyear, fexamtype, fmoduser, fmoddate) values
						(
						'{$degree}',
						'{$exam}',
						'{$college_code}',
						'{$reg_no}',
						'{$subcode}',
						'T',
                        '{$prs}', '{$lobj_check_adminsion_freeze['fmeyear']}', 
                        '{$lobj_check_adminsion_freeze['fmeexamtyp']}',
						'{$FLOGNAME}',now()
						)";
                        $lobj_insert_canddet_records = $aobj_context->mobj_db->Execute($query);
                        
                        $query = "INSERT ignore INTO appcanddet (APPNO, FDEGREE, FEXAMNO, FCOLLCODE, FREGNO, FSUBCODE,
                        FINSERTED, FPRESENT, FYEAR, FEXAMTYPE)
                        select APPNO, FDEGREE,'{$exam}',FCOLLCODE,FREGNO,'{$subcode}','T','{$prs}',FYEAR,FEXAMTYPE from 
                        appcandsum where fregno = '{$reg_no}'";
                        $lobj_insert_canddet_records1 = $aobj_context->mobj_db->Execute($query);


			}else
			{
				$query = "update canddet set fsubcode = '{$subcode}',
				fpresent = '{$prs}', fmoduser = '{$FLOGNAME}', fmoddate = now()
				where fregno = '{$reg_no}' and fcollcode = '{$college_code}' and fdegree = '{$degree}' 
				and fsubcode = '{$osubcode}'";
				$lobj_insert_canddet_records = $aobj_context->mobj_db->Execute($query);

				$query1 = "update appcanddet set fsubcode = '{$subcode}',
				fpresent = '{$prs}'
				where fregno = '{$reg_no}' and fcollcode = '{$college_code}' 
				and fdegree = '{$degree}' 
				and fsubcode = '{$osubcode}'";
				$res = $aobj_context->mobj_db->Execute($query1);
			}

			$univcode = $_SESSION['FUNIVCODE'];
			$mob = $_SESSION['FMOBILE'];
			$usr = $_SESSION['usr'];
			$college_code = $_SESSION['collcode'];
			$remark = "SUBMOD - Subject Modification - $degree, $exam, $College_Code,".$reg_no.", Old: $osubcode, New: ".$subcode;
			$enttype = "SUBMOD";

			$res = error_logs($aobj_context,$univcode,$remark,$college_code,$enttype,$usr,$mob);


			$query1 = "insert ignore into marks (FDEGREE, FEXAMNO, FCOLLCODE, FREGNO, FSUBCODE, fmarks, fyear, fexamtype)
			select c.fdegree,c.fexamno,c.fcollcode,c.fregno,
			s.fcsubcode,'-1', c.fyear,c.fexamtype
			from candsum c inner join 
			subject s on c.fdegree = s.fdegree and  s.fexamno = '{$exam}'
			and s.FSUBCODE	= '{$subcode}'
			where c.fregno = '{$reg_no}'
			and c.fcollcode = '{$college_code}' and c.fdegree = '{$degree}'
			and s.fintass = 'T' and s.fretain = 'T'";
			$res = $aobj_context->mobj_db->Execute($query1); 

			$query = "insert ignore into marks_pr (FDEGREE, FEXAMNO, FCOLLCODE,focollcode, FREGNO, FSUBCODE, fmarks11, fyear, fexamtype)
			select cd.fdegree,cd.fexamno,cd.fcollcode,cd.fcollcode,cd.fregno,s.fcsubcode,'-1', 
			cd.fyear,cd.fexamtype
			from subject s inner join candsum cd on s.fdegree = cd.fdegree 
			and s.fsubcode = '{$subcode}'
			and cd.fregno = '{$reg_no}'
			and ifnull(cd.fpassmth,'') = '' 
			and ifnull(cd.fthpr,'') <> 'F'
			where s.fdegree = '{$degree}' 
			and cd.fcollcode = '{$college_code}'
			and s.ftheory = 'F'
			and ifnull(s.fintass,'F') <> 'T'";
			$res = $aobj_context->mobj_db->Execute($query);

		}
	

		if($lobj_insert_canddet_records)
		{
			$rdata = "Updated Successfully.";
			echo($aobj_context->mobj_output->ToJSONEnvelope($rdata,0,"success"));
			return $rdata;
		}
		else
		{
			$rdata = "No Updation / Add..!";
			echo($aobj_context->mobj_output->ToJSONEnvelope($rdata,-1,"Failure"));  
			return $rdata;			
		}

	}


	
?>