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


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

<?php

function displayroomdeclarationdetails($aobj_context)
{
	session_start();
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$collcode = $_SESSION['collcode'];
		
	$query = "select froomname as roomname, fcapacity as capacity,ifnull(forder,'') as forder, ifnull(fmaxqpcnt,'') as fmaxqpcnt from masroom
			where fcollcode = '{$collcode}' order by froomno";
	$rst = $aobj_context->mobj_db->GetAll($query);		
	
	echo $aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success"); 
}


function saveroomdeclarationdetails($aobj_context)
{
	session_start();
	include_once("/JSON.php");
	$json = new Services_JSON();
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$collcode = $_SESSION['collcode'];
	$roomdet = stripslashes($aobj_context->mobj_data["room_arri"]);
	$roomarri = json_decode($roomdet, true);
	$roomdet = stripslashes($aobj_context->mobj_data["room_arru"]);
	$roomarru = json_decode($roomdet, true);

	$sql = array();

	foreach($roomarri as $key => $value )
	{
		$sql[] = "('{$collcode}','{$value['roomno']}','{$value['roomname']}','{$value['capacity']}','{$value['order']}','{$value['qpcnt']}','{$value['capacity']}','F')";			
	}
	foreach($roomarru as $key => $value )
	{
		$sql[] = "('{$collcode}','{$value['roomno']}','{$value['roomname']}','{$value['capacity']}','{$value['order']}','{$value['qpcnt']}','{$value['capacity']}','F')";			
	}

	$query = 'INSERT INTO masroom(fcollcode, froomno, froomname, fcapacity, forder, fmaxqpcnt, fbalroomcnt, fdeleted) VALUES '.implode(',', $sql).' 
		ON DUPLICATE KEY UPDATE
	 	froomname = VALUES(froomname), fcapacity=VALUES(fcapacity), 
	 	forder=VALUES(forder), fmaxqpcnt=VALUES(fmaxqpcnt), fbalroomcnt=VALUES(fbalroomcnt)';
	 	// var_dump($query);
	 $rst = $aobj_context->mobj_db->Execute($query);

	if($rst)
	{	
		$success_msg = "Updated Successfully";
		echo $aobj_context->mobj_output->ToJSONEnvelope($success_msg,0,"success"); 
	}
	else
	{
		$error_msg = "Updation Failed";
		echo $aobj_context->mobj_output->ToJSONEnvelope($error_msg,1,"failure"); 
	}		
}

?>