<?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();
window.opener.location.reload();
  });
  
   
  $("#new").click(function(){
						   
window.location='rnmentry.php';

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

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

  });
});

function autocolon(event,field)
{
	var TextBox = field;
        //jSuccess(event.keyCode);
       if(event.keyCode != 8&&event.keyCode != 37&&event.keyCode != 39)
       {
            if (TextBox.value.length == 2 && TextBox.value.length != 3)
            {
                TextBox.value = TextBox.value + ":";
            }

        }
		
		
		
	}
	
	
	
</script>

</head>

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

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

?>

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

<table width="60%" border="0">
  <tr>
    <td align="left">RM CODE</td>
    <td><input type="text" class="rmcode" name="rmcode" id="rmcode" /><input type="hidden" class="EntryID" name="EntryID" /></td>
  </tr>
  <tr>
    <td align="left">DESCRIPTION</td>
    <td><input type="text" class="description" name="description"  id="description" /></td>
  </tr>
  <tr>
    <td align="left">UNIT</td>
    <td><input type="text" class="unit" name="unit" id="unit" /></td>
  </tr>
  <!--<tr>
    <td align="left">Qty</td>
    <td><input type="text" class="qty"  id="qty" /></td>
  </tr>-->
  <tr>
    <td colspan="2" align="right"><input type="button" class="button" name="" value="Save" id="save" /> <input type="button" class="button" name="" style="display:none" value="Update" id="update" /> <input type="button" class="button" name="" value="New" /> <input type="button" class="button" name="" value="Close" id="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']); ?>');
$('.rmcode').val('<?php echo clean($con,$row['code']); ?>');
$('.description').val('<?php echo clean($con,$row['desc']); ?>');
$('.unit').val('<?php echo clean($con,$row['unit']); ?>');


$('#copy').hide();

<?php }?>

$('#EBdate').datepick();
$('#passexp').datepick();
$('#licenseexp').datepick();
$('#visanoexp').datepick();
$('#idnoexp').datepick();
$('#dateofjoin').datepick();
$('#petexp').datepick();

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


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