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


Current Path : /proc/thread-self/root/var/www/html/phdadm/pgetadm/
Upload File :
Current File : //proc/thread-self/root/var/www/html/phdadm/pgetadm/seat-allot.php

<?php

function getSeatAllotDet($aobj_context) 
{
	session_start();
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	// var_dump($_SESSION['MOBILE']);
	if(!isset($_SESSION['MOBILE'])){
		$arr['msg'] = 'Session Expired!!! Login again.';
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
		return;
	}

	$query2 = "select ifnull(fappno,'') as fappno, fround as fround 
	from entstudadm 
	where fmobileno = '{$_SESSION['MOBILE']}'";
	$qry2 =  $aobj_context->mobj_db->GetRow($query2);
	$fappno = $qry2['fappno'];
	$fround = $qry2['fround'];
	
	
	$query3 = "select if(ifnull(c.ftype,'A') = 'U','UNIVCOLL','AFFICOLL') as type,
	a.fappno, a.fdegree, d.fdescpn, a.fcollcode, b.funiv,
	c.fcollname, a.frank, b.fcategory_ver as fcatcode, ifnull(fincome_ver,'-') as fincome,
	b.fname,a.freserve, a.fallotround,ifnull(a.fseatstatus,'-') as fseatstatus, a.fallotno
	from entseatallot a inner join entstudadm b
	on a.fappno = b.fappno
	inner join entdeg d on a.fdegree = d.fdegree 
	inner join entcoll c on a.fcollcode = c.fcollcode
	where a.fappno = '{$fappno}' and ifnull(fcancel,'') <> 'T' 
	and a.fallotround = '{$fround}'";
	// var_dump($query3);
	$result2 = $aobj_context->mobj_db->GetRow($query3);
	  
	if(count($result2) > 0) {
		$res['seat'] = $result2;

		$ftype = $result2['type'];
		$allotno = $result2['allotno'];		
		$funiv = $result2['funiv'];
		$fincome = $result2['fincome'];
		$fdegree = $result2['fdegree'];
		$fcatcode = $result2['fcatcode'];
		$fcombcode = "";
		if($funiv == 'VKU')
		{
			$fcombcode = 'PGETADM';
		}
		else
		{
			$fcombcode = 'PGETSOU';
		}

		if( ($fcatcode == "SC" || $fcatcode == "ST" || $fcatcode == "CAT-I") && $fincome > 250000) {
			$fcatcode = "GM";
		}
		if( ($fcatcode == "IIA" || $fcatcode == "IIB" || $fcatcode == "IIIA" || $fcatcode == "IIIB") && $fincome > 100000) {
			$fcatcode = "GM";
		}

		$query = "select fmaxfee from admfeestr 
		where fdegree = '{$fdegree}'
		and fcombcode = '{$fcombcode}'
		and fconstype = '{$ftype}'
		and fcatcode = '{$fcatcode}'";
		//var_dump($query);
		$result2 = $aobj_context->mobj_db->GetRow($query);
		$res['admfee'] = $result2['fmaxfee'];
		echo $aobj_context->mobj_output->ToJSONEnvelope($res,0,"success"); 
	}
	else {
		$arr['msg'] = 'Seat allotment details not available.';
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
	}
	return;

}

