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


Current Path : /var/www/oasis/src/
Upload File :
Current File : /var/www/oasis/src/room_allotment_shifiting.php

<?php

function getStudDet($aobj_context){
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC); 
	$collcode = $_SESSION['collcode'];
	$regno = $aobj_context->mobj_data["fregno"];
	$curr_date = date("Y-m-d");

	$que = "select distinct d.FDESCPN, s.* from student s
	left join degree d on s.fdegree = d.fdegree
	where fregno = '{$regno}'";
	
	$res = $aobj_context->mobj_db->GetRow($que);

	$query = "select distinct s.fqpcode, s.fsubcode,fsubname,c.fregno,DATE_FORMAT(s.fdoe,'%d/%m/%Y') as fdoe
			from subject s inner join canddet c on s.fdegree = c.fdegree and
			s.fexamno = c.fexamno and s.fsubcode = c.fsubcode
			where c.fregno = '{$regno}' and s.fdoe >= '{$curr_date}' 
			order by s.fdoe";
	// var_dump($query);
	$result = $aobj_context->mobj_db->GetAll($query);

	if($res){
		$arr['qpcode'] = $result;
		$arr['stddet'] = $res;
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
	}
	else{
		$arr['msg'] = 'Student Details Not Found';
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failed"); 
	}
}

function getRoomDetails($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC); 
	$collcode = $_SESSION['collcode'];
	
	$query = "select froomno as id, concat(froomname,' - ',fcapacity) as value 
			from masroom 
			where ifnull(fdeleted,'') <>'T' and fcapacity > 0
			and  fcollcode = '{$collcode}' order by froomno";

	$rst = 	$aobj_context->mobj_db->getAll($query);
	if($rst)
		echo $aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success"); 
	else{
		$arr['msg'] = 'Room No. Not Found';
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failed"); 
	}
}

function roomallotmentStd($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC); 
	$collcode = $_SESSION['collcode'];
	$regno = $aobj_context->mobj_data["regno"];
	$fsubj = $aobj_context->mobj_data["fsubj"];
	$roomno = $aobj_context->mobj_data["roomno"];
	$fslno = $aobj_context->mobj_data["fslno"];

	$query = "select s.fqpcode,s.fdoe,s.FSESSION from canddet c 
			inner join subject s on c.fdegree = s.fdegree
			and s.fexamno = s.fexamno
			and s.fsubcode = c.fsubcode
			where c.fsubcode = '{$fsubj}' 
			and fregno = '{$regno}'
			and ifnull(s.fqpcode,'') <> ''";

	$result = $aobj_context->mobj_db->GetRow($query);
	$FSESSION = $result['FSESSION'];
	$fdoe = $result['fdoe'];
	$fqpcode = $result['fqpcode'];
	// $cond = "";
	// if($result == true){
	// 	$fslno = "AZ009";
	// 	$result['fslno'];
	// 	$alphaPart = preg_replace('/[^A-Z]/', '', $fslno);
	// 	$numericPart = preg_replace('/[^0-9]/', '', $fslno);
	// 	$newNumericPart = sprintf('%0' . strlen($numericPart) . 'd', $numericPart + 1);
	// 	$newSlno = $alphaPart . $newNumericPart;
	// 	$cond = ",fslno = '{$newSlno}'";
	// }
	
	$que = "update canddet set FHALLNO = '{$roomno}',fslno = '{$fslno}'
			where fregno = '{$regno}' 
			and fsubcode ='{$fsubj}'";
		
	$rst = 	$aobj_context->mobj_db->Execute($que);

	$insert = " insert ignore into room_allotment(FCOLLCODE,FQPCODE,FHALLNO,FLOGNAME,FLOGDATE,FDOE,FSESSION )
						values ('{$collcode}','{$fqpcode}' ,'{$roomno}','D',now(),'{$fdoe}','{$FSESSION}')";
	$lobj_insert = $aobj_context->mobj_db->Execute($insert);

	if($rst){
		$arr['msg'] = "Successfully Alloted";
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"Alloted"); 
	}
	else{
		$arr['msg'] = "Failed To Allot";
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failed"); 
	}
}
?>