


	 <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>
                



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

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

	 if( window.print()) {
         window.location.href = "../user/searchhousebalance";
		alert(" printing...........");
    }else {

	
		      return      window.location.href = "../user/searchhousebalance";

		    // document.body.innerHTML = originalContents;

	}
}
	</script>
   <style type="text/css">
  
  

    #printable { display: none; }

    #myprint { display: none; }
#print{  	


    background-repeat: no-repeat;
	font-size;12px;
  
    


}


#sale{  	
background-image:url(images/add.png) ;

    background-repeat: no-repeat;
  
    width:100px; height:50px;


}
    
    @media print
    {
    	#non-printable { display: none; }
    	#printableArea { display: block; font-size:16; width:100%; }
		    	#myprint { display: block; font-size:16; width:100%; }

    }
    </style>
<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 href="<?php echo base_url(); ?>admin/searchbalance">	Go back
				 
				 	<div class="print-hide" id="non-printable"  >
<form name="print" method="post" action="">
 
 <div class="row">

 

   	<div class="col-md-6">

	
</div>
   	<div class="col-md-6">
<input type="submit" id="print"  accesskey="p" class="btn btn-primary"  name="print"onclick="printDiv('printableArea')" value="print receipt!" />
</form></div></div>
							</div> 
				 
				 
				 </a>
                    	</a></li>
							<li>
						
										 <a href="<?php echo base_url(); ?>user/mysales">	Back to cashier sales</a>

                    	</a></li>
			
		</ul>
    	<!------CONTROL TABS END------>
        
		<div class="tab-content">
            <!----TABLE LISTING STARTS-->
            <div class="tab-pane box active " id="list">
				
     
	 
	 <?php
	
 
				//echo $this->session->flashdata('msg'); 
   $session_data = $this->session->userdata('logged_in');

      $mydate=date("Y-m-d H:i:s");
 $date = Date('Y-m-d') ;
		 	 $year = Date('Y') ;
		  $month = Date('m') ;
 	$data['id'] = $session_data['id'];
        
		 $userid = $data['id'];
$data['companyid'] = $session_data['companyid'];
	 $companyid = $data['companyid'];
		 $data['usertype'] = $session_data['usertype'];
	 $usertype = $data['usertype'];	
    $deletebank=$this->usermodel->populatuserpermissionsdataarray('accounting','deletebank',$userid);

    $mpesaaction=$this->usermodel->populatuserpermissionsdataarray('accomodation','mpesa',$userid);
	      $chequeaction=$this->usermodel->populatuserpermissionsdataarray('accomodation','cheque',$userid);
 $voucheraction=$this->usermodel->populatuserpermissionsdataarray('accomodation','voucher',$userid);
	      $creditaction=$this->usermodel->populatuserpermissionsdataarray('accomodation','credit',$userid);
		   $pointsaction=$this->usermodel->populatuserpermissionsdataarray('accomodation','points',$userid);
	      $cardaction=$this->usermodel->populatuserpermissionsdataarray('accomodation','card',$userid);
		    $cashpayment=$this->usermodel->populatuserpermissionsdataarray('accomodation','cash',$userid);


		
	
	        		$configuration = $this->usermodel->populateallarray('smsconfig','id',$companyid);
					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;
					}
 $totalsales=0;
 $totalexpenses=0;
  $totalbanked=0;
    $totalbalance=0;
	    $totalcashathand=0;



	 
	 ?>
	 
	 
	 


 <div class="panel panel-primary" data-collapsed="0">
 	<div class="table-responsive">
			<div id="printableArea" style="width:100%" >
			
			<table width="100%">
           
			
			<tr>
				 	
	<td colspan="2" width="100%">
	<center>
					
										<?php $bussinessname=$configuration[0]['businessname']; if(isset($bussinessname)) {echo   $bussinessname; }?>
		</center>	
		</td>

			</tr>
				<tr>
				<td colspan="8">
				<CENTER> <B>SUMMARY RECEIPT SALES AND EXPENSES  REPORT</B>	</CENTER>
				</td>

		</tr>
			
			<tr>
				<td>

				<h4><b>Sales and expenses  between <?php echo $fromdate; ?> AND <?php echo $todate; ?>.</b></h4>	</td>
					<td><h4><b>Printed on <?php echo $date = date("Y-m-d"); ?></b></h4></td>

		</tr>
			
			
			
			
			
			
</table >
			
		<table width="100%">
           
			
			<tr>
				 	
	<td><h1>
Total sales Receipts	
</h1>
		</td>

				 
				 											       <td>
																   <h1><?php ;
						  								echo formatMoney($allbookings[0]["total"], true);

 $totalsales=$allbookings[0]["total"];

  $totalbanked=$cashbanked;
  
 


																   ?></h1></td>

			</tr>		
		</table >	
			
			

<table  border="1"width="100%">
             <thead>
		<tr>
				 	
	<td><h1>
Expenses / Cash Out
</h1>
		</td>
		
						 	
	<td><h1>
