<style>
    .w_33_g{
        width:33%;
        float:left;
        padding:0px 10px;
    }
    
    .w_34_g{
        width:33%;
        float:left;
        padding:0px 10px;
    }
</style>
<div class="container-fluid mt-3 mb-3 bg-white">
    <div class="row">
        <div class="col-sm-12 pt-3 pb-3">
            
            <div class="table-responsive">
                <table class="table table-striped table-bordered">
                    <thead>
                        <tr>
                            <th colspan="5">Day Fee Collection </th>
                        </tr>    
                        <tr>
                            <th colspan="5">
                                <div class="form-group w_33_g">
                                    <label>From Date :</label>
                                    <input type="date" style="padding:5px;" class="form-control from_date" id="today-date" value="<?php echo date("Y-m-d"); ?>">
                                </div>
                                
                                <div class="form-group w_33_g">
                                    <label>To Date :</label>
                                    <input type="date" style="padding:5px;" class="form-control to_date" id="today-date" value="<?php echo date("Y-m-d"); ?>">    
                                </div>
                                
                                <div class="form-group w_34_g">
                                    <label>&nbsp;&nbsp;</label><br>
                                    <button id="date_info" class="btn btn-success">Fetch</button>    
                                </div>
                                
                                
                                
                                
                            </th>
                        </tr>
                    </thead>
                    <tbody id="today-fee-data">

                        
                    </tbody>
                </table>
            </div>

            
            <div class="table-responsive" id="admission_and_enquiry_fee_for_today">
                
            </div>
            
            <div class="table-responsive" id="opening_fee_collection_for_today">
                
            </div>
            
            <div class="table-responsive" id="user_wise_collection">
                
            </div>            
            
        </div>
    </div>
</div>


<script>
    $(document).ready(function(){
        var from_date="<?php echo date('Y-m-d');?>";
        var to_date="<?php echo date('Y-m-d');?>";
        var today_fee_date="<?php echo date('Y-m-d');?>";
        // today_fee_invoices(today_fee_date);
        
        
        today_fee_invoices(from_date,to_date);
        user_wise_fee_collection(from_date,to_date);
        opening_fee_collection_for_today(from_date,to_date);
        admission_and_enquiry_fee_for_today(from_date,to_date);
        $("#date_info").click(function(){
            // alert();
            
            var from_date=$(".from_date").val();
            var to_date=$(".to_date").val();
            
            var today_fee_date=$("#today-date").val();
            // today_fee_invoices(today_fee_date);
            // user_wise_fee_collection(today_fee_date);
            // opening_fee_collection_for_today(today_fee_date);
            // admission_and_enquiry_fee_for_today(today_fee_date);
            
            
            today_fee_invoices(from_date,to_date);
            user_wise_fee_collection(from_date,to_date);
            opening_fee_collection_for_today(from_date,to_date);
            admission_and_enquiry_fee_for_today(from_date,to_date);
        });
        function today_fee_invoices(from_date,to_date){
        // alert(today_fee_date);
        
            $.ajax({

                url: '<?php echo base_url(); ?>Fee/today_fee_collection/',
                type: 'POST',
                data: {from_date:from_date,to_date:to_date},
                success: function(data){
                    // $("#previous_balance").html(data);
                    $("#today-fee-data").html(data);
                    // alert(data);
                }
            }); 
        }
        
        function user_wise_fee_collection(from_date,to_date){
            $.ajax({

                url: '<?php echo base_url(); ?>Fee/user_wise_fee_collection/',
                type: 'POST',
                data: {from_date:from_date,to_date:to_date},
                success: function(data){
                    // $("#previous_balance").html(data);
                    $("#user_wise_collection").html(data);
                    // alert(data);
                }
            });
        }
        
        function opening_fee_collection_for_today(from_date,to_date){
            $.ajax({

                url: '<?php echo base_url(); ?>Fee/opening_fee_collection_for_today/',
                type: 'POST',
                data: {from_date:from_date,to_date:to_date},
                success: function(data){
                    // $("#previous_balance").html(data);
                    $("#opening_fee_collection_for_today").html(data);
                    // alert(data);
                }
            });
        }
        
        function admission_and_enquiry_fee_for_today(from_date,to_date){
            $.ajax({

                url: '<?php echo base_url(); ?>Fee/admission_and_enquiry_fee_for_today/',
                type: 'POST',
                data: {from_date:from_date,to_date:to_date},
                success: function(data){
                    // $("#previous_balance").html(data);
                    $("#admission_and_enquiry_fee_for_today").html(data);
                    // alert(data);
                }
            });
        }
        
    });
</script>