<?php 
if($_REQUEST['AttSite']!='')
	{
$att_sql="Select * from daily_attendance where attendance_date='".ConvertSQLDate($date)."' and site =  '".$_REQUEST['AttSite']."'"; //echo $att_sql;
$att_res=DB_query($att_sql,$db);
if(DB_num_rows($att_res)>0)
{
?>
<h3 align="center"><strong>View Attendance For Today (<?php echo $date;?>)</strong></h3>

<table width="100%" border="1" cellspacing="2" cellpadding="2">
  <tr>
    <td width="6%"><strong>SNo.</strong></td>
    <td width="5%">&nbsp;</td>
	<td width="14%">&nbsp;</td>
	<td width="8%">&nbsp;</td>
    <td width="15%">&nbsp;</td>
    <td width="12%">&nbsp;</td>  <td  >&nbsp;</td> 
    <td colspan="2"><strong>Shift</strong></td>
    <td colspan="2"><strong>Time</strong></td>
    <td width="6%"><strong>OT</strong></td>
    <td width="8%"> <strong>Leave</strong></td>
  </tr>
  <tr>
    <td><strong>No.</strong></td>
	<td><strong>Site</strong></td>
	<td><strong>Present/Absent</strong></td>
    <td><strong>E Code</strong></td>
    <td><strong>Employee Name </strong></td>
	<td><strong>Employee Designation </strong></td>
	<td><strong>Shift </strong></td>
	<td width="8%"><strong>Start</strong></td>
    <td width="7%"><strong>End</strong></td>
    <td width="6%"><strong>In</strong></td>
    <td width="5%"><strong>Out</strong></td>
    <td><strong>HRS</strong></td>
    <td><strong>Code</strong></td>
  </tr>
<?php 
$j=1;
while($att_row=DB_fetch_array($att_res))
{
?>  
  <tr bgcolor="#FFFFFF">
    <td><?php echo $j; ?></td>
	<td><?php 
	$site_query=DB_query("Select loccode,locationname from locations where loccode='".$att_row['site']."'",$db);
	$site_res=DB_fetch_array($site_query);
	echo $site_res['locationname']; ?></td>
	<td><?php 
	if($att_row['pres_abs']=='WL')echo "Weekly Off"; 
	else if($att_row['pres_abs']=='P')echo "Present"; 
	else if($att_row['pres_abs']=='HL')echo "Holiday"; 
	else if($att_row['pres_abs']=='A')echo "Absent"; 
	else if($att_row['pres_abs']=='L')echo "Leave";
	else echo "Official Tour";
	//echo $att_row['pres_abs']; ?></td>
    <td><?php echo $att_row['e_code']; ?></td>
    <td><?php 
	$empl_sql=DB_query("Select emp_name,designation from empmaster where id='".$att_row['employee']."'",$db);
	$empl_res=DB_fetch_array($empl_sql);
	echo $empl_res['emp_name']; ?></td>
    <td><?php 
      echo $s->getField('desigmaster','desigcode',$empl_res['designation'],'designame');
    //echo $empl_res['designation'];?>&nbsp;</td>
     <td><?php //echo  $att_row['shift_category'];
      echo $s->getField('shift_master','id',$att_row['shift_category'],'shift_category');
  ?>&nbsp;</td>
    <td><?php  echo $att_row['pres_abs']!='A'? $att_row['shift_start']." ".$att_row['shiftstart_AMPM'] :''; ?></td>
    <td><?php  echo $att_row['pres_abs']!='A'?$att_row['shift_end']." ".$att_row['shiftend_AMPM'] :''; ?></td>
    <td><?php  echo $att_row['pres_abs']!='A'?$att_row['time_in']." ".$att_row['timein_AMPM'] :''; ?></td>
    <td><?php  echo $att_row['pres_abs']!='A'?$att_row['time_out']." ".$att_row['timeout_AMPM'] :''; ?></td>
    <td><?php  echo $att_row['pres_abs']!='A'?$att_row['ot_hrs'] :''; ?></td>
    <td><?php 
	if(($att_row['leave_code']=='000' || $att_row['leave_code']=='') && $att_row['others']=='')
	{echo "N/A";}
	else
	{
		$query=DB_query("Select leavename from leavemaster where leavecode='".$att_row['leave_code']."'",$db);
		$res=DB_fetch_array($query);
		echo $res['leavename']; 
	}
	?></td>
  </tr>
<?php $j++;
} ?>
</table>
<?php  
   }
}
?>