<?php 
$sql=DB_query("Select * from stock_summary order by date ASC",$db);
?>
<table width="100%" border="1" cellpadding="5">
  <tr>
    <th scope="col">Site</th>
    <th scope="col">Store</th>
    <th scope="col">Item</th>
    <th scope="col">Opening Qty </th>
    <th scope="col">Opening Rate </th>
    <th scope="col">Opening Value </th>
    <th scope="col">In Qty </th>
    <th scope="col">In Rate </th>
    <th scope="col">In Value </th>
    <th scope="col">Out Qty </th>
    <th scope="col">Out Rate </th>
    <th scope="col">Out Value </th>
    <th scope="col">Closing Qty </th>
    <th scope="col">Closing Rate </th>
    <th scope="col">Closing Value </th>
    <th scope="col">Date</th>
  </tr>
  <?php 
  while($row=DB_fetch_array($sql)){
  ?>
  <tr>
    <td nowrap="nowrap"><?php echo $s->getField('locations','loccode',$row['site'],'locationname');?></td>
    <td nowrap="nowrap"><?php echo $s->getField('storetype','id',$row['store'],'StoreName');?></td>
    <td nowrap="nowrap"><?php echo $s->getField('item_master','id',$row['item'],'item_name');?></td>
    <td><?php echo $row['opening_qty'];?></td>
    <td><?php echo $row['opening_rate'];?></td>
    <td><?php echo $row['opening_value'];?></td>
    <td><?php echo $row['inwards_qty'];?></td>
    <td><?php echo $row['inwards_rate'];?></td>
    <td><?php echo $row['inwards_value'];?></td>
    <td><?php echo $row['outwards_qty'];?></td>
    <td><?php echo $row['outwards_rate'];?></td>
    <td><?php echo $row['outwards_value'];?></td>
    <td><?php echo $row['closing_qty'];?></td>
    <td><?php echo $row['closing_rate'];?></td>
    <td><?php echo $row['closing_value'];?></td>
    <td nowrap="nowrap"><?php echo ConvertSQLDate($row['date']);?></td>
  </tr>
  <?php } ?>
</table>
