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.146.178.220
<?php
function ViewGeneratedPO($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
session_start();
$pono =$aobj_context->mobj_data["pono"];
$query = "select detpo.FPONO, date_format(maspo.FPODATE,'%d/%m/%Y') as FPODATE, maspo.FSUPCODE,massup.FSUPNAME,
date_format(maspo.FDELDATE,'%d/%m/%Y') as FDELDATE,detpo.FITEMCODE, masitem.FITEMNAME,detpo.FORDQTY, detpo.FORGQTY,
detpo.FRECQTY, pomview.fstatus as FSTATUS from detpo,maspo,massup,masitem,pomview
where maspo.FPONO = detpo.FPONO and maspo.FSUPCODE = massup.FSUPCODE and detpo.FITEMCODE = masitem.FITEMCODE
and detpo.FPONO = '{$pono}' and pomview.FPONO = maspo.FPONO order by detpo.FITEMCODE";
$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 saveGeneratedPO($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
session_start();
$pono = $aobj_context->mobj_data["pono"];
$deldate =$aobj_context->mobj_data["deldate"];
$indno =$aobj_context->mobj_data["indno"];
$itemcode =$aobj_context->mobj_data["itemcode"];
$itemcode=explode(',', $itemcode);
$ordqty =$aobj_context->mobj_data["ordqty"];
$ordqty = explode(',', $ordqty);
$query = "UPDATE MASPO set FDELDATE = date_format(str_to_date('{$deldate}','%d/%m/%Y'),'%Y-%m-%d') where FPONO = '{$pono}'";
$rst = $aobj_context->mobj_db->Execute($query);
$itemlist='';
for($i=0;$i<count($itemcode);$i++)
{
$itemlist .="'". $itemcode[$i]."',";
$update = "UPDATE detpo set FORDQTY = {$ordqty[$i]}
WHERE FITEMCODE = '{$itemcode[$i]}' and FPONO = '{$pono}' ";
$lobj_update = $aobj_context->mobj_db->Execute($update);
$query = "SELECT {$ordqty[$i]}-FORDQTY AS FORDQTY FROM masitem
WHERE FITEMCODE = '{$itemcode[$i]}'";
$rst = $aobj_context->mobj_db->GetRow($query);
$query2 = "UPDATE masitem SET FAPPQTY = FAPPQTY-{$rst[FORDQTY]}, FORDQTY = FORDQTY+{$rst[FORDQTY]}
WHERE FITEMCODE = '{$itemcode[$i]}'";
$lobj_update = $aobj_context->mobj_db->Execute($query2);
$query3 = "UPDATE detind SET FAPPQTY = {$ordqty[$i]}
WHERE FITEMCODE = '{$itemcode[$i]}' and FPONO = '{$pono}'";
$lobj_update = $aobj_context->mobj_db->Execute($query3);
}
$itemlist = $itemlist."'0000'";
$query = "SELECT mp.FPONO, DATE_FORMAT(mp.FPODATE,'%d/%m/%Y') as FPODATE, mp.FSUPCODE,
ms.FSUPNAME, ms.FADD1, ms.FADD2, ms.FADD3, ms.FEMAIL,DATE_FORMAT((mp.FPODATE + INTERVAL 2 DAY),'%d/%m/%Y') as deldate,
ms.FADD3, dp.FITEMCODE, mit.FITEMNAME, sum(dp.FORDQTY) as FORDQTY
FROM maspo mp INNER JOIN detpo dp ON mp.FPONO=dp.FPONO INNER JOIN massup ms ON mp.FSUPCODE=ms.FSUPCODE
INNER JOIN masitem mit ON dp.FITEMCODE=mit.FITEMCODE WHERE IFNULL(mp.FDELETED,'') <> 'T' AND mp.FPONO
IN ({$pono}) and dp.FITEMCODE IN ({$itemlist}) group by dp.FITEMCODE ORDER BY dp.FITEMCODE";
$rst = $aobj_context->mobj_db->GetAll($query);
$emailid = $rst[0][FEMAIL];
$subject = 'Live 100 - Modified Purchase order '.$rst[0][FPONO].' Dated : '.$rst[0][FPODATE];
$message="<p style='font-size:18px;font-weight:bold;'>Dear Sir / Madam,</p></br><br></br><br>";
$message.="<span style='font-size:14px;'>Your are here by requested to note down modified PO.NO. and supply the item accordingly.
<br> Submit the Invoice in duplicate and ensure that our PO.NO should be mentioned in the Invoice.</span></br><br></br><br>";
$message.="<span style='padding-right:500px;text-align:left;font-size:16px;'>Regards </span>
<span style='font-size:16px;'>Thanking You</span></br><br>";
$message.="<span style='font-size:14px;'>Live100 <br>Support Team</span></br>";
$header_det ="You are here by requested to note down modified PO.NO. and supply the item accordingly. Submit the Invoice in duplicate
and ensure that our PO.NO should be mentioned in the Invoice.";
require_once("cManualMailer.php");
require_once("reports/report_po.php");
$class_obj=new poDetail("P");
$class_obj->AliasNbPages();
$class_obj->Default_construstor($aobj_context,$pono,'Modified Purchase Order',$rst,$header_det);
$class_obj->GetpoDetail();
$filename = $class_obj->SendOutput();
send_attachments($emailid,$subject,$message,$replay_to=null,$cc='sandeep.n@logisys.org',$bcc=null,$filename);
$success_msg = 'Updated Successfully';
$error_msg = "Some Failure as occured ";
if($rst)
echo $aobj_context->mobj_output->ToJSONEnvelope($success_msg,0,"success");
else
echo $aobj_context->mobj_output->ToJSONEnvelope($error_msg,-1,"error");
}
?>
|