<?
session_start();
include("test.php");
include("opendb.php");
include("includes/function.php");
if(strlen($user)<=0)
{
  print "<script> alert('Invalid User'); document.location='ind.php' </script>";
  return;
}
$us=mysqli_query($db,"select level from bruser where username='$user'")or die(mysqli_error($db));
$r=mysqli_fetch_row($us);
$user_level=$r[0];
 //print "User Level:".$user_level;
        
?>
<!DOCTYPE html>
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<title>Xpress</title>
    <script src=" rightclick_deactive.js"></script> 
    <script type="text/javascript" src="scripts/jquery-latest.js"></script>
	<link type="text/css" href="includes/style1.css" rel="stylesheet" />
      <link type="text/css" href="css/form.css" rel="stylesheet" />
<script type="text/javascript" src="js/jquery-1.6.1.min.js"></script>

    <script type="text/javascript">
        $(function() {
          if ($.browser.msie && $.browser.version.substr(0,1)<7)
          {
			$('li').has('ul').mouseover(function(){
				$(this).children('ul').show();
				}).mouseout(function(){
				$(this).children('ul').hide();
				})
          }
        });        
    </script>
	<script type="text/javascript">
    $(document).ready(function() {
        var cont_left = $("#container").position().left;
        $("a img").hover(function() {
            // hover in
            //$(this).parent().parent().css("z-index", 1);
            $(this).animate({
               height: "110",
               width: "110",
              
            }, "fast");
        }, function() {
            // hover out
         //   $(this).parent().parent().css("z-index", 0);
            $(this).animate({
                height: "80",
                width: "80",
                
            }, "fast");
        });
        
        $(".img").each(function(index) {
            var left = (index * 160) + cont_left;
            $(this).css("left", left + "px");
        });
    });




    </script>

<script src="datetimepicker_css1.js"></script>

<!-- js code below for active enter with textfield-->


<script type="text/javascript">

/***********************************************
* Disable "Enter" key in Form script- By Nurul Fadilah(nurul@REMOVETHISvolmedia.com)
* This notice must stay intact for use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
                
function handleEnter (field, event) {
		var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
		if (keyCode == 13) {
			var i;
			for (i = 0; i < field.form.elements.length; i++)
				if (field == field.form.elements[i])
					break;
			i = (i + 1) % field.form.elements.length;
			field.form.elements[i].focus();
			return false;
		} 
		else
		return true;
	}      

</script>


<style>
.cont
	{


       background-color:#3b5998;

	//background:url(images/bg-inner.jpg) #e9e0c3 repeat-x;
  	width: 100%;position: absolute ;
	height:99%;
    	/* Optional - just for DIV)*/
    	//border: solid 1px #000000;
	-moz-box-shadow: 0px 5px 5px #888;
	-webkit-box-shadow: 0px 5px 5px #888;
	box-shadow: 0px 5px 10px #888;
    
	}
