<style>
    //.dataTables_filter { visibility: hidden;}
    #custom_search_wrapper {display: none;}
    #custom_pager_wrapper {display: none;}
</style>  
        <!-- page content -->
        <div class="right_col" role="main">
          <div class="">
            <div class="page-title">
              <div class="title_left">
              </div>
            </div>

            <div class="clearfix"></div>
<?php if ($this->session->flashdata('bankmsg')): ?>
<div class="alert alert-danger">
<?php echo $this->session->flashdata('bankmsg'); ?>
</div>
<?php endif ?>
            <div class="row">

              <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                  <div class="x_title">
                    <h2>Voucher List</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">
                    <div class="row" id="custom_search_wrapper">
                      <div class="col-md-4 col-sm-4 col-xs-12 col-md-offset-8 col-sm-offset-8">
                        <div class="form-group">
                            <input name="search" class="form-control has-feedback-left" id="search" type="search" value="<?php echo $q; ?>">
                            <span class="fa fa-search form-control-feedback left" aria-hidden="true"></span>
                        </div>
                        <div class="form-group pull-right">
                          <input type="submit" class="btn btn-success" id="go-search" value="Search"></i>
                        </div>
                      </div>
                      
                    </div>
                     <p style="color:green;font-weight: bold;padding:10px;text-align: center"><?php echo $this->session->flashdata('msg');?></p>
    
                    
                    <div class="row">

                       <div class="item form-group">
                        
                        <label class="control-label col-md-3 col-sm-3 col-xs-12 col-md-offset-1 text-right" for="section">Select Month*
                        </label>
                        <div class="col-md-3 col-sm-6 col-xs-12">
                           <input type="Month" class="form-control col-md-7 col-xs-12" value="<?= date('Y-m') ?>" id="date" name="date">
                        </div>
                       
                      </div>
                      
                      <div class="col-md-4 col-sm-4 col-xs-12 col-md-offset-8">
                        <div class="form-group pull-right">
                            <?php $check = @$this->db->select('is_permit')->where('id',32)->get('tsms_permission')->row()->is_permit; ?>
                          <button class="btn btn-warning" id="sms_reminder" <?php  if($check!=1){echo "title = 'Warning! Sms Permission is not set for this event' disabled";}?>>SMS for Fee Reminder</button>
                        </div>
                        <div class="form-group pull-right">
                            <?php $check = @$this->db->select('is_permit')->where('id',33)->get('tsms_permission')->row()->is_permit; ?>
                          <button class="btn btn-danger" id="sms_defaulters" <?php if($check!=1){echo "title = 'Warning! Sms Permission is not set for this event' disabled";}?>>SMS to Defaulter Students</button>
                        </div>
                      </div>
                    </div>
                    <table id="datatable-buttons" class="table table-striped table-bordered dt-responsive nowrap">
                      <thead>
                        <tr>
                          <th>#</th>
                          <th>SID</th>
                          <th>Roll#</th>
                          <th>Invoice#</th>
                          <th>Student</th>
                          <th>Parent Name</th>
                          <th>Parent Contact</th>
                          <th>Class</th>
                          <!--<th>Group</th>-->
                          <th>Section</th>
                          <th>Balance</th>
                          <th>Date</th>
                          <th>Due Date</th>
                          <th>Status</th>
                          <?php if(!$is_super){ ?>
                          <th>Actions</th>
                          <?php } ?>
                        </tr>
                      </thead>


                      <tbody class="center">
                        <?php $i=1; foreach ($voucher as $key => $value){ ?>
                        <tr>
                          <td><?php echo $i++; ?></td>
                          <td><?php echo $value['sid']; ?></td>
                          <td><?php echo $value['roll_no']; ?></td>
                          <td><?php echo $value['invoice']; ?></td>
                          <td><?php echo @$value['student_name']; ?></td>
                          <td><?php echo @$value['father_name']; ?></td>
                          <td><?php echo @$value['father_contact']; ?></td>
                          <td><?php echo @$value['class_name']; ?></td>
                          <!--<td><?php echo @$value['class_group']; ?></td>-->
                          <td><?php echo @$value['section_name']; ?></td>
                          <td><?php if($value['remaining'] == 0 && $value['status'] == 1){echo 0;}elseif($value['remaining'] > 0 && $value['status'] !=0){echo $value['remaining'];}else{if($this->voucher_model->countTotalFee($value['invoice']) >= 0){echo ($this->voucher_model->countTotalFee($value['invoice']));}else{echo 0;}} ?></td>
                          <td><?php echo date("d-m-Y",strtotime($value['date'])); ?></td>
                          <td><?php echo date("d-m-Y",strtotime($value['date_expire']." -1 day")); ?></td>
                          <?php
                          $due = date("Y-m-d",strtotime($value['date_expire']." -1 day"));
                          $date = date("Y-m-d");
                          if ($due<$date && $value['status']==0) {
                            $status = "Defaulter";
                          }else if($value['status']==1 && $value['remaining'] != 0)
                          {
                            $status = "Partial Paid";
                          }else if($value['status']==1 && $value['remaining'] == 0)
                          {
                            $status = "Paid";
                            
                          }else{
                            if ($value['status']==0) {
                              $status = "Due";
                            }elseif ($value['status']==1  && $value['remaining'] == 0) {
                              $status = "Paid";
                            }else {
                              $status = "Partial Paid";
                            } 
                          }?>
                          <td><?php echo $status; ?> </td>
                          <?php if(!$is_super){ ?>
                          <td>
                            <a href='<?php echo base_url();?>voucher/view/<?php echo base64_encode(json_encode($value['invoice'].SALT)); ?>' target ='_self' class='btn btn-md btn-info'>P Pay</a> 
                            
                            <?php
                            if ($value['status']==0) {?>
                            <a href='<?php echo base_url();?>voucher/full_submit/<?php echo $value['invoice']; ?>' onclick="return confirm('Are You Sure Full Submit Voucher...?')" class="btn btn-md btn-primary">F Pay</a>
                             <a href='<?php echo base_url();?>voucher/full_submit_receipt/<?php echo $value['invoice']; ?>' onclick="return confirm('Are You Sure Full Submit & Receipt Voucher...?')" class="btn btn-success">F Pay & Receipt</a>
                             
                            <?php } ?>
                          </td>
                          <?php } ?>
                        </tr>
                        <?php } ?>
                      </tbody>
                    </table>
                  
                </div>
              </div>

              <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                  <div class="x_title">
                    <h2>Print Section Wise Vouchers</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">
                    <div class="row">
                      <div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3 col-sm-offset-3">
                        <form action="" method="get">
                          <?php if($this->user_model->is_super()){ ?>
                      <div class="form-group">
                        <label for="name">Branch <span class="text-danger">*</span>
                        </label>
                          <select id="branch" class="form-control" name="branch" title="Select Branch" required="required" style="width:100%">
                            <option value=''>Select Branch</option>
                      <?php
                            foreach ($branch as $value) {
                      ?>
                            <option value="<?php echo $value['id']; ?>"><?php echo $value['name']?></option>

                      <?php } ?>
                          </select>
                      </div>
                      <?php  }else{$branch=$this->user_model->getbranch();?>
                          <input id="branch" name="branch" type="hidden" value="<?= $branch ?>">
                      <?php  } ?>
                      
                          <div class="form-group">
                              <label for="class">Class <span class="text-danger">*</span></label>
                              <select name="class" class="form-control" required id="class">
                                <option value="">Select Class</option>
                              </select>
                          </div>
                          <div class="form-group">
                              <label for="section">Section <span class="text-danger">*</span></label>
                              <select name="section" class="form-control" required id="section">
                                <option value="">Select Section</option>
                              </select>
                          </div>
                          <div class="form-group">
                              <label for="session">Session <span class="text-danger">*</span></label>
                              <select name="session" class="form-control" required id="session">
                                <option value="">Select Session</option>
                                <?php foreach ($session as $key => $value) {
                                  echo "<option value='".$value['id']."'>".$value['name']."</option>";
                                } ?>
                              </select>
                          </div>
                          <div class="form-group">
                              <label for="month">Month <span class="text-danger">*</span></label>
                              <input name="month" class="form-control" required id="month" type="month">
                          </div>
                          <div class="form-group pull-right">
                            <input type="submit" class="btn btn-success" id="classPrint" value="Print"></i>
                          </div>
                        </form>
                      </div>
                    </div>
                  </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>
     <div id='ajaxload' style='position:fixed;top:0;left:0;bottom:0; width:100%;height:100%;z-index:1000;background:rgba(2,132,130,0.5);display:none;'>
            <i class='fa fa-spinner fa-spin fa-4x' style='position: relative;top: 50%;left: 50%;margin-top: -50px;margin-left: -50px;'></i>
        </div>

    <!--Starting SMS Defaulters Modal -->
    <div class="modal fade" tabindex="-1" role="dialog" id="defaultersModal">
          <div class="modal-dialog" role="document">
            <div class="modal-content">
              <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">Send SMS to defaulters <span style="color:red;" id="all_defaulters"></span></h4>
              </div>
              <div class="modal-body">
                <div class="form-group row">
                    <!--<p>Are you sure ! to send SMS to all defaulter students of this branch.</p>-->
                  <label class="col-sm-2 col-form-label">Class</label>
                  <div class="col-sm-10">
                    <select name="def_class" id="def_class" class="form-control" required>
                      <option value="">Select Class</option>
                    </select>
                  </div>
                </div>
                <div class="form-group row">
                  <label class="col-sm-2 col-form-label">Section</label>
                  <div class="col-sm-10">
                    <select name="def_section" id="def_section" class="form-control" required>
                        <option value="">Select Section</option>
                    </select>
                  </div>
                </div>
              </div>
              <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                <button type="button" class="btn btn-success" id="SendSms">Send SMS</button>
              </div>
            </div><!-- /.modal-content -->
          </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->

