<?php
$my_class=$this->session->userdata('class_teacher');
$my_class_section=$this->session->userdata('class_teacher_section');    
?>

<div class="container">
<div class="row">
<div class="col-sm-12">
<ul class="breadcrumb mt-3">
<li class="breadcrumb-item">Home</li>
<li class="breadcrumb-item"><?php echo $my_class; ?></li>
<li class="breadcrumb-item"><?php echo $my_class_section; ?></li>
</ul>    
    
<div class="table-responsive">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>Roll. No.</th>    
<th>Sch No.</th>
<th>Student Name</th>
<th>Contact No.</th>
<th>Alternate No.</th>
<th>Apr</th>
<th>May</th>
<th>Jun</th>
<th>Jul</th>
<th>Aug</th>
<th>Sep</th>
<th>Oct</th>
<th>Nov</th>
<th>Dec</th>
<th>Jan</th>
<th>Feb</th>
<th>Mar</th>
</tr>    
</thead>    

<tbody>
<tr>    
<?php

$student_table='student';
$my_class_students=$this->FeeModel->fetch_class_section_student($student_table,$my_class,$my_class_section);
if($my_class_students){
$count=0;    
foreach($my_class_students as $student){
$count++;    
?>
<td><?php echo $student['roll_no']; ?></td>
<td><?php echo $student['sch_no']; ?></td>
<td><?php echo $student['student_name'];?></td>
<td><?php echo $student['contact_no'];?></td>
<td><?php echo $student['alternate_no'];?></td>

<?php
$sid=$student['id'];
$table_fee='student_fee';
$fee_data=$this->FeeModel->get_single_student_fee_data($sid,$table_fee);
$apr=0;$may=0;$jun=0;$jul=0;$aug=0;$sep=0;$oct=0;$nov=0;$dec=0;$jan=0;$feb=0;$mar=0;
$april_date=''; $may_date=''; $june_date=''; $july_date=''; $august_date=''; $september_date=''; $october_date=''; $november_date=''; $december_date=''; $january_date=''; $february_date=''; $march_date='';
if($fee_data){
foreach($fee_data as $data){
if($data['april']==1){
$apr=$data['april'];
$april_date=date('d-M-Y',strtotime($data['fee_date']));
}
if($data['may']==1){
$may=$data['may'];
$may_date=date('d-M-Y',strtotime($data['fee_date']));
}

if($data['june']==1){
$jun=$data['june'];
$june_date=date('d-M-Y',strtotime($data['fee_date']));
}
if($data['july']==1){
$jul=$data['july'];
$july_date=date('d-M-Y',strtotime($data['fee_date']));
}
if($data['august']==1){
$aug=$data['august'];
$august_date=date('d-M-Y',strtotime($data['fee_date']));
}
if($data['september']==1){
$sep=$data['september'];
$september_date=date('d-M-Y',strtotime($data['fee_date']));
}

if($data['october']==1){
$oct=$data['october'];
$october_date=date('d-M-Y',strtotime($data['fee_date']));
}
if($data['november']==1){
$nov=$data['november'];
$november_date=date('d-M-Y',strtotime($data['fee_date']));
}
if($data['december']==1){
$dec=$data['december'];
$december_date=date('d-M-Y',strtotime($data['fee_date']));
}
if($data['january']==1){
$jan=$data['january'];
$january_date=date('d-M-Y',strtotime($data['fee_date']));
}
if($data['february']==1){
$feb=$data['february'];
$february_date=date('d-M-Y',strtotime($data['fee_date']));
}
if($data['march']==1){
$mar=$data['march'];
$march_date=date('d-M-Y',strtotime($data['fee_date']));
}



}
}

if($apr==1){echo "<td class='bg-success text-white'>".$april_date."</td>";  
}else{
echo "<td class='bg-danger text-white'>NP</td>";   }

if($may==1){echo "<td class='bg-success text-white'>".$may_date."</td>";  
}else{
echo "<td class='bg-danger text-white'>NP</td>";   }

if($jun==1){echo "<td class='bg-success text-white'>".$june_date."</td>";  
}else{
echo "<td class='bg-danger text-white'>NP</td>";   }

if($jul==1){echo "<td class='bg-success text-white'>".$july_date."</td>";  
}else{
echo "<td class='bg-danger text-white'>NP</td>";   }

if($aug==1){echo "<td class='bg-success text-white'>".$august_date."</td>";  
}else{
echo "<td class='bg-danger text-white'>NP</td>";   }

if($sep==1){echo "<td class='bg-success text-white'>".$september_date."</td>";  
}else{
echo "<td class='bg-danger text-white'>NP</td>";   }

if($oct==1){echo "<td class='bg-success text-white'>".$october_date."</td>";  
}else{
echo "<td class='bg-danger text-white'>NP</td>";   }

if($nov==1){echo "<td class='bg-success text-white'>".$november_date."</td>";  
}else{
echo "<td class='bg-danger text-white'>NP</td>";   }

if($dec==1){echo "<td class='bg-success text-white'>".$december_date."</td>";  
}else{
echo "<td class='bg-danger text-white'>NP</td>";   }

if($jan==1){echo "<td class='bg-success text-white'>".$january_date."</td>";  
}else{
echo "<td class='bg-danger text-white'>NP</td>";   }

if($feb==1){echo "<td class='bg-success text-white'>".$february_date."</td>";  
}else{
echo "<td class='bg-danger text-white'>NP</td>";   }

if($mar==1){echo "<td class='bg-success text-white'>".$march_date."</td>";  
}else{
echo "<td class='bg-danger text-white'>NP</td>";   }

?>
</tr>    
<?php 
}    
}
?>    
</tbody>

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