Index of /home/htscrtms/newcrm.htshah.com/hslider
<?php ob_start(); ?>
<?php session_start();
include('lib/db_connect.php');
$date=date('Y-m-d');
$fielname='attendance-dwnld_'.$date.'.xls';
header("Content-Type: application/xls");
header("Content-Disposition: attachment; filename=$fielname");
header("Pragma: no-cache");
header("Expires: 0");
$fromDate=date('d',strtotime($_REQUEST['startdt']));
$toDate=date('d',strtotime($_REQUEST['enddt']));
$month=date('m',strtotime($_REQUEST['enddt']));
$year=date('Y',strtotime($_REQUEST['enddt']));
$date1=date_create($_REQUEST['startdt']);
$date2=date_create($_REQUEST['enddt']);
$diff=date_diff($date1,$date2);
$days_count = $diff->days;
?>
<!-- <h2 style="text-align:center;">Principal Company: <?php echo $_REQUEST["officeId"];?><br><br>Date: <?php echo $_REQUEST['startdt']." to ".$_REQUEST['enddt'];?></h2><br><br>-->
<table class="table" border="1" width="100%">
<thead>
<tr>
<th>Sr.</th>
<th>Emp Name</th>
<?php
//echo $month ;echo 'dates===='.$dates.'$fromDate=='.$fromDate;
// echo $sel;
for($qi=0;$qi<=$days_count;$qi++){
// echo date('d-m-Y' ,strtotime("+".$i." day"))."<br>";
$day = date("Y-m-d", strtotime($_REQUEST['startdt'] . '+ '.$qi.'days'));
// $day = date("Y-m-d", strtotime($_REQUEST['startdt'], "+" . $qi . " days"));
// print_r($qi . " = " . $day);
// $day = $year.'/'.$month.'/'.$qi;
$dName = date('d', strtotime($day));
$result = date("l", strtotime($day));
if($result == "Sunday"){
?> <th bgcolor="#FF0000" class="text-center"><?php echo $dName;?></th>
<?php
}else{ ?>
<th class="text-center"><?php echo $dName;?></th>
<?php
}
}
?>
<th>Totalc</th>
</tr>
</thead>
<tbody>
<?php
$i = 0;
$reg_sel = "select * from `tabl_attendance` where officeId ='".$_REQUEST["officeId"]."' && att_date >= '".$_REQUEST['startdt']."' && att_date <= '".$_REQUEST['enddt']."' group by clientId order by att_date desc";
$reg_quer = mysqli_query($con,$reg_sel) or die(mysqli_error($con));
while($fetcharr = mysqli_fetch_array($reg_quer))
{
$i++;
$selc="select * from `tabl_employees` where id='".$fetcharr['clientId']."'";
$qryc=mysqli_query($con,$selc) or die(mysqli_error($con));
$rowc=mysqli_fetch_array($qryc);
?>
<tr>
<td><?php echo $i?></td>
<td><?php echo $rowc['firstName'];?></td>
<?php
for($j=0;$j<=$days_count;$j++)
{
$queryDate = date("Y-m-d", strtotime($_REQUEST['startdt'] . '+ '.$j.'days'));
$resultq = date("l", strtotime($queryDate));
$sqlGetRow="Select * from tabl_attendance where clientId ='".$rowc["id"]."' and att_date='$queryDate'";
$queryGetRow=mysqli_query($con,$sqlGetRow);
$dataRow=mysqli_fetch_assoc($queryGetRow);
if($resultq == "Sunday") {
?>
<td bgcolor="#FF0000"></td>
<?php } else {?>
<td bgcolor="<?php if($dataRow['att_status']=="P"){ echo "green"; }elseif($dataRow['att_status']=="LM"){ echo "orange"; }elseif($dataRow['att_status']=="CL"){ echo "yellow"; }elseif($dataRow['att_status']=="HD"){ echo "blue"; }elseif($dataRow['att_status']=="H"){ echo "#9B9BFF"; } ?>" class="text-white text-center"><strong><?php echo $dataRow['att_status'];?></strong></td>
<?php }
}
$tRow="Select count(*) as tcount from tabl_attendance where clientId ='".$rowc["id"]."' && att_status in ('P','LM','HD')";
$qtRow=mysqli_query($con,$tRow);
$dtRow=mysqli_fetch_assoc($qtRow);
?>
<td><?php echo $dtRow['tcount']; ?></td>
</tr>
<?php
}
?>
</tbody>
</table>