<?php
$table_name = $_SESSION['db_prefix']."_presets";
$time_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'clockin1'  ";
$time_result = $con->query($time_query);
$row = mysqli_fetch_assoc($time_result);
$hours1 = $row['preset_value'];

$clockin_hours1 =  floor($hours1/60); 
$clockin_mins1 =   $hours1 % 60; 
if ($clockin_hours1<10) { $clockin_hours1 = 0 . $clockin_hours1; }
if ($clockin_mins1<10) { $clockin_mins1 = 0 . $clockin_mins1; }

$table_name = $_SESSION['db_prefix']."_presets";
$time_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'clockout1'  ";
$time_result = $con->query($time_query);
$row = mysqli_fetch_assoc($time_result);
$hours1 = $row['preset_value'];


$clockout_hours1 =  floor($hours1/60); 
$clockout_mins1 =   $hours1 % 60; 
if ($clockout_hours1<10) { $clockout_hours1 = 0 . $clockout_hours1; }
if ($clockout_mins1<10) { $clockout_mins1 = 0 . $clockout_mins1; }

$table_name = $_SESSION['db_prefix']."_presets";
$time_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'clockin2'  ";
$time_result = $con->query($time_query);
$row = mysqli_fetch_assoc($time_result);
$hours2 = $row['preset_value'];


$clockin_hours2 =  floor($hours2/60); 
$clockin_mins2 =   $hours2 % 60; 
if ($clockin_hours2<10) { $clockin_hours2 = 0 . $clockin_hours2; }
if ($clockin_mins2<10) { $clockin_mins2 = 0 . $clockin_mins2; }

$table_name = $_SESSION['db_prefix']."_presets";
$time_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'clockout2'  ";
$time_result = $con->query($time_query);
$row = mysqli_fetch_assoc($time_result);
$hours2 = $row['preset_value'];


$clockout_hours2 =  floor($hours2/60); 
$clockout_mins2 =   $hours2 % 60; 
if ($clockout_hours2<10) { $clockout_hours2 = 0 . $clockout_hours2; }
if ($clockout_mins2<10) { $clockout_mins2 = 0 . $clockout_mins2; }

if ($_SESSION['time_zone']==1) { $time_period =  $clockin_hours1.':'.$clockin_mins1.' hr to '.$clockout_hours1.':'.$clockout_mins1.' hr'; }
if ($_SESSION['time_zone']==2) { $time_period =  $clockin_hours2.':'.$clockin_mins2.' hr to '.$clockout_hours2.':'.$clockout_mins2.' hr'; }
if ($_SESSION['time_zone']==3) { $time_period =  ' Not defined'; }
?>

</head>
<?php include('../include/wait.php') ?>
<body onLoad="MM_showHideLayers('wait','','hide')" onFocus="MM_showHideLayers('wait','','hide');">

