<?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

  $branch=getBranch($m);

$m->where("student_id", $_REQUEST['student']);
$student=$m->get("edu_student_details");


 ?>
<!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="background-color: green;">
<div class="profile_img" style="width: 20%;float: left;" >
        <div id="crop-avatar">
          <!-- Current avatar -->
           <?php if($student[0]['image']!=NULL){ ?>

      <img src="<?php echo DOMAIN;?>Production/students_pics/<?php echo $student[0]['image'];?>" id="preview" class="img-thumbnail" style="width:100px;height:100px;"   />

   <?php }else { ?>   

       <img src="<?php echo DOMAIN;?>Production/images/upload.png" id="preview" height="100px" class="img-thumbnail" width="100px"  />


   <?php } ?>
    </div>
  </div>

  <div style="width:60%;font-size:24px;text-align:center;float: left;"><span style="font-size:30px; text-align:center;font-family:times new roman;font-weight: bolder;"><br>  <?php echo $branch[0]['Branch_Name'];?> </span>

         <br>
         <span style="font-size:14px; text-align:center;">  <?php echo $branch[0]['Branch_Location']." Cell: ".$branch[0]['Owner_no'];?> </span></div>

  <div style="width:20%;font-size:13px;text-align:center;float:left;height:80px;">

         <img src="<?php echo DOMAIN;?>Production/img/<?php echo $branch[0]['logo']; ?>" style="height:100px;width:100px;" />

  </div>

</div>


<br>

<div style="width:40%;float: left;">Class/Sec:  <?php echo getClassName($m,$_REQUEST['class_id'])."/".getSectionName($m,$_REQUEST['section_id']);?></div>
</div>

<div style="font-size: 16px;text-align: center;font-weight: bold;margin-top: 115px;">
<div style="width: 25%;float: left;">Name:  <?php echo $student[0]['first_name'];?></div>
<div style="width: 25%;float: left;">Father:  <?php echo $student[0]['last_name'];?></div>


   
    <table  style="width:100%;border-collapse: collapse;margin-top: 20px;">
          
          <thead>
            <tr>
                
      <th width="10%" style="background-color:lightgray;">Classes</th>
        
        
       <th width="90%">
        
      <table border="1" width="100%"  class="responsive" style="border-collapse: collapse;margin-top: -3px;">
              <?php 

          $days=date("t");
          for($i=1;$i<=31;$i++){     

          ?>

           <th  width="2%" style="padding:4px;text-align: center;background-color: lightgray;"> <?php  echo $i;?> </th>

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

            </tr>
      
        </thead>
        <tbody>
     
     <?php
     
  $branch=$_SESSION['branch'];
  $WorkAssignListings = $m->query("SELECT sec.*, cls.* FROM edu_adm_section_detail as sec LEFT JOIN edu_class_config as cls ON sec.class_id = cls.class_id where cls.class_id!='' and cls.branch_id='$branch' and sec.branch_id='$branch' ORDER BY cls.class_id asc"); 
    
      foreach($WorkAssignListings as $class) { ?>

<tr>        
     
    <?php $monthss = date('F', mktime(0,0,0,$mm, 1, date('Y'))); ?>

      <td style="background-color: lightgray;border: 1px solid black;"><?php echo $class['Class_Name']." - ".$class['section_name'];?></td>

      <td>

    <div style="">


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

  <tr>  
<?php 
$monthID =date('m');
$days=date("t");
for($i=1;$i<$days+1;$i++){

    $date=date("Y")."-".str_pad($monthID, 2, '0', STR_PAD_LEFT)."-".str_pad($i, 2, '0', STR_PAD_LEFT);   
  
   $branch_id=$_SESSION['branch'];
   $classID=$class['class_id'];
   $sectionID=$class['section_id'];
   $qr="SELECT count(*) as absents FROM eduportal_attendance_detail WHERE date='$date' and attendance='A' and class_id='$classID' and section_id='$sectionID' and branch_id='$branch_id' ";
   //print_r($qr);
   $att = $m->query($qr);   

   //echo $qr;
?>

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

<?php } ?>

  </tr>

</table>

  </div>

   

      </td>
</tr>

        <?php } ?>



           
            
           
        </tbody>
        
    </table><br>
     
      
      

</body>
</html>
