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.218.50.170
<?php
function saveServicesMaster($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$add_edit = trim($aobj_context->mobj_data["add_edit"]);
$sercode = trim($aobj_context->mobj_data["sercode"]);
$sername = trim($aobj_context->mobj_data["sername"]);
$procedure = trim($aobj_context->mobj_data["procedure"]);
$seroder = trim($aobj_context->mobj_data["seroder"]);
$maxdays = trim($aobj_context->mobj_data["maxdays"]);
$servtype = trim($aobj_context->mobj_data["servtype"]);
if($add_edit == 'Add')
{
$checkRecord = "select * from servtype where FSERVCODE = '{$sercode}'";
$lobj_checkRecord = $aobj_context->mobj_db->getAll($checkRecord);
if(count($lobj_checkRecord) > 0 )
{
$error_msg = 'Services code '.$supcode.' already exist';
echo $aobj_context->mobj_output->ToJSONEnvelope($error_msg,-1,"failure");
return;
}
else
{
$query = "insert into servtype(FSERVCODE, FSERVNAME, FPROC, FMAXDAYS, FORDER,FMULTIPLE)
values('{$sercode}','{$sername}','{$procedure}','{$maxdays}','{$seroder}','{$servtype}')";
$result = $aobj_context->mobj_db->Execute($query);
if($result)
{
$success_msg = 'Updated successfully.';
echo $aobj_context->mobj_output->ToJSONEnvelope($success_msg,0,"success");
return;
}
else
{
$error_msg = 'Updation failed';
echo $aobj_context->mobj_output->ToJSONEnvelope($error_msg,-1,"failure");
return;
}
}
}
else if($add_edit == 'Edit')
{
$query = "update servtype set FSERVNAME = '{$sername}',FPROC='{$procedure}',
FMAXDAYS='{$maxdays}',FORDER='{$seroder}',FMULTIPLE='{$servtype}'
where FSERVCODE = '{$sercode}'";
$result = $aobj_context->mobj_db->Execute($query);
if($result)
{
$success_msg = 'Updated successfully';
echo $aobj_context->mobj_output->ToJSONEnvelope($success_msg,0,"success");
return;
}
else
{
$error_msg = 'Updation failed';
echo $aobj_context->mobj_output->ToJSONEnvelope($error_msg,-1,"failure");
return;
}
}
}
function getServiceCodeDetails($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
session_start(); //and FDELETED = 'F'
$servicecode =$aobj_context->mobj_data["servicecode"];
$get_supplier_details = "select FSERVCODE,FSERVNAME,FPROC,FMAXDAYS,FORDER,FMULTIPLE from servtype
where FSERVCODE = '{$servicecode}'";
$lobj_get_supplier_details = $aobj_context->mobj_db->getRow($get_supplier_details);
if(count($lobj_get_supplier_details) > 0)
{
echo $aobj_context->mobj_output->ToJSONEnvelope($lobj_get_supplier_details,0,"success");
return;
}
else
{
$error_msg = 'no details found ';
echo $aobj_context->mobj_output->ToJSONEnvelope($error_msg,-1,"Disabled");
return;
}
}
function disableServicesRecord($aobj_context)
{
include_once("/JSON.php");
$json = new Services_JSON();
$lstr_param = stripslashes($aobj_context->mobj_data["delete_arr"]);
$mobj_jsondata = $json->decode($lstr_param);
$delete_arr_data = get_object_vars($mobj_jsondata);
$supcodes = '';
for($k=0;$k<count($delete_arr_data);$k++)
{
$supcodes .= $delete_arr_data[$k]->supplierCode.
$disable_supplier_record = "UPDATE servtype SET FDELETED='T'
WHERE FSERVCODE='{$delete_arr_data[$k]->supplierCode}' ";
$lobj_rs = $aobj_context->mobj_db->Execute($disable_supplier_record);
}
if($lobj_rs)
{
echo $aobj_context->mobj_output->ToJSONEnvelope($lobj_rs,0,"success");
return;
}
else
{
echo $aobj_context->mobj_output->ToJSONEnvelope($lobj_rs,-1,"Failure");
return;
}
}
?>
|