<!--style sheets-->
<link rel="stylesheet" type="text/css" href="../css/scroll_table.css" />
<link href="../css/main.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="../css/tabs.css" />

<!--jscript-->
<script language="javascript" src="../jscript/calendar.js"></script>
<script language="JavaScript" src="../jscript/tooltip.js"  type="text/javascript"></script> 

<?php
include('../include/period_select_date.php');

$table_name = $_SESSION['db_prefix']."_store_deliver";	 	
	$display_query = "SELECT * FROM $table_name WHERE date BETWEEN '".$start."' AND '".$end."' ";
	
		$display_result = execsql($display_query);
		$i = 0;
		$display_num = mysql_num_rows($display_result);

?>

<div class="page_middle_frame" style="height:690px;"> 

<ul class="tabs">
      <li>
          <input type="radio" name="tabs" id="tab1">
          <label class="tab" for="tab1"><a class="tabs" href="internal_supplies_list.php?branch=Gaborone&date=">Gaborone</a></label>
<div id="tab-content1" class="tab-content animated fadeIn" style="height:630px;"> 

 </div>
 </li>
        <li>
          <input type="radio"  name="tabs" id="tab2">
          <label  class="tab" for="tab2"><a class="tabs" href="internal_supplies_list.php?branch=Francistown&date=">Francistown</a></label>
<div id="tab-content2" class="tab-content animated fadeIn"> 

</div>
        </li>
        <li>
          <input type="radio" checked name="tabs" id="tab3">
          <label class="tab"for="tab3"><a class="tabs" href="internal_supplies_list.php?branch=Combined&date=">Combined</a></label>
           
 <div id="tab-content3" class="tab-content animated fadeIn">  

<script type="text/javascript" language="javascript" src="../jscript/jquery.dataTables.js"></script>
<script type="text/javascript" charset="utf-8">
			$(document).ready(function() {
				$('#scroll_table').dataTable( {
					"sScrollY": "500px",
					"bPaginate": false,
					"bScrollCollapse": true,
					"aaSorting": [[ 1, "desc" ]],
					"aoColumns": [
								{"iDataSort": 1},
								{"bVisible": false},
                              	{"bSortable": true},
                             	{"bSortable": true},
								{"bSortable": true},
								{"bSortable": true},
								{"bSortable": true},
								{"bSortable": true}
								 ]
				} );
			} );
		</script>
       
        
<?php
$page='internal_supplies_list.php';
$reference_name='branch';
$reference='Gaborone';
$reference_name_2='';
$reference_2='';
include('../include/period_select_block_2.php');
?>

          
          <table width="662" id="scroll_table" class="data_display"  >
	<thead>
		<tr>
		  <th width="63">Date</th>
		  <th width="34">&nbsp;</th>
		  <th width="160">Item</th>
			<th width="70">Sub store</th>
            <th width="110">Delivered to</th>
          	<th width="55" >Qty</th>
			<th width="62" >Unit Price</th>
		    <th width="72" >Total </th>
		</tr>
	</thead>
	<tbody>
  <?php
    $b9=0;
	while($i < $display_num){
		 $b = mysql_result($display_result, $i, "deliver_id");
		 $b0 = mysql_result($display_result, $i, "date");
		 
		 $table_name2 = $_SESSION['db_prefix']."_store_items";
		 $b1 = mysql_result($display_result, $i, "store_item_id");
		 $table_name2 = $_SESSION['db_prefix']."_store_items";
		 $item_query = "SELECT item_name FROM $table_name2 WHERE store_item_id = '".$b1."' " ;
		 $item_result = execsql($item_query);
		   $b1a = mysql_result($item_result, 0, "item_name");
		 	  
		$b2 = mysql_result($display_result, $i, "delivered_to");
		
		$b3 = mysql_result($display_result, $i, "quantity");
		$b4 = mysql_result($display_result, $i, "price");
		$b5 = mysql_result($display_result, $i, "sub_cat");
		
		//$b8 = mysql_result($displayResult, $i, "reference");
		
		$b7=$b3*$b4;
		$b9 += $b7;
		
		 $itemTT =
		   "<table id=table_tool_tip width=250 ><tr><td  width=75>Item name:</td><td width=175>".$b1a."</td></tr><tr><td>Supplied to:</td><td>".$b2."</td></tr><tr><td>Date supplied:</td><td>".date("d-m-Y", strtotime($b0))."</td></tr></table><br><b>Click for details</b>";
		
						
		?>
		<tr >
		  <td ><?php echo date("d-m-Y", strtotime($b0 ))?></td>
		  <td ><?php echo $b0 ?>&nbsp;</td>
		  <td ><a href="store_item_display.php?store_item_id=<?php echo $b1 ?> " onMouseover="ddrivetip('<?php echo $itemTT ?>', 260)"; onMouseout="hideddrivetip()">&nbsp;&nbsp;</a><a href="store_item_display.php?store_item_id=<?php echo $b1 ?> " onMouseOver="ddrivetip('<?php echo $itemTT ?>', 260)"; onMouseOut="hideddrivetip()"><?php echo $b1a ?></a></td>
			<td ><?php echo $b5?></td>
			<td align="left"><?php echo $b2?></td>
			<td align="right"><?php echo $b3?></td>
			<td align="right"><?php echo $b4?></td>
		    <td align="right"><?php $b7=$b3*$b4;  echo number_format($b7, 2, '.', ',')?> </td>
		</tr>
        
		<?php
		$i++;
		  
	}
	
	?>
	</tbody>
	<tfoot>
	    <tr >
          <td colspan="7"><div align="right">total:&nbsp;&nbsp;&nbsp;</div></td>
          <td><div align="right"><?php echo number_format($b9, 2, '.', ',')?></div></td>
        </tr> 
  </tfoot>
</table>
 


 
          </div>
        </li>
</ul>
 
  </div>


 

