<?php
$apr_status=0;
$may_status=0;
$jun_status=0;
$jul_status=0;
$aug_status=0;
$sep_status=0;
$oct_status=0;
$nov_status=0;
$dec_status=0;
$jan_status=0;
$feb_status=0;
$mar_status=0;

$apr_fee_status=0;
$may_fee_status=0;
$jun_fee_status=0;
$jul_fee_status=0;
$aug_fee_status=0;
$sep_fee_status=0;
$oct_fee_status=0;
$nov_fee_status=0;
$dec_fee_status=0;
$jan_fee_status=0;
$feb_fee_status=0;
$mar_fee_status=0;

            
$fare=0;
$extra_fare=0;
$sid=$this->uri->segment('3');
$acedemic_session=$this->session->userdata('acedemic_session');


$get_student_fee_info=$this->TransportModel->get_transport_fee($sid,$acedemic_session);
if($get_student_fee_info){
    foreach($get_student_fee_info as $fee_info){
        $apr_fee_status=$apr_fee_status + $fee_info['april'];
        $may_fee_status=$may_fee_status + $fee_info['may'];
        $jun_fee_status=$jun_fee_status + $fee_info['june'];
        $jul_fee_status=$jul_fee_status + $fee_info['july'];
        $aug_fee_status=$aug_fee_status + $fee_info['august'];
        $sep_fee_status=$sep_fee_status + $fee_info['september'];
        $oct_fee_status=$oct_fee_status + $fee_info['october'];
        $nov_fee_status=$nov_fee_status + $fee_info['november'];
        $dec_fee_status=$dec_fee_status + $fee_info['december'];
        $jan_fee_status=$jan_fee_status + $fee_info['january'];
        $feb_fee_status=$feb_fee_status + $fee_info['february'];
        $mar_fee_status=$mar_fee_status + $fee_info['march'];
    }
}
$get_student_transport_info=$this->TransportModel->get_student_info_for_ac_sesssion($sid,$acedemic_session);
if($get_student_transport_info){
    foreach($get_student_transport_info as $student_transport_info){
        $fare=$student_transport_info['fare'];
        $extra_fare=$student_transport_info['extra_fare'];
        $total_fare=$fare + $extra_fare;
        $apr_status=$apr_status + $student_transport_info['april'];
        $may_status=$may_status + $student_transport_info['may'];
        $jun_status=$jun_status + $student_transport_info['june'];
        $jul_status=$jul_status + $student_transport_info['july'];
        $aug_status=$aug_status + $student_transport_info['august'];
        $sep_status=$sep_status + $student_transport_info['september'];
        $oct_status=$oct_status + $student_transport_info['october'];
        $nov_status=$nov_status + $student_transport_info['november'];
        $dec_status=$dec_status + $student_transport_info['december'];
        $jan_status=$jan_status + $student_transport_info['january'];
        $feb_status=$feb_status + $student_transport_info['february'];
        $mar_status=$mar_status + $student_transport_info['march'];
    }
}

?>

