<?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 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 Award 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;}

  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 {border-bottom:1px solid black;border-left:1px solid black;padding:0.7%;text-align:center;}
  .section{width:28%; height:600px;float:left;border: 1px solid black;front-size:10px;padding:1%;margin-left:4%;}
  .name{font-size:14px;text-align:left;}
  .lname{font-size:13px;text-align:left;}

</style>

<style>

    body {
      width: 100%;
      height: 100%;
      margin: 0;
      padding: 0;
      background-color: #FAFAFA;
      font: 12pt "Tahoma";
      background: white;
  }
    * {
        box-sizing: border-box;
        -moz-box-sizing: border-box;
    }
    .page {
        width: 297mm;
        min-height:auto;        
        padding: 20mm;
        padding-top: 10mm;
        margin: 10mm auto;
        /*border: 1px #D3D3D3 solid;
        border-radius: 5px;
        background: white;
        box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);*/
    }
    .subpage {
        width: 257mm;
        height:auto;
        
    }
    
    @page {
        
        margin: 0;
    }
    @media print {
        html, body {
            width:297mm;
            height:auto;        
        }
        .page {
            margin: 0;
            border: initial;
            border-radius: initial;
            width: initial;
            min-height: initial;
            box-shadow: initial;
            background: initial;
            page-break-after: blue;
        }
    }


  </style>

</head>
<body >

<div class="book">
  <div class="page">
      <div class="subpage">



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


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

<br>

<br>

      </td>
   </tr>
   

  <tr>
      <td width="50%" class="no_style" style="text-align:left;"><strong> Class: 
      <?php echo $class[0]['Class_Name']."-".$section[0]['section_name'];?></strong></td>
      <td width="50%" class="no_style" style="text-align:left;font-size: 11px;"><?php if ($_REQUEST['show_no_of_test']=="2") { ?><strong> Paper/Test II: <?php } ?> </strong>
      
                    <strong style="margin-left:60px;">Paper/Test:</strong></td>
   </tr>
   

  <tr>
      <td width="50%" class="no_style" style="text-align:left;"><strong> Subject: </strong></td>
      <td width="50%" class="no_style" style="text-align:left;font-size: 11px;"><?php if ($_REQUEST['show_no_of_test']=="2") { ?><strong> Total Marks II:  </strong><?php } ?>
      
                    <strong style="margin-left:60px;">Total Marks:</strong></td>
   </tr>
   
 
 </table>



 <table width="48%" class="table"  cellspacing="0" style="float:left;margin-left:4%;"  >


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

<br>

<br>

      </td>
   </tr>
   
   

  <tr>
      <td width="50%" class="no_style" style="text-align:left;"><strong> Class: 
      <?php echo $class[0]['Class_Name']."-".$section[0]['section_name'];?></strong></td>
      <td width="50%" class="no_style" style="text-align:left;font-size: 11px;"><?php if ($_REQUEST['show_no_of_test']=="2") { ?><strong> Paper/Test II:  </strong><?php } ?>
      
                    <strong style="margin-left:60px;">Paper/Test:</strong></td>
   </tr>
   

  <tr>
      <td width="50%" class="no_style" style="text-align:left;"><strong> Subject: </strong></td>
      <td width="50%" class="no_style" style="text-align:left;font-size: 11px;"><?php if ($_REQUEST['show_no_of_test']=="2") { ?><strong> Total Marks II:  </strong><?php } ?>
      
                    <strong style="margin-left:60px;">Total Marks:</strong></td>
   </tr>
  
 
 </table>



