<?php include('parent/callMe.php');?>
<?php include('Sessioncheck.php');?>
<?php   
  

  $m->where("section_id", $_REQUEST['section']);
  $sectionName=$m->get("edu_adm_section_detail");

    $default;
    
    if($_GET["month"]!=NULL ){
      $default= $_GET["month"];
    }
    else{
      $default= date("m");
    }
  
  // getting branch details

  $m->where("branch_id", $_SESSION['branch']);
  $branch_details=$m->get("edu_branch_config");

    
  $m->where("class_id", $_REQUEST['class_id']);
  $className=$m->get("edu_class_config");


$branch=$_SESSION['branch'];
 $m->where("status", '0');
 $m->where("branch_id", $_SESSION['branch']);
 $m->where("designation_id!=14");
 $m->orderBy("user_id", 'desc');
 $WorkAssignListings = $m->get("edu_user_config");


 $session;
    
    if($_GET["session"]!=NULL ){
      $session= $_GET["session"];
    }
    else{
      $session= $_SESSION['current_session'];
    }



 $m->where("session_id", $session);
 $session_ID = $m->get("edu_session_config");

 $yr=explode("-", $session_ID[0]['session_year']);


 ?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Print PayRoll Sheet</title>
<link rel="icon" type="image/png" href="img/favicon.png" sizes="32x32" />
<script type="text/javascript">
// window.print();
</script>
<style type="text/css">

tr th {text-align:center;font-size:14px; padding:3px;}
tr td {font-size:14px; padding:3px;}
  
.border{border:1px solid black;}
.center{text-align:center;}
.alignment{padding-left:1%;text-align:left;}
.borderTop{
  border-top: none;
}
</style>
</head>
<body style="font-size:12px;padding:1%;">



<div style="text-align:center;font-size:24px;font-weight:bold;"> 
  <?php echo  $branch_details[0]['Branch_Name'];?>

 </div>

<br>

<div style="text-align:center;font-size:24px;font-weight:bold;">Staff Attendance Sheets of (<?php echo getMonthName($m,$_REQUEST['month']);?>)

 </div>


<br>
   
    <table  style="width:100%;border-collapse: collapse;">
          
          <thead>
            <tr>
                
                <th width="10%" style="background-color:lightgray;">Name</th>
        
        
       <th width="90%">
        
      <table border="1" width="100%"  class="responsive" style="border: none;border-collapse: collapse;">
              <?php 

          //$days=date("t");
          $days=cal_days_in_month(CAL_GREGORIAN, $default, date("Y"));
          for($i=1;$i<$days+1;$i++){     

          ?>

           <th width="2%" class="" style="padding:0px;text-align: center;background-color:lightgray;border-left: 1px solid lightgray;"> <?php echo $i;?>  </th>

          <?php } ?>
                
      </table>
      
      </th>
    

            </tr>
      
        </thead>
        <tbody>
     
     <?php
     
     $count=1; 

     /*print_r($WorkAssignListings);
     echo "=======";*/
      foreach($WorkAssignListings as $WorkAssignListVal)
      { 
      
      ?>


<tr>
        
     

  <td>
    
    <?php echo $WorkAssignListVal['user_fname'];?>
           
                     
  </td>

      
      

      <td>

    <div style="">


    <table border="1" width="100%"  class="responsive" style="border-collapse: collapse;">  

  <tr>  
<?php 
cal_days_in_month(CAL_GREGORIAN, $default, date("Y"));
//$days=date("t");
$days=cal_days_in_month(CAL_GREGORIAN, $default, date("Y"));
for($i=1;$i<$days+1;$i++){

    $date=$yr[0]."-".str_pad($default, 2, '0', STR_PAD_LEFT)."-".str_pad($i, 2, '0', STR_PAD_LEFT);
   
   $id=$WorkAssignListVal['user_id'];  
   $qr="select * from eduportal_hrm_emp_attendance where date='$date' and emp_id='$id' and branch_id=".$_SESSION['branch'];
   $att = $m->query($qr);

   //echo $qr;
?>

 <th  width="2%" style="padding:0px;text-align: center;"> <?php  if($att[0]['attendance']!=NULL){echo $att[0]['attendance'];}else {echo "--";};?> </th>

<?php } ?>

  </tr>

</table>

  </div>

   

      </td>
</tr>

        <?php } ?>



           
            
           
        </tbody>
        
    </table><br>
     
      
      

</body>
</html>
