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.189.194.225
<?php
function viewRecivedatStores($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
session_start();
$query = "select salemrn.FBARCODE, recmrn.FITEMCODE, masitem.FITEMNAME, masitem.FBINNO, salemrn.FACCQTY,
recmrn.FBATCHNO, date_format(recmrn.FEXPDATE,'%d/%m/%Y') as FEXPDATE from salemrn, recmrn, masitem
where recmrn.FITEMCODE = masitem.FITEMCODE and recmrn.FRECMRNNO = salemrn.FRECMRNNO and ifnull(salemrn.FSTATUS,'') = 'S'";
$rst = $aobj_context->mobj_db->getAll($query);
if($rst)
{
echo $aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success");
return;
}
else
{
$error_msg = 'no details found ';
echo $aobj_context->mobj_output->ToJSONEnvelope($error_msg,-1,"Disabled");
return;
}
}
function saveReceivedatStores($aobj_context)
{
include_once("/JSON.php");
$json = new Services_JSON();
$lstr_param = stripslashes($aobj_context->mobj_data["sendarr"]);
$mobj_jsondata = $json->decode($lstr_param);
$sendarr = get_object_vars($mobj_jsondata);
for($k=0;$k<count($sendarr);$k++)
{
$baritmcode = $sendarr[$k]->barcode;
$val = explode('*',$baritmcode);
$query = "UPDATE salemrn SET FSTATUS='R',FBALQTY = FBALQTY+FACCQTY
where FBARCODE ='{$val[0]}'";
$rst = $aobj_context->mobj_db->Execute($query);
$update = "UPDATE masitem AS mi INNER JOIN ( SELECT FACCQTY FROM detmrn
WHERE FITEMCODE = '{$val[1]}' and FBARCODE ='{$val[0]}') AS mi2 SET mi.FACCQTY = mi.FACCQTY-mi2.FACCQTY,
mi.FBALQTY = mi.FBALQTY+mi2.FACCQTY
WHERE mi.FITEMCODE = '{$val[1]}'";
$lobj_update = $aobj_context->mobj_db->Execute($update);
}
if($rst)
{
$success_msg = 'Updated Successfully';
echo $aobj_context->mobj_output->ToJSONEnvelope($success_msg,0,"success");
return;
}
else
{
$error_msg = 'Updated Failed';
echo $aobj_context->mobj_output->ToJSONEnvelope($error_msg,-1,"Failure");
return;
}
}
?>
|