function updateSeatStatus($aobj_context) 
{
	session_start();
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$chmode = $aobj_context->mobj_data["chmode"];

    // var_dump($result3);

    

	$query2 = "select ifnull(fappno,'') as fappno,
	fround, funiv, fdegree,fcollcode, fcategory_ver as fcatcode, 
	ifnull(fseatstatus,'-') as fseatstatus from entstudadm 
	where fmobileno = '{$_SESSION['MOBILE']}'";
	// var_dump($query2);
	$qry2 =  $aobj_context->mobj_db->GetRow($query2);
	$fappno = $qry2['fappno'];
	$fround = $qry2['fround'];
	$funiv = $qry2['funiv'];
	$fdegree = $qry2['fdegree'];
	$fcollcode = $qry2['fcollcode'];
	$fcatcode = $qry2['fcatcode'];

	$query_pgadmdate = "select * from entseatallot where fappno = '{$fappno}' 
	and fallotround = '{$fround}'
    and date_format(now(),'%Y-%m-%d') <= date_format(fpaydate,'%Y-%m-%d')";
    // var_dump($query_pgadmdate);

    $result3 = $aobj_context->mobj_db->GetAll($query_pgadmdate);
	
	if(count($result3) == 0)
    {
      $arr['msg'] = "Admission fee payment is disabled.";
      echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-2,"Failure"); 
      return;
    }

	if($qry2['fseatstatus'] == "Confirmed") {
		$arr['msg'] = 'Seat status is confirmed.';
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
		return;
	}

	if($chmode != '1')	
	{
		$arr['msg'] = 'Only Choice 1 is allowed.';
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
		return;
	}

	if($chmode == '3')	
	{
		$query = "update entseatallot set 
		fchoice = '{$chmode}',
		fchoicedate = now(),
		fseatstatus = 'Cancelled' 
		where fappno = '{$fappno}'
		and fallotround = '{$fround}'
		and fcollcode = '{$fcollcode}'
		and fdegree = '{$fdegree}'";
		$results1 = $aobj_context->mobj_db->Execute($query);

		$query = "update entstudadm set 
		fchoice = '{$chmode}',
		fchoicedate = now(),
		fseatstatus = 'Cancelled' 
		where fappno = '{$fappno}'
		and fround = '{$fround}'
		and fcollcode = '{$fcollcode}'
		and fdegree = '{$fdegree}'";
		
		$results2 = $aobj_context->mobj_db->Execute($query);

		$query = "update entoptions set 
		fchoice = '{$chmode}',
		fchoicedate = now(),
		fseatstatus = 'Cancelled' 
		where fappno = '{$fappno}'
		and fround = '{$fround}'
		and fcollcode = '{$fcollcode}'
		and fdegree = '{$fdegree}'";
		
		$results3 = $aobj_context->mobj_db->Execute($query);

		$query = "update entoptdeg set 
		fchoice = '{$chmode}',
		fchoicedate = now(),
		fseatstatus = 'Cancelled' 
		where fappno = '{$fappno}'
		and fround = '{$fround}'
		and fcollcode = '{$fcollcode}'
		and fdegree = '{$fdegree}'";
		
		$results4 = $aobj_context->mobj_db->Execute($query);

		$query = "INSERT INTO `entseatlog` (`fappno`, `fdegree`, `fcollcode`, `frank`, `fallotno`, `fallotround`, `fseatstatus`, `fchoice`, `fchoicedate`)
		select `fappno`, `fdegree`, `fcollcode`, `frank`,`fallotno`, `fallotround`,
		 'Cancelled', '{$chmode}', now() from entseatallot
		 where fappno = '{$fappno}'
		and fallotround = '{$fround}'
		and fcollcode = '{$fcollcode}'
		and fdegree = '{$fdegree}'";
		$results5 = $aobj_context->mobj_db->Execute($query);

		if($results1 && $results2 && $results5)
		{
			$res['msg'] = "Updated successfully.";
			$res['chmode'] = $chmode;
			echo $aobj_context->mobj_output->ToJSONEnvelope($res,0,"success"); 
			return;
		}else
		{
			$arr['msg'] = 'Updation failed Please try later.';
			echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
			return;
		}

	}else
	{

		$query3 = "select if(ifnull(c.ftype,'A') = 'U','UNIVCOLL','AFFICOLL') as type
		from entcoll c
		where fcollcode = '{$fcollcode}'";
		$result2 = $aobj_context->mobj_db->GetRow($query3);
		$ftype = $result2['type'];

		
	
		$query3 = "select if(ifnull(c.ftype,'A') = 'U','UNIVCOLL','AFFICOLL') as type,
		a.fappno, a.fdegree, d.fdescpn, a.fcollcode, b.funiv,
		c.fcollname, a.frank, b.fcategory_ver as fcatcode, ifnull(fincome_ver,'-') as fincome,
		b.fname,a.freserve, a.fallotround,ifnull(a.fseatstatus,'-') as fseatstatus, a.fallotno
		from entseatallot a inner join entstudadm b
		on a.fappno = b.fappno
		inner join entdeg d on a.fdegree = d.fdegree 
		inner join entcoll c on a.fcollcode = c.fcollcode
		where a.fappno = '{$fappno}'
		and a.fallotround = '{$fround}'";
		//var_dump($query3);
		$result2 = $aobj_context->mobj_db->GetRow($query3);
		

		$ftype = $result2['type'];
		$allotno = $result2['allotno'];		
		$funiv = $result2['funiv'];
		$fincome = $result2['fincome'];
		$fdegree = $result2['fdegree'];
		$fcatcode = $result2['fcatcode'];
		$fcombcode = "";
		if($funiv == 'VKU')
		{
			$fcombcode = 'PGETADM';
		}
		else
		{
			$fcombcode = 'PGETSOU';
		}

		if( ($fcatcode == "SC" || $fcatcode == "ST" || $fcatcode == "CAT-I") && $fincome > 250000) {
			$fcatcode = "GM";
		}
		if( ($fcatcode == "IIA" || $fcatcode == "IIB" || $fcatcode == "IIIA" || $fcatcode == "IIIB") && $fincome > 100000) {
			$fcatcode = "GM";
		}

		$query = "select fmaxfee from admfeestr 
		where fdegree = '{$fdegree}'
		and fcombcode = '{$fcombcode}'
		and fconstype = '{$ftype}'
		and fcatcode = '{$fcatcode}'";
		//var_dump($query);
		$result2 = $aobj_context->mobj_db->GetRow($query);

		// if($funiv == 'VKU')
		// {
		// 	$fcombcode = 'PGETADM';
		// }else
		// {
		// 	$fcombcode = 'PGETSOU';
		// }
		// if( ($fcatcode == "SC" || $fcatcode == "ST" || $fcatcode == "CAT-I") && $fincome > 250000) {
		// 	$fcatcode = "GM";
		// }
		// if( ($fcatcode == "IIA" || $fcatcode == "IIB" || $fcatcode == "IIIA" || $fcatcode == "IIIB") && $fincome > 100000) {
		// 	$fcatcode = "GM";
		// }
		

		// $query = "select fmaxfee from admfeestr 
		// where fdegree = '{$fdegree}'
		// and fcombcode = '{$fcombcode}'
		// and fconstype = '{$ftype}'
		// and fcatcode = '{$fcatcode}'";
		
		// $result2 = $aobj_context->mobj_db->GetRow($query);
		$admfee = $result2['fmaxfee'];

		$query3 = "select  fallotno as allotno
		from entseatallot
		where fappno = '{$fappno}'
		and fallotround = '{$fround}'
		and fcollcode = '{$fcollcode}'
		and fdegree = '{$fdegree}'";
		$result2 = $aobj_context->mobj_db->GetRow($query3);
		$allotno = $result2['allotno'];
			
		if($result2)
		{
			$query = "update entseatallot set fadmfee = '{$admfee}',
			fchoice = '{$chmode}'
			where fappno = '{$fappno}'
			and fallotround = '{$fround}'
			and fcollcode = '{$fcollcode}'
			and fdegree = '{$fdegree}'";
			//var_dump($query);
			$results = $aobj_context->mobj_db->Execute($query);

			$query = "select * from masbank where ifnull(fsuspend,'') <> 'T'";
      		$respayment = $aobj_context->mobj_db->GetAll($query);	

      		$res['masbank'] = $respayment;

			if($results)
			{
				$res['msg'] = "Updated successfully.";
				$res['chmode'] = $chmode;
				$res['fee'] = $admfee;
				$res['appno'] = $allotno;

				echo $aobj_context->mobj_output->ToJSONEnvelope($res,0,"success"); 
				return;
			}else
			{
				$arr['msg'] = 'Updation failed Please try later.';
				echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
				return;
			}


		}
		
	}

}

?>