    

   <style type="text/css">

    @media print
    {
    	#non-printable { display: none; }
    	#printableArea { display: block; font-size:20;margin-top:0; margin-bottom:0;


    margin: 0 0 0 0;
    overflow: hidden;  
		}
    }
    </style>
	<script>

 

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

     document.body.innerHTML = printContents.fontsize(28);
     window.print();


}
	</script>








<ul class="nav nav-tabs bordered" id="non-printable">
			<li class="active">
            	<a href="#list" data-toggle="tab"><i class="entypo-menu"></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>
							<li>
            	<a href="#customer" data-toggle="tab"><i class="entypo-plus-circled"></i>
	
				 <a   class="btn btn-primary" href="<?php echo base_url(); ?>admin/viewpallmyplots">Next booking </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" >
  <div id="printableArea">
  <h2>
  <?php 
function formatMoney($number, $fractional=false) {
						if ($fractional) {
							$number = sprintf('%.2f', $number);
							
						}
						while (true) {
							$replaced = preg_replace('/(-?\d+)(\d\d\d)/', '$1,$2', $number);
							if ($replaced != $number) {
								$number = $replaced;
							} else {
								break;
							}
						}
						return $number;
					}
									
 
    $postedtime = date('Y-m-d');
		$currenttime = date('h:i:sa');
 		$dateposted =  ($postedtime)." ".$currenttime ;	
 echo $this->session->flashdata('imagemsg1'); 
		 
		    
$session_data = $this->session->userdata('logged_in');


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

$surname=$data['surname'];
   $userid=$data['id'];
      $data['companyid'] = $session_data['companyid'];
	 $companyid = $data['companyid'];
$data['usertype'] = $session_data['usertype'];
   $usertype=$data['usertype'];

 $data['branchid'] = $session_data['branchid'];
	 $branch = $data['branchid'];
