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.14.255.58
<?php
function savestockadjustment($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
include_once("/JSON.php");
$json = new Services_JSON();
$item_arrjson = stripslashes($aobj_context->mobj_data["item_arrjson"]);
$mobj_jsondata = $json->decode($item_arrjson);
$item_arr = get_object_vars($mobj_jsondata);
session_start();
$username = $_SESSION['usr'];
$auto_mrnno = $mrnno;
for($k=1;$k<=count($item_arr);$k++)
{
$query1 = "update salemrn set FBALQTY = FBALQTY+{$item_arr[$k]->quantity}
where FBARCODE = '{$item_arr[$k]->barcode}'";
$rst = $aobj_context->mobj_db->Execute($query1);
$query2="INSERT INTO stkadj(FBARCODE,FQTY,FDATE,FUSER,FREMARKS) VALUES
('{$item_arr[$k]->barcode}','{$item_arr[$k]->quantity}',now(),'{$username}','')";
$rst = $aobj_context->mobj_db->Execute($query2);
}
$success_report = 'Updated Successfully';
$error_reports="Some Failure as occured ";
if($rst)
echo $aobj_context->mobj_output->ToJSONEnvelope($success_report,0,"success");
else
echo $aobj_context->mobj_output->ToJSONEnvelope($query,-1,"error");
}
function selectStockadjItemCode($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$itemcode = $aobj_context->mobj_data["itemcode"];
session_start();
$query="select masitem.FITEMCODE as FITEMCODE, masitem.FITEMNAME as FITEMNAME
from masitem where masitem.FITEMCODE = '{$itemcode}'";
$rst = $aobj_context->mobj_db->GetRow($query);
if($rst)
{
echo $aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success");
}
else
{
$err_data="Invalid Item code";
echo $aobj_context->mobj_output->ToJSONEnvelope($err_data,-1,"Failure");
}
}
function validateBarcode($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$brcode = $aobj_context->mobj_data["brcode"];
session_start();
$query = "select * from detmrn where FBARCODE = '{$brcode}'";
$rst = $aobj_context->mobj_db->GetRow($query);
if(count($rst)==0)
{
$succ_data = '';
echo $aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success");
}
else
{
$err_data = 'Barcode '.$brcode .' already exist';
echo $aobj_context->mobj_output->ToJSONEnvelope($err_data,-1,"error");
}
}
function getstockadjustmentDetails($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$docno = $aobj_context->mobj_data["docno"];
$qury = "select masmrn.FMRNNO, date_format(masmrn.FMRNDATE,'%d/%m/%Y') as FMRNDATE, detmrn.FBARCODE, detmrn.FITEMCODE,
masitem.FITEMNAME, detmrn.FBATCHNO, date_format(detmrn.FEXPDATE,'%d/%m/%Y') as FEXPDATE, detmrn.FPACKQTY, detmrn.FMRP,
detmrn.FBALQTY from detmrn, masmrn, masitem
where detmrn.FMRNNO = masmrn.FMRNNO and detmrn.FITEMCODE = masitem.FITEMCODE
and masmrn.FMRNNO = '{$docno}' and masmrn.FTRANTYPE = 'A'";
$rst = $aobj_context->mobj_db->getAll($qury);
if($rst)
{
echo $aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success");
return;
}
else
{
$error_msg = 'no details found ';
echo $aobj_context->mobj_output->ToJSONEnvelope($qury ,-1,"Disabled");
return;
}
}
function getstkadjBcodeDetails($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$barcode = $aobj_context->mobj_data["barcode"];
$qry = "select masitem.FITEMCODE AS id,masitem.FITEMCODE ,masitem.FITEMNAME,masitem.FBINNO,
recmrn.FMRP,(recmrn.FMRP/recmrn.FPACKQTY) as PRICE, recmrn.FPACKQTY,salemrn.FQTY,
salemrn.FBALQTY , DATE_FORMAT(recmrn.FEXPDATE,'%d/%m/%Y') AS FEXPDATE,recmrn.FBATCHNO from masitem ,recmrn, salemrn
where masitem.FITEMCODE = recmrn.FITEMCODE and salemrn.FRECMRNNO = recmrn.FRECMRNNO
and salemrn.FBARCODE='{$barcode}' and ifnull(salemrn.FBALQTY,0) >=0";
$rst = $aobj_context->mobj_db->GetRow($qry);
if($rst)
{
echo $aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success");
}
else
{
$err_data="Invalid Barcode code";
echo $aobj_context->mobj_output->ToJSONEnvelope($err_data,-1,"Failure");
}
}
?>
|