<?php
/* $Revision: 1.42 $ */

$PageSecurity = 11;

/* Session started in header.inc for password checking and authorisation level check */
include('includes/DefinePOClass.php');
include('includes/DefineSerialItems.php');
include('includes/session.inc');
include('includes/SQL_CommonFunctions.inc');

$title = _('Quality Control');
include('includes/header.inc');

 $sql = "SELECT * FROM grns left JOIN suppliers  ON (grns.supplierid = suppliers.supplierid) join purchorders on 
(grns.supplierid=purchorders.supplierno) group by grns.grnbatch"; 

// join purchorderdetails on (grns.podetailitem=purchorders.orderno)join stockmaster on(grns.itemcode=stockmaster.stockid)";
	$result = DB_query($sql,$db);

	echo "<br><table border=1>\n";
	echo '<tr><th>' . _('Grn Number') . '</th>
	        <th>' . _('Supplier Code') . '</th>
			<th>' . _('Supplier Name') . '</th>
			<th>' . _('PO Number') . '</th>
			<th>' . _('PO Date') . '</th>
            
           </tr>';

	$k=0; //row colour counter

	while ($myrow = DB_fetch_array($result)) {
		if ($k==1){
			echo '<tr class="EvenTableRows">';
			$k=0;
		} else {
			echo '<tr class="OddTableRows">';
			$k=1;
		}
		$ModifyPage = $rootpath . "/GRN_number.php?" . SID . "&GRNNumber=" . $myrow["grnbatch"];
		printf("<td><a  href='".$ModifyPage."'> ".$myrow['grnbatch']."</a></td>
            		<td>".$myrow['supplierid']."</td>
					<td>".$myrow['suppname']."</td>
					<td>".$myrow['orderno']."</td>
					<td>".ConvertSQLDate($myrow['orddate'])."</td>
					
            		</tr>");
            		
					
	}



include('includes/footer.inc');
?>