<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="1">Day Fee Collection </th>
                            <th colspan="3"><input type="date" style="padding:5px;" class="form-control" id="today-date"></th>
                            <th><button id="date_info" class="btn btn-sm btn-success">Fetch</button></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 today_fee_date="<?php echo date('Y-m-d');?>";
        // today_fee_invoices(today_fee_date);
        
        var tid=<?php echo $this->session->userdata('tid');?>;
        // today_fee_invoices(today_fee_date);
        user_wise_fee_collection(today_fee_date,tid);
        // opening_fee_collection_for_today(today_fee_date);
        // admission_and_enquiry_fee_for_today(today_fee_date);
        $("#date_info").click(function(){
            // alert();
            var today_fee_date=$("#today-date").val();
            var tid=<?php echo $this->session->userdata('tid');?>;
            // today_fee_invoices(today_fee_date);
            user_wise_fee_collection(today_fee_date,tid);
            // opening_fee_collection_for_today(today_fee_date);
            // admission_and_enquiry_fee_for_today(today_fee_date);
        });
        // function today_fee_invoices(today_fee_date){
        // // alert(today_fee_date);
        
        //     $.ajax({

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

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

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

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