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


Current Path : /proc/thread-self/root/proc/thread-self/root/var/www/oasis/src/
Upload File :
Current File : //proc/thread-self/root/proc/thread-self/root/var/www/oasis/src/roomdeclaration_stph.php

<?php

function displayroomdeclarationdetailsStph($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,ifnull(fprefix,'') as fprefix 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 saveroomdeclarationdetailsStph($aobj_context)
{
	session_start();
	include_once("/JSON.php");
	$json = new Services_JSON();
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$collcode = $_SESSION['collcode'];
	$funivcode = $_SESSION['FUNIVCODE'];	
	//$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','{$value['prefix']}')";			
	}
	foreach($roomarru as $key => $value )
	{
		$sql[] = "('{$collcode}','{$value['roomno']}','{$value['roomname']}','{$value['capacity']}','{$value['order']}','{$value['qpcnt']}','{$value['capacity']}','F','{$value['prefix']}')";			
	}

	// var_dump($sql);
	// die();
	if($funivcode == '049x')
	{
		$query = 'INSERT INTO masroom(fcollcode, froomno, froomname, fcapacity, forder, fmaxqpcnt, fbalroomcnt, fdeleted,fprefix) VALUES '.implode(',', $sql).' 
		ON DUPLICATE KEY UPDATE forder=VALUES(forder), fmaxqpcnt=VALUES(fmaxqpcnt), fbalroomcnt=VALUES(fbalroomcnt),fprefix=VALUES(fprefix)';
	}else
	{
		$query = 'INSERT INTO masroom(fcollcode, froomno, froomname, fcapacity, forder, fmaxqpcnt, fbalroomcnt, fdeleted,fprefix) VALUES '.implode(',', $sql).' 
		ON DUPLICATE KEY UPDATE
	 	froomname = VALUES(froomname), fcapacity=VALUES(fcapacity), 
	 	forder=VALUES(forder), fmaxqpcnt=VALUES(fmaxqpcnt), fbalroomcnt=VALUES(fbalroomcnt),fprefix=VALUES(fprefix)';
	}

	$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"); 
	}		
}

?>