
    <html moznomarginboxes mozdisallowselectionprint>

   <style type="text/css" media="print">
@media print {
    a {
        display:none;
    }
 }

 @media screen and projection {
    a {
        display:inline;
    }
  }  @media print
    {
    	#non-printable { display: none; }
		 	#href{ display: none; }
    	#printableArea { display: block; font-size:12;margin-top:0; margin-bottom:0;


    margin: 0 ;
    overflow: hidden;  
		}
		
	
	a[href]:after {
        content: none !important;
    }
    }
    </style>
	<script>

 

	function printDiv(divName) {
     var printContents = document.getElementById(divName).innerHTML;
     var originalContents = document.body.innerHTML;
document.body.innerHTML = printContents;
     document.body.innerHTML = printContents.fontsize(2);
     window.print();


}
	</script>





<ul class="nav nav-tabs bordered" id="non-printable">
			<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>
			
				 <a href="<?php echo base_url(); ?>user/searchstatement">	Go back
                    	</a></li>
			
				<li>
            	<a href="#print" data-toggle="tab"><i class="entypo-plus-circled"></i>
						<form name="print" method="post" action="">
<input type="submit" id="print"  accesskey="p" class="btn btn-primary"  name="print"onclick="printDiv('printableArea')" value="Click here to Print" />
</form>
				
                    	</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">
  <div id="printableArea">
<table cellspacing="1" border="0" width="100%" style="margin:10px" >
 
		<tr>
		
		<td width="40%">
				<span style="text-center: right; font-weight: bold;font-size:36px;">    PLUM</span><br>
			<p style="text-center: left; font-weight: bold;font-size:24px ">
		PROPERTIES (K) LTD.</p><p>
		<b>Phone No: 0713893611 <br>
			0765893611<br>
			Email: plumproperties0@gmail.com.
			</p>
		</td>
			<td width="35%">
			<div id="non-printable">
				<?php
				$session_data = $this->session->userdata('logged_in');


$data['surname'] = $session_data['surname'];
$data['id'] = $session_data['id'];

$surname=$data['surname'];
   $userid=$data['id'];
					$profile= $this->studentprofilemodel->populateimages($userid);
		
	
		if(!is_array($profile)) 

 {
	 $this->session->set_flashdata('msg', '<div class="alert alert-danger fade in">
						 <a href="#" class="close" data-dismiss="alert">&times;</a><strong>Error!</strong>Please make sure you fill in your bio data first for you to upload your profile</div>');
							

    }else {

    
          
  	foreach ($profile as $c): 
$photo= $c->photo;
		 	if($photo!=""){
		 
		 
		
		
	
			
		
		$img=$c->photo;
	
		$img1='uploads/';
	$url = base_url().$img1.$img;

 
 ?>
 <div  id="non-printable" >
<img class="img-circle" src="<?php echo $url ?>" height="100" width="100" style="border-radius:4px;  ">		 

</div>



	 <?php }else{
		 ?>

				<?php
	 }
		 endforeach; ?>

              <?php }?>
			</td>
			<td style="margin-right:2px;" width="22%">
			
				<p style=" font-weight: bold;font-size:16px; ">
					<span style=" font-weight: bold;font-size:16px;">     HEAD OFFICE</span>
		 <BR> Juja arcade 1st flr rm 12F.<BR>

		Juja Town, Gatundu Street off <br>Superhighway<BR>
		
		Kiambu County.<br>
		</p>
			
			</td>
		</tr>
		</table>
		<table cellspacing="1" border="0" width="100%" style="margin:10px">

		
		
		<tr>
			<td >				
			<p style="font-size:12px;"><B>OFFICIAL STATEMENT FOR  <?php echo $plotnames[0]['name'] ." ( ". $plotno ." )"; ?></B></p>
</td>
			<td></td>
		</tr>
		
		
			
		<tr>
			<td style="font-size:12px;"><B>RENT REMITTANCE BETWEEN <?php echo $fromdate; ?> AND <?php echo $todate; ?></B></td>
					<td style="font-size:12px;" width="37%"><B>DATE PRINTED <?php echo $date = date("Y-m-d"); ?> </B></td>
			
		</tr>
		
				
		
		
		
	
 
 
 
 
 
 
 </table>
 
 
<table cellspacing="1"  border="1" width="100%">
             <thead>
			
         <tr>
		   <th>Room No </th>
    	<th>Name of Tenant </th> 
  
		<th>Date of Payments </th> 

	<th>Rent </th> 
		<th> Water</th> 
	
		<th> Deposite</th> 
 
	 




                 </tr>
             </thead>
<?php

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

 {



 
    }else {
?>
    
             <?php 
  $grandtotal=0;
  	foreach ($invoice as $c): 
		 

             ?>



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


?>
<td><?php echo $c->houseno ; ?></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){

   echo $names=$tenantsrow->lastname. " ".$tenantsrow->firstname ; 
   
   ?>
   

   
   <?php
    

}
    } else {
 
}

}



} else {
    echo 'vacant.';
}
					
					


