<? include("si_confi.php"); ?>
<? include("ad_head.php"); ?>
  <div class="container">
<? include("mn_option.php");


if($_REQUEST['action']=='trsh') {
	$get_emp_id=base64_decode($_REQUEST['isd']);
	mysql_query("delete from `employee_mng` where `id`='$get_emp_id'");
?><script>window.location="viwe_empploe.php?del=suc";</script><? }


if($_REQUEST['search_emp'])
{
	$get_emp_name=base64_encode($_REQUEST['search_employee']);
	?><script>window.location="viwe_salary.php?seemp=<? echo $get_emp_name ?>";</script><? } 
	
	$get_emp_name12=base64_decode($_REQUEST['seemp']);
	?>
    

<? if($_REQUEST['ed']=='suc'){ ?>
<div class="success" style="width:92%;margin:0 auto;margin-top:9px;"> Employee Salary Details Edited successfully.</div><? } ?>
<? if($_REQUEST['del']=='suc'){ ?>
<div class="error" style="width:92%;margin:0 auto;margin-top:9px;"> Employee Salary Details Deleted successfully.</div><? } ?>
 
<?
if($get_emp_name12==NULL){
$select_count_emp=mysql_query("select count(*) as num from `employee_mng`"); } else {
$select_count_emp=mysql_query("select count(*) as num from `employee_mng` where `name`='$get_emp_name12'");	
}
$fetch_count_emp=mysql_fetch_array($select_count_emp);
$total_emp_result=$fetch_count_emp['num'];
?>

   <div style="border:groove;margin-top:10px;border-width:thin;padding:20px;border-radius:4px;border-color:#cccccc;box-shadow: 10px 9px 90px #000;">
   <h2>View Employee Details&nbsp;&nbsp;&nbsp;(Total&nbsp;:&nbsp;<? echo $total_emp_result; ?>)</h2>
   
   <link rel="stylesheet" type="text/css" media="all" href="ad_comple.css">
  <script type="text/javascript" src="jquery-1.9.1.min.js"></script>
  <script type="text/javascript" src="jquery.autocomplete.min.js"></script>  
  <script type="text/javascript">
  $(function(){
  var currencies = [
 <?php $qur="SELECT distinct `name` FROM `employee_mng`"; 
		$result = mysql_query($qur);
		while ($row_section = mysql_fetch_array($result)) {?>	  
    { value:'<?php echo $row_section['name']; ?>' },<?php } ?> ];
  $('#autocomplete').autocomplete({
    lookup: currencies,
  }); });
</script>
   
   <form method="post" enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>">
   <table>
   <tr>
   <td><input type="text" name="search_employee" id="autocomplete"></td>
   <td><input type="submit" name="search_emp" value="Search"></td>
   </tr>
   </table>
   </form>
  <br>
    <table width="100%" cellpadding="9" cellspacing="0" border="1">
  <tr bgcolor="#CCCCCC">
  <td>EMP ID</td>
  <td>Name</td>
  <td>Salary </td>
  <td>Edit</td>

  </tr>
  <?
  if($get_emp_name12==NULL){
   $select_employee_details=mysql_query("select * from `employee_mng`");} else {
	    $select_employee_details=mysql_query("select * from `employee_mng` where `name`='$get_emp_name12'"); }
	   
  while($fetch_employee_details=mysql_fetch_array($select_employee_details)){ ?>
  <tr bgcolor="#FFFFFF">
  <td><? echo ucwords($fetch_employee_details['emp_id']); ?></td>
  <td><? echo ucwords($fetch_employee_details['name']); ?></td>
  <td>Rs.<? echo $fetch_employee_details['salary']; ?></td>
  
  <td><a href="ad_salary2.php?id=<? echo $fetch_employee_details['id']; ?>"><img src="ad_img/edit-male-user-icon.png" width="40"></a></td>
 
  </tr>
  <? } ?>
  <script type="text/javascript">
function newPopup(url) {
	popupWindow = window.open(
		url,'popUpWindow','height=580,width=700,left=140,top=60,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes')
}
</script>
  </table>  
  </div>
</div><!-- container -->
  </body>
</html>