Amount
</h1>
		</td>
	   </tr>		

             </thead>
			 
			 <tbody>
<?php
 //$totalamount=0;

 if(!is_array($viewexpense)) {
	 
				//    echo '<div class="alert alert-danger text-center">There was no group/ category found in the system. Please create group/category first</div>';

			 }else{

    
       
 
  	foreach ($viewexpense as $c): 

		 

             ?>



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

$totalexpenses=$totalexpenses+$c->amount;

?>


         

  <td><?php 
  
  	$getgroup= $this->usermodel->populateallarray('glaccounts','number',$c->account );
								echo$groupname=$getgroup[0]['accountname'];
  
 echo $c->description ;
  ?></td>
   
   
    <td >
	<span class="pull-right">
  		<?php  echo formatMoney($c->amount, true); ?>
		</span>

  </td> 


	 
	 
		 
             </tr>

	<?php endforeach;} ?>
  <tfoot>
           <tr style="margin:0;padding:0">
		 
    <td></b><h3 style="margin:0;padding:0">Total Expenses /Cash Out:</h3></b></td>
	    <td><b><h3 style="margin:0;padding:0">
			<span class="pull-right">
<?php  echo formatMoney($totalexpenses, true); ?>
		</span>
		
		</h3>
	
		
		</b>
		</td>
			  
     </tr>	
      <tr>
		 
    <td></b><h3 style="margin:0;padding:0">Cash Balance:</h3></b></td>
	    <td><b><h3 style="margin:0;padding:0">
		<?php


    $totalbalance=$totalsales - $totalexpenses;




		//echo formatMoney($totalbalance, true);
		?>
		
		
		
		
				<span class="pull-right">
<?php  echo formatMoney($totalbalance, true); ?>
		</span>
		
		
		
		
		
		</h3>
	
		
		</b>
		</td>
			  
     </tr>	
	 
	 
	       <tr style="margin:0;padding:0">
		 
    <td></b><h3 style="margin:0;padding:0">Cash in Bank:</h3></b></td>
	    <td><b><h3 style="margin:0;padding:0">
		<?php



	//	echo formatMoney($totalbanked, true);
		?>
		
		
		
				<span class="pull-right">
<?php  echo formatMoney($totalbanked, true); ?>
		</span>
		
		
		
		</h3>
	
		
		</b>
		</td>
			  
     </tr>	
	 
	 
	 
	       <tr style="margin:0;padding:0">
		 
    <td></b>
	<h3 style="margin:0;padding:0">Cash at Hand:</h3>
	
	</b></td>
	    <td><b><h3 style="margin:0;padding:0">
		<?php


  
	    $totalcashathand=$totalbalance-$totalbanked;



		//echo formatMoney($totalcashathand, true);

		?>
		
			<span class="pull-right">
<?php  echo formatMoney($totalcashathand, true); ?>
		</span>
		
		
		
		</h3>
	
		
		</b>
		</td>
			  
     </tr>	
<tr>
<td colspan="2">
<br>Name-----------------------------------------------Date--------------------Signature----------------
</td>
</tr>	 
 </tfoot>
        </table>


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

</div>
		<!----CREATION FORM STARTS---->
	   <div id="Checkout" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Check Out</h4>
      </div>
      <div class="modal-body">
        <h3>Are you sure you want to Check out this customer? </h3>
      </div>
      <div class="modal-footer">
	  	

     
		<?PHP
				$session_data = $this->session->userdata('adminlogged_in');
 echo $this->session->flashdata('deletemsg'); 

		
                 echo form_open('admin/updatechekout' , array('class' => 'form-horizontal ', 'enctype' => 'multipart/form-data'));
				 if(validation_errors()):?>
<div class='alert alert-danger text-center'><?php echo validation_errors(); ?></div>
<?php endif;?>  								  		<input type="hidden" name="roomidentifier" value="<?php  echo $roomidentifier ; ?>"id="roomidentifier" class="form-control"  placeholder="Enter roomidentifier">

 <input type="hidden" id="table"name="table" class="table" placeholder="bookroom" value="bookroom">
 <input type="hidden" id="view2"name="view2" class="view2" placeholder="view2" value="&randomitemidentifier1=">

 <input type="hidden" id="view"name="view" class="view" placeholder="view" value="admin/allocate?randomitemidentifier=">
 <input type="hidden" id="itemid1"name="itemid" class="itemid" placeholder="itemid" value=""><br>
           <input type="hidden" id="houseno"name="houseno" class="form-control" placeholder="houseno"  value="<?php echo $houseno;?>">

          <input type="hidden" id="plotno1"name="plotno" class="form-control" placeholder="plotno"  value="<?php echo $plotno;?>">
 		   		  	         <button type="submit" name="updatecharges" value="charges" class="btn btn-success"> Yes  </button>

 <button type="button" class="btn btn-danger" data-dismiss="modal">No</button>


	<?php echo form_close();?>
      </div>
    </div>

  </div>

  </div>
		
</div>




			