<div class="container bg-white mt-3 mb-3 pt-3  pb-3">
    <div class="row">
        <div class="col-sm-12">
            
            <div class="table-responsive">
                <table class="table table-bordered table-striped">
                    <thead>
                        <tr>
                            <th>#</th>
                            <th>Name</th>
                            <th>Invoices</th>
                            <th>Received</th>
                            <th>Discount</th>
                        </tr>
                    </thead>
                    <tbody>
                        
                        <?php 
                        $count=0;
                        $table='school_staff';
                        $get_fee_admins_data=$this->NewFeeModel->get_data($table);
                        if($get_fee_admins_data){
                            foreach($get_fee_admins_data as $data){
                                if($data['fee_permission'] ==1 && $data['status'] ==0){
                                    $staff_id=$data['id'];
                                    $count=$count + 1;
                                    $invoices_count=0;
                                    $fee_received=0;
                                    $discount_given=0;
                                    $fee_date=date('Y-m-d');
                                    $fee_table='student_fee';
                                    $get_today_fee_invoices=$this->NewFeeModel->get_staf_fee_collection_by_date($staff_id,$fee_date,$fee_table);
                                    if($get_today_fee_invoices){
                                        foreach($get_today_fee_invoices as $fee_invoices){
                                            $invoices_count=$invoices_count + 1;
                                            $fee_received=$fee_received + $fee_invoices['received_amount'];
                                            $discount_given=$discount_given + $fee_invoices['discount'];
                                        }
                                    }
                                ?>
                        <tr>
                            <td><?php echo $count;?></td>
                            <td><?php echo $data['salutation']; echo " "; echo $data['name'];?></td>
                            <td><?php echo $invoices_count;?></td>
                            <td><?php echo $fee_received;?></td>
                            <td><?php echo $discount_given;?></td>
                        </tr>
                                <?php
                                }
                            }
                        }
                        ?>
                        
                    </tbody>
                </table>
            </div>
            
        </div>
    </div>
</div>