<?php
session_start();
// ============
include("../../asset/theme/css/myfunc.php");
include("../../php_crud/my_class.php");
$obj=new my_class();
extract($_POST);


if($month=='01'){$mo = 'January';}
if($month=='02'){$mo = 'February';}
if($month=='03'){$mo = 'March';}
if($month=='04'){$mo = 'April';}
if($month=='05'){$mo = 'May';}
if($month=='06'){$mo = 'June';}
if($month=='07'){$mo = 'July';}
if($month=='08'){$mo = 'August';}
if($month=='09'){$mo = 'September';}
if($month=='10'){$mo = 'October';}
if($month=='11'){$mo = 'November';}
if($month=='12'){$mo = 'December';}

?>

<style type="text/css">

th{

   font-size:13px;
   text-align: center;

}

i{
	cursor:pointer;
}

.select_list{
	width: 200px;
}

.input_sub{
	width: 185px;
}
.select_list1{
	width: 100px;
	float: left;
	margin-left: 3px;
	margin-right: 3px;
}


</style>



<div class="page-content" id="tab">
    <legend style="text-align:center;">
    Section Fee Colletion Report(<?php echo $mo."-".$year;?>)
    </legend>


    
<div class="row-fluid"  style="margin-top: 15px;" >

    <?php echo "<button style='float: right;' class='btn btn-small btn-primary ' type='print' id='btn_print_sec_fee_coll_details' onclick='create_sec_fee_coll_details_mpdf($br_id,$sc_id,$month,$year)'>
			<i class='icon-print '></i>
			Print
		</button>";?>    
			

	<table id="sample-table-121" class="table table-striped table-bordered table-hover"  >
		<thead style="">
			<th>Sl</th>
			<th>Student Id</th>
			<th>Name</th>
			<th>Section Roll</th>
			<th>Contact Number</th>
			<th>Fee Details (.TK)</th>
			<th >Total Amount (.TK)</th>
			<th>Paid Amount (.TK)</th>
			<th>Due Amount (.TK)</th>
			
			
			
		</thead>
		<tbody>
<?php
$i=0;
//$where = "_br_id='$br_id' AND _section_id='$sc_id' AND _month='$month' AND _year='$year' AND pmi._status!='AD'";
$where = "pbf._section_id='$sc_id' AND pspi._status='A' AND pmi._month='$month' AND pmi._year='$year' ORDER BY pspi._section_roll ASC";

foreach($obj->section_fee_collect_report($where) as $value_head){
extract($value_head);
$i++;


?>       
        <tr>
		    <td><?php echo  $i; ?></td>
		    <td><?php echo  $value_head['_uniq_id']; ?></td>
		    <td><?php echo  $value_head['_full_name']; ?></td>
		    <td><?php echo  $value_head['_section_roll']; ?></td>
		    <td><?php echo  $value_head['_contact_mobile']; ?></td>	
			<td><?php $std_id = $value_head['_std_id'];
					  $table_name = "_fee_details_invoice";
					  $column = "_fee_head,_amount,_type";
					  $where_cond = "_std_id=".$std_id." AND _month=".$month." AND _year=".$year;
					  $fee_detail_info = $obj->View_all_data_row_column_By_Cond($table_name,$column,$where_cond);
					  foreach($fee_detail_info AS $index1=>$value1){
						  $type = $value1['_type'];
						  if($type=='C'){
							echo $value1['_fee_head']."= +".$value1['_amount'];  
						  }
						  else{
							echo $value1['_fee_head']."= -".$value1['_amount'];   
						  }
						  echo "<br>";
					  }?>
			</td>
		    <td style="text-align:center;"><?php echo  $value_head['st_total']; ?></td>	    
		    <td style="text-align:center;"><?php echo $value_head['_paid']; ?></td>
		    <td style="text-align:center;"><?php  echo $value_head['_due'];?></td>
		    


		</tr>

<?php } ?>

       </tbody>
       <tfoot>
<?php
$where="_section_id='$sc_id' AND _month='$month' AND _year='$year'";
foreach($obj->section_total_fee_report($where) as $value_){
extract($value_);

?>
            <tr style="background-color: #e0e0d1;">
		      <td colspan="6" style="text-align:center; font-weight: bold;">Total</td>
		      
		      <td style="text-align:center;"><?php echo  $value_['_total']; ?></td>
		      <td style="text-align:center;"><?php echo  $value_['_paid']; ?></td>
		      <td style="text-align:center;"><?php echo  $value_['_unpaid']; ?></td>
		      
		    </tr>

 <?php } ?>

		</tfoot>
	</table>

<?php  ?>
</div>
</div>