<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"><a href="<?php echo base_url();?>Welcome">Home</a></li>
                <li class="breadcrumb-item"><a href="<?php echo base_url();?>Transport">Tranport</a></li>
                <li class="breadcrumb-item"><a href="<?php echo base_url();?>Transport/students">Students</a></li>
                <li class="breadcrumb-item active">Fee</li>
            </ul>
        
            
            <div class="table-responsive">
                <table class="table table-bordered table-striped">
                    <tbody>
                        
                        <tr><th colspan="2" class="text-center">Student Information</th></tr>
                        <?php
                        $student_table='student';
                            $get_student_info=$this->TransportModel->get_item_data($sid,$student_table);
                            if($get_student_info){
                                foreach($get_student_info as $student_info){
                            ?>
                            <tr>
                                <th>Student Name</th>
                                <td><?php echo $student_info['student_name'];?></td>
                            </tr>
                            <tr>
                                <th>Father's Name</th>
                                <td><?php echo $student_info['father_name'];?></td>
                            </tr>
                            <tr>
                                <th>Mobile Number</th>
                                <td><?php echo $student_info['contact_no'];?></td>
                            </tr>
                            <tr>
                                <th>Address</th>
                                <td><?php echo $student_info['address'];?></td>
                            </tr>
                            <?php
                                }
                            }
                        ?>
                        
                    </tbody>
                </table>
            </div>
            <div class="table-responsive mb-3">
                <table class="table table-bordered table-striped">
                    <thead>
                        <tr>
                            <th>Month</th>
                            <th>Status</th>
                            <th>Fee</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td>April</td>
                            
                            <?php
                            if($apr_status == 1){
                                echo '<td><span class="text-success">Active</span></td>';
                                if($apr_fee_status == 1){
                                    // echo '<td class="text-success">Paid</td>';    
                                    echo "<td class='text-success'>".$total_fare."</td>";
                                }else{echo '<td class="text-warning">Pending</td>';}
                                
                                // echo '<td><a href="'.base_url().'Transport/pay_fee/'.$sid.'" class="btn btn-sm btn-info">Pay</a></td>';
                                
                            }else if($apr_status ==0){
                                echo "<td><span class='text-warning'>Inactive</span></td>";
                                echo "<td>...</td>";
                            }
                            ?>
                            
                            
                        </tr>
                        <tr>
                            <td>May</td>
                            <?php
                            if($may_status == 1){
                                echo '<td><span class="text-success">Active</span></td>';
                                if($may_fee_status == 1){
                                    echo "<td class='text-success'>".$total_fare."</td>";
                                }else{echo '<td class="text-warning">Pending</td>';}
                                
                            }else if($may_status ==0){
                                echo "<td><span class='text-warning'>Inactive</span></td>";
                                echo "<td>...</td>";
                            }
                            ?>
                        </tr>
                        <tr>
                            <td>June</td>
                            <?php
                            if($jun_status == 1){
                                echo '<td><span class="text-success">Active</span></td>';
                                if($jun_fee_status == 1){
                                    echo "<td class='text-success'>".$total_fare."</td>";
                                }else{echo '<td class="text-warning">Pending</td>';}
                                
                            }else if($jun_status ==0){
                                echo "<td><span class='text-warning'>Inactive</span></td>";
                                echo "<td>...</td>";
                            }
                            ?>
                        </tr>
                        <tr>
                            <td>July</td>
                            <?php
                            if($jul_status == 1){
                                echo '<td><span class="text-success">Active</span></td>';
                                if($jul_fee_status == 1){
                                    echo "<td class='text-success'>".$total_fare."</td>";
                                }else{echo '<td class="text-warning">Pending</td>';}
                                
                            }else if($jul_status ==0){
                                echo "<td><span class='text-warning'>Inactive</span></td>";
                                echo "<td>...</td>";
                            }
                            ?>
                        </tr>
                        <tr>
                            <td>August</td>
                            <?php
                            if($aug_status == 1){
                                echo '<td><span class="text-success">Active</span></td>';
                                if($aug_fee_status == 1){
                                    echo "<td class='text-success'>".$total_fare."</td>";
                                }else{echo '<td class="text-warning">Pending</td>';}
                                
                            }else if($aug_status ==0){
                                echo "<td><span class='text-warning'>Inactive</span></td>";
                                echo "<td>...</td>";
                            }
                            ?>
                        </tr>
                        <tr>
                            <td>September</td>
                            <?php
                            if($sep_status == 1){
                                echo '<td><span class="text-success">Active</span></td>';
                                if($sep_fee_status == 1){
                                    echo "<td class='text-success'>".$total_fare."</td>";
                                }else{echo '<td class="text-warning">Pending</td>';}
                            }else if($sep_status ==0){
                                echo "<td><span class='text-warning'>Inactive</span></td>";
                                echo "<td>...</td>";
                            }
                            ?>
                        </tr>
                        <tr>
                            <td>October</td>
                            <?php
                            if($oct_status == 1){
                                echo '<td><span class="text-success">Active</span></td>';
                                if($oct_fee_status == 1){
                                    echo "<td class='text-success'>".$total_fare."</td>";
                                }else{echo '<td class="text-warning">Pending</td>';}
                            }else if($oct_status ==0){
                                echo "<td><span class='text-warning'>Inactive</span></td>";
                                echo "<td>...</td>";
                            }
                            ?>
                        </tr>
                        <tr>
                            <td>November</td>
                            <?php
                            if($nov_status == 1){
                                echo '<td><span class="text-success">Active</span></td>';
                                if($nov_fee_status == 1){
                                    echo "<td class='text-success'>".$total_fare."</td>";
                                }else{echo '<td class="text-warning">Pending</td>';}
                            }else if($nov_status ==0){
                                echo "<td><span class='text-warning'>Inactive</span></td>";
                                echo "<td>...</td>";
                            }
                            ?>
                        </tr>
                        <tr>
                            <td>December</td>
                            <?php
                            if($dec_status == 1){
                                echo '<td><span class="text-success">Active</span></td>';
                                if($dec_fee_status == 1){
                                    echo "<td class='text-success'>".$total_fare."</td>";
                                }else{echo '<td class="text-warning">Pending</td>';}
                                
                            }else if($dec_status ==0){
                                echo "<td><span class='text-warning'>Inactive</span></td>";
                                echo "<td>...</td>";
                            }
                            ?>
                        </tr>
                        <tr>
                            <td>January</td>
                            <?php
                            if($jan_status == 1){
                                echo '<td><span class="text-success">Active</span></td>';
                                if($jan_fee_status == 1){
                                    echo "<td class='text-success'>".$total_fare."</td>";
                                }else{echo '<td class="text-warning">Pending</td>';}
                            }else if($jan_status ==0){
                                echo "<td><span class='text-warning'>Inactive</span></td>";
                                echo "<td>...</td>";
                            }
                            ?>
                        </tr>
                        <tr>
                            <td>February</td>
                            <?php
                            if($feb_status == 1){
                                echo '<td><span class="text-success">Active</span></td>';
                                if($feb_fee_status == 1){
                                    echo "<td class='text-success'>".$total_fare."</td>";
                                }else{echo '<td class="text-warning">Pending</td>';}
                            }else if($feb_status ==0){
                                echo "<td><span class='text-warning'>Inactive</span></td>";
                                echo "<td>...</td>";
                            }
                            ?>
                        </tr>
                        <tr>
                            <td>March</td>
                            <?php
                            if($mar_status == 1){
                                echo '<td><span class="text-success">Active</span></td>';
                                if($mar_fee_status == 1){
                                    echo "<td class='text-success'>".$total_fare."</td>";
                                }else{echo '<td class="text-warning">Pending</td>';}
                            }else if($mar_status ==0){
                                echo "<td><span class='text-warning'>Inactive</span></td>";
                                echo "<td>...</td>";
                            }
                            ?>
                        </tr>
                    </tbody>
                </table>
            </div>
            
            
        </div>
    </div>
</div>