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.223.171.83
<?php
function saveFinanceDesignation($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data["univcode"];
$data = json_decode($aobj_context->mobj_data["data"], true);
foreach($data as $val){
if($val['fdeleted']){
$cond = 'T';
}else{
$cond = 'F';
}
$query = "insert into fms_masdegn(fdegncode, fdegndesc, fdeleted)
values('{$val['fdegncode']}','{$val['fdegndesc']}','{$cond}')
on duplicate key update
fdegndesc = '{$val['fdegndesc']}', fdeleted = '{$cond}'";
$result = $aobj_context->pobj_db->Execute($query);
}
if($result){
$arr['msg'] = "successfully updated";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
}else{
$arr['msg'] = 'Failed to update';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
}
}
function getFinanceDesignation($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data["univcode"];
$query = "select ifnull(fdegncode, '')as fdegncode,
ifnull(fdegndesc, '')as fdegndesc,
ifnull(fdeleted, '') as fdeleted from fms_masdegn";
$result = $aobj_context->pobj_db->GetAll($query);
if($result){
echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success");
}else{
$arr['msg'] = 'No data found';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
}
}
?>
|