<!--jscript-->
<script language="JavaScript" src="../jscript/alert_message.js"  type="text/javascript"></script>
<script language="JavaScript" src="../jscript/show_hide_layers.js"  type="text/javascript"></script>  
<script language="JavaScript" src="../jscript/go_to_url.js"  type="text/javascript"></script> 
<script language="JavaScript" src="../jscript/alert_message.js"  type="text/javascript"></script>
<link rel="stylesheet" href="../window/dhtmlwindow.css" type="text/css" />
<link rel="stylesheet" href="../window/modal.css" type="text/css" />
<script language="JavaScript" src="../jscript/numbers_only.js"  type="text/javascript"></script>  
<script type="text/javascript" src="../window/dhtmlwindow.js"></script>
<script type="text/javascript" src="../window/modal.js"></script>

<script type="text/javascript">
function MM_changeProp(objId,x,theProp,theValue) { //v9.0
  var obj = null; with (document){ if (getElementById)
  obj = getElementById(objId); }
  if (obj){
    if (theValue == true || theValue == false)
      eval("obj.style."+theProp+"="+theValue);
    else eval("obj.style."+theProp+"='"+theValue+"'");
  }
}
</script>
<?php
$error=$_GET['error'];
?>
</head>
<?php include('../include/wait.php') ?>
<body onLoad="MM_showHideLayers('wait','','hide', 'upload','','hide', <?php if ($_SESSION['page_stage']=='0') { ?>'select','','show'<?php } else { ?>'select','','hide'<?php } ?> , <?php if ($_SESSION['page_stage']=='3') { ?>'import','','show'<?php } else { ?>'import','','hide'<?php } ?>); <?php if ($error==1) { ?> alertMessage(1, '', 'The file you try to import contains dates which are already in the time sheet.<br><br>You cannot import a time record file twice.')<?php } ?>;" onFocus="MM_showHideLayers('wait','','hide');" > 
<?php 
$page_name = "HR-time recording";
include ("../navigation/access.php");

