<!--Notice: (c)2015 This page is part of the management program for Radstone Quality Roof Tiles, 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-->

<title>Radstone Quality Roof Tiles</title>
<link rel="shortcut icon" type="image/x-icon" href="../favicon.ico">


<!--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" />
<link rel="stylesheet" type="text/css" href="../css/tooltip.css" />

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


<?php 
include ("../include/session.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);

date_default_timezone_set('Africa/Gaborone');
$entry_date = date("Y-m-d H:i:s", time()); 

$table_name = "active_users";
$update_query = "UPDATE $table_name SET last_active = '".$entry_date."' WHERE username = '".$_SESSION['username']."' ";
execsql($update_query);

$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","hr")>0) {$current_page = "hr";}
if ( strpos("$path_current","production")>0) {$current_page = "production";}
if ( strpos("$path_current","orders")>0) {$current_page = "orders";}
if ( strpos("$path_current","store")>0) {$current_page = "store";}
if ( strpos("$path_current","quality")>0) {$current_page = "quality";}
if ( strpos("$path_current","admin")>0) {$current_page = "admin";};


$table_name = $_SESSION['db_prefix']."_alerts_hr";
$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);
if ($hr_alert_num>5) { $hr_alert_num=6; }

$table_name = $_SESSION['db_prefix']."_alerts_production";
$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']."_alerts_store";
$stores_alert_query = "SELECT message_id FROM $table_name WHERE department = 'store' 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']."_alerts_quality";
$quality_alert_query = "SELECT message_id FROM $table_name WHERE department = 'quality' AND user_name = '".$_SESSION['username']."' AND `read_done` IS NULL AND `no_view` IS NULL";
$quality_alert_result = mySQL_query($quality_alert_query);
$quality_alert_num = mysql_num_rows($quality_alert_result);
if ($quality_alert_num>5) { $quality_alert_num=6; }

$admin_alert_num=0;
?>


<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">&nbsp;<img src="../images/radstone_medium_logo.png" width="116" height="33" /></td>
      <td height="37" valign="top"><div align="center" class="label_header_title">Radstone Quality Roof Tiles</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="><div class="<?php if ($current_page =='hr') {echo 'header_button_active'; } else { echo 'header_button'; }?>">
      <div align="center">
      <table width="60" 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="60" 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&subCatSelect=Tiles"><div class="<?php if ($current_page =='store') {echo 'header_button_active'; } else { echo 'header_button'; }?>">
      <div align="center">
      <table width="60" 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 } ?> >Store</td>
        </tr>
        </table>
        </div>
        </div>
       </a>
      
      <a href="../quality/quality_main.php"><div class="<?php if ($current_page =='quality') {echo 'header_button_active'; } else { echo 'header_button'; }?>">
      <div align="center">
      <table width="110" border="0" >
        <tr>
        <td height="20" align="center" valign="bottom" <?php if ($quality_alert_num>0) {?> style="background-image:url(../images/alert_circle_<?php echo $quality_alert_num ?>.png); background-repeat:no-repeat;" <?php } ?> >Quality control</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="60" 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>