</style>
<style>
th{background-color:steelblue;color:white}
</style>
<script src="css3-dropdown-menu-demo_files/bsa.js" async="" type="text/javascript"></script><script async="async" src="css3-dropdown-menu-demo_files/s_a5f348233fceef06ba365ab392938d10.js" id="_bsap_js_a5f348233fceef06ba365ab392938d10" type="text/javascript"></script><style id="bsa_css" type="text/css">.one{position:relative}.one .bsa_it_ad{display:block;padding:15px;border:1px solid #e1e1e1;background:#f9f9f9;font-family:helvetica,arial,sans-serif;line-height:100%;position:relative}.one .bsa_it_ad a{text-decoration:none}.one .bsa_it_ad a:hover{text-decoration:none}.one .bsa_it_ad .bsa_it_t{display:block;font-size:12px;font-weight:bold;color:#212121;line-height:125%;padding:0 0 5px 0}.one .bsa_it_ad .bsa_it_d{display:block;font-size:11px;color:#434343;font-size:12px;line-height:135%}.one .bsa_it_ad .bsa_it_i{float:left;margin:0 15px 10px 0}.one .bsa_it_p{display:block;text-align:right;position:absolute;bottom:10px;right:15px}.one .bsa_it_p a{font-size:10px;color:#666;text-decoration:none}.one .bsa_it_ad .bsa_it_p a:hover{font-style:italic}</style></head>
<body bgcolor="#0033FF">
<div class='cont'>


<br>
<table class="container"><tr><td>


	<link type="text/css" href="css/redmond/jquery-ui-1.8.16.custom.css" rel="stylesheet" />	
		<script type="text/javascript" src="js/jquery-1.6.2.min.js"></script>
		<script type="text/javascript" src="js/jquery-ui-1.8.16.custom.min.js"></script>
<script type="text/javascript">
$(function(){

$(".regno").live("keydown.autocomplete",function(){

$regno = $(this);

$row = $regno.parent().parent();
$(this).autocomplete({
		source: function( request, response ) {

		$.ajax({
			url: "search1.php",
			dataType: "json",
			data: "key="+$regno.val(),
			success: function( data ) {
				response( $.map( data, function( item ) {
					return {
						label: item.regno+' | '+  item.chasisno + '| '+ item.make +'|'+item.model    ,
						value: item.regno,
						name:item.chasisno,
						qty:item.make,
						price:item.model,
						


					}
				}));
			}
		});
	}
	
,
	minLength: 2,
	select: function( event, ui ) {

	$row.find('.chasisno').val(ui.item.name);
	$row.find('.make').val(ui.item.qty);
	$row.find('.model').val(ui.item.price);
	
	
	/*log( ui.item ?
	"Selected: " + ui.item.label :
	"Nothing selected, input was " + this.value);
	*/
	 }
	
	});

					
});







});
</script>







<?php echo "<body onload='f1.entrydate.focus()'>\n"; ?>

<link href="css1/xp.css" type="text/css" rel="stylesheet" media="print,screen"  />


<?
session_start();
include("opendb.php");

$tbl="empprofile";
//mysqli_query($db,"drop table $tbl");


//mysqli_query($db,"CREATE TABLE $tbl (gateno double(10,2) default 0,jcno double(10,2) default 0,vehiclename varchar(200),model varchar(20),regno varchar(20),chasisno varchar(50),policereport varchar(100),instype varchar(20),insurance varchar(200),labour double(10,2) default 0,receivedby varchar(200),entrydate date,duedate date, brcode varchar(20),colour varchar(20),customer varchar(200),owner varchar(200),address varchar(250),license varchar(200),remarks varchar(100),telephone varchar(100),mobile varchar(100),email varchar(100),fileno varchar(50),jobtype varchar(20),policyexcess double(10,2),others double(10,2),depreciation double(10,2),estdate date)");

//	mysqli_query($db,"delete from $tbl");


if($sv)
{

$dob1=explode('-',$dob);
$dob=$dob1[2].'-'.$dob1[1].'-'.$dob1[0];

$dor1=explode('-',$dor);
$dor=$dor1[2].'-'.$dor1[1].'-'.$dor1[0];

$doj1=explode('-',$doj);
$doj=$doj1[2].'-'.$doj1[1].'-'.$doj1[0];

$entry=explode('-',$entrydate);
$entry1=$entry[2].'-'.$entry[1].'-'.$entry[0];

$visaexpdate1=explode('-',$visaexpdate);
$visaexpdate=$visaexpdate1[2].'-'.$visaexpdate1[1].'-'.$visaexpdate1[0];


$passportexpdate1=explode('-',$passportexpdate);
$passportexpdate=$passportexpdate1[2].'-'.$passportexpdate1[1].'-'.$passportexpdate1[0];


 $sql="update $tbl set EName='$name',DtBirth='$dob',Sex='$sex',Trade='$dep',Desig='$designation',DtEntry='$entry1',DtTerminate='$dor',Add1='$address',PhMob='$mobile',
Phone='$telephone',Status='$status',DayBasic='$payperday',Visaexp='$visaexpdate',Passportexp='$passportexpdate',Nationalty='$nationality',Passportno='$passportno',idno='$idno',
Remarks='$remarks', brcode='$branc' where EmpNo='$empno'";
 mysqli_query($db,$sql) or die(mysqli_error($db));

echo "<script> alert ('Data updated');</script>";
echo "<script> document.location='empmaster.php';</script>";
}



if($del)
{
  mysqli_query($db,"delete from machmaster where code='$code'");
}
?>
<title>XCS</title>
<link rel="stylesheet" href="style.css" type="text/css" />
<script type="text/javascript" src="scripts/jquery-latest.js"></script>
<body background="back_ground.jpg">
<form name='f1' action='<?print $PHP_SELF?>' onSubmit="return valid()" method='post'> 

<br>
<table class="container" bgcolor="#0033FF"><tr><td>
<font style="font-family: 'Trebuchet MS',Verdana,Helvetica,sans-serif; font-size:15px;">  &nbsp;&nbsp;Master >>  Employee Master</font>
<br>
<center>
<body bgcolor="#0033FF">
<form action="" method="post">
<table width="100%" border="1" cellpadding="1" cellspacing="1" align="center" bgcolor="#0033FF">
  <tr>
    <th colspan="7" bgcolor="#666"><h3 style="color:#fff"><strong>Employee Master</strong></h3></th>
    </tr>

<?

 $res=mysqli_query($db,"select * from empprofile where EmpNo='$empno' ");

 $row=mysqli_fetch_row($res);

?>
  <tr>
    <td width="135">Employee Number</td>

    <td colspan="4"><input name="empno"  type="text" id="empno"   readonly size="40" value='<?print $empno?>'  onkeypress="return handleEnter(this, event)"/></td>
    <td width="164">Date of Birth</td>


    <td width="327"><img src="img/cal.gif" onclick="javascript:NewCssCal ('dob','ddMMyyyy','dropdown')"  style="cursor:pointer"/>
<input type="Text" id="dob" name = 'dob'  value='<?print datetoHtml($row[2]); ?>' maxlength="25" size="37" readonly/></td>
   
   
  </tr>
  <tr>
    <td >Joining Date </td>
  <td><input type="Text" id="entrydate" value='<?print datetoHtml($row[6]);?>' name ='entrydate' maxlength="25" size="37" readonly/>
<img src="img/cal.gif" onclick="javascript:NewCssCal ('entrydate','ddMMyyyy','dropdown')"  style="cursor:pointer"/></td><td></td><td></td><td></td>
    <td width="164" >Sex</td>
    <td width="327"><select name="sex" id="instype" style="width:275px;" onkeypress="return handleEnter(this, event)">
      <option><?print $row[3]; ?></option>
      <option>Male</option>
      <option>Female</option>
  

    </select></td>
  </tr>




  <tr>
    <td  width="164">Name</td>
    <td colspan="4" width="327"><input name="name" type="text"   id="name"   size="40"  value='<?print $row[1]; ?>' onkeypress="return handleEnter(this, event)" class="regno"/></td>

<td >Telephone </td><td colspan="4"><input name="telephone" type="text" id="telephone" size="40" value='<?print $row[10]; ?>' onkeypress="return handleEnter(this, event)"/></td>
  </tr>

 <tr>
    <td >Address</td>
    <td colspan="4"><textarea name="address" cols="41" id="textarea"><?print $row[8]; ?></textarea></td>
    <td width="164">Mobile</td>
    <td width="327"><input name="mobile" type="text" id="mobtile" size="40"  value='<?print $row[9]; ?>' onkeypress="return handleEnter(this, event)"/></td>
  </tr>

  <tr>
<td  width="164" >Department</td>
    <td colspan="4" width="327"><select name="dep" id="dep" style="width:275px;" onkeypress="return handleEnter(this, event)">
      <option><?print $row[4]; ?></option>
      <option>Service</option>
      <option> Denting / Painting</option>
      <option> Administration</option>
  

    </select></td>
 <td >Branch </td><td colspan="4"><select name="branc"  id="branc"  style="width:275px;" onkeypress="return handleEnter(this, event)"/>
<?

$sql=mysqli_query($db,"select brname,brcode from branch where brcode='$row[19]'");
$sql1=mysqli_fetch_array($sql);
?>
<option value='$sql1[1]'><?print $sql1[0]; ?></option>
<?
$sql=mysqli_query($db,"select brname,brcode from branch");
while($sql1=mysqli_fetch_array($sql))
{
 print "\n<option value='$sql1[1]'>$sql1[0]</option>";
 }
?>
 </select>
</td>
 
  </tr>
 

<tr>
    <td >Designation</td>
    <td colspan="4"><select name='designation' style="width:275px;" onkeypress="return handleEnter(this, event)">
<option><?print $row[5]; ?></option>
<?

$re=mysqli_query($db,"select * from desigmast order by divname");
while($row1=mysqli_fetch_array($re))
{
 print "\n<option value='$row1[divname]'>$row1[divname]</option>";
 

}
?>
</select> </td>
    
<td  width="164" >Status</td>
    <td colspan="4" width="327"><select name="status" id="status" style="width:275px;" onkeypress="return handleEnter(this, event)">
      <option><?print $row[11]; ?></option>
      <option>Releaved</option>
      <option> Working</option>
      <option> On-Leave</option>
  

    </select></td>
    </tr>
<tr>
    <td >Joining Date</td>
    <td colspan="4"><input type="Text" id="doj" name ='doj' value='<?print datetoHtml($row[6]); ?>' maxlength="25" size="37" readonly/>
<img src="img/cal.gif" onclick="javascript:NewCssCal ('doj','ddMMyyyy','dropdown')"  style="cursor:pointer"/></td>
    
<td width="164">Releaved on</td> <td width="327"><img src="img/cal.gif" onclick="javascript:NewCssCal ('dor','ddMMyyyy','dropdown')"  style="cursor:pointer"/>
<input type="Text" id="dor" name ='dor' maxlength="25" size="37" value='<?print datetoHtml($row[7]); ?>' readonly/></td>
 
    </tr>
<tr>
    <td >Pay Per Day</td>
    <td colspan="4"><input name="payperday" type="text" id="payperday" size="40" value='<?print $row[12]; ?>' onkeypress="return handleEnter(this, event)"/></td>
    
<td width="164">Nationality</td>
    <td width="327"><input name="nationality" type="text" id="others" size="40" value='<?print $row[15]; ?>' onkeypress="return handleEnter(this, event)"/></td>
 
    </tr>
<tr>
    <td >Id no</td>
    <td colspan="4"><input name="idno" type="text" id="idno" size="40" value='<?print $row[17]; ?>' onkeypress="return handleEnter(this, event)"/></td>
    
<td width="164">Passport No </td>
    <td width="327"><input name="passportno" type="text" id="passportno"  size="40" value='<?print $row[16]; ?>' onkeypress="return handleEnter(this, event)"/></td>
 
    </tr>

<tr>
    <td >Visa Expiry date</td>
    <td colspan="4"><input type="Text" id="visaexpdate" name ='visaexpdate' value='<?print datetoHtml($row[13]); ?>' maxlength="25" size="37" readonly/>
<img src="img/cal.gif" onclick="javascript:NewCssCal ('visaexpdate','ddMMyyyy','dropdown')"  style="cursor:pointer"/></td>
    
<td width="164">Passport Expiry date </td>
    <td width="327"><img src="img/cal.gif" onclick="javascript:NewCssCal ('passportexpdate','ddMMyyyy','dropdown')"  style="cursor:pointer"/>
<input type="Text" id="passportexpdate" name ='passportexpdate' value='<?print datetoHtml($row[14]); ?>' maxlength="25" size="37" readonly/></td>
 
    </tr>


  <tr>
    <td >Remarks</td>
    <td colspan="6" ><textarea name="remarks" cols="41" id="remarks"><?print $row[18]; ?></textarea></td>
    </tr>




<tr><th colspan='7'><input type=submit value='Save' name='sv'></th></tr>

 </table>
</td></tr></table>
</form>