<!--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
$sub_cat = $_GET['subCatSelect'];

if ($sub_cat=='Tiles') {

$table_name = $_SESSION['db_prefix']."_stockloss";
$tiles_gab_date_query = "SELECT date FROM $table_name WHERE sub_category = 'Tiles' AND branch = 'Gaborone'  ORDER BY date DESC LIMIT 1 ";
$tiles_gab_date_result = mySQL_query($tiles_gab_date_query);
$tiles_gab_date_num = mysql_num_rows($tiles_gab_date_result);
if ($tiles_gab_date_num!=0) {
$gab_last_stock_date = mysql_result($tiles_gab_date_result, 0, "date");
}
else {
$gab_last_stock_date = date("Y-m-d");
}

$table_name = $_SESSION['db_prefix']."_stockloss";
$tiles_ftw_date_query = "SELECT date FROM $table_name WHERE sub_category = 'Tiles' AND branch = 'Francistown'  ORDER BY date DESC LIMIT 1 ";
$tiles_ftw_date_result = mySQL_query($tiles_ftw_date_query);
$tiles_ftw_date_num = mysql_num_rows($tiles_ftw_date_result);
if ($tiles_ftw_date_num!=0) {
$ftw_last_stock_date = mysql_result($tiles_ftw_date_result, 0, "date");
}
else {
$ftw_last_stock_date = date("Y-m-d");
}
}

if ($sub_cat=='Accessories') {

$table_name = $_SESSION['db_prefix']."_stockloss";
$tiles_gab_date_query = "SELECT date FROM $table_name WHERE sub_category = 'Accessories' AND branch = 'Gaborone'  ORDER BY date DESC LIMIT 1 ";
$tiles_gab_date_result = mySQL_query($tiles_gab_date_query);
$tiles_gab_date_num = mysql_num_rows($tiles_gab_date_result);
if ($tiles_gab_date_num!=0) {
$gab_last_stock_date = mysql_result($tiles_gab_date_result, 0, "date");
}
else {
$gab_last_stock_date = date("Y-m-d");
}

$table_name = $_SESSION['db_prefix']."_stockloss";
$tiles_ftw_date_query = "SELECT date FROM $table_name WHERE sub_category = 'Accessories' AND branch = 'Francistown'  ORDER BY date DESC LIMIT 1 ";
$tiles_ftw_date_result = mySQL_query($tiles_ftw_date_query);
$tiles_ftw_date_num = mysql_num_rows($tiles_ftw_date_result);
if ($tiles_ftw_date_num!=0) {
$ftw_last_stock_date = mysql_result($tiles_ftw_date_result, 0, "date");
}
else {
$ftw_last_stock_date = date("Y-m-d");
}
}

if (($sub_cat!='Tiles') || ($sub_cat!='Accessories') ){

$table_name = $_SESSION['db_prefix']."_stockloss";
$tiles_gab_date_query = "SELECT date FROM $table_name WHERE sub_category = '".$sub_cat."' AND branch = 'Gaborone'  ORDER BY date DESC LIMIT 1 ";
$tiles_gab_date_result = mySQL_query($tiles_gab_date_query);
$tiles_gab_date_num = mysql_num_rows($tiles_gab_date_result);
if ($tiles_gab_date_num!=0) {
$gab_last_stock_date = mysql_result($tiles_gab_date_result, 0, "date");
}
else {
$gab_last_stock_date = date("Y-m-d");
}

$table_name = $_SESSION['db_prefix']."_stockloss";
$tiles_ftw_date_query = "SELECT date FROM $table_name WHERE sub_category = '".$sub_cat."' AND branch = 'Francistown'  ORDER BY date DESC LIMIT 1 ";
$tiles_ftw_date_result = mySQL_query($tiles_ftw_date_query);
$tiles_ftw_date_num = mysql_num_rows($tiles_ftw_date_result);
if ($tiles_ftw_date_num!=0) {
$ftw_last_stock_date = mysql_result($tiles_ftw_date_result, 0, "date");
}
else {
$ftw_last_stock_date = date("Y-m-d");
}
}

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

<ul class="tabs" >
      <li>
          <input type="radio" name="tabs" id="tab1">
          
          <label class="tab" for="tab1"><a class="tabs" href="stockLoss.php?branch=Gaborone&subCatSelect=<?php echo $sub_cat ?>&date=1&date1=<?php echo $gab_last_stock_date?>&date2=<?php echo $gab_last_stock_date?>&ftw_last_stock_date=<?php echo $ftw_last_stock_date ?>">Gaborone</a></label>
          
<div id="tab-content1" class="tab-content animated fadeIn" style="height:660px;">

</div>

        </li>
        <li>
          <input type="radio" name="tabs" id="tab2">
          <label  class="tab" for="tab2"><a class="tabs" href="stockLoss.php?branch=Francistown&subCatSelect=<?php echo $sub_cat ?>&date=1&date1=<?php echo $ftw_last_stock_date?>&date2=<?php echo $ftw_last_stock_date?>&gab_last_stock_date=<?php echo $gab_last_stock_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="stockLoss.php?branch=Combined&date=&subCatSelect=<?php echo $sub_cat ?>">Combined</a></label>
          <div id="tab-content3" class="tab-content animated fadeIn">
<br /><br />

<label class="label_std">
<img src="../images/info_green.png" width="32" height="32" />&nbsp;&nbsp;Combined stock reports are not available. </label>


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

</div>
<br />
</div>