<br>

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

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

    <tr>
      <th width="10%" class="border"><strong>S.No</strong></th>
      <th width="30%" class="name"><strong> Name</strong></th>
      <?php if ($_REQUEST['add_column']!="YES") {?>
      <th width="25%" class="border alignment"><strong>Father</strong></th>
      
      <?php if($_REQUEST['show']=='roll') { ?>
      
      <th width="20%" class="border alignment"><strong>Roll No</strong></th>
      
      <?php }else { ?>

        <th width="20%" class="border alignment"><strong>Adm No</strong></th>

      <?php } }?>

      <th width="15%" class="border"  style="border-right:1px solid black;"><strong>Obt Marks</strong></th>
      <?php if ($_REQUEST['show_no_of_test']=="2") { ?>
      <th width="15%" class="border"  style="border-right:1px solid black;"><strong>Obt Marks II</strong></th>
    <?php } ?>

    <?php if ($_REQUEST['add_column']=="YES") {?>
      <th></th>
      <th style="border-right:1px solid black;"></th>
    <?php } ?>
    
    </tr>
   
   
    </thead>
    <tbody>
  
  <?php 


  $second_array=array_slice($WorkAssignListings,$total_cols);
  

     $count=1;
      for($i=0;$i<count($WorkAssignListings);$i++)
      { 
        
  ?>     
    <tr>
      <td class="border center"><?php echo  $count; ?> </td>
      <td class="name"><?php echo  $WorkAssignListings[$i]['first_name']; ?></td>
      <?php if ($_REQUEST['add_column']!="YES") {?>
      <td class="lname"><?php echo  $WorkAssignListings[$i]['last_name']; ?></td>
    
     <?php if($_REQUEST['show']=='roll') { ?>
      
      <td class="name"><?php echo $WorkAssignListings[$i]['candidate_roll_no'];?>  </td>
      
      <?php }else { ?>

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

      <?php } }?>

      <td class="border center"  style="border-right:1px solid black;"></td>
      <?php if ($_REQUEST['show_no_of_test']=="2") { ?>
      <td class="border center"  style="border-right:1px solid black;"></td>
      <?php } ?>

      <?php if ($_REQUEST['add_column']=="YES") {?>
      <td></td>
      <td style="border-right:1px solid black;"></td>
    <?php } ?>
    </tr>
   
<?php $count++; } ?>



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



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

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


    <tr>
      <th width="10%" class="border"><strong>S.No</strong></th>
      <th width="30%" class="name"><strong> Name</strong></th>
      <?php if ($_REQUEST['add_column']!="YES") {?>
      <th width="25%" class="border alignment"><strong>Father</strong></th>
      
    <?php if($_REQUEST['show']=='roll') { ?>
      
      <th width="20%" class="border alignment"><strong>Roll No</strong></th>
      
      <?php }else { ?>

        <th width="20%" class="border alignment"><strong>Adm No</strong></th>

      <?php } }?>


      <th width="15%" class="border"  style="border-right:1px solid black;"><strong>Obt Marks</strong></th>
      <?php if ($_REQUEST['show_no_of_test']=="2") { ?>
      <th width="15%" class="border"  style="border-right:1px solid black;"><strong>Obt Marks II</strong></th>
      <?php } ?>

      <?php if ($_REQUEST['add_column']=="YES") {?>
      <th></th>
      <th style="border-right:1px solid black;"></th>
      <?php } ?>
    </tr>
   

    </thead>
    <tbody>



   
 <?php 


  $second_array=array_slice($WorkAssignListings,$total_cols);
  

     $count=1;
      for($i=0;$i<count($WorkAssignListings);$i++)
      { 
        
  ?>     
    <tr>
      <td class="border center"><?php echo  $count; ?> </td>
      <td class="name"><?php echo  $WorkAssignListings[$i]['first_name']; ?></td>
      <?php if ($_REQUEST['add_column']!="YES") {?>
      <td class="lname"><?php echo  $WorkAssignListings[$i]['last_name']; ?></td>
    
      <?php if($_REQUEST['show']=='roll') { ?>
      
      <td class="name"><?php echo $WorkAssignListings[$i]['candidate_roll_no'];?>  </td>
      
      <?php }else { ?>

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

      <?php } }?>


      <td class="border center"  style="border-right:1px solid black;"></td>
      <?php if ($_REQUEST['show_no_of_test']=="2") { ?>
      <td class="border center"  style="border-right:1px solid black;"></td>
      <?php } ?>

      <?php if ($_REQUEST['add_column']=="YES") {?>
      <td></td>
      <td style="border-right:1px solid black;"></td>
      <?php } ?>
    </tr>
   
<?php $count++; } ?>





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


<br>


        </div>    
    </div>      
   </div>


</body>
</html>