if ($permission_num==1) {
	 
?>

<div class="wizard_page_middle_frame" onMouseMove="document.getElementById('upload_file_text').focus();" >
<form enctype="multipart/form-data" action="../include/time_uploader.php" method="POST" name="form1" onMouseMove="document.getElementById('upload_file_text').focus();">
    
    <div class="wizard_frame" >
    <div class="lay_out_frame_small" style="height:30px; width:70px; border:solid; border-width:1px; border-color:#209949;"><font color="#209949"; size=5;><b>1</b></font>&nbsp;&nbsp;&nbsp;Select</div>
    <div class="lay_out_frame_small" style="height:30px; width:475px;" id='select' onfocus="MM_showHideLayers('select','','hide')">
        <input type="hidden" name="MAX_FILE_SIZE" value="100000" />
        <label class="label_std">Select a file to upload:</label>
  &nbsp;&nbsp;&nbsp;
  <input name="uploadedfile" id="uploadedfile" type="file" class="imagebutton"  onChange="MM_showHideLayers('upload','','show');MM_showHideLayers('select','','hide'); "  onBlur="document.getElementById('upload_file_text').value = document.getElementById('uploadedfile').value; "  />
  </div> 
  <div class="spacer_frame" style="height:10px;"></div>    
  <div class="lay_out_frame_small" style="height:30px; width:70px; border:solid; border-width:1px; border-color:#209949;" ><font color="#209949"; size=5;><b>2</b></font>&nbsp;&nbsp;&nbsp;Upload</div>
  <div class="lay_out_frame_small" style="height:30px; width:475px;" id='upload' on >
  <label class="label_std">Selected file:</label>&nbsp;
  <label for="upload_file_text"></label>
  <input type="text" name="upload_file_text" id="upload_file_text"  style="border:hidden; background-color:inherit; font-weight:bold; color:#209949;">
  &nbsp;&nbsp;<input name="upload_button" type="submit" value="Upload file" onClick="needToConfirm = false; MM_showHideLayers('import','','show');MM_showHideLayers('upload','','hide')" class="imagebutton" >
     <input name="import_button" type="button" onClick="needToConfirm = false; <?php $_SESSION['page_stage']='0';?> MM_goToURL('parent','recordTimesWizbase.php?p=1&s=&error=0');return document.MM_returnValue" value="Start again" class="imagebutton">
     <input type="hidden" name="alert_message" id="alert_message" value="">
     <input type="hidden" name="error" id="error" value="0">
  </div>
<div class="spacer_frame" style="height:10px;"></div>           
  <div class="lay_out_frame_small" style="height:30px; width:70px; border:solid; border-width:1px; border-color:#209949;"><font color="#209949"; size=5;><b>3</b></font>&nbsp;&nbsp;&nbsp;Import</div>
    <div class="lay_out_frame_small" style="height:100px; width:475px;" id='import'>
    
    <?php if ($_SESSION['error'] == '0') { ?>
    <?php // if ($_SESSION['job_no']==$_SESSION['file_job_no'])
	if (1==1) { ?>
    
    <div class="lay_out_frame_small" style="width:20px; height:30px; border:hidden;"><img src="../images/check_mark_green.png" width="32" height="32"></div>
    <div class="lay_out_frame_small" style="width:360px; border:hidden;"><label class="label_std">The file "<?php echo $_SESSION['file_name'] ?>"  <?php // echo 'J'.$_SESSION['file_job_no']?> was uploaded successfully. Click the Import button to import the contents of this file.</label></div>
    <?php } else { ?>
    <div class="lay_out_frame_small" style="width:20px; height:30px; border:hidden;"><img src="../images/exclamation_mark_green_small.png" width="20" height="32"></div>
    <div class="lay_out_frame_small" style="width:360px; border:hidden;"><label class="label_std">The file "<?php echo $_SESSION['file_name'] ?>" was uploaded successfully but is not for <?php echo 'J'.$_SESSION['job_no']?> in this wizard. If you want to use this file to import, click Import. To select a new file, click Start again.</label></div>
    <?php } ?>
    <br>
<br><div align="center">
    <input name="import_button" type="button" onClick="needToConfirm = false; MM_showHideLayers('wait','','show'); MM_goToURL('parent','time_upload.php');return document.MM_returnValue; " value="Import time record" class="imagebutton">
    <input name="import_button" type="button" onClick="needToConfirm = false; <?php $_SESSION['page_stage']='0';?> MM_goToURL('parent','recordTimesWizbase.php?p=1&s=&error=0');return document.MM_returnValue" value="Start again" class="imagebutton"></div>
    <?php } ?>
    <?php if ($_SESSION['error'] == '2') { ?>
    <div class="lay_out_frame_small" style="width:20px; height:30px; border:hidden;"><img src="../images/exclamation_mark_green_small.png" width="20" height="32"></div>
     <div class="lay_out_frame_small" style="width:360px; border:hidden;"><label class="label_std">The file "<?php echo $_SESSION['file_name'] ?>" was already uploaded. </label>
       A file for a date can only imported once. If this file was uploaded before but not imported, you can continue, else click 'Start again' to select a new file.</div>
    <br>
<br>
   <div align="center"> <input name="import_button" type="button" onClick="needToConfirm = false; MM_showHideLayers('wait','','show'); MM_goToURL('parent','time_upload.php'); return document.MM_returnValue; " value="Import time record" class="imagebutton">
    <input name="import_button" type="button" onClick="needToConfirm = false; <?php $_SESSION['page_stage']='0';?> MM_goToURL('parent','recordTimesWizbase.php?p=1&s=&error=0');return document.MM_returnValue" value="Start again" class="imagebutton"></div>
    <?php } ?>
    <?php if ($_SESSION['error'] == '3') { ?>
    <div class="lay_out_frame_small" style="width:20px; height:30px; border:hidden;"><img src="../images/error_32.png" width="24" height="24"></div>
     <div class="lay_out_frame_small" style="width:360px; border:hidden;"><label class="label_std">The file "<?php echo $_SESSION['file_name'] ?>" is not a valid file, only ".csv" can be used. If you want to upload another file, click Start again.</label></div>
    <br>
<br>
   <div align="center"><input name="import_button" type="button" onClick="needToConfirm = false; <?php $_SESSION['page_stage']='0';?> MM_goToURL('parent','recordTimesWizbase.php?p=1&s=&error=0');return document.MM_returnValue" value="Start again" class="imagebutton"></div>
    <?php } ?>
    </div>
    </div>
<div class="wizard_frame"> 
<table width="675" height="50" align="left" id="table_button_bar">
          <tr>
            <td width="117">&nbsp;</td>
            <td width="115">&nbsp;</td>
            <td width="99">
              <input name="p" type="hidden" id="p" value="1" />
              <input name="error" type="hidden" id="error" value="0" />
              <input name="s" type="hidden" id="s" value="1" />
              <input name="r" type="hidden" id="r" value="" />
            </td>
            <td width="125"><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="110" align="right"></td>
          </tr>
      </table>
</form>

</div>   


<!--form validation-->
<script language="JavaScript" type="text/javascript" xml:space="preserve">
  var frmvalidator  = new Validator("form1");
  frmvalidator.EnableMsgsTogether();
  frmvalidator.addValidation("uploadedfile","req","Please select a file to upload.");
  </script>
<?php } else { 
    $_SESSION['denied_return'] = "hr_module/hr_main.php?date=";	?>
	<body onLoad="accessdenied(); return false">
</body>
<?php }
?>