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

      $branch=$_SESSION['branch'];
     $sql = "SELECT student_id,ref_no,first_name,last_name,cell_no,branch_id,class_id,candidate_roll_no,section_id,session_id,family_code,status,image FROM  edu_student_details  WHERE branch_id='$branch' and status='0'";

      if($_REQUEST['class_id']!=NULL){
      $sql .= " AND class_id ='" . $_REQUEST['class_id']. "' ";
      }

      if($_REQUEST['section']!=NULL){
      $sql .= " AND section_id ='" . $_REQUEST['section']. "' ";
     }

     if($_REQUEST['session']!=NULL){
      $sql .= " AND session_id ='" . $_REQUEST['session']. "' ";
     }

      if($_REQUEST['orderBy']=='alphabetic'){
      $sql .= "order by first_name asc";
    }

    if($_REQUEST['orderBy']=='RollNoWise'){
        $sql .= "ORDER BY CONVERT(SUBSTRING(candidate_roll_no,3),UNSIGNED) DESC";
      }

    if($_REQUEST['orderBy']=='AdmNoWise'){
        $sql .= "order by CAST(ref_no as UNSIGNED) asc";
      }

      //print_r($sql);
   $WorkAssignListings = $m->query($sql);




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

        $m->where("section_id", $_GET['section']);
        $section=$m->get("edu_adm_section_detail");
       // print_r($section);


       // getting branch details

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



     ?>

<!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 Attendance Exam Sheet List</title>
<link rel="icon" type="image/png" href="img/favicon.png" sizes="32x32" />
<script type="text/javascript">
  //window.print();
</script>


<style> 

  .no_style{border:none;background-color:!important transparent;font-size:13px;}
  .alignment{padding-left:1%;text-align:left;}
  .border{border:1px solid black;}  
  tr th {border-top:1px solid black;border-left:1px solid black;padding:0.5%;text-align:center;background-color:lightgray;font-size:14px;}
  tr td {font-size:12px;border-bottom:1px solid black;border-left:1px solid black;padding:0.5%;text-align:center;}
  .section{width:28%; height:600px;float:left;border: 1px solid black;front-size:10px;padding:0.3%;margin-left:4%;}
  .name{font-size:16px;text-align:left;padding-left:5px;}
  

</style>

<style>
    body {
    margin:0;
    padding:1%;
 }
  

  </style>

</head>
<body>


 <table width="100%" class="table"  cellspacing="0" style="float:left;"  >


  <tr>
      <td width="100%" colspan="4" style="font-size:28px;" class="no_style"><strong><?php echo $branch[0]['Branch_Name'];?>   </strong><br>Attendence sheet 
</td>
</tr>

  <tr>
      <td width="33%" class="no_style" style="text-align:;"><strong> Class: 
      <?php echo $class[0]['Class_Name']."-".$section[0]['section_name'];?></strong></td>
      <td width="33%" class="no_style" style="text-align:;"><strong> Paper/Test:  </strong></td>

      <td width="33%" class="no_style" style="text-align:;"><strong> Subject: </strong></td>
      
   </tr>
   
 
 </table>




<br>

 <div style="height:auto;float:left;background-color:;width:100%;">

  <table width="100%" class="table" style="font-size:16px;" cellspacing="0" >
  
  
  <thead>

    <tr>
      <th width="3%"><strong>S.No</strong></th>
      <th width="12%"><strong>Name</strong></th>
      <th width="12%"><strong>Father</strong></th>
      

      <?php if($_REQUEST['show']=='roll') { ?>
      
      <th width="8%" class=""><strong>Roll No</strong></th>
      
      <?php }else { ?>

        <th width="8%" class=""><strong>Adm No</strong></th>

      <?php } ?>

      <th width="8%" class=""><strong>Answer Sheet </strong></th>

      <th width="8%" style="border-right: 1px solid black;" class=""><strong>Signature</strong></th>

   

    </tr>   
   
   
    </thead>
    <tbody>
  
  <?php 


     $count=1;
      for($i=0;$i<count($WorkAssignListings);$i++)
      { 
        
  ?>     
    <tr>
      <td class="center"><?php echo  $count; ?> </td>
      <td class="name">

        <?php if($WorkAssignListings[$i]['image']!=NULL){?>

        <img style="border-radius:50%;height:30px;width:30px;" src="<?php echo DOMAIN;?>Production/students_pics/<?php echo $WorkAssignListings[$i]['image'];?>"  />
      <?php }else {?>

        <img style="border-radius:50%;height:30px;with:30px;" src="images/student.png" />

      <?php }?>&nbsp;&nbsp;<span style="margin-top:1px;"><?php echo  $WorkAssignListings[$i]['first_name']; ?></span></td>
      <td style="text-align: left;padding-left:1%;" ><?php echo  $WorkAssignListings[$i]['last_name']; ?></td>
      
    <?php if($_REQUEST['show']=='roll') { ?>
      
      <td class="center"><?php echo $WorkAssignListings[$i]['candidate_roll_no'];?>  </td>
      
      <?php }else { ?>

        <td class="center"><?php echo $WorkAssignListings[$i]['ref_no'];?>  </td>

      <?php } ?>

      <td></td>
      <td style="border-right: 1px solid black;"></td>


    </tr>
   
<?php $count++; } ?>



 </tbody>
        
    </table>
 </div> 


<br>



</body>
</html>
