<?php
	//Start session
	session_start();
	
	//Check whether the session variable SESS_MEMBER_ID is present or not
	if(!isset($_SESSION['SESS_MEMBER_ID']) || (trim($_SESSION['SESS_MEMBER_ID']) == '')) {
		header("location: index.html");
		exit();
	}
?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<!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>
<title>Master Edit</title>
<meta name="description" content=""/>
<meta name="keywords" content=""/>
<meta http-equiv="Content-Type"
 content="text/html; charset=iso-8859-1"/>
<script type="text/javascript" src="../javascript/jquery.js"></script>
<script type="text/javascript" src="../javascript/jquery.autocomplete.js"></script>
<script type="text/javascript" src="../javascript/jquery.datepick.min.js"></script>

<link rel="stylesheet" href="../css/redmond.datepick.css">
<link rel="stylesheet" href="../css/jquery.autocomplete.css" type="text/css" >
</link>
<link rel="stylesheet" href="../css/style.css"  type="text/css">
</link>

<style type="text/css">
input[type=text],textarea{
	width:100%
}
</style>
<script type="text/javascript">
$(document).ready(function(){	
$("#close").click(function(){
						   
window.close();

  });
  
  $("#new").click(function(){
						   
window.location='masterempinfoedit.php';

  });
  
   $("#update").click(function(){
			$('#transperent').show();			   
$.post("master_empinfo_crud.php?mode=update",$('#form_vehextra').serialize(),function(result){
	
		 $('#message').html(result);
			$('#transperent').hide();		
	 });

  });
  
  $("#save").click(function(){
$('#transperent').show();						   
$.post("master_empinfo_crud.php?mode=insert",$('#form_vehextra').serialize(),function(result){
	var str=result.split('###');
	 $('#ID').val(str[1]);
		 $('#message').html(str[0]);
					
	 });$('#transperent').hide();

  });
});
</script>

</head>

<body>
<div id="transperent" >
</div>
<div class="main">

  <div class="page">
 <div>
      <?php 
	    
		
  include '../db_connect.php';
  
$id=$_GET['EntryID'];
if(($result = mysqli_query($con,"SELECT * FROM empinfo  where EntryID='$id'"))&&(!empty($id)))
{
$row = mysqli_fetch_array($result);
}

?>

<form  id="form_vehextra" action=""  method="" style="margin:auto" >

 <table  cellspacing="5" style="margin:auto;margin: auto;border: 1px solid;padding: 5px;border-radius: 5px;">
		  <tr>
		    <td align="center">Name</td>
		    <td colspan="3" align="center"><input type="text" name="EName" id="EName"  /></td>
	      </tr>
		  <tr>
		    <td align="right">Emp Code </td>
		    <td align="center"><input type="text" name="ECode" id="ECode" /></td>
		    <td align="right">Password</td>
		    <td align="center"><input type="password" name="password" id="password"/></td>
	      </tr>
			  <tr>
			    <td align="right">Address</td>
			    <td colspan="3" rowspan="2"><textarea name="EAddress" rows="3" id="EAddress" ></textarea></td>
		      </tr>
			  <tr align="right">
			    <td>&nbsp;</td>
	      </tr>
			  <tr>
			    <td align="right">Contact Number</td>
			    <td align="center"><input type="text" name="ContactNumber" id="ContactNumber" /></td>
			    <td align="right">Designation</td>
			    <td align="center"><input type="text" name="Designation" id="Designation" style="width:100%" class="nocaps"  /></td>
	      </tr>
			  <tr>
			    <td align="right">DOB</td>
			    <td align="center"><input type="text" name="EBdate" id="EBdate" /></td>
			    <td align="right">Age</td>
			    <td align="center"><input type="text" name="EAge" id="EAge" /></td>
	    </tr>
			  <tr>
			    <td align="right">Department</td>
			    <td align="center"><input type="text" name="Department" id="Department"  /></td>
			    <td align="right">EDEmployed</td>
			    <td><input type="text" name="EDEmployed" id="EDEmployed"/></td>
	    </tr>
			  <tr>
			    <td align="right">Status</td>
			    <td align="center"><input type="text" name="Status" id="Status" /></td>
			    <td align="right">Gender</td>
			    <td align="center"><input type="text" name="EGender" id="EGender"/></td>
	      </tr>
			  <tr>
			    <td align="right">Civil Status</td>
			    <td><input type="text" name="ECivilStatus" id="ECivilStatus" /></td>
			    <td align="right">Salary</td>
			    <td><input type="text" name="salary" id="salary"/></td>
	      </tr>
			  <tr>
			    <td align="right">Reporting Time</td>
			    <td align="center"><input type="text" name="reptime" id="reptime"/></td>
			    <td align="right">Close Time</td>
			    <td align="center"><input type="text" name="closetime" id="closetime" readonly/></td>
	      </tr>
			  <tr>
			    <td align="right">Basic Salary</td>
			    <td><input type="text" name="basicsalary" id="basicsalary" /></td>
			    <td align="right">Holidays</td>
			    <td><input type="text" name="holidays" id="holidays" /></td>
	      </tr>
			  <tr>
			    <td align="right">other1</td>
			    <td align="center"><input type="text" name="other1" id="other1" /></td>
			    <td align="right">other2</td>
			    <td align="center"><input type="text" name="other2" id="other2"/></td>
	      </tr>
			  <tr>
			    <td align="right">HRA</td>
			    <td><input type="text" name="HRA" id="HRA" /></td>
			    <td align="right">Conveyance</td>
			    <td><input type="text" name="Conveyance" id="Conveyance"/></td>
	      </tr>
			  <tr>
			    <td align="right">Medical</td>
			    <td align="center"><input type="text" name="Medical" id="Medical" /></td>
			    <td align="right">Bonus</td>
			    <td align="center"><input type="text" name="Bonus" id="Bonus"/></td>
	      </tr>
			  <tr>
			    <td align="right">OT. Allowance</td>
			    <td><input type="text" name="otallowance" id="otallowance"/></td>
			    <td align="right">DA Allowance</td>
			    <td><input type="text" name="daallowance" id="daallowance" /></td>
	      </tr>
			  <tr>
			    <td align="right">CPF</td>
			    <td align="center"><input type="text" name="cpf" id="cpf"/></td>
			    <td align="right">CLIC</td>
			    <td align="center"><input type="text" name="clic" id="clic" /></td>
	      </tr>
			  <tr>
			    <td align="right">EPF</td>
			    <td><input type="text" name="epf" id="epf"/></td>
			    <td align="right">ELIC</td>
			    <td><input type="text" name="elic" id="elic" /></td>
	      </tr>
			  <tr>
			    <td align="right">P . Tax</td>
			    <td align="center"><input type="text" name="pTax" id="pTax"/></td>
			    <td align="right">CMP</td>
			    <td align="center"><input type="text" name="CMP" id="CMP"/>
		        <input type="hidden" name="EntryID" id="EntryID" readonly/></td>
	      </tr>
			  <tr>
			    <td colspan="4">
                <input type="button" class="button" id="update" value="UPDATE" style="display:none" />
                <input type="button" class="button" id="save" value="SAVE" />
			      <input type="button" class="button" id="new"  value="NEW" />
			      <input type="button" class="button" id="close"  value="CLOSE" />
