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

$branch_id=$_SESSION['LOGIN_BRANCH'];
$date = $_POST['date'];
//$date2=date_create("$date");
//$dates = date_format($date2,"Y-m-d");
$dates = date("Y-m-d",strtotime($date))

?>
						
	<table id="sample-table-22" class="table table-striped table-bordered table-hover">
		<thead>
			<th>SL No</th>
            <th>Invoice</th>
			<th>Std Name</th>
			<th>Month</th>
			<th>Year</th>
			<th>Invoice amount</th>
			
			<th>Due Amount</th>
			<th>Receive Amount</th>
			<th>Status</th>
			
			<th>Create Date</th>
			<th>Last Update</th>
			<th>Action</th>
		</thead>
		<tbody>
        
			<?php
			$i=0;
			$max_ = $obj->View_Invoice_Master_Date_Find("_fee_master_invoice", "date_format(_last_update,'%y-%m-%d') =date_format('$dates','%y-%m-%d')");
			$max_date = $max_['max_date'];
			foreach($obj->View_Invoice_Master("_fee_master_invoice"," date_format(_last_update,'%y-%m-%d') =date_format('$dates','%y-%m-%d')") as $value){
			$invoice_no = $value['_invoice_no'];
			$month = $value['_month'];
			$year = $value['_year'];
			$std_id = $value['_std_id'];
			$student_info = $obj->View_Student_Id("_pf_std_personal_info"," _id ='$std_id'");
			
			$student_name = $student_info['_full_name'];
			$total_amount = $value['_total_amount'];
			$due_amount = $value['_due_amount'];
			$last_paid_amount = $value['_last_paid_amount'];
			$status = $value['_status'];
			$entry_date = $value['_entry_date'];
			$last_update = $value['_last_update'];
			$i++;
			?>
            <tr>
            <td><?php echo $i;?></td>
			<td><?php echo $invoice_no;?></td>
            <td><?php echo $student_name;?></td>
            <td>
			<?php $month_name = $obj->Month($month); echo $month_name;?>
			<?php //echo $month;?></td>
            <td><?php echo $year;?></td>
            <td><?php echo $total_amount;?></td>
            <td><?php echo $due_amount;?></td>
            <td><?php echo $last_paid_amount;?></td>
            <td>
            <?php if($status=='U'){?>
            <span class="label label-warning" style="font-size:14px">Unpaid</span>
			<?php }else if($status=='P'){?>
            <span class="label label-success" style="font-size:14px">Paid</span>
            <?php }else if($status=='PR'){?>
            <span class="label label-warning" style="font-size:14px">Partialy</span>
            <?php }else{?>
            <span class="label" style="font-size:14px">Adjustment</span>
            <?php }?>
            </td>
            <td><?php echo $entry_date;?></td>
            <td><?php echo $last_update;?></td>
            <td>
            <i class="icon-eye-open bigger-170" style="hover:cursor;" href="#modal-table_edit" data-toggle="modal" onclick="show_view(<?php echo $invoice_no; ?>)"></i>
           <!-- <i class="icon-edit bigger-170" style="hover:cursor;" href="#modal-table_edit" data-toggle="modal"></i>-->
            </td>
             </tr>
			<?php }	
			?>
           
		</tbody>	

	</table>

<script type="text/javascript">
	
				
				var oTable2 = $('#sample-table-22').dataTable( {
				"aoColumns": [
			      { "bSortable": true },
			      null, null,null, null,null,null,null,
				  { "bSortable": true }
				] } );
				
				
				
			
</script>
