<?php include('parent/callMe.php');?>
<?php include('Sessioncheck.php');?>
<?php
$branch=$_SESSION['branch'];
$class_id=$_REQUEST['class_id'];
$section_id=$_REQUEST['section'];

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


  $sql = "SELECT cell_no, section_id, last_name, address, class_id, student_id FROM  edu_student_details  WHERE branch_id='$branch' and status='0' and class_id='$class_id' group by cell_no order by last_name asc";
//print_r($sql);
 $WorkAssignListings = $m->query($sql); 
//}

 ?>

<!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>Parents 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;font-size:14px;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 {
        size: A4 portrait; 
        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">

 <div style="height:auto;float:right;background-color:;width:100%;">
  <h2 style="text-align: center;"><?php echo $branchName[0]['Branch_Name'];?></h2>
    <h3 style="text-align: center;">Parents List</h3>

 <p>Class Name: <?php echo getClassName($m,$class_id);?></p>
  <table id="listofstudents" class="table table-striped table-bordered" style="width:100%">
 
        <thead>
            <tr>

              
                <th width="">Sr</th>
                <th width="">Parents Name</th>
                <th width="">Cell Number</th>
                <th width="">Address</th>
                <th width="">Children Names</th>
                
                
                <th width="10%" style="border-right: 1px solid black; ">Children</th>
               
                
                                
            </tr>
        </thead>
        <tbody>


   
     
     <?php 
$count=1;
      foreach($WorkAssignListings as $WorkAssignListVal)
      { 
      $cell_number=$WorkAssignListVal['cell_no'];
       $m->where("section_id", $WorkAssignListVal['section_id']);
       $section=$m->get("edu_student_details");
     ?>




        <tr>

          <td style="text-align:center; padding: 2px;"><?php echo $count++;?></td>        

          <td style="padding: 2px;text-align: left;" > <?php echo $WorkAssignListVal['last_name'];?></td>
          <td style="padding: 2px;" > <?php echo $WorkAssignListVal['cell_no'];?></td>
          <td> <?php echo $WorkAssignListVal['address'];?></td>      
          <td  style="padding: 2px;text-align: left;">
            <?php 
             $query = "SELECT * FROM  edu_student_details  WHERE cell_no='$cell_number' and branch_id='$branch' and status='0'";
                   //print_r($query);
                   $childs = $m->query($query);

             foreach ($childs as $child) {
             echo $child['first_name'].",";
            }
            ?> 
            </td>

          <td style="padding: 2px; text-align: center;border-right: 1px solid black; "> 
            <?php echo noOfParentsChild($cell_number,$m);  ?> 
          </td>
          </tr>

  <?php  } ?>
 
        </tbody>
        
    </table>
 </div> 


<br>


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


</body>
</html>