?>
				 
				 
		</td>
             
	<td><?php echo $c->createdat ; ?></td> 
					

				       <td><?php echo $c->amount * -1; 
					   $totalpaid=(-1)*($c->amount); 
					   $grandtotal= $grandtotal + $totalpaid;
					   ?></td> <td>
					   <?php
					     $mywater = $this->adminusermodel->getstatementbytype($c->plotno,$c->houseno,$status,$fromdate,$todate,'WATER');

					    if(is_array($mywater)) {
					   foreach ($mywater as $cwater){
						   ?>
					  <?php echo $cwater->amount * -1;?>
	
	                                  <?php  
										}}
									?></td> <td>
					   <?php
					 $mydeposit = $this->adminusermodel->getstatementbytype($c->plotno,$c->houseno,$status,$fromdate,$todate,'DEPOSIT');

					    if(is_array($mydeposit)) {
					   foreach ($mydeposit as $cdeposit){
						   ?>
							<?php echo $cdeposit->amount * -1;?>
	
	                                  <?php  
										}}
									?>
					       </td> 
               
				
         				
            
             </tr>

     <?php endforeach; ?>       
	
 

              <?php }?>
        </table>
		<br>	<br>	
		
<table cellspacing="1" border="1" width="100%">

<tr>
			<td width="40%"><b>Total Rent </b></td>
			<td width="60%"><b><?php  if(isset($grandtotal)) {echo $grandtotal; }else{ echo "0";}?></b></td>
		</tr>
		<tr>
			<td width="40%"><b>Commission (<?php echo$plotnames[0]['commission']; ?> )%</b></td>
			<td width="60%"><b><?php 
			if(isset($grandtotal)) {echo "-".$comm= ($grandtotal)* (($plotnames[0]['commission'])/100); }else{ echo "-".$comm= (0)* (($plotnames[0]['commission'])/100);}
			?></b></td>
		</tr>
	<?php
	 if(!is_array($expenditure)) 

 {



  
    }else {
?>
    
             <?php 
  $mygrandtotal=0;
  	foreach ($expenditure as $row): 
	if(isset($mygrandtotal)) { $mygrandtotal; }else{ echo "0"; }
	$mygrandtotal= $mygrandtotal+($row->amount);?>
	<tr>
	
			<td width="40%"><?php echo$row->description ?></td>
			<td width="60%"><?php echo$row->amount ?></td>
		</tr>
	
	<?php
	endforeach; }?>
	
	
		<tr>
			<td width="40%"><b>Total Expenditure</b></td>
			<td width="60%"><b><?php if(isset($mygrandtotal)) {echo $mygrandtotal+(-1*$comm); }else{ $mygrandtotal=0; echo (-1*$comm); }?></b></td>
		</tr>
		
		
		
		
		         <?php 
				 	 if(!is_array($other)) 

 {
  
    }else {
  $mytotal=0;
    $tt=0;
  	foreach ($other as $otherrow): 
	if(isset($mytotal)) { $mytotal; }else{ echo "0"; }
	$mytotal= $mytotal+(($otherrow->amount)*(-1));?>
	<tr>
	
			<td width="40%"><?php echo$otherrow->type ?></td>
			<td width="60%"><?php echo(($otherrow->amount)*(-1)) ?></td>
		</tr>
	
	<?php
	endforeach; }?>

	
		
		<tr>
			<td width="40%"><b>Total of other collection</b></td>
			<td width="60%"><b><?php if(isset($mytotal)) {echo $mytotal;}else{ $mytotal=0;echo "0"; }?></b></td>
		</tr>
		
		
		
		<tr>
			<td><b>Cash Rendered to Landlord </b></td>
			<td><b><?php if(isset($grandtotal)) {echo $payment=($grandtotal+$mygrandtotal+$mytotal-$comm); }else{  echo $payment=0+(0)+0; }?> </b></td>
		</tr>
	
 	<tr>
			<td><b>Bank Name </b></td>
			<td ><b><?php echo $plotnames[0]['accountname']	?> </b></td>
		</tr>
  	<tr>
			<td><b>Bank Account Number </b></td>
			<td><b><?php echo $plotnames[0]['accountno']	?> </b></td>
		</tr>

 
 
 
 </table>



</div>
</div>

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




			