<?php
$PageSecurity = 1;
include('config.php');
include('includes/ConnectDB.inc');
include('includes/function_lib.php');
include('includes/LanguageSetup.php');
include('includes/DateFunctions.inc');

 
    $sql_po = "Select * from purchorders where id='".$_GET['id']."'";
	$result=DB_query($sql_po,$db);
	$myrow=DB_fetch_array($result);	
	$myrow['cancel_reason'];
	
	
?>
<link rel="stylesheet" href="css/purchase_requision_print.css">
<div class="body_contain">
<div class="">
<div>
<form action="" method="post">
<table width="100%" border="0"  bordercolor="#999999" cellpadding="3" cellspacing="0">
  <tr>
    <td align="left"><strong>Reason</strong></td>
  </tr>
  <tr>
    <td><textarea name="reason" style="width:100%" rows="6" cols="6" ><?php echo $myrow['cancel_reason']; ?></textarea></td>
  </tr>
 
</table>
</form> 
</div>
<?php 
	 if(isset($_POST['Cancel']))
			 {
			 echo "manoj";
					 //$venderid=$s->getField('purchorders','id',$_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']."' 
					 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&modid=".$_REQUEST['modid']."&frmid=".$_REQUEST['frmid']."'</script>";			
				}
?>