$ttfood=0;
$ttpaid=0;
$ttexpected=0;

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

 {




    
       echo '<div class="alert alert-warning text-center">There is no Payment found by now from system..Try again</div>';
   
    }else {
?>
    
             <?php 
  
  	foreach ($mypayment as $row): 

		$cash= $row->amount; 
				$mpesa= $row->mpesa; 
				$card= $row->card; 
							 $mpesa=$row->mpesa; 
							  $card=$row->card; 
								$voucher=$row->voucher; 
							 $credit=$row->credit; 
							  $cheque=$row->cheque; 
							  $points=$row->points; 
							  $roomtype=$row->roomtype; 
							  $discount=$row->discount; 

							$totalpaid=$cash+$mpesa+$card+$voucher+$cheque+$points;

				$user=$row->userid; 
				
				
				
				
				
				
				
				
				
				
				
				
				
				

             ?>
			 
 <table  align="center" width="100%">
 
		<tr>
			<td colspan="2">
			<div style="text-align:center; " >
			
			
			  
			   <p>
			  <center>
					<b>
										<?php $bussinessname=$configuration[0]['businessname']; if(isset($bussinessname)) {echo   $bussinessname; }?>
					</b>
				</center>
			  </p>

		
				<p style="margin-center;"><B>GUEST REGISTRATION FORM.</B></p>
			</div></td>
			
		</tr>
		<tr>
			<td width="40%">REF NO#</td>
			<td width="60%">:<?php echo $row->id ; ?></td>
		</tr>
		<tr>
			<td width="40%">RECEIPT NO</td>
			<td width="60%">:<?php echo $row->transactioncode ; ?></td>
		</tr>
			<tr>
			<td>DATE PRINTED </td>
				<td>:<?php echo $dateposted ; ?></td>
		</tr>
	<tr>
			<td>CHECK IN </td>
				<td>:<?php echo $row->createdat ; ?></td>
		</tr>
	
	
	<tr>
			<td>CHECK OUT </td>
				<td>:<?php echo $row->checkoutdate ; ?></td>
		</tr>
	
		<tr>
			
			<td>HOUSE NAME</td>
			<td>:<?php echo $plotnames[0]['name'] ; ?></td>
		</tr>
		<tr>
			
			<td>ROOM NO</td>
			<td>:<?php echo $row->houseno ; ?></td>
		</tr>
		
		
		<tr>
			
			<td>DAYS</td>
			<td>:<?php echo $row->number ; ?></td>
		</tr>
		
		
		
		
		
										 
										 <?php



 $roomsales = $this->usermodel->populatealldatanoarrayfour('roomsales','houseno', $houseno,'plotno', $plotno,'description', $row->id,'customerid', $row->tenantid);			   

				
				
				
				
				
 if(!is_array($roomsales)) 

 {


  		   $ttfood= 0;

    }else {
?>
    
			<tr>
			
			<td>FOOD/DRINKS</td>
				 <td>
             <?php 
  $mytotal=0;
  	foreach ($roomsales as $myrow){ 

		   $mytotal=$mytotal+$myrow->total;
		   $ttfood= $mytotal;
	}
	
		if(isset($mytotal)) {echo   formatMoney($mytotal, true); }
?>

				</td>
		</tr>
		
		  <?php 
	}
			?>		


			
		
		
		
		
		
		
		
			<tr>
			
			<td>STATUS :</td>
			<td>:<?php echo $row->paymentstatus; ?></td>
		</tr>
		
			<?php if ($roomtype>0)
							{
								
							?>
								<tr>
								
								<td><b>TT EXPECTED</b></td>
								
								<td><b>:Ksh.<?php 
								$ttexpected=$roomtype+$ttfood;
		if(isset($ttexpected)) {echo   formatMoney($ttexpected, true); }

								
								?>
								
								
								</td></b>
							
							</tr>
							
								
							
							<tr>
							<td COLSPAN="2"><b>
							<hr  style="height:1px;border:none;margin:0;color:#333;background-color:#333;"/>
							
								</b></td>
							
							</tr>
							
							<?php 
							}
								
							?>
						
							
							<?php if ($cash>0)
							{
								
							?>
								<tr>
								
								<td><b>CASH</b></td>
								
								<td><b>:Ksh.
								<?php 
										if(isset($cash)) {echo   formatMoney($cash, true); }

								
								?>
								</td></b>
							
							</tr>
							
							<?php 
							}
								
							?>
							
								<?php if ($card>0)
							{
								
							?>
								<tr>
								
								<td><b>CARD</b></td>
								
								<td><b>:Ksh.
								<?php echo$card?></b>
								</td>
							
							</tr>
							
							<?php 
							}
								
							?>
								<?php if ($cheque>0)
							{
								
							?>
								<tr>
								
								<td><b>CHEQUE</b></td>
								
								<td><b>:Ksh.
								<?php echo$cheque?></b>
								</td>
							
							</tr>
							
							<?php 
							}
								
							?>	<?php if ($mpesa>0)
							{
								
							?>
								<tr>
								
								<td><b>MPESA</b></td>
								
								<td><b>:Ksh.
								<?php echo$mpesa?></b>
								</td>
							
							</tr>
							
							<?php 
							}
								
							?>	<?php if ($credit>0)
							{
								
							?>
								<tr>
								
								<td><b>CREDIT</b></td>
								
								<td><b>:
								<?php echo$credit?></b>
								</td>
							
							</tr>
							
							<?php 
							}
								
							?>	<?php if ($voucher>0)
							{
								
							?>
								<tr>
								
								<td><b>VOUCHER</b></td>
								
								<td><b>:Ksh.
								<?php echo$voucher?></b>
								</td>
							
							</tr>
							
							<?php 
							}
								
							?>	<?php if ($points>0)
							{
								
							?>
								<tr>
								
								<td><b>L POINTS</b></td>
								
								<td><b>:
								<?php echo$points?></b>
								</td>
							
							</tr>
							
							<?php 
							}
								
							?>
							<tr>
		<td COLSPAN="2"><b>
							<hr  style="height:1px;border:none;margin:0;color:#333;background-color:#333;"/>
							
								</b></td>
							
							</tr>
								<?php if($discount>0){ ?>
		<tr>
			<tr>
			
			<td><b>DISCOUNT </b></td>
			<td><b>:Ksh.<?php echo $discount; ?></b></td>
		</tr>	
			<tr>
		
		<?php  }?>
			<tr>
			
			<td><b>TOTAL PAID </b></td>
			<td><b>:Ksh.<b><?php 
		if(isset($totalpaid)) {echo   formatMoney($totalpaid, true); }


			?></b></td>
		</tr>
		
		
			<?php 
							$balance=$ttexpected-$totalpaid;

			
			if($balance!=0){ ?>
	
			<tr>
			
			<td><b>BALANCE </b></td>
			<td><b>:Ksh.<?php
		if(isset($balance)) {echo   formatMoney($balance, true); }


			?></b></td>
		</tr>

   <?php 
   }
   

			   	 if(!is_array($roomcharges)) 

 {
  

    }else {
  ?>
 
  		<tr>
			<td colspan="2"> <br><b>OTHER CHARGES </b></td>
		</tr>
		
			<tr>
	
			<td width="40%"><u>Charge Name</u></td>
			<td width="60%"><u>Cost</u></td>
		</tr>
		<?php
  	foreach ($roomcharges as $roomchargesrow): ?>
	<tr>
	
			<td width="40%"><?php echo $roomchargesrow->name;?></td>
			<td width="60%"><?php echo $roomchargesrow->cost;?></td>
		</tr>
	
	<?php
	endforeach; }?>
			
			
			<tr>
		
		
				
			
			<td>DESCRIPTION :</td>
			<td>:<?php echo $row->description; ?></td>
		</tr>
		
		
		
		<tr>
			
			<td>GUEST NAME </td>
						 		<td><?php  $tenantid=$row->tenantid ; 
				 
				 
				    $tenantsid = $this->accomodationmodel->gettenantbyid($tenantid);
					$phone="";			
					$email="";			
					$company="";			

					$idno="";			

if(is_array($tenantsid)) {

   foreach($tenantsid as $tenantsidrow){

   echo $tenantsidrow->firstname. "  ".$tenantsidrow->lastname; 
       $phone= $tenantsidrow->phone; 
       $email= $tenantsidrow->email; 
       $idno= $tenantsidrow->idno; 
       $company= $tenantsidrow->company; 


}} else {
    echo "No details";
}
				 
				 
				 
				 
				 
				 ?></td>
						
					
						
		</tr>
			<tr>
			
			<td>IDNO.</td>
			<td>:<?php echo $idno ; ?></td>
		</tr>
			<tr>
			
			<td>PHONE</td>
			<td>:<?php echo $phone ; ?></td>
		</tr>
		
		<tr>
			
			<td>EMAIL</td>
			<td>:<?php echo $email ; ?></td>
		</tr>
		
		<tr>
			
			<td>COMPANY</td>
			<td>:<?php echo $company ; ?></td>
		</tr>
			<tr>
		
		
				
			
			<td>COMMENTS :</td>
			<td>:-----------------------------------------------------------------------
			</td>
		</tr>
		<tr>
			
			<td>Guest Signature:</td>
			<td>------------------------------------</td>
		</tr>
		
		
		
		<tr>
			
			<td><b>SERVED BY </b></td>
			<td><b><?php
        		$SERVEDBY = $this->usermodel->populateallarray('people','id',$user);
	$myname=$SERVEDBY[0]['firstname'];
			echo $myname; 
			
			
			?></b></td>
		</tr>
		</h2>


             <?php endforeach; ?>

              <?php }?>
			  	</table>
	<div style="text-align: left; text-size:16px ">
	<h3 style="padding:2px;margin:1px;">
		<?php $returnpolicy=$configuration[0]['returnpolicy']; if(isset($returnpolicy)) {echo   $returnpolicy; }?><br>

Developed by Robiseach LTD (0780655987)<br>
.............*******...............
</h3>
</div>

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