<!--Starting SMS Reminder Modal -->
    <div class="modal fade" tabindex="-1" role="dialog" id="reminderModal">
          <div class="modal-dialog" role="document">
            <div class="modal-content">
              <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">Send for Fee Reminder</h4>
              </div>
              <div class="modal-body">
                <div class="form-group row">
                  <label class="col-sm-2 col-form-label">Class</label>
                  <div class="col-sm-10">
                    <select name="def_class" id="def_rclass" class="form-control" required>
                      <option value="">Select Class</option>
                    </select>
                  </div>
                </div>
                <div class="form-group row">
                  <label class="col-sm-2 col-form-label">Section</label>
                  <div class="col-sm-10">
                    <select name="def_section" id="def_rsection" class="form-control" required>
                        <option value="">Select Section</option>
                    </select>
                  </div>
                </div>
              </div>
              <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                <button type="button" class="btn btn-success" id="SendRSms">Send SMS</button>
              </div>
            </div><!-- /.modal-content -->
          </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->

    <!-- 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>
    <!-- Datatables -->
    <script src="<?php echo base_url()?>assets/select/js/select2.min.js"></script>
    <script  src="<?php echo base_url(); ?>assets/js/notify.js"></script>
    <script src="<?php echo base_url(); ?>assets/js/bootstrap-notify.js"></script>
    <!-- Form Validator-->
    <script type="text/javascript" src="<?php echo base_url(); ?>assets/js/bootstrapValidator.js"></script>
    <!-- Form Validator-->
    <link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/bootstrapValidator.css"/>

