


	 <link href="<?php echo base_url(); ?>assets/select/chosen.min.css" rel="stylesheet" media="screen">
	
		   
		   		   <script src="<?php echo base_url(); ?>assets/select/chosen.jquery.min.js"></script>

				   
	
        <script>
        $(function() {
<!--             $(".datepicker").datepicker(); -->
<!--             $(".uniform_on").uniform() -->;
            $(".chzn-select").chosen();
   <!--          $('.textarea').wysihtml5(); -->

        });
        </script>
                  




<ul class="nav nav-tabs bordered">
			<li class="active">
            	<a href="#add" data-toggle="tab"><i class="entypo-menu"></i> 
			View House Details
                    	</a></li>
						
							<li>
            	<a href="#list" data-toggle="tab"><i class="entypo-plus-circled"></i>
			
				 <a href="<?php echo base_url(); ?>admin/searchstatement">	Go back</a>
                    	</a></li>
			
		</ul>
    	<!------CONTROL TABS END------>
        
		<div class="tab-content">
            <!----TABLE LISTING STARTS-->
            <div class="tab-pane box active " id="list">
				
     


 <div class="panel panel-primary" data-collapsed="0">
<table id="example"  cellspacing="1" class="table  table" width="100%">
             <thead>
			
         <tr>
    
    <th>House Number </th>
	<th>Plot Name</th>
    
	<th>Type</th> 	
	<th>Tenant </th> 
	<th>Amount </th> 
		<th> Invoice Name</th> 
		<th> Month </th> 
		<th> Year </th> 
	<th> Invoice Date </th> 
	<th>Due Date</th> 
 
	 




                 </tr>
             </thead>
<?php

	echo $this->session->flashdata('msg'); 
		if(validation_errors()):
		 endif;
 if(!is_array($invoice)) 

 {



   echo "<tr  style='margin-bottom:0px;margin-top:0px;' '>";
      echo "<td colspan='5'>";
    
       echo '<div class="alert alert-danger text-center">There is no payment found for this plot and house number by now from system..try again</div>';
    echo "</td>";
   echo "</tr>";
    }else {
?>
    
             <?php 
  $grandtotal=0;
  	foreach ($invoice as $c): 

		 

             ?>



             <tr>
                
            <?php 
		$id=$c->id;


?>

             <td><?php echo $c->houseno ; ?></td> 
				<td><?php echo $c->plotno ; ?></td> 
<td><?php echo $c->paymentstatus ; ?></td> 
					

                	         <td><?php 
					$tenantavalable = $this->adminusermodel->tenantavailable($c->plotno,$c->houseno); 
					  $total=0;
					if(is_array($tenantavalable)) {

   foreach($tenantavalable as $tenantavalablerow){
	   $tenantid= $tenantavalablerow->tenantid ; 
				    $tenants = $this->adminusermodel->gettenantbyid($tenantid);
 if(is_array($tenants)) {
   foreach($tenants as $tenantsrow){

    $names=$tenantsrow->lastname. " ".$tenantsrow->firstname ; 
   
   ?>
   
                     <a class="btn btn-warning"  id="more" href="<?php echo base_url();?>admin/edittenant?randomitemidentifier=<?php   {echo  $tenantid;}  ?>"><?php   {echo  $names;}  ?>  </a>

   
   <?php
    

}
    } else {
 
}

}



} else {
    echo 'vacant.';
}
					
					


?>
				 
				 
		</td>
				       <td><?php echo $c->amount ; 
					   $grandtotal= $grandtotal+$c->amount ;
					   ?></td>
					   <td><?php echo $c->type ; ?></td> 
					          <td><?php echo $c->month ; ?></td>
							         <td><?php echo $c->year ; ?></td>
                     <td><?php echo $c->createdat; ?></td>
					     <td><?php echo $c->duedate; ?></td>
				
         				
            
             </tr>
<?php endforeach; ?>
            
			    <tfoot>
			  <tr>
    
 
	 
	
 <th>House no </th>
	
    <th colspan="3"> Balance for House Number  <?php echo  $c->houseno?> and plot number <?php echo  $c->plotno?> </th>         
	<th ><?php echo $grandtotal." /=" ?></th> 

	<Th></th>
	<Th></th>
	<th></th> 
<th></th> 

<th>Payment</th> 



                 </tr>
			 	  </tfoot>
 

              <?php }?>
        </table>



</div>

</div>
		<!----CREATION FORM STARTS---->
	
</div>




			