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.227.134.165
Current Path : /var/www/oasis/src/ |
| Current File : /var/www/oasis/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 from masroom
where fcollcode = '{$collcode}' order by froomno";
// var_dump($query);die();
$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_arr"]);
$roomdetarr = $json->decode($roomdet);
$roomarr = get_object_vars($roomdetarr);
for($k=1;$k<=count($roomarr);$k++)
{
$query = "select * from masroom
where fcollcode = '{$collcode}' and froomno = '{$roomarr[$k]->roomno}'";
//var_dump($query);
$rst = $aobj_context->mobj_db->GetRow($query);
if($rst)
{
$query2 = "update masroom set froomname = '{$roomarr[$k]->roomname}' , fcapacity = '{$roomarr[$k]->capacity}',forder = '{$roomarr[$k]->order}'
where fcollcode = '{$collcode}' and froomno = '{$roomarr[$k]->roomno}'";
//var_dump($query2);
$rst = $aobj_context->mobj_db->Execute($query2);
}
else
{
$query3 = "insert into masroom(fcollcode,froomno, froomname, fcapacity) value('{$collcode}', '{$roomarr[$k]->roomno}', '{$roomarr[$k]->roomname}', '{$roomarr[$k]->capacity}')";
//var_dump($query3);
$rst = $aobj_context->mobj_db->Execute($query3);
}
}
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,0,"success");
}
}
function totalroomcount($aobj_context){
$collcode = $_SESSION['collcode'];
$query="SELECT COUNT(froomname) AS croomname FROM masroom WHERE fcollcode = '{$collcode}'";
$rst = $aobj_context->mobj_db->GetRow($query);
if($rst){
echo $aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success");
}
}
?>
|