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.15.211.55
<?php
function admprevqppatterndet($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$patcode = $aobj_context->mobj_data['patcode'];
$qpcode = $aobj_context->mobj_data['qpcode'];
$query1 = "SELECT * from patdetl
WHERE fpatcode = '{$patcode}'";
$rst1 = $aobj_context->mobj_db->GetAll($query1);
$qppatdetails = '';
$slno = 1;
foreach($rst1 as $patkey=>$patval)
{
$qppatdetails .= "<tr> ";
$qppatdetails .= '<td style="width:5%;float:left;height:30px;" align="center"><input type="hidden" name="qppatterdet">'.$slno.'</td>';
$qppatdetails .= '<td style="width:6%;float:left;height:30px;" align="center"><input type="hidden" id="'.$slno.'HT1" value="'.$patval['fqnid'].'">'.$patval['fqnid'].'</td>';
$qppatdetails .= '<td style="width:6%;float:left;height:30px;" align="center"><input type="hidden" id="'.$slno.'HT2" value="'.$patval['fqnno'].'">'.$patval['fqnno'].'</td>';
$qppatdetails .= '<td style="width:10%;float:left;height:30px;" align="center"><input type="hidden" id="'.$slno.'HT3" value="'.$patval['fqntit'].'">'.$patval['fqntit'].'</td>';
$qppatdetails .= '<td style="width:73%;float:left;" align="center"><input type="text" id="'.$slno.'HT4" value = "'.$patval['fqndesc'].'" class="form-control1" ></td>';
$qppatdetails .= "</tr> ";
++$slno;
}
echo $aobj_context->mobj_output->ToJSONEnvelope($qppatdetails,0,"Success");
return true;
}
function admsavepqpatterndet($aobj_context)
{
include_once("/JSON.php");
$json = new Services_JSON();
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$patcode = $aobj_context->mobj_data['patcode'];
$qpcode = $aobj_context->mobj_data['qpcode'];
$qppattern_arr = stripslashes($aobj_context->mobj_data["qppattern_arr"]);
$mobj_jsondata = $json->decode($qppattern_arr);
$qppattern_arr = get_object_vars($mobj_jsondata);
$instqry = "";
for($k=1;$k<=count($qppattern_arr);$k++)
{
$instqry .= "('{$patcode}','{$qpcode}','{$qppattern_arr[$k]->qnid}','{$qppattern_arr[$k]->qnno}','{$qppattern_arr[$k]->qntit}','{$qppattern_arr[$k]->qndesc}'),";
}
$query2 ="DELETE FROM qpdetl
WHERE fqpcode = '{$qpcode}' and fpatcode = '{$patcode}'";
$aobj_context->mobj_db->Execute($query2);
$query = "insert into qpdetl(fpatcode,fqpcode,fqnid,fqnno,fqntit,fqndesc) values".$instqry;
$query = substr($query,0,strlen($query)-1);
$rst = $aobj_context->mobj_db->Execute($query);
if($rst)
{
$succ_msg = "Updated Successfully";
echo $aobj_context->mobj_output->ToJSONEnvelope($succ_msg,0,"Success");
return true;
}
else
{
$error_msg = "Updation failed";
echo $aobj_context->mobj_output->ToJSONEnvelope($error_msg,-1,"Failure");
return true;
}
}
?>
|