<!--Notice: (c)2013 This page is part of the management program for Tlhomeso Timbers, Gaborone, 
and developed by Customized Software (Pty) Ltd, Gaborone, Botswana. 
Customized Software holds the copyright on the source code on this and all other pages in the 
management program. For more info contact Customized Software on email: info@bwcustomized.com-->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Tlhomeso Timbers</title>
<link rel="shortcut icon" type="image/x-icon" href="../images/favicon.ico">
<meta name="expires" content="tue, 05 Nov 2013">

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

<link type="text/css" rel="stylesheet" media="all" 	href="../css/chat.css" />

<!--jscript-->
<script type="text/javascript" src="../jscript/jquery.1.4.2.js"></script>
<script type="text/javascript" src="../jscript/chat.js"></script>



<?php 
include ("../include/session.php");
//include ("../include/active.php");
//include ("../include/formValidations.php");

$today = date('Y-m-d');

$table_name = "active_users";
$active_users_query = "SELECT username FROM $table_name";
$active_users_result = execsql($active_users_query);
$active_users_num = mysql_num_rows($active_users_result);

$login_query = "SELECT username, password, access_id, tlh_gab, tlh_ftw, rad_gab, rad_nam, rad_rmc, vertex, pecus, `admin` FROM system_users WHERE username = '".$_SESSION['username']."' ";
$login_result = mySQL_query($login_query);
$login_num = mysql_num_rows($login_result);
$username = mysql_result($login_result, 0, "username");
$access_id = mysql_result($login_result, 0, "access_id");
$tlh_gab = mysql_result($login_result, 0, "tlh_gab");
$tlh_ftw = mysql_result($login_result, 0, "tlh_ftw");
$rad_gab = mysql_result($login_result, 0, "rad_gab");
$rad_nam = mysql_result($login_result, 0, "rad_nam");
$rad_rmc = mysql_result($login_result, 0, "rad_rmc");
$vertex = mysql_result($login_result, 0, "vertex");
$pecus = mysql_result($login_result, 0, "pecus");
$admin = mysql_result($login_result, 0, "admin");

function curPageName() {
 return substr($_SERVER["SCRIPT_NAME"],strrpos($_SERVER["SCRIPT_NAME"],"/")+1);
}

$path_current = getcwd();
if ( strpos("$path_current","production")>0) {$current_page = "production";}
if ( strpos("$path_current","store")>0) {$current_page = "store";}
if ( strpos("$path_current","sales")>0) {$current_page = "sales";}
if ( strpos("$path_current","hr_module")>0) {$current_page = "hr";}
if ( strpos("$path_current","admin")>0) {$current_page = "admin";};


$table_name = $_SESSION['db_prefix']."_alert_message";
$hr_alert_query = "SELECT message_id FROM $table_name WHERE department = 'hr' AND user_name = '".$_SESSION['username']."' AND read_done IS NULL AND no_view IS NULL";
$hr_alert_result = mySQL_query($hr_alert_query);
$hr_alert_num = mysql_num_rows($hr_alert_result);

$table_name = $_SESSION['db_prefix']."_alert_message";
$sales_alert_query = "SELECT message_id FROM $table_name WHERE department = 'sales' AND user_name = '".$_SESSION['username']."' AND read_done IS NULL AND no_view IS NULL";
$sales_alert_result = mySQL_query($sales_alert_query);
$sales_alert_num = mysql_num_rows($sales_alert_result);
if ($sales_alert_num>5) { $sales_alert_num=6; }

$table_name = $_SESSION['db_prefix']."_alert_message";
$stores_alert_query = "SELECT message_id FROM $table_name WHERE department = 'stores' AND user_name = '".$_SESSION['username']."' AND read_done IS NULL AND no_view IS NULL";
$stores_alert_result = mySQL_query($stores_alert_query);
$stores_alert_num = mysql_num_rows($stores_alert_result);
if ($stores_alert_num>5) { $stores_alert_num=6; }

$table_name = $_SESSION['db_prefix']."_alert_message";
$production_alert_query = "SELECT message_id FROM $table_name WHERE department = 'production' AND user_name = '".$_SESSION['username']."' AND read_done IS NULL AND no_view IS NULL";
$production_alert_result = mySQL_query($production_alert_query);
$production_alert_num = mysql_num_rows($production_alert_result);
if ($production_alert_num>5) { $production_alert_num=6; }

