<?php include_once("class/class.MySQL.php");
	$db	=new MySQL();
$date = date('Y-m-d');
$querys="SELECT * FROM employee e,time t,file f,designation d where e.e_id=t.e_id and t.e_date='$date' and e.e_post=d.desig_id and f.e_id=e.e_id";

$y = date('Y',strtotime($date));


		$emp_sel_stat = mysql_query("SELECT * FROM emp_status where (emply_stat='Terminated' || emply_stat='Resigned' || emply_stat='vacation') ");
   // $emp_sel_stat = mysql_fetch_array($emp_sel_stat);	
	while($emp_sel_statss=mysql_fetch_array($emp_sel_stat)){	
	 $em_stat[]=$emp_sel_statss['id'];
	}

 $emp_stats=join(',',$em_stat);

 $levemp_psnt = mysql_query("SELECT distinct t.e_id FROM employee e,time t  where e.e_id=t.e_id and t.e_date='$date'");
  	while($levemp_psnts=mysql_fetch_array($levemp_psnt)){	
	 $em_ids[]=$levemp_psnts['e_id'];
	}
 $em_idss=join(',',$em_ids);

if($em_idss)
{

$querys="SELECT * FROM employee e,time t,file f,designation d where e.e_id=t.e_id and t.e_date!='$date' and e.e_post=d.desig_id and f.e_id=e.e_id and  e.emp_status not in($emp_stats)  and e.e_id not in($em_idss)  ";
 }else
 {

$querys="SELECT * FROM employee e,time t,file f,designation d where e.e_id=t.e_id and t.e_date!='$date' and e.e_post=d.desig_id and f.e_id=e.e_id and  e.emp_status not in($emp_stats) ";
 }



if($_GET['bnch'])
{
$querys  = $querys ." and e.branchid ='$_GET[bnch]'";
}
if($_GET['dept'])
{
$querys  = $querys ." and e.departid ='$_GET[dept]'";
}
if($_GET['emp'])
{
$querys  = $querys ." and e.e_id ='$_GET[emp]'";
}

$sel_emp = mysql_query($querys.' GROUP BY t.e_id');

//$sel_emp = mysql_query("SELECT * FROM employee e,time t,file f,designation d where e.e_id=t.e_id and t.e_date='$date' and e.e_post=d.desig_id and f.e_id=e.e_id");



$base_url = DOC_ROOT;
?>

<div id="tablelist">
<?php while($sel_emps=mysql_fetch_array($sel_emp)){ ?>
<div class="employee-cell">
<?php /*?><div class="clocked-in">
<span class="clocked-status" style="width:1px"> <input type="button" name="btn" class="btn_<?php echo $sel_emps['e_id'];?> button-color-logout" id="'+bt_id+'" nums="'+num+'" value="Clocked In" style="width:80px"  /><input type="hidden" name="txt"  class="txt_'+employeeslist.e_id+'" id="txt_id" value="'+employeeslist.clock_status+'"/></span>
<a href="timesheet-individual.html?employees='+employeeslist.e_id+'"><span class="clocked-time" data-times="'+emp_in+'" id="e_time'+num+'" ><?php echo $sel_emps['time_in'];?></span></a>
</div><?php */?>
 <div class="employee-foto"><a href="profile-view.php?employ_id=<?php echo $sel_emps['e_id'];?>"><img src="<?php echo $base_url;?>upload/image/<?php echo $sel_emps['photo'];?>" alt="" border="0" width="170" height="172" /></a></div>
 <div class="employee-designation"><?php echo $sel_emps['desig_name'];?></div>
 <a class="findurl" href="profile-view.php?employ_id=<?php echo $sel_emps['e_id'];?>" data-link="'+ employeeslist.e_id + '" id="emps_id'+num+'"><h2 style="font-size:15px; font-weight:bold;"><?php echo $sel_emps['e_fname'];?></h2></a>
 <h3 title="'+e_mailtitle+'"><?php echo $sel_emps['e_mail'];?></h3>
<div style="float:left"><h4>Emp Code:<?php echo $sel_emps['employee_id'];?></h4></div>
<div class="timesheet-nav"><a href="timesheet-individual.php?employees=<?php echo $sel_emps['e_id'];?>"><translate>Timesheet</translate></a></div>

</div><!-------employee-cell------->
<?php } ?>
</div><!------------tablelist------------>