<?php
include_once 'header.php';
?>

<div class="page-wrapper">
        <!-- ============================================================== -->
        <!-- Bread crumb and right sidebar toggle -->
        <!-- ============================================================== -->
        <div class="page-breadcrumb">
          <div class="row">
            <div class="col-12 d-flex no-block align-items-center">
              <h4 class="page-title">All Student Fee Report</h4>
              <div class="ms-auto text-end">
                <nav aria-label="breadcrumb">
                  <ol class="breadcrumb">
                    <li class="breadcrumb-item"><a href="#">Dashboard</a></li>
                    <li class="breadcrumb-item active" aria-current="page">
                     Report
                    </li>
                  
                  </ol>
                </nav>
              </div>
            </div>
          </div>
        </div>
        <!-- ============================================================== -->
        <!-- End Bread crumb and right sidebar toggle -->
		<div class="container-fluid">
             <form action="core/reportFee.php" method="post">
		                <div class="row" style="background-color:white;">   <h1></h1>
													                          <div class="col-md-4">                                                                                                               
                                                                <div class="card-body">
                                                                    <div class="form-group row">
                                                                            <label for="s_date" class="col-sm-3 text-end control-label col-form-label">Student ID</label>
                                                                            <div class="col-sm-9">
                                                                                <input type="text" class="form-control date-inputmask" id="s_id" placeholder="Please Enter Student ID!"/>
                                                                            </div>
                                                                    </div>
                                                                </div>                                                                                              
                                                    </div>  
													                          <div class="col-md-4">                                                                                                               
                                                                <div class="card-body">
                                                                    <div class="form-group row">
                                                                            <label for="s_date" class="col-sm-3 text-end control-label col-form-label">St. Name</label>
                                                                            <div class="col-sm-9">
                                                                                <input type="text" class="form-control date-inputmask" id="s_name" readonly/>
                                                                            </div>
                                                                    </div>
                                                                </div>                                                                                              
                                                    </div> 
													                          <div class="col-md-4">                                                                                                               
                                                                <div class="card-body">
                                                                    <div class="form-group row">
                                                                            <label for="batch_no" class="col-sm-3 text-end control-label col-form-label">Batch No</label>
                                                                            <div class="col-sm-9">
                                                                                <select id="batch_no" class="form-control" name="batch_no">
                                                                                  <option></option>
                                                                                </select>
                                                                            </div>
                                                                    </div>
                                                                </div>                                                                                              
                                                    </div> 
                                                    <div class="col-md-6">                                                                                                               
                                                                <div class="card-body">
                                                                    <div class="form-group row">
                                                                            <label for="s_date" class="col-sm-3 text-end control-label col-form-label">From Date</label>
                                                                            <div class="col-sm-9">
                                                                                <input type="date" class="form-control date-inputmask" id="s_date" name="s_date" value="<?php echo date('Y-m-d'); ?>"/>
                                                                            </div>
                                                                    </div>
                                                                </div>                                                                                              
                                                    </div>  
													                          <div class="col-md-6">                                                                                                               
                                                                <div class="card-body">
                                                                    <div class="form-group row">
                                                                            <label for="e_date" class="col-sm-3 text-end control-label col-form-label">To Date</label>
                                                                            <div class="col-sm-9">
                                                                                <input type="date" class="form-control date-inputmask" id="e_date" name="e_date" value="<?php echo date('Y-m-d'); ?>"/>
                                                                            </div>
                                                                    </div>
                                                                </div>                                                                                              
                                                    </div>  
													<div class="border-top">
														<div class="card-body">
                                <button type="button" id="view" class="btn btn-info">
                                  View Report
                                </button>
                                <button type="submit" id="download" class="btn btn-primary">
                                  Download Report
                                </button>
														</div>
														
													</div>                                               
                                         
						</div>
        </form>
		</div>
          <!-- ============================================================== -->
          <!-- End PAge Content -->
          <!-- ============================================================== -->
          <!-- ============================================================== -->

