<?php
$ti=time();
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=inventory_stock_report_".$ti.".xls");
header("Pragma: no-cache");
header("Expires: 0");
?>
<table class="table table-bordered table-striped filterTable" id="filterTable">
        <tr>
          <th width="5%" class="align-center">S.No</th>
          <th>Category Name</th>
          <th>Item Name</th>
          <th>Purchased Qty</th>
          <th>Issued Qty</th>
          <th>Available Qty</th>
        </tr>
		  <?php foreach($results as $k => $r ) : ?>
          <?php $category	= $this->inventory_stock_report_model->get_category_by_id($r['inv_cat_id']);  ?>
          <?php $item		= $this->inventory_stock_report_model->get_item_by_id($r['inv_item_id']);  ?>
				<tr>
                    <td class="align-center"><?php echo $k+1; ?></td>
                    <td><?php echo $category; ?></td>
                    <td><?php echo $item; ?></td>
                    <td><?php echo ($r['now_avail_qty'] + $r['total_issued_qty']); ?></td>
                    <td><?php echo $r['total_issued_qty']; ?></td>
                    <td><?php echo $r['now_avail_qty']; ?></td>
				</tr>
		<?php 
			endforeach; 
		?>
</table>