<script>

    <?php if($this->user_model->is_super()){ ?>
    $('#branch').select2({
     //selectOnClose: true,
    placeholder: "Select Branch",
    allowClear:true
    });
    <?php } ?>
    $('#class').select2({
    placeholder: "Select Class",
    allowClear:true
    })
    
    $('#section').select2({
     //selectOnClose: true,
    placeholder: "Select Section",
    allowClear:true
    });
    
    $('#session').select2({
    placeholder: "Select Session",
    allowClear:true
    });
</script>
    <script>
      $(document).ready(function() {
          
            $("#datatable-buttons").DataTable({
                "lengthMenu": [ [10, 25, 50, -1], [10, 25, 50, "All"] ],
                "pageLength": 10,
                 dom: "lBfrtip",
           buttons: [
                 {
                  extend: "print",
                  className: "btn-sm",
                   exportOptions: {
                       <?php  if($this->user_model->is_super()){ ?>
                        columns: [0,1,2,3,4,5,6,7,8,9,10,11],
                       <?php }else{?>
                       columns: [0,1,2,3,4,5,6,7,8,9,10,11],
                       <?php }?>
                        modifier: {
                            selected: true
                        }
                    }
                },
                {
                  extend: "copy",
                  className: "btn-sm",
                  exportOptions: {
                       <?php  if($this->user_model->is_super()){ ?>
                        columns: [0,1,2,3,4,5,6,7,8,9,10,11],
                       <?php }else{?>
                       columns: [0,1,2,3,4,5,6,7,8,9,10,11],
                       <?php }?>
                        modifier: {
                            selected: true
                        }
                    }
                },
                {
                  extend: "csv",
                  className: "btn-sm",
                  exportOptions: {
                       <?php  if($this->user_model->is_super()){ ?>
                        columns: [0,1,2,3,4,5,6,7,8,9,10,11],
                       <?php }else{?>
                       columns: [0,1,2,3,4,5,6,7,8,9,10,11],
                       <?php }?>
                        modifier: {
                            selected: true
                        }
                    }
                },
                {
                  extend: "excel",
                  className: "btn-sm",
                  exportOptions: {
                       <?php  if($this->user_model->is_super()){ ?>
                        columns: [0,1,2,3,4,5,6,7,8,9,10,11],
                       <?php }else{?>
                       columns: [0,1,2,3,4,5,6,7,8,9,10,11],
                       <?php }?>
                        modifier: {
                            selected: true
                        }
                    }
                },
                {
                extend: 'pdfHtml5',
                className: "btn-sm",
                title: '',
                exportOptions: {
                       <?php  if($this->user_model->is_super()){ ?>
                        columns: [0,1,2,3,4,5,6,7,8,9,10,11],
                       <?php }else{?>
                       columns: [0,1,2,3,4,5,6,7,8,9,10,11],
                       <?php }?>
                        modifier: {
                            selected: true
                        }
                    }
                },
              ],
              responsive: true
            });
        
      });
    </script>
    <!-- /Datatables -->
        <script>
      $(function(){
        $(document).on("click","#go-search",function(){
          var p = 1;
          var s = $("#search").val();
          if(s=="")
            s="all";
          window.location = "<?php echo base_url();?>voucher/listv/"+s+"/"+p;
        });
        $(function(){
          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);
          });
        });
        $(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);
          });
        });
        $(document).on("click","#classPrint",function(e){
          var b = $("#branch").val();
          var c = $("#class").val();
          var s = $("#section").val();
          var sess = $("#session").val();
          var m = $("#month").val();
          if(b=="")
          {
            alert("Select Branch First");
          }else if(c=="")
          {
            alert("Select Class First");
          }else if(s=="")
          {
            alert("Select Section First");
          }else if(sess=="")
          {
            alert("Select Session First");
          }else if(m=="")
          {
            alert("Select Month First");
          }else{
            var win = window.open("<?php echo $base_url; ?>voucher/classPrint/"+b+"/"+c+"/"+s+"/"+sess+"/"+m, '_blank');
            if (win) {
                win.focus();
            } else {
                alert('Please allow popups for this website');
            }
          } 
          e.preventDefault();
        });

        $(document).on("click","#sms_defaulters",function(){
            $('#defaultersModal').modal();
            
            $.get("<?php echo base_url(); ?>load/classs_defaulter/role/"+"<?php echo $this->user_model->getBranch(); ?>",{},function(d){
                    $("#all_defaulters").html('('+d+')');
            });
            $.get("<?php echo base_url(); ?>load/classs/role/"+"<?php echo $this->user_model->getBranch(); ?>",{},function(d){
                    var pre = '<option value="">Select Class</opiton>';
                    $("#def_class").html(pre+d);
            });
        });
        
        $(document).on("click","#sms_reminder",function(){
            $('#reminderModal').modal();
            $.get("<?php echo base_url(); ?>load/classs/role/"+"<?php echo $this->user_model->getBranch(); ?>",{},function(d){
                    var pre = '<option value="">Select Class</opiton>';
                    $("#def_rclass").html(pre+d);
            });
        });
        
        $(document).on("change","#def_class",function(){
          var value=$(this).val();
          $.get("<?php echo base_url(); ?>load/classs_defaulter_sclass/role/"+value,{},function(d){
                    $("#all_defaulters").html('('+d+')');
            });
            $.get("<?php echo base_url(); ?>load/section/role/"+value,{},function(d){
                  var pre = '<option value="">Select Section</opiton>';
                  $("#def_section").html(pre+d);
            });
        });
        
        $(document).on("change","#def_section",function(){
            var value=$(this).val();
          $.get("<?php echo base_url(); ?>load/classs_defaulter_ssection/role/"+value,{},function(d){
                    $("#all_defaulters").html('('+d+')');
            });
            
            // if($('#def_class').val()!='' && $('#def_section').val()!='')
            //   $('#SendSms').prop('disabled',false);
        });
        
        $(document).on("change","#def_rclass",function(){
          var value=$(this).val();
            $.get("<?php echo base_url(); ?>load/section/role/"+value,{},function(d){
                  var pre = '<option value="">Select Section</opiton>';
                  $("#def_rsection").html(pre+d);
            });
        });
        
        $(document).on("change","#def_rsection",function(){
            // if($('#def_rclass').val()!='' && $('#def_rsection').val()!='')
            //   $('#SendRSms').prop('disabled',false);
        });
     
        $(document).on("click","#SendSms",function(){
            var classs=$('#def_class').val();
            var section=$('#def_section').val();
            window.location = "<?php echo base_url(); ?>"+"Voucher/sms_defaulters/"+classs+"/"+section;
        });
        
        $(document).on("click","#SendRSms",function(){
       
            var classs=$('#def_rclass').val();
            var section=$('#def_rsection').val();
            window.location = "<?php echo base_url(); ?>"+"Voucher/sms_reminder/"+classs+"/"+section;
        });

      });
    </script>
      <script>