<!-- The Modal -->
<div class="modal" id="myModal">
  <div class="modal-dialog" style="max-width: 60%">
    <div class="modal-content">
      <!-- Modal Header -->
      <div class="modal-header">
        <h4 class="modal-title">Attendence Report</h4>
        <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
      </div>
      <!-- Modal body -->
      <div class="modal-body">
                                                      <table cellspacing="0" cellpadding="0" border="0" width="100%">
                                                        <tr><td>
                                                        <div class="table-responsive-sm" style="width:100%; height:200px; overflow:auto;">
                                                            <table id="" class="table">
                                                                <thead class="table-light">
                                                                <tr>
                                                                    <th scope="col">S.No</th>
                                                                   
                                                                    <th scope="col">Student Name</th>                                                               
                                                                    <th scope="col">Payment Mode</th>
                                                                    <th scope="col">Amount</th>
                                                                    <th scope="col">Date</th>
                                                                
                                                                </tr>
                                                                </thead>
                                                                <tbody id="tbody1">                       
                                                                    
                                                                </tbody>                  
                                                            </table>
                                                        </div> 
                                                        </td></tr>    
                                                       </table>  
      </div>
      <!-- Modal footer -->
      <div class="modal-footer">
               
      </div>

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



          <footer class="footer text-center">
          All Rights Reserved by ECI. Designed and Developed by
          <a href="https://www.ntlogix.in">NTLogix</a>.
        </footer>
       
   <!-- All Jquery -->
    <!-- ============================================================== -->
    <script src="../assets/libs/jquery/dist/jquery.min.js"></script>
    <!-- Bootstrap tether Core JavaScript -->
    <script src="../assets/libs/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
    <!-- slimscrollbar scrollbar JavaScript -->
    <script src="../assets/libs/perfect-scrollbar/dist/perfect-scrollbar.jquery.min.js"></script>
    <script src="../assets/extra-libs/sparkline/sparkline.js"></script>
    <!--Wave Effects -->
    <script src="../dist/js/waves.js"></script>
    <!--Menu sidebar -->
    <script src="../dist/js/sidebarmenu.js"></script>
    <!--Custom JavaScript -->
    <script src="../dist/js/custom.min.js"></script>
    <!-- this page js -->
    <script src="../assets/extra-libs/multicheck/datatable-checkbox-init.js"></script>
    <script src="../assets/extra-libs/multicheck/jquery.multicheck.js"></script>
    <script src="../assets/extra-libs/DataTables/datatables.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
   
    <script>
      var msg;
      var icon;
      
      function showAlert(msg,icon) {
          Swal.fire({
              title: msg,
              icon: icon,
              confirmButtonText: 'Close'
          });
      }
      
      $(document).ready(function(){
              $("#zero_config").DataTable();

                $('#view').click(function(e){ 
                    e.preventDefault();
                                     
                    setTimeout(function(){$("#myModal").modal('show');}, 100);
                });
             
                  $('#print').click(function () {
                
                  });
                  $('#s_id').change(function(){
                            var name = $("#s_id").val();
                            $.ajax({
                                url:"core/fetch_student.php",
                                method:"post",
                                data: {
                                    name:name,                          
                                },
                                success: function(data){
                                  // $('#form')[0].reset();  
                                    //$('#add_data_Modal').modal('hide');  
                                    $('#s_name').val(data[0].name);
                                                                                               
                                    if(data===0)
                                    {                                   
                                    $('#name').val('');
                                                                   
                                    $('#batch_no').val(null).trigger('change');                               
                                    }
                                }
                            }); 
                            var id = $("#s_id").val();
                            $.ajax({
                                url:"core/fetch_asignCourse.php",
                                method:"post",
                                data: {
                                    id:id,                          
                                },
                                success: function(data){                                
                                      if(data)
                                      {
                                        $("#batch_no").empty();
                                        $.each(data, function(key, value) {
                                                $('#batch_no')
                                                      .append($('<option>', { value : value })
                                                      .text(value));
                                            });
                                       }
                                          
                                }
                            });                 
                });
                $('#s_id').keypress(function (e) {    
    
                  var charCode = (e.which) ? e.which : event.keyCode    

                  if (String.fromCharCode(charCode).match(/[^0-9]/g))    

                      return false;                        

              });
              $('#view').click(function(){
                   var date1 = $("#s_date").val();
                   var date2 = $("#e_date").val();
                   var batch_no = $("#batch_no").val();
                 
                 
                               $.ajax({
                                      url:"core/fetch_attendence2.php",
                                      method:"post",
                                      data: {
                                          date1:date1,
                                          date2:date2,
                                          batch_no:batch_no,
                                          s_date:'reportFee',                                
                                      },
                                      success: function(data){ 
                                      
                                        var c=0;
                                          $('#tbody1').empty();
                                          $.each(data,function(key,value){  
                                                c=c+1;                                  
                                                $('#tbody1').append('<tr><td>'+c+'</td><td>'+value['student_name']+'</td><td>'+value['payment_mode']+'</td><td>'+value['amount']+'</td><td>'+value['payment_date']+'</td></tr>');                                                         
                                              })
                                      }
                                  });
                        $("#myModal1").modal('show');                
               });

           
        
        });
    
</script>

  </body>
</html>