<div class="page_middle_frame">
<form id="feedbackform" method="POST" action="employeeWiz6.php" >

  <div class="wizard_frame">
      Personal details
        <table width="650" id="table_details_display">
          <tr>
            <td>No:</td>
            <td><?php echo $_SESSION['emp_no'] ?></td>
            <td><?php echo $_SESSION['group'] ?></td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td width="123"><span class="wizard">Employee name:</span></td>
            <td width="205"><strong><span class="wizard"><?php echo $_SESSION['last_name'] ?></span></strong></td>
            <td width="109">First name:</td>
            <td width="213"><?php echo $_SESSION['first_name'] ?></td>
          </tr>
          <tr>
            <td><span class="wizard">Date of birth:</span></td>
            <td><?php echo date("d-m-Y", strtotime($_SESSION['birth_date'])) ?></td>
            <td><span class="wizard">id number:</span></td>
            <td><?php echo $_SESSION['id_number'] ?></td>
          </tr>
          </table>
      </div>
        <br />
        <br />
        <div class="wizard_frame">
        Employment details<br />
          <table width="650" id="table_details_display">
            <tr>
              <td>Employment date:</td>
              <td><?php echo date("d-m-Y", strtotime($_SESSION['employ_date'] )) ?></td>
              <td>&nbsp;</td>
              <td>Employee no.:</td>
              <td><?php echo $_SESSION['emp_no'] ?></td>
            </tr>
            <tr>
              <td>Contract exp date:</td>
              <td><?php if ($_SESSION['expiry_date']<'2030-01-01') { echo date("d-m-Y", strtotime($_SESSION['expiry_date'] ));} ?></td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td width="121">Rate / salary:</td>
              <td width="101"><?php echo $_SESSION['rate'] ?></td>
              <td width="93">per
              <?php $p=$_SESSION['pay_unit']; echo $p ?></td>
              <td width="101">Salary scale:</td>
              <td width="210"><?php echo $_SESSION['scale'] ?></td>
            </tr>
            <tr>
              <td>Leave days:</td>
              <td colspan="2"><?php echo $_SESSION['leave_days'] ?>&nbsp;&nbsp;days per month</td>
              <td>Pay period:</td>
              <td><?php echo $_SESSION['pay_period'] ?></td>
            </tr>
            <tr>
              <td>Time keeping:</td>
              <td colspan="2"><?php echo $_SESSION['time_keeping'] ?></td>
              <td>Time zone: </td>
              <td><?php echo $_SESSION['time_zone'].'&nbsp;&nbsp;('.$time_period.')' ?> </td>
            </tr>
            <tr>
              <td>Department:</td>
              <td colspan="2"><?php echo $_SESSION['department'] ?></td>
              <td>Position:</td>
              <td><?php echo $_SESSION['position'] ?></td>
            </tr>
            <tr>
              <td>Expatriate:</td>
              <td colspan="2"><?php echo $_SESSION['exp'] ?></td>
              <td>Nationality:</td>
              <td><?php echo $_SESSION['nationality'] ?></td>
            </tr>
            <tr>
              <td>Permit no:</td>
              <td colspan="2"><?php echo $_SESSION['permit'] ?></td>
              <td>Expiry date:</td>
              <td><?php echo date("d-m-Y", strtotime($_SESSION['permit_date'] )) ?></td>
            </tr>
            <tr>
              <td>CV:</td>
              <td colspan="2"><?php echo $_SESSION['cv'] ?></td>
              <td>References:</td>
              <td><?php echo $_SESSION['file_reference'] ?></td>
            </tr>
          </table>
        </div>
        <br />
        <br />
        <div class="wizard_frame">
        Address details<br />
          <table width="650" id="table_details_display">
            <tr>
              <td width="128">Postal address:</td>
              <td width="200"><?php echo $_SESSION['bag_box']." ".$_SESSION['box_no'] ?></td>
              <td width="111">Place:</td>
              <td width="211"><?php echo $_SESSION['post_place'] ?></td>
            </tr>
            <tr>
              <td>Physical address:</td>
              <td><?php echo $_SESSION['phys_address'] ?></td>
              <td>Place:</td>
              <td><?php echo $_SESSION['phys_place'] ?></td>
            </tr>
          </table>
        </div>
        <br />
        <br />
        <div class="wizard_frame">
        Contact details<br />
          <table width="650" id="table_details_display">
            <tr>
              <td width="127">Phone:</td>
              <td width="202"><?php echo $_SESSION['phone'] ?></td>
              <td width="106">Country:</td>
              <td width="215"><?php echo $_SESSION['country'] ?></td>
            </tr>
            <tr>
              <td>e-mail:</td>
              <td><?php echo $_SESSION['email'] ?></td>
              <td>Cell:</td>
              <td><?php echo $_SESSION['cell'] ?></td>
            </tr>
            <tr>
              <td>emergency contact:</td>
              <td><?php echo $_SESSION['emergency_name'] ?></td>
              <td>emergency tel:</td>
              <td><?php echo $_SESSION['emergency_phone'] ?></td>
            </tr>
          </table>
        </div>
        <div class="wizard_frame">
        Miscelaneous<br />
          <table width="650" id="table_details_display">
            <tr>
              <td width="127">clothing size:</td>
              <td width="204"><?php echo $_SESSION['clothing_size'] ?></td>
              <td width="107">shoe size:</td>
              <td width="212"><?php echo $_SESSION['shoe_size'] ?></td>
            </tr>
            <tr>
              <td>bank:</td>
              <td><?php echo $_SESSION['bank'] ?></td>
              <td>branch:</td>
              <td><?php echo $_SESSION['branch'] ?></td>
            </tr>
            <tr>
              <td>Account number:</td>
              <td><?php echo $_SESSION['bank_account'] ?></td>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td>Notes:</td>
              <td colspan="3"><?php echo $_SESSION['notes'] ?></td>
            </tr>
          </table>
        </div>
        <br />
        

        <div class="wizard_frame">
          <label class="label_std">If you want to make changes use the 'Prev' button to go back. <br />
            Click 'New' to make a new entry or to finish the wizard click 'Finish'.</label>
        </div>
        <div class="wizard_frame">
        <table width="675" height="50" align="center" id="table_button_bar">
        <tr>
          <td width="117"><input type="button" name="lastprev_button" class="imagebutton" value="Prev" onClick="needToConfirm = false;MM_goToURL('parent','employeeWizbase.php?s=6&amp;p=4');return document.MM_returnValue" /></td>
          <td width="115"><input name="s" type="hidden" id="s" value="5" />
            <input name="p" type="hidden" id="p" value="5" /></td>
          <td width="99"><input name="cancelbutton" type="button" class="imagebutton" id="cancelbutton" onClick="needToConfirm = false; cancel_confirmation(1, '../hr_module/hr_main.php?date=0');" value="Cancel" /></td>
          <td width="125" align="right"><input type="submit" name="new_button" class="imagebutton" id="new_button" value="New" onClick="needToConfirm = false; MM_showHideLayers('wait','','show');" /></td>
          <td width="110" align="right"><input  name="finish_button" type="submit" class="imagebutton" id="finish_button" value="Finish" onClick="needToConfirm = false; MM_showHideLayers('wait','','show');"  /></td>
        </tr>
      </table>
  </div>
</form>
</div>
