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

<?php  include("sessioncheck.php"); ?>



<?php



     $branch=$_SESSION['branch'];

     

     $classes = $m->query("select * from edu_class_config where branch_id=".$branch." order by class_id asc limit 1");

     // print_r($classes); 





   $session;



   if($_REQUEST['session']!=NULL){



      $session=$_REQUEST['session'];

      

    }else {

      

      $session=$_SESSION['current_session'];

    }





     /* code for advance Search*/





$sql = "SELECT * FROM  edu_student_details  WHERE branch_id='$branch' and status='0' and session_id='$session' ";



    if($_REQUEST['class_id']!=NULL){ 



    if($_REQUEST['class_id']=="All"){

      $sql;

    } else {

    $sql .= " AND class_id = '" .$_REQUEST['class_id']. "' ";



    }



    if($_REQUEST['section']!=''){



        $sql .= " AND section_id ='" . $_REQUEST['section']. "' ";

   }



    if($_REQUEST['gender']!=''){

      

        $sql .= " AND gender ='" . $_REQUEST['gender']. "' ";

   }





  //echo $sql;



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

}



 else {



  $sql = "SELECT * FROM  edu_student_details  WHERE branch_id='$branch' and status='0'";

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



}



 ?>



<!DOCTYPE html>

<html lang="en">

  <head>

   

    <title> Gender Wise Student Report | EduPortal </title>

     <?php include('RootMe/css_links.php');?> 

  </head>

  





  <body class="nav-md">

    <div class="container body">

      <div class="main_container">

        <div class="col-md-3 left_col">

     

            <?php include('RootMe/sidebar.php');?>



              <?php include('RootMe/header.php');?>

     

        <!-- page content -->

            <div class="right_col" role="main">

            <div class="row" style="background-color: white;">

  



        <a href="<?php echo $_SESSION['dashboard'];?>">Dashboard </a> &nbsp; <i style="" class="fa fa-angle-double-right"></i>  &nbsp; 

    

         <a href="students_reports_link.php">Students Reports </a> &nbsp; <i style="" class="fa fa-angle-double-right"></i>  &nbsp; 

              

         Gender Wise Reports



          <br><br>





<section class="add_sub_agent" id="table_sub_agent">

  <div class="container">





 <div class="" style="margin-top:10px;">







      <form class="" action="genderwise_report.php" enctype="multipart/form-data" method="get">

        <div class="panel panel-default">

          <div class="panel-heading"><?php echo count($WorkAssignListings);?> Students Records <span style="float:right;margin-top: -7px;">



          <input type="hidden" value="<?php echo session_id().session_id().session_id().session_id().session_id(); ?>" name="session" />





        <div class="pull-right">         



          <a onClick="$('#advanceSearch').toggle('blind')" class=" btn btn-primary" style="cursor:pointer;float: right;">Advance Search</a>



          <?php if (isset($_REQUEST['gender'])) { ?>          	

          

          <a href="print_genderwise_report.php?<?php echo session_id().session_id().session_id().session_id().session_id(); ?>&class_id=<?php echo $_GET['class_id'];?>&section=<?php echo $_GET['section'];?>&gender=<?php echo $_GET['gender'];?>&session=<?php echo $_GET['session'];?>&orderby=<?php echo $_GET['orderby'];?>" target="_blank" class="fa fa-print btn btn-success" style="padding: 10px;">&nbsp;Print Report

          </a>  



      <?php } ?>



          

        </div>





          </span><div class="clearfix"></div> </div>

          <div class="panel-body">

          

            <div class="col-md-12" id="advanceSearch" style="display:none;">

            

              <div class="col-md-2 col-xs-12" style="padding: 8px;">

              <div class="form-group ">

              <label class="required">Class</label>

              <select name="class_id" onChange="getsec(this.value)" class="form-control" >

              <option value="All">All</option> 

              <?php

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

              $WorkAssignList = $m->get("edu_class_config");

              foreach($WorkAssignList as $WorkAssignListVal)

              { ?>

              <option <?php if($_REQUEST['class_id']==$WorkAssignListVal['class_id']){echo 'selected';}?> value="<?php echo $WorkAssignListVal['class_id']; ?>"><?php echo $WorkAssignListVal['Class_Name']; ?></option>

              <?php } ?>

              </select>                 

              </div>

              </div>

              

              

              <div class="col-md-2 col-xs-12" style="padding: 8px;">

              <div class="form-group ">

              <label class="required">Section</label>

              <select name="section" id="txt_section" class="form-control" >                      

              <?php
              if($_REQUEST['section']!='')

              { 

              $m->where("class_id", $_REQUEST['class_id']); 

              $secondLevel = $m->get("edu_adm_section_detail");

              foreach($secondLevel as $secondLevel_val)

              {

              ?>

              <option <?php if($_REQUEST['section']==$secondLevel_val['section_id']){echo "selected";} ?> value="<?php echo $secondLevel_val['section_id']; ?>"><?php echo trim(utf8_encode_all($secondLevel_val['section_name'])); ?></option>

              <?php }   ?>

              <?php } ?>

              </select>                  

              </div>

              </div> 

              

              <div class="col-md-2 col-xs-12" style="padding: 8px;">

              <div class="form-group ">

              <label class="required">Session</label>

              <select name="session" class="form-control" >

           
              <?php

              $match;

              if(!isset($_REQUEST['session'])){

              $match=$_SESSION['current_session'];

              }else { $match=$_REQUEST['session']; }


              $WorkAssignList = $m->get("edu_session_config");

              foreach($WorkAssignList as $WorkAssignListVal)

              { ?>

              <option <?php if($match==$WorkAssignListVal['session_id']){echo 'selected';}?> value="<?php echo $WorkAssignListVal['session_id']; ?>"><?php echo $WorkAssignListVal['session_year']; ?></option>


              <?php

              } ?>


              </select>

              </div>

              </div>



            <div class="col-md-2 col-xs-12" style="padding: 8px;">

            <div class="form-group ">

            <label class="required">Gender</label>

            <select id="gender" name="gender" class="form-control">

            <option value="">Select Gender </option>

            <option <?php if($_REQUEST['gender']=="Male"){echo "Selected";} ?> value="Male">Male</option>

            <option <?php if($_REQUEST['gender']=="Female"){echo "Selected";} ?> value="Female">Female</option>

            </select>

            </div>

            </div>      




              <div class="col-md-2 col-xs-12" style="padding: 8px;">

              <div class="form-group ">

              <label class="required">Order By</label>

              <select name="orderby" class="form-control"  >

              <option <?php if($_GET['orderby']=="class"){echo 'selected';}?> value='class'>Class Wise</option>

              <option <?php if($_GET['orderby']=="adm"){echo 'selected';}?> value='adm'>Admission Wise</option>

              </select>

              </div>

              </div>               



               <div class="col-md-2 pull-right" style="padding:2px;margin-top: 25px;">

                <div class="form-group ">

                   <input type="hidden" name="addaccountAdmin" value="1">

                <button type="submit" class="btn btn-primary" style="float: right;">Search</button>

                </div>

              </div>



             

            </div>

            <div class="clearfix"></div>

          </div>

        </div>

      </form>

      <div class="clearfix"></div>

    </div>

    <br>







<div style="">



<?php if(isset($_REQUEST['gender'])) { ?>

  



<table id="listofstudents" class="table table-striped table-bordered" style="width:100%">

  

   

        <thead>

            <tr>

              

                <th width="5%">S.No</th>

                <th width="17%">Student</th>

                <th width="5%">Roll#</th>

                <th width="10%">Adm No</th>

                <th width="10%"> Cell </th>

                <th width="20%"> Class </th>

                <th width="10%"> Gender </th>

                



               

                

            </tr>

        </thead>

        <tbody>





   

     

     <?php 

$count=1;

      foreach($WorkAssignListings as $WorkAssignListVal)

      { 



        $m->where("class_id", $WorkAssignListVal['class_id']);

        $class=$m->get("edu_class_config");



        $m->where("section_id", $WorkAssignListVal['section_id']);

        $section=$m->get("edu_adm_section_detail");



        $m->where("session_id", $WorkAssignListVal['session_id']);

        $session=$m->get("edu_session_config");

        

      ?>



        <tr>



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



                  <td style="padding: 2px;" > 



<!-- making a link   -->



<a style="padding: 0px 5px; font-size:14px;"  href="student_profile.php?<?php echo session_id().session_id().session_id().session_id().session_id(); ?>&class_id=<?php echo $_REQUEST['class_id']; ?>&section=<?php echo $_REQUEST['section']; ?>&session=<?php echo $_REQUEST['session']; ?>&student=<?php echo $WorkAssignListVal['student_id']; ?>" style="cursor:pointer;">



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



                    <img style="border-radius:50%;height:30px;width:30px;" src="<?php echo DOMAIN.AgentDirectory;?>/students_pics/<?php echo $WorkAssignListVal['image'];?>"  />

                  <?php }else {?>



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



                  <?php }?>

                  

                   &nbsp;&nbsp; <?php echo $WorkAssignListVal['first_name'];?>

                </a>

                                   

                                   

                </td>

                  <td style="padding: 2px; text-align: center;"> <?php echo $WorkAssignListVal['candidate_roll_no']; ?> </td>

                  <td style="padding: 2px; text-align: center;"> <?php echo $WorkAssignListVal['ref_no']; ?> </td>

                  <td style="text-align:center; padding: 2px;"> <?php echo $WorkAssignListVal['cell_no'];?> </td>

                  <td style="text-align:center; padding: 2px;">

                   <?php echo getClassName($m,$WorkAssignListVal['class_id']);?> / <?php echo getSectionName($m,$WorkAssignListVal['section_id']);?> </td>



                   <td style="text-align:center; padding: 2px;"> <?php echo $WorkAssignListVal['gender'];?> </td>

                  

                



  



 </tr> <?php   } ?>

 

        </tbody>

        

    </table>



  <?php } else { ?>



<div class="alert alert-danger" id="msg">

 <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>

  <strong>Warning!</strong> Please Select Class/Section and Gender.

</div>

<?php } ?>



  </div>



    </form>



    <br><br>





  </div>

  <div class="clearfix"></div>

</section>



        </div> 

        </div>





            </div>

          </div>

        </div>





     

        <!-- /page content -->





 <!-- jQuery -->

    <script src="js/ajax_functions.js"></script>

  <?php include('RootMe/js_linksscript.php');?> 

  <!-- Links for Datatable-->



<script src="https://cdn.datatables.net/1.10.13/js/jquery.dataTables.min.js"></script>

 <script>

        

  $(document).ready(function() {

    $('#listofstudents').DataTable({

      "pageLength": 100

    });

    } 

  );



  $("#checkAll").change(function () {



      $("input:checkbox").prop('checked', $(this).prop("checked"));

  });





</script>

  

  </body>

</html>