</td>
	      </tr>
			  
	  </table>
    
</form>
 <div id="message" style="width:100%;text-align: center;font-weight: bold;color: #0064D1;"> </div>
    </div>


  </div>
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){
<?php if(!empty($id))
{?>
$('#save').hide();
$('#update').show();
$('#EntryID').val('<?php echo clean($con,$row['EntryID']); ?>');
$('#CMP').val('<?php echo clean($con,$row['CMP']); ?>');
$('#ECode').val('<?php echo clean($con,$row['ECode']); ?>');
$('#password').val('<?php echo clean($con,$row['password']); ?>');
$('#attstatus').val('<?php echo clean($con,$row['attstatus']); ?>');
$('#EName').val('<?php echo clean($con,$row['EName']); ?>');
$('#EAddress').val('<?php echo clean($con,$row['EAddress']); ?>');
$('#EBdate').val('<?php echo clean($con,$row['EBdate']); ?>');
$('#EAge').val('<?php echo clean($con,$row['EAge']); ?>');
$('#EDEmployed').val('<?php echo clean($con,$row['EDEmployed']); ?>');
$('#Designation').val('<?php echo clean($con,$row['Designation']); ?>');
$('#Department').val('<?php echo clean($con,$row['Department']); ?>');
$('#Status').val('<?php echo clean($con,$row['Status']); ?>');
$('#ECivilStatus').val('<?php echo clean($con,$row['ECivilStatus']); ?>');
$('#EGender').val('<?php echo clean($con,$row['EGender']); ?>');
$('#ContactNumber').val('<?php echo clean($con,$row['ContactNumber']); ?>');
$('#EAddress').val('<?php echo clean($con,$row['EAddress']); ?>');
$('#reptime').val('<?php echo clean($con,$row['reptime']); ?>');
$('#closetime').val('<?php echo clean($con,$row['closetime']); ?>');
$('#salary').val('<?php echo clean($con,$row['salary']); ?>');
$('#holidays').val('<?php echo clean($con,$row['holidays']); ?>');
$('#other1').val('<?php echo clean($con,$row['other1']); ?>');
$('#other2').val('<?php echo clean($con,$row['other2']); ?>');
$('#HRA').val('<?php echo clean($con,$row['HRA']); ?>');
$('#Conveyance').val('<?php echo clean($con,$row['Conveyance']); ?>');
$('#Medical').val('<?php echo clean($con,$row['Medical']); ?>');
$('#Bonus').val('<?php echo clean($con,$row['Bonus']); ?>');
$('#basicsalary').val('<?php echo clean($con,$row['basicsalary']); ?>');
$('#otallowance').val('<?php echo clean($con,$row['otallowance']); ?>');
$('#daallowance').val('<?php echo clean($con,$row['daallowance']); ?>');
$('#cpf').val('<?php echo clean($con,$row['cpf']); ?>');
$('#clic').val('<?php echo clean($con,$row['clic']); ?>');
$('#epf').val('<?php echo clean($con,$row['epf']); ?>');
$('#elic').val('<?php echo clean($con,$row['elic']); ?>');
$('#pTax').val('<?php echo clean($con,$row['pTax']); ?>');


<?php }?>

$('#EBdate').datepick();

$("#Designation").autocomplete(
		 "design.php?",
	  {
  			delay:10,
  			minChars:1,
  			matchSubset:1,
  			matchContains:1,
  			cacheLength:10,
			mustMatch:1,
  			autoFill:false
  		}
    );
	$("#mis").autocomplete(
      "misc_fill.php?",
      {
  			delay:10,
  			minChars:1,
  			matchSubset:1,
  			matchContains:1,
  			cacheLength:10,
  			onItemSelect:selectItem,
  			onFindValue:findValue,
  			formatItem:formatItem,
  			autoFill:false
  		}
    );
	
		$("#CMP").autocomplete({
		url: 'data.php?mode=getcode',
	 	minChars:0,
		mustMatch:1,
    });	
	
	});
	  $(window).load(function() {
    $('#transperent').hide();
	  });
</script>


</body>
</html>
<body>
</body>
</html>