
<!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" />


<?php
include ("../navigation/header.php");
include ("../navigation/hr_sidebar.php");
include ("../include/formValidations.php");
?>



<?php 
	
	$s = $_GET['s'];
	$p = $_GET['p'];
	$error = $_SESSION['error'];
	$_SESSION['p']=$p;
	$_SESSION['s']=$s;
	
	
	if (isset($_GET['prev_button']) )
	   {
		 $_SESSION['p']= $_SESSION['p']-1;
	   }
		 
	if (isset($_GET['next_button']) )
	  {
		$_SESSION['p']=$_SESSION['p']+1;
	  }
	
		
	
	if ($s==1) {
		    
			 
			 if ($_SESSION['new']==0) {
				 
			
		 	 $table_name1 = $_SESSION['db_prefix']."_employee";
			 $table_name2 = $_SESSION['db_prefix']."_time_record";
			 
			 $check_query = "SELECT time_id  FROM $table_name2  WHERE  date = '".$_SESSION['record_date']."' ";
			 $check_result = mySQL_query($check_query);
		     $check_num = mysql_num_rows($check_result);
			 
			 if ($check_num==0) {			 
			 
			 $i = 0;
			 $emp_nummer = 1000;
			 while ($i < 200) {
			 $select_query = "SELECT emp_id, time_keeping FROM $table_name1 WHERE emp_id = '".$emp_nummer."' AND time_keeping = 'yes' ";
			 
			 $select_result = mySQL_query($select_query);
             $select_num = mysql_num_rows($select_result);
			 			 
			 if ($select_num == 1) {
			   $emp_id =  mysql_result($select_result, 0, "emp_id");
			   $time_keeping =  mysql_result($select_result, 0, "time_keeping");
			   			   
			   $prepare_query = "INSERT INTO $table_name2 (date, emp_id, status, checked, type) VALUES ('".$_SESSION['record_date']."', '".$emp_id."', 'N', '0', 'N')";
			   execsql($prepare_query);
			 }
			 $emp_nummer++;
			 $i++;
			 }
			 }
			 }
		 
	}
		
	
	
	?>
<!--style sheets-->
<link href="../css/main.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="../css/wizard.css" />
<link rel="stylesheet" href="../window/dhtmlwindow.css" type="text/css" />
<link rel="stylesheet" href="../window/modal.css" type="text/css" />

<!--jscript-->
<script type="text/javascript" src="../window/dhtmlwindow.js"></script>
<script type="text/javascript" src="../window/modal.js"></script>
<script type="text/javascript" src="../jscript/jquery.1.4.2.js"></script>
<script language="JavaScript" src="../jscript/cancel_confirmation.js"  type="text/javascript"></script>
<script language="JavaScript" src="../jscript/confirm_exit.js"  type="text/javascript"></script>    
<script language="JavaScript" src="../jscript/show_hide_layers.js"  type="text/javascript"></script>
<script language="JavaScript" src="../jscript/gen_validatorv4.js"  type="text/javascript" xml:space="preserve"></script>      
</head>

<body>
<div class="main_frame">

<div class="page_head_frame">
  <label class="label_page_head">Time recording - clock in</label>
</div>
<div class="wizard_paging_frame">
        <table align="left">
      <tr>
      <td>
      <?php if ($_SESSION['p']==1) { ?>
      <div class="active_step_frame"><div class="active_step_head_label">&nbsp;1</div>
      <div class="active_step_label"><br /><br /><br />Prepare</div>
      <?php } else { ?>
      <div class="de_active_step_frame"><div class="de_active_step_head_label">&nbsp;1</div>
      <div class="de_active_step_label"><br /><br /><br />Prepare</div>
      <?php } ?>
      
      </td>
      <td>
      <?php if ($_SESSION['p']==2) { ?>
      <div class="active_step_frame"><div class="active_step_head_label">&nbsp;2</div>
      <div class="active_step_label"><br /><br /><br />List info</div>
      <?php } else { ?>
      <div class="de_active_step_frame"><div class="de_active_step_head_label">&nbsp;2</div>
      <div class="de_active_step_label"><br /><br /><br />List info</div>
      <?php } ?>
     </td>
      <td>
      <?php if ($_SESSION['p']==3) { ?>
      <div class="active_step_frame"><div class="active_step_head_label">&nbsp;3</div>
      <div class="active_step_label"><br /><br /><br />Recording</div>
      <?php } else { ?>
      <div class="de_active_step_frame"><div class="de_active_step_head_label">&nbsp;3</div>
      <div class="de_active_step_label"><br /><br /><br />Recording</div>
      <?php } ?>
      </td>
            
      </tr>
      </table>
      </div>
      </td>
      </tr>
      <tr>
      <td><?php 
	if ($_SESSION['p']==1) { include("timeWiz1.php"); }
	if ($_SESSION['p']==2) { include("timeWiz2.php"); }
	if ($_SESSION['p']==3) { include("timeWiz3.php"); }
	
    ?></td>
    </tr>
    </table>
    </div>
   


</body>
<?php include ('../navigation/side_bar.php'); ?>