window.setTimeout(function() {
$(".alert").fadeTo(500, 0).slideUp(500, function(){
    $(this).remove(); 
});
}, 3000);
        </script>
    <script type="text/javascript">
      $('#date').change(function(){
        var value=$('#date').val();
           //$('#send').hide();
            $(document).ajaxStart(function() {
                $('#ajaxload').show();
            });
            
           $.ajax({
         url: '<?php echo base_url(); ?>Voucher/getStudent/'+value,
        data: {},
        success: function (result) {
            $(document).ajaxStop(function() {
           $('#ajaxload').hide();
      });
            if(result!=""){
              $("#datatable-buttons").dataTable().fnDestroy();
              setTimeout(function(){
                  $("tbody.center").html(result);
                  $("#datatable-buttons").DataTable({
                "lengthMenu": [ [10, 25, 50, -1], [10, 25, 50, "All"] ],
                "pageLength": 10,
                 dom: "lBfrtip",
           buttons: [
                 {
                  extend: "print",
                  className: "btn-sm",
                   exportOptions: {
                       <?php  if($this->user_model->is_super()){ ?>
                        columns: [0,1,2,3,4,5,6,7,8,9,10,11],
                       <?php }else{?>
                       columns: [0,1,2,3,4,5,6,7,8,9,10,11],
                       <?php }?>
                        modifier: {
                            selected: true
                        }
                    }
                },
                {
                  extend: "copy",
                  className: "btn-sm",
                  exportOptions: {
                       <?php  if($this->user_model->is_super()){ ?>
                        columns: [0,1,2,3,4,5,6,7,8,9,10,11],
                       <?php }else{?>
                       columns: [0,1,2,3,4,5,6,7,8,9,10,11],
                       <?php }?>
                        modifier: {
                            selected: true
                        }
                    }
                },
                {
                  extend: "csv",
                  className: "btn-sm",
                  exportOptions: {
                       <?php  if($this->user_model->is_super()){ ?>
                        columns: [0,1,2,3,4,5,6,7,8,9,10,11],
                       <?php }else{?>
                       columns: [0,1,2,3,4,5,6,7,8,9,10,11],
                       <?php }?>
                        modifier: {
                            selected: true
                        }
                    }
                },
                {
                  extend: "excel",
                  className: "btn-sm",
                  exportOptions: {
                       <?php  if($this->user_model->is_super()){ ?>
                        columns: [0,1,2,3,4,5,6,7,8,9,10,11],
                       <?php }else{?>
                       columns: [0,1,2,3,4,5,6,7,8,9,10,11],
                       <?php }?>
                        modifier: {
                            selected: true
                        }
                    }
                },
                {
                extend: 'pdfHtml5',
                className: "btn-sm",
                title: '',
                exportOptions: {
                       <?php  if($this->user_model->is_super()){ ?>
                        columns: [0,1,2,3,4,5,6,7,8,9,10,11],
                       <?php }else{?>
                       columns: [0,1,2,3,4,5,6,7,8,9,10,11],
                       <?php }?>
                        modifier: {
                            selected: true
                        }
                    }
                },
              ],
              responsive: true
            });
              },500);
            
          
          }else{
            $("tbody.center").html(result);}
                }
                });
       });

      /*$(document).ready(function() {
    $('#datatable-buttons').DataTable( {
        "pagingType": "full_numbers"
    } );
} );*/
    </script>
  </body>
</html>