$table_name = $_SESSION['db_prefix']."_alert_message";
$admin_alert_query = "SELECT message_id FROM $table_name WHERE department = 'admin' AND user_name = '".$_SESSION['username']."' AND read_done IS NULL AND no_view IS NULL";
$admin_alert_result = mySQL_query($admin_alert_query);
$admin_alert_num = mysql_num_rows($admin_alert_result);

?>


<div class="header_frame">
  <table width="967" height="81" cellpadding="0" cellspacing="0" id="navigation_main_table" >
    <tr>
      <td width="110" rowspan="2" align="left" valign="middle"><img src="../images/logo_tlhomeso(2).png" width="111" height="54" /></td>
      <td height="37" valign="top"><div align="center" class="label_header_title">Tlhomeso Timbers Francistown</div></td>
      <td width="133" rowspan="2" align="center" valign="middle"><img src="../images/logo_tocotex.png" width="110" height="60" /></td>
    </tr>
    <tr valign="top">
      <td width="722" height="38" align="left" valign="top">
      <div class="header_button_holder_frame">
      
      <a href="../hr_module/hr_main.php?date=0"><div class="<?php if ($current_page =='hr') {echo 'header_button_active'; } else { echo 'header_button'; }?>">
      <div align="center">
      <table width="85" border="0" >
        <tr>
        <td height="20" align="center" valign="bottom" <?php if ($hr_alert_num>0) {?> style="background-image:url(../images/alert_circle_<?php echo $hr_alert_num ?>.png); background-repeat:no-repeat;" <?php } ?>>HR</td>
        </tr>
        </table>
        </div>
        </div>
       </a>
       
      <a href="../production/production_main.php"><div class="<?php if ($current_page =='production') {echo 'header_button_active'; } else { echo 'header_button'; }?>">
      <div align="center">
      <table width="85" border="0" >
        <tr>
        <td height="20" align="center" valign="bottom" <?php if ($production_alert_num>0) {?> style="background-image:url(../images/alert_circle_<?php echo $production_alert_num ?>.png); background-repeat:no-repeat;" <?php } ?>>Production</td>
        </tr>
        </table>
        </div>
        </div>
       </a> 
       
     <a href="../store/store_main.php?date=0"><div class="<?php if ($current_page =='store') {echo 'header_button_active'; } else { echo 'header_button'; }?>">
      <div align="center">
      <table width="85" border="0" >
        <tr>
        <td height="20" align="center" valign="bottom" <?php if ($stores_alert_num>0) {?> style="background-image:url(../images/alert_circle_<?php echo $stores_alert_num ?>.png); background-repeat:no-repeat;" <?php } ?>>Stores</td>
        </tr>
        </table>
        </div>
        </div>
       </a>
      
      <a href="../sales/sales_main.php?date=0"><div class="<?php if ($current_page =='sales') {echo 'header_button_active'; } else { echo 'header_button'; }?>">
      <div align="center">
      <table width="85" border="0" >
        <tr>
        <td height="20" align="center" valign="bottom" <?php if ($sales_alert_num>0) {?> style="background-image:url(../images/alert_circle_<?php echo $sales_alert_num ?>.png); background-repeat:no-repeat;" <?php } ?>>Sales</td>
        </tr>
        </table>
        </div>
        </div>
       </a>
     
      
      <a href="../admin_module/user_list.php?date="><div class="<?php if ($current_page =='admin') {echo 'header_button_active'; } else { echo 'header_button'; }?>">
      <div align="center">
      <table width="85" border="0" >
        <tr>
        <td height="20" align="center" valign="bottom" <?php if ($admin_alert_num>0) {?> style="background-image:url(../images/alert_circle_<?php echo $admin_alert_num ?>.png); background-repeat:no-repeat;" <?php } ?>>Admin</td>
        </tr>
        </table>
        </div>
        </div>
       </a>
<div style="height:30px; " >
<hr style="margin-top:45px; color:#FFE9BB; border-color:#FFE9BB; " / >
</div>     
      </div>
      </td>
    </tr>
  </table>
</div>
