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 : 3.137.198.181
<?php
function savecompanyMaster($aobj_context)
{
require_once($aobj_context->main_src."src/format.php");
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$add_edit=trim($aobj_context->mobj_data["add_edit"]);
$cmpcode=trim($aobj_context->mobj_data["cmpcode"]);
$cmpname=trim($aobj_context->mobj_data["cmpname"]);
$contact=trim($aobj_context->mobj_data["contact"]);
$add1=trim($aobj_context->mobj_data["add1"]);
$add2=trim($aobj_context->mobj_data["add2"]);
$add3=trim($aobj_context->mobj_data["add3"]);
$add4=trim($aobj_context->mobj_data["add4"]);
$email=trim($aobj_context->mobj_data["email"]);
$website=trim($aobj_context->mobj_data["website"]);
$agrdate=trim($aobj_context->mobj_data["agrdate"]);
$agrdate = db_date_Format($agrdate);
if($add_edit == 'Add')
{
$checkRecord = "select FCMPCODE,FCMPNAME,FADD1,FADD2,FADD3,FADD4,FCONTACT,FEMAIL,FWEBSITE,date_format(FAGRDATE, '%d/%m/%Y') as FAGRDATE from mascomp where FCMPCODE = '{$cmpcode}'";
$lobj_checkRecord = $aobj_context->mobj_db->getAll($checkRecord);
if(count($lobj_checkRecord) > 0 )
{
$error_msg = 'Company code '.$cmpcode.' already exist';
echo $aobj_context->mobj_output->ToJSONEnvelope($error_msg,-1,"failure");
return;
}
else
{
$save_comp = "insert into mascomp(FCMPCODE,FCMPNAME,FADD1,FADD2,FADD3,FADD4,FCONTACT,FEMAIL,FWEBSITE,FAGRDATE)
values('{$cmpcode}','{$cmpname}','{$add1}','{$add2}','{$add3}','{$add4}','{$contact}','{$email}','{$website}','{$agrdate}')";
$lobj_save_comp = $aobj_context->mobj_db->Execute($save_comp);
if($lobj_save_comp)
{
$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')
{
$update_comp = "update mascomp set FCMPNAME = '{$cmpname}',FCONTACT='{$contact}',FADD1='{$add1}',FADD2='{$add2}',
FADD3='{$add3}',FADD4='{$add4}', FEMAIL='{$email}', FWEBSITE='{$website}',FAGRDATE='{$agrdate}'
where FCMPCODE = '{$cmpcode}'";
$lobj_update_comp = $aobj_context->mobj_db->Execute($update_comp);
if($lobj_update_comp)
{
$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 getcompanyCodeDetails($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
session_start(); //and FDELETED = 'F'
$cmpcode =$aobj_context->mobj_data["cmpcode"];
$get_company_details = "select m.*, date_format(m.FAGRDATE,'%d/%m/%Y') as FAGRDATE from mascomp m
where m.FCMPCODE = '{$cmpcode}'";
$lobj_get_company_details = $aobj_context->mobj_db->getRow($get_company_details);
if(count($lobj_get_company_details) > 0)
{
echo $aobj_context->mobj_output->ToJSONEnvelope($lobj_get_company_details,0,"success");
return;
}
else
{
$error_msg = 'No details found ';
echo $aobj_context->mobj_output->ToJSONEnvelope($error_msg,-1,"Disabled");
return;
}
}
function disablecompanyRecord($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++)
{
$cmpcodes = $delete_arr_data[$k]->companyCode.
$disable_company_record = "UPDATE mascomp SET FDELETED='T'
WHERE FCMPCODE='{$delete_arr_data[$k]->companyCode}' ";
$lobj_rs = $aobj_context->mobj_db->Execute($disable_company_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;
}
}
?>
|