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.147.73.117
<?php
function savemanufacturerMaster($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$add_edit=trim($aobj_context->mobj_data["add_edit"]);
$mfgcode=trim($aobj_context->mobj_data["mfgcode"]);
$mfgname=trim($aobj_context->mobj_data["mfgname"]);
$shortname=trim($aobj_context->mobj_data["shortname"]);
if($add_edit == 'Add')
{
$checkRecord = "select * from masmfg where FMFGCODE = '{$mfgcode}'";
$lobj_checkRecord = $aobj_context->mobj_db->getAll($checkRecord);
if(count($lobj_checkRecord) > 0 )
{
$error_msg = 'Manufacturer code '.$mfgcode.' already exist';
echo $aobj_context->mobj_output->ToJSONEnvelope($error_msg,-1,"failure");
return;
}
else
{
$save_manufacturer = "insert into masmfg(FMFGCODE,FMFGNAME,FSHORTNAME) values('{$mfgcode}','{$mfgname}','{$shortname}')";
$lobj_save_manufacturer = $aobj_context->mobj_db->Execute($save_manufacturer);
if($lobj_save_manufacturer)
{
$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_manufacturer = "update masmfg set FMFGNAME = '{$mfgname}',FSHORTNAME='{$shortname}' where FMFGCODE = '{$mfgcode}'";
$lobj_update_manufacturer = $aobj_context->mobj_db->Execute($update_manufacturer);
if($lobj_update_manufacturer)
{
$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 ViewmanufacturerMasterDetails($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
session_start();
$srchfield1 = trim($aobj_context->mobj_data["srchfield1"]);
$srchfield2 = trim($aobj_context->mobj_data["srchfield2"]);
$srchfield3 = trim($aobj_context->mobj_data["srchfield3"]);
if($srchfield1 != '')
$srchcond1 ="fmfgcode like '{$srchfield1}%' and";
else
$srchcond1 ='';
if($srchfield2 != '')
$srchcond2 =" fmfgname like '{$srchfield2}%' and";
else
$srchcond2 ='';
if($srchfield3 != '')
$srchcond3 =" fshortname like '{$srchfield3}%' and";
else
$srchcond3 ='';
$qry="select FMFGCODE, FMFGNAME, FSHORTNAME from masmfg
where {$srchcond1} {$srchcond2} {$srchcond3} ifnull(FDELETED,'') <> 'T' order by fmfgname";
$lobjManufcode = $aobj_context->mobj_db->GetAll($qry);
if($lobjManufcode)
{
echo $aobj_context->mobj_output->ToJSONEnvelope($lobjManufcode,0,"success");
}
else
{
$err_data="No records found";
echo $aobj_context->mobj_output->ToJSONEnvelope($err_data,-1,"Failure");
}
}
function getmanufacturerCodeDetails($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
session_start(); //and FDELETED = 'F'
$mfgcode =$aobj_context->mobj_data["mfgcode"];
$get_manufacturer_details = "select * from masmfg where fmfgcode = '{$mfgcode}'";
$lobj_get_manufacturer_details = $aobj_context->mobj_db->getRow($get_manufacturer_details);
if(lobj_get_manufacturer_details )
{
echo $aobj_context->mobj_output->ToJSONEnvelope($lobj_get_manufacturer_details,0,"success");
return;
}
else
{
$error_msg = 'no details found ';
echo $aobj_context->mobj_output->ToJSONEnvelope($error_msg,-1,"Disabled");
return;
}
}
function disableManufacturerRecord($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);
for($k=0;$k<count($delete_arr_data);$k++)
{
$disable_manufacturer_record = "UPDATE masmfg SET FDELETED='T'
WHERE fmfgcode='{$delete_arr_data[$k]->mfgcode}' ";
$lobj_rs = $aobj_context->mobj_db->Execute($disable_manufacturer_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;
}
}
?>
|