<? 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 `work_allocation` where `id`='$get_emp_id'");
	?><script>window.location="viwe_work.php?del=suc";</script><?
}
 ?>

<? if($_REQUEST['ed']=='suc'){ ?>
  <div class="success" style="width:92%;margin:0 auto;margin-top:9px;">Changes saved successfully.</div><? } ?>
  <? if($_REQUEST['del']=='suc'){ ?>
  <div class="error" style="width:92%;margin:0 auto;margin-top:9px;">One Details Deleted successfully.</div><? } ?>
  
  
<?
$select_count_emp=mysql_query("select count(*) as num from `work_allocation` where `username`='$vel_empl_id'");
$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 Work Allocation&nbsp;&nbsp;&nbsp;(Total&nbsp;:&nbsp;<? echo $total_emp_result; ?>)</h2>
   
  
    <table width="100%" cellpadding="9" cellspacing="0" border="1">
  <tr bgcolor="#CCCCCC">
  <td>EMP ID</td>
  <td>EMP Name</td>
  <td>Work</td>
  <td>Allocation Date</td>
  <td>Status</td>
  <td>Status Date</td>
  <td>Particulars</td>
  <td>&nbsp;</td>
  </tr>
  <? $select_employee_details=mysql_query("select * from `work_allocation` where `username`='$vel_empl_id' order by `id` desc");
  while($fetch_employee_details=mysql_fetch_array($select_employee_details)){
	  
	  $empid_id=$fetch_employee_details['username'];
	  
	  $select_empname=mysql_query("select * from `employee_mng` where `emp_id`='$empid_id'");
	  $fetchemployeename=mysql_fetch_array($select_empname); ?>
  <tr bgcolor="#FFFFFF">
  <td><? echo ucwords($fetch_employee_details['username']); ?></td>
  <td><? echo ucwords($fetchemployeename['name']); ?></td>
  <td><? echo ucwords($fetch_employee_details['work']); ?></td>
  <td><? echo $fetch_employee_details['date_allocation']; ?>, <? echo $fetch_employee_details['time_allocation']; ?></td>
  
   <? if($fetch_employee_details['status']=='NULL'){ ?>
   <td bgcolor="#FF9900">Pending</td>
   <? } ?>
    <? if($fetch_employee_details['status']=='Complete'){ ?>
   <td bgcolor="#009900" style="color:#FFF;">Complete</td>
   <? } ?>
    <? if($fetch_employee_details['status']=='Cancel'){ ?>
   <td bgcolor="#F00" style="color:#FFF;">Cancel</td>
   <? } ?>
   
    <td><? echo $fetch_employee_details['date']; ?>, <? echo $fetch_employee_details['time']; ?></td>
     <td><? echo ucwords($fetch_employee_details['particulars']); ?></td>
     <td><a href="JavaScript:newPopup('reg.php?isd=<? echo $fetch_employee_details['id']; ?>');">Update Status</a>

<script type="text/javascript">
function newPopup(url) {
	popupWindow = window.open(
		url,'popUpWindow','height=400,width=1000,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes')
}
</script></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>