       <!-- page content -->
        <div class="right_col" role="main">
          <div class="">
            <div class="page-title">
              <div class="title_left">
               
              </div>
            </div>

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

            <div class="row">

              <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                  <div class="x_title">
                    <h2>Student View</h2>
                    <ul class="nav navbar-right panel_toolbox">
                      <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                      </li>
                    </ul>
                    <div class="clearfix"></div>
                  </div>
                  <div class="x_content">
                    <form class="form-horizontal form-label-left" action="<?php echo base_url(); ?>student/promote_students" method="post">
                           <div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-1">
                         </div>
                        <table id="datatable-buttons" class="table table-striped table-bordered dt-responsive nowrap">
                            
                        <thead>
                        
                            <tr>
                            <th>All<input type="checkbox" id="checkall" / >&nbsp;</th>
                             
                            <th>SID</th>
                            <th>Student Name</th>
                            <th>Parent Name</th>
                            <th>Remaining Fee</th>
                            </tr>
                        </thead>


                        <tbody>
                            <?php if(!empty($student)){
                                // echo "<pre>";print_r($student);exit;
                             $i=1; foreach ($student as $key => $value) {
                              $invoc=$this->db->select('id,remaining,status')
                                            ->where('student_id',$value['p_id'])
                                            ->order_by('id','desc')
                                            ->limit(1)
                                            ->get('invoice')->row_array();
                             ?>
                            <tr>
                            <td><input type="checkbox" name="student[]" value="<?php echo $value['id']; ?>"></td>
                          
                            <td><?php echo $value['sid']; ?></td>
                            <td><?php echo $value['student_name']; ?></td>
                            <td><?php echo $value['father_name']; ?></td>
                          <td>
                                <?php
                                if($invoc['status']==0)
                                {
                                    echo ($this->voucher_model->countTotalFee($invoc['id']))."<span class='text-danger'><b>(Remaining Fee will be added as promoted class arrears)</b></span>";
                                }else
                                {
                                    echo $invoc['remaining']."<span class='text-danger'><b> (Remaining Fee will be added as promoted class arrears) </b></span>";
                                }
                                //if(empty($invoc['remaining'])){echo 0;}elseif($invoc['remaining'] && $invoc['remaining'] == 0 && $invoc['status'] == 1){echo 0;}elseif($invoc['remaining'] && $invoc['remaining'] > 0 && $invoc['status'] !=0){echo $invoc['remaining']."<span class='text-danger'><b> (Remaining Fee will be added as promoted class arrears) </b></span>";}else{echo ($this->voucher_model->countTotalFee($invoc['id']))."<span class='text-danger'><b>(Remaining Fee will be added as promoted class arrears)</b></span>";} 
                                ?>
                                </td>
                          </tr>
                            <?php $i++; } }
else{?>
                            <tr>
                            <td colspan="4" class="text-center">No Record Found...!!!</td>
                            </tr>
                            <?php } 
?>
                        </tbody>
                        </table>
                           
                        <div class="row">
                        </div>
                        <input type="hidden" name="branch_old" value="<?php echo $branch_old; ?>">
                        <input type="hidden" name="class_old" value="<?php echo $class_old; ?>">
                        <input type="hidden" name="section_old" value="<?php echo $section_old; ?>">
                        <input type="hidden" name="session_old" value="<?php echo $session_old; ?>">
                      
                      <!--branch check-->
                    <?php if($this->user_model->is_super()){ ?>
                      <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12 text-right" for="name">Branch <span class="text-danger">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <select id="branch" class="form-control col-md-7 col-xs-12" name="branch" required="required" style="width:100%;">
                            <option value=''>Select branch</option>
                      <?php
                            $branc = $this->db->select("name,id")->from("branch")->get()->result();
                            foreach ($branc as $value) {
                      ?>
                            <option value="<?php echo $value->id; ?>"><?php echo $value->name?></option>

                      <?php } ?>
                          </select>
                        </div>
                      </div>
                      <?php  } ?>
                      <?php if(!$this->user_model->is_super()){ 
                                   $branch=$this->user_model->getbranch(); ?>
	                            <input type="hidden" class="form-control" name="branch" id="branch" value="<?= $branch ?>">
                                <?php } ?>
               
                <!--branch-->
                      
                        <?php if(!empty($student)){?>
                      
                      <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="class">Class <span class="text-danger">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <select id="class" class="form-control col-md-7 col-xs-12" name="class" required="required">
                            <option value="">Select Class</option>
                          </select>
                        </div>
                      </div>
                      <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="section">Section <span class="text-danger">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <select id="section" class="form-control col-md-7 col-xs-12" name="section" required="required">
                            <option value="">Select Section</option>
                          </select>
                        </div>
                      </div>
                      <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="session">Session <span class="text-danger">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <select id="session" class="form-control col-md-7 col-xs-12" name="session" required="required">
                            <option value="">Select Session</option>
                            <?php foreach ($session as $key => $value) {
                                echo '<option value="'.$value['id'].'">'.$value['name'].'</option>';
                            } ?>
                          </select>
                        </div>
                      </div>
                      <div class="form-group">
                        <div class="col-md-6 col-md-offset-3">
                           
                          <button id="go" class="btn btn-success" style="float:right;">Promote</button>
                         
                          
                        </div>
                      </div>
                       <?php }?>
                    </form>
                  </div>
                </div>
              </div>

            </div>
          </div>
        </div>
        <!-- /page content -->

        <!-- footer content -->
        <footer>
          <div class="pull-right">
            Prudmac
          </div>
          <div class="clearfix"></div>
        </footer>
        <!-- /footer content -->
      </div>
    </div>

    <!-- jQuery -->
    <script src="<?php echo base_url(); ?>assets/vendors/jquery/dist/jquery.min.js"></script>
    <!-- Custom JS -->
    <script src="<?php echo base_url(); ?>assets/js/main.js"></script>
    <!-- Bootstrap -->
    <script src="<?php echo base_url(); ?>assets/vendors/bootstrap/dist/js/bootstrap.min.js"></script>
    <!-- FastClick -->
    <script src="<?php echo base_url(); ?>assets/vendors/fastclick/lib/fastclick.js"></script>
    <!-- NProgress -->
    <script src="<?php echo base_url(); ?>assets/vendors/nprogress/nprogress.js"></script>
    <!-- Chart.js -->
    <script src="<?php echo base_url(); ?>assets/vendors/Chart.js/dist/Chart.min.js"></script>
    <!-- gauge.js -->
    <script src="<?php echo base_url(); ?>assets/vendors/gauge.js/dist/gauge.min.js"></script>
    <!-- bootstrap-progressbar -->
    <script src="<?php echo base_url(); ?>assets/vendors/bootstrap-progressbar/bootstrap-progressbar.min.js"></script>
    <!-- iCheck -->
    <script src="<?php echo base_url(); ?>assets/vendors/iCheck/icheck.min.js"></script>
    <!-- Skycons -->
    <script src="<?php echo base_url(); ?>assets/vendors/skycons/skycons.js"></script>
    <!-- Flot -->
    <script src="<?php echo base_url(); ?>assets/vendors/Flot/jquery.flot.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/Flot/jquery.flot.pie.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/Flot/jquery.flot.time.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/Flot/jquery.flot.stack.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/Flot/jquery.flot.resize.js"></script>
    <!-- Flot plugins -->
    <script src="<?php echo base_url(); ?>assets/js/flot/jquery.flot.orderBars.js"></script>
    <script src="<?php echo base_url(); ?>assets/js/flot/date.js"></script>
    <script src="<?php echo base_url(); ?>assets/js/flot/jquery.flot.spline.js"></script>
    <script src="<?php echo base_url(); ?>assets/js/flot/curvedLines.js"></script>
    <!-- jVectorMap -->
    <script src="<?php echo base_url(); ?>assets/js/maps/jquery-jvectormap-2.0.3.min.js"></script>
    <!-- bootstrap-daterangepicker -->
    <script src="<?php echo base_url(); ?>assets/js/moment/moment.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/js/datepicker/daterangepicker.js"></script>

    <!-- Custom Theme Scripts -->
    <script src="<?php echo base_url(); ?>assets/build/js/custom.min.js"></script>

    <!-- Datatables -->
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net/js/jquery.dataTables.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-buttons/js/dataTables.buttons.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-buttons-bs/js/buttons.bootstrap.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/jszip/dist/jszip.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/pdfmake/build/pdfmake.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/pdfmake/build/vfs_fonts.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-buttons/js/buttons.flash.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-buttons/js/buttons.html5.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-buttons/js/buttons.print.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-fixedheader/js/dataTables.fixedHeader.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-keytable/js/dataTables.keyTable.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-responsive/js/dataTables.responsive.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-responsive-bs/js/responsive.bootstrap.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-scroller/js/datatables.scroller.min.js"></script>
<!-- SLECT 2-->
<script src="<?php echo base_url()?>assets/select/js/select2.min.js"></script>
<script>
<?php if($this->user_model->is_super()){ ?>
    $('#branch').select2();
    <?php  } ?>
    $('#class').select2();
    $('#section').select2();
    $('#session').select2();
</script>
    <!-- Datatables -->
    <script>
      $(document).ready(function() {
        var handleDataTableButtons = function() {
          if ($("#datatable-buttons").length) {
            $("#datatable-buttons").DataTable({
              dom: "lBfrtip",
              "bPaginate": false,
              "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
              buttons: [
                {
                  extend: "copy",
                  
                  exportOptions: {
                    columns: [ 0, 1, 2 ]
                    },
                    className: "btn-sm"
                },
                {
                  extend: "csv",
                  
                  exportOptions: {
                    columns: [ 0, 1, 2 ]
                    },
                    className: "btn-sm"
                },
                {
                  extend: "excel",
                  
                  exportOptions: {
                    columns: [ 0, 1, 2 ]
                    },
                    className: "btn-sm"
                },
                {
                  extend: "pdfHtml5",
                  
                  exportOptions: {
                    columns: [ 0, 1, 2 ]
                    },
                    className: "btn-sm"
                },
                {
                  extend: "print",
                  exportOptions: {
                    columns: [ 0, 1, 2 ]
                    },
                  className: "btn-sm"
                },
                
              ],
              "columnDefs": [ {
                "targets": 0,
                "orderable": false
                } ],
              responsive: true
            });
          }
        };

        TableManageButtons = function() {
          "use strict";
          return {
            init: function() {
              handleDataTableButtons();
            }
          };
        }();

        TableManageButtons.init();
      });
    </script>
    <!-- /Datatables -->
    <script>
    $(document).ready(function(){
        <?php if(!$this->user_model->is_super()){ ?>
        var val = $('#branch').val();
        $.get("<?php echo base_url(); ?>load/classs/role/"+val,{},function(ret){
            var pre = "<option value=''>Select Class</option>";
            $("#class").html(pre+ret);
          });
          <?php } ?>
    });
</script>
    <script>
      $(function(){
        $(document).on("change","#branch",function(){
        
          var val = $(this).val();
          $.get("<?php echo base_url(); ?>load/classs/role/"+val,{},function(ret){
            var pre = "<option value=''>Select Class</option>";
            $("#class").html(pre+ret);
          });
        });
        $(document).on("change","#class",function(){
          var val = $(this).val();
          $.get("<?php echo base_url(); ?>load/section/role/"+val,{},function(ret){
            var pre = "<option value=''>Select Section</option>";
            $("#section").html(pre+ret);
          });
        });
      });
    </script>
      <script>
       $(function(){
           
           $('#checkall').change(function(){
               if (this.checked) {
        // the checkbox is now checked
                   $('input:checkbox').not(this).prop('checked', this.checked);
                } else {
                    // the checkbox is now no longer checked
                    $('input:checkbox').not(this).prop('checked', '');
                }
           })
       })
   </script>

  </body>
</html>