<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-bordered table-striped">
                    <thead>
                        <tr>
                            <th colspan="15" class="text-success text-center ">
                                Fee collection on <?php echo date('d-M-Y');?>
                            </th>
                        </tr>
                        <tr>
                            <th>#</th>
                            <th>Fee No.</th>
                            <th>Name</th>
                            <th>Father Name</th>
                            <th>Fee Type</th>
                            <th>Est. Amount</th>
                            <th>Prev Bal.</th>
                            <th>Prev. Extra</th>
                            <th>Discount</th>
                            <th>Received Amount</th>
                            <th>Bill Book No.</th>
                            <th>Course</th>
                            <th>Date</th>
                            <th>Rec. By</th>
                            <th>Invoice</th>
                        </tr>
                    </thead>
                    <tbody>
                        
                        <?php 
                        $count=0;
                        $rec_total=0;
                        $staff_id=$this->session->userdata('tid');
                        $fee_date=date('Y-m-d');
                        $fee_table='student_fee';
                        $my_collection=$this->NewFeeModel->get_userwise_day_fee_collection($staff_id,$fee_date,$fee_table);
                        if($my_collection){
                            foreach($my_collection as $collection){
                                $sid=$collection['sid'];
                                $student_table='student';
                                $get_student_info=$this->NewFeeModel->get_item_data($sid,$student_table);
                                $count=$count + 1;
                                $rec_total=$rec_total + $collection['received_amount'];
                        ?>
                                <tr>
                                    <td><?php echo $count;?></td>
                                    <td><?php echo $collection['fee_no'];?></td>
                                    <?php
                                    if($get_student_info){
                                        foreach($get_student_info as $student_info){
                                    ?>
                                    <td><?php echo $student_info['student_name'];?></td>
                                    <td><?php echo $student_info['father_name'];?></td>
                                    <?php
                                        }
                                    }
                                    ?>
                                    <td><?php echo $collection['fee_type'];?></td>
                                    <td><?php echo $collection['estimate_amount'];?></td>
                                    <td><?php echo $collection['balance_amount_added'];?></td>
                                    <td><?php echo $collection['extra_amount_used'];?></td>
                                    <td><?php echo $collection['discount'];?></td>
                                    <td class="text-success"><?php echo $collection['received_amount'];?></td>
                                    <td><?php echo $collection['bill_book_number'];?></td>
                                    <td><?php echo $collection['fee_no'];?></td>
                                    <td><?php echo date('d-M-Y',strtotime($collection['fee_date']));?></td>
                                    <td>
                                        <?php 
                                        $tid=$collection['tid'];
                                        $staff_table='school_staff';
                                        $get_staff_info=$this->NewFeeModel->get_item_data($tid,$staff_table);
                                        if($get_staff_info){
                                            foreach($get_staff_info as $staff_info){
                                                echo $staff_info['salutation']; echo " "; echo $staff_info['name'];
                                            }
                                        }
                                        ?>
                                    </td>
                                    <td>
                                        <a href="<?php echo base_url();?>Fee/invoice/<?php echo $collection['fee_no'];?>">
                                            <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-printer-fill" viewBox="0 0 16 16">
                                                <path d="M5 1a2 2 0 0 0-2 2v1h10V3a2 2 0 0 0-2-2H5zm6 8H5a1 1 0 0 0-1 1v3a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1z"/>
                                                <path d="M0 7a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2h-1v-2a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2H2a2 2 0 0 1-2-2V7zm2.5 1a.5.5 0 1 0 0-1 .5.5 0 0 0 0 1z"/>
                                            </svg>
                                        </a>
                                    </td>
                                </tr>
                        <?php
                            }
                        }
                        ?>
                        <tr>
                            <th colspan="9">Total</th>
                            <th class="text-success"><?php echo $rec_total;?></th>
                            <th colspan="5"></th>
                        </tr>
                    </tbody>
                </table>
                
            </div>
            
        </div>
    </div>
</div>