<?php
$PageSecurity = 1;
session_name('CAKEPHP'); session_start();
include('config.php');
include('includes/ConnectDB.inc');
include('includes/function_lib.php');
include('includes/LanguageSetup.php');
include('includes/DateFunctions.inc');
?>
<link rel="stylesheet" href="css/purchase_requision_print.css">
<div class="body_contain">
<div class="tab_div">
<div>
<form action="" method="post">
<table width="100%" border="0">
  <tr>
    <td align="center"><strong>Reason</strong></td>
  </tr>
  <tr>
    <td><textarea name="reason" style="width:100%"></textarea></td>
  </tr>
  <tr>
    <td align="center"><input type="submit" name="Cancel" value="Proceed" /></td>
  </tr>
</table>
</form>
    

  
</div>
<?php



         
				 if(isset($_POST['Cancel']))
					{
					// $venderid=$s->getField('purchorders','orderno',$_REQUEST['id'],'mst_vendor_quotesid');
					$comid=$s->getField('purchorders','id',$_REQUEST['id'],'comperativeId');
					 //$updatevender=DB_query("update venderquotations set po_cancel_vender='Y' where id='".$venderid."'",$db); 
					 $update=DB_query("update purchorders set cancel_status=1,cancel_reason='".$_REQUEST['reason']."'
					 ,po_cancel_by='".$_SESSION['UserID']."' 
					 where id='".$_REQUEST['id']."'",$db);
					 $update_com=DB_query("update comprative set status_active=1 where id ='".$comid."'",$db);
							
					
					

echo "<script>parent.window.close();
parent.window.opener.location.href='index.php?route=POModule/view_purchase_order_direct&modid=".$_REQUEST['modid'].                      "&frmid=".$_REQUEST['frmid']."'</script>";			
				}
?>