<?php
    include("../include/session.php");
    if(!$session->isAdmin() && !$session->isRadstoneReceptionUser() && !$session->isRadstoneStoreUser()){
		header("Location: ../Store/productionMenu.php");
    }
    else {
    	include("../reportHeader.php");
//        include("../include/db.php");
    	$q = "SELECT * FROM nam_products";
    	$result = execsql($q);
    	$i = 0;
    	$num = mysql_num_rows($result);
    	
?>
<script type="text/javascript" src="../include/tablesort.js"></script>
      
<h3>All the products currently in the store</h3><br /><br />

<table id="test1" cellpadding="0" cellspacing="0" border="0" class="rowstyle-alt colstyle-alt no-arrow">
    <thead>
      <tr>
        <th class="sortable-text">Product Id</th>
        <th class="sortable-text">Product Name</th>
        <th class="sortable-text">Category</th>
        <th class="sortable-text">Returnable</th>
        <th class="sortable-numeric">Quantity</th>
      </tr>
    </thead>
    <tbody>
    <?php 

    	while($i < $num){
	       $b1 = mysql_result($result, $i, "productId");
	       $b2 = mysql_result($result, $i, "productName");
	       $b3 = mysql_result($result, $i, "category");
	       $b4 = mysql_result($result, $i, "returnable");
    		if($b4 < 1){
	           $permission = "No";
	       	}else {
	           $permission = "Yes";
	       	}
	       $b5 = mysql_result($result, $i, "quantity");
    
    ?>
    <tr class="alt"><td><?php echo $b1?></td>
        <td><?php echo $b2?></td>
        <td><?php echo $b3?></td>
        <td><?php echo $permission?></td>
        <td><?php echo $b5?></td>
        </tr> 
    
<?php 
		$i++;
    	}
    	?></tbody>
    	</table>
    	<?php 
    	include("../footer.html");
    }
//    
	
?>