 <?php extract($_POST);
$PageSecurity = 1;
 
global $db;

if($_REQUEST['action']=='del')
{
 
	  $delete_sql1="Delete from vendor_quotes_ammendment where id='".$_REQUEST['VAMID']."'";
	  $delete_res1=DB_query($delete_sql1,$db);
 	
  }
  
 

	$sql = "select * from vendor_quotes_ammendment order by quotation_date desc";
 
	 
   $PurchOrdersResult = DB_query($sql,$db);?>
 
   <h3>Purchase Order Approval </h3>
   <table  border="0" width="100%" cellspacing="2" cellpadding="2">
	<tr>
	<th><strong>Vendor Quotation No</strong></th>
	<th><strong>Vendor Quotation Date</strong></th>
	 
	<th><strong>Vendor Code</strong></th>
	<th><strong>Vendor</strong></th>

	<th><strong>PO Status</strong></th>
	 
	<th><strong>Process PO/View</strong></th>
	<th><strong>Delete</strong></th>
	</tr>
	<?php
	$j = 1;
	$k=0; //row colour counter

	if(DB_num_rows($PurchOrdersResult)>0)
	{
	while ($row=DB_fetch_array($PurchOrdersResult)) 
	{
		
	?>
	<tr bgcolor="#FFFFFF" onmouseover="this.style.backgroundColor='#fffeb3'; this.style.color='#00f';" onmouseout="this.style.backgroundColor='#FFF'; this.style.color='#000000';">
	<td> 
	
	
	<?php echo $row['vernder_quotation'];?></td>
	<td> <?php echo ConvertSQLDate($row['quotation_date']);?></td>
		<td> <?php echo $s->GetFieldValue('suppliers',"id='".$row['mst_supplierno']."'" ,'vendor_code');
		?></td>
 <td> <?php echo  $s->GetFieldValue('suppliers',"id='".$row['mst_supplierno']."'" ,'vendor_name');?></td>
	<td>
<?php 	
	  $CHECK_POSTATUS= $sql_query_amd=DB_fetch_array(DB_query("select orderno from purchorders where mst_vendor_quotesid ='".$row['id']."' and identify_Vquotes='AMD'",$db));
	 
	 echo   $CHECK_POSTATUS['orderno']!=0?'Generated':'Not Generated' ;?></td>
	<td>  
	 
	<?php if($CHECK_POSTATUS!=0)
	{?>
	
	<a href="index.php?route=POModule/Vendor_Quotes_Ammendment_order<?php echo $rurl;?>&view=<?php echo $row['id']?>"> <img src="images/search.gif"  width="20" height="20"/></a>
	
 	<?php }
	else
	{
	?>
	<a href="index.php?route=POModule/Vendor_Quotes_Ammendment_order<?php echo $rurl;?>&VAMID=<?php echo $row['id']?>"> <img src="images/search.gif"  width="20" height="20"/></a>
	</td><?php } ?>
	
	</td>
	<td>
<?php
if( $CHECK_POSTATUS==0)
{?>
<a href="index.php?route=POModule/Comp-order-list&action=del<?php echo $rurl;?>&VAMID=<?php echo $row['comprative_id']?>">
<img src="images/Icon_Delete.png" /></a>
<?php } 
	else {
	echo "Delete";
	}?>
	</td>
	</tr>
<?php
	
		}
 		
	 
	}
	else
	{?>
		<tr>
		<td colspan="5"><font color="#FF0000"><h2 align="center">No Record Found!</h2></font></td>
		</tr>
	<?php }
	?>
</table>
<?php if(isset($_SESSION['success_msg']))
{ ?>
	<script> alert("<?php echo ($_SESSION['success_msg']);?>");</script>
<?php 
}	unset($_SESSION['success_msg']);
?>
