<?php
// $day=$this->uri->segment('3');
// $month=$this->uri->segment('4');
// $year=$this->uri->segment('5');


$from_date=$this->uri->segment('3');
$to_date=$this->uri->segment('4');

$acedemic_session=$this->session->userdata('acedemic_session');
// $dateObj=DateTime::createFromFormat('!m',$month);
// $monthName = $dateObj->format('F');


// $date = new DateTime();
// $date->setDate($year, $month, $day);
// $fee_date=date('Y-m-d',strtotime($date->format('Y-m-d')));
?>

<div class="container-fluid mt-3 mb-3 bg-white">
    <div class="row">
        <div class="col-sm-12 pt-3 pb-3">
            
            <ul class="breadcrumb">
                <li class="breadcrumb-item">Home</li>
                <li class="breadcrumb-item"><a href="<?php echo base_url();?>FeeManagement">Fee Collection</a></li>
                <!--<li class="breadcrumb-item"><a href="<?php echo base_url();?>FeeManagement/month_data/<?php // echo $acedemic_session; echo "/"; echo $month;?>"><?php // echo $monthName; echo "-"; echo $year;?></a></li>-->
                <!--<li class="breadcrumb-item"><?php // echo $day;?></li>-->
            </ul>
            <?php // echo $from_date; ?>
            <div class="table-responsive">
                <table class="table table-bordered table-striped">
                    <thead>
                        <tr>
                            <th>#</th>
                            <th>Student Name</th>
                            <th>Father Name</th>
                            <th>Class</th>
                            <th>Contact No.</th>
                            <th>Received Amount</th>
                            <th>Payment Mode</th>
                            <!--<th></th>-->
                            <th>View</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php 
                        $count=0;
                        $fee_table='student_fee';
                        // $today_collection=$this->NewFeeModel->get_date_fee_collection($day,$month,$year,$acedemic_session);
                        // $today_collection=$this->NewFeeModel->day_fee_collection($fee_date,$acedemic_session,$fee_table);
                        
                        $today_collection=$this->NewFeeModel->get_date_range_fee_collection($from_date,$to_date,$acedemic_session);
                        if($today_collection){
                            foreach($today_collection as $collection){
                                $sid=$collection['sid'];
                                $student_table='student';
                                $get_student_profile=$this->NewFeeModel->get_item_data($sid,$student_table);
                                if($get_student_profile){
                                    foreach($get_student_profile as $student){
                                        $count=$count + 1;
                        ?>
                        <tr>
                            <td><?php echo $count;?></td>
                            <td><?php echo $student['student_name'];?></td>
                            <td><?php echo $student['father_name'];?></td>
                            <td><?php echo $student['class']; echo " "; echo $student['course_stream'];?></td>
                            <td><?php echo $student['contact_no'];?></td>
                            <td class="text-success font-weight-bold"><?php echo $collection['received_amount'];?></td>
                            <td style="text-transform:uppercase;"><?php echo $collection['payment_mode'];?></td>
                            <!--<td></td>-->
                            <td><a href="<?php echo base_url();?>Fee/invoice/<?php echo $collection['fee_no'];?>" class="btn btn-sm btn-primary" target="_blank">View</a></td>
                        </tr>                                
                                <?php
                                    }
                                }
                            }
                        }
                        ?>

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