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

	}
}


       
		 
  
		
		 $(document).on("click", "#managebtndelete", function()
        {
          var itemid = $(this).data('id');
		  $("#itemid").val(itemid); 
		  
		  
		   
        });
		








	</script>
	
	
	         <script type="text/javascript">
  
  
		 $(document).on("click", "#managebtncheckout", function()
        {
          var roomidentifier = $(this).data('id');
		  $("#roomidentifier").val(roomidentifier); 
		  
		    var houseno2 = $(this).data('houseno');
		  $("#houseno2").val(houseno2); 
		     var plotno2 = $(this).data('plotno');
		  $("#plotno2").val(plotno2); 
		   
		    var bedid = $(this).data('bedid');
		  $("#bedid").val(bedid); 
        });
		
	
		</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>







 <div class="row">

 

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

				 
				 	<div class="print-hide" id="non-printable"  >
<form name="print" method="post" action="">
 
 <div class="row">

 

   	<div class="col-md-6">
				 <a class="btn btn-success" href="<?php echo base_url(); ?>admin/viewpallmyplots">	GO BACK</a> ||

					 <a class="btn btn-info"href="<?php echo base_url(); ?>admin/searchbalance">View More reports</a>||
										     <a data-toggle='modal' data-target='#viewsms' class="btn btn-primary">Search for Reservations Report </a></br>

</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> 
     
	 
	 <?php
	 	$session_data = $this->session->userdata('logged_in');

    $data['companyid'] = $session_data['companyid'];
	 $companyid = $data['companyid'];
 $data['id'] = $session_data['id'];
        
		 $userid = $data['id'];
        
		
			 $data['usertype'] = $session_data['usertype'];
	 $usertype = $data['usertype'];	
	        		$configuration = $this->usermodel->populateallarray('smsconfig','id',$companyid);



    $updatehouse=$this->usermodel->populatuserpermissionsdataarray('accomodation','updatehouse',$userid);
		   $cancelpayment=$this->usermodel->populatuserpermissionsdataarray('accomodation','cancel',$userid);
	      				 				   $checkoutroom=$this->usermodel->populatuserpermissionsdataarray('accomodation','checkoutroom',$userid);

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

	 
	 ?>
	 
	 
	 


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

			</tr>
			<?php if(isset($fromdate)) {
			
				
				
			
			?>
		<tr>
				<td>

				<h4><b> Room Reservations  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>
			
			
				<?php 
				
				}
			
			?>
			
			
			
</table >
			
			
			
			
		







								
  <table cellpadding="0" cellspacing="0"  border="1"width="100%" class="table  table-striped" id="example2" style="border-color:#CCCCCC; width:100%;"  >

             <thead>
		
	<tr>
	<th colspan="6">
	
								<h4><b><center>ALL Merged items</CENTER> </b></h4>	
</th> 
	</tr>
			 
			 
			 
			 
			 
			 

         <tr>
   
     <th>Charge</th>
	   
	<th>Cost</th>	
  <th>Qty</th>	
  <th>Pax</th>	
  <th>Total</th>	
  <th>Date</th>	 
	  
  <th>By</th>	 
	  <th>Ref No:</th>	 

                 </tr>
             </thead><tbody>
<?php




				
				
				
				
				
				
 if(!is_array($roomcharges)) 

 {


   echo "<tr  style='margin-bottom:0px;margin-top:0px;' '>";
      echo "<td colspan='4'>";
    
       echo '<div class="alert alert-warning text-center">There no records found..</div>';
    echo "</td>";
   echo "</tr>";
    }else {
?>
    
             <?php 
  $ttamount=0;
  	foreach ($roomcharges as $c){

		 

             ?>



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


?>

              

  <td><?php 
  
  
  if(trim($c->type) =="room"){
		   $mycheckname = $this->usermodel->populateallarray('charges','id',trim($c->name));


if($mycheckname[0]["type"] !=""){
	echo $mycheckname[0]["type"];
}else{
	
	echo $c->name ;
}

  }else{
	  
	  

		   $checkname = $this->usermodel->populateallarray('products','code',trim($c->code));


if($checkname[0]["name"] !=""){
	echo $checkname[0]["name"];
}else{
	
	echo $c->name ;
}
  }


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

  ?></td>
   
     <td><?php echo $c->cost ; ?></td>
     <td><?php echo $c->qty ; ?></td>
     <td><?php echo $c->uomqty ; ?></td>
     <td><?php echo $c->amount ; ?></td>
     <td><?php echo $c->date ; ?></td>
   <td><?php



		   $users = $this->usermodel->populateallarray('people','id',trim($c->userid));



	echo $users[0]["firstname"];







   ?></td>
     <td>
	 
		   <a  id="non-printable" target="_blank" class="btn btn-warning"  href="<?php echo base_url();?>user/searchallmyinvoices?searchterm=<?php   if(isset($c->invoice )) {echo $c->invoice ; } ?>&view=userdata/allinvoices">  <?php echo $c->invoice ; ?> </a>
 
	 
	 </td>

		
		 
             </tr>

	<?php
	}
	?>
	
	<tr>
<td colspan="4"> <b>Total amount:</b></td>
<td > 	<b>	 <?php echo $ttamount ; ?></b></td>
<td></td>
</tr>
	
	
	<?php
	
	} 
	
	?>

              
</tbody>


        </table>








		

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









 <div id="myCheckout" 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">Customer 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/myupdatechekoutbedsgoup' , 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" id="table"name="table" class="table" placeholder="bookroom" value="bookroom">
 <input type="hidden" id="view2"name="view2" class="view2" placeholder="view2" value="">
 <input type="hidden" id="roomidentifier" name="roomidentifier" class="roomidentifier" placeholder="roomidentifier" value="">
 <input type="hidden" id="bedid" name="bedid" class="roomidentifier" placeholder="roomidentifier" value="">

 
 	<select class="form-control" name="status" required >
	<option  value=""  >--Select status-</option>

				   <option selected value="Vacant Dirty" >Vacant Dirty</option>
				<?php
					if( $usertype=="admin"){
						?>
   <option value="vacant"  >Vacant Ready</option>
  
<option value="Occupied Dirty" >Occupied Dirty </option>

   <option value="Blocked" >Blocked</option>
   <option value="Reserved" >Reserved</option>

					<?php	
					}
					
					?>
					


	
</select>
Clear Pending Balance?
 	<select class="form-control" name="balance" required>
	<option  value=""  >--Do you want to Clear any Pending tenant balance automatically?-</option>
   <option value="yes"  >Yes</option>
									  
 <option value="no"  selected="selected"  >No</option>
																 									   <option value="Pending">Pending</option>



	
</select>
 <input type="hidden" id="view"name="view" class="view" placeholder="view" value="admin/pendingbeds?=">
 <input type="hidden" id="itemid1"name="itemid" class="itemid" placeholder="itemid" value=""><br>
           <input type="hidden" id="houseno2"name="houseno" class="form-control" placeholder="houseno"  value="">

          <input type="hidden" id="plotno2"name="plotno" class="form-control" placeholder="plotno"  value="">
 		   		  	         <button type="submit" name="updatecheckout" value="checkoutbedgroup" 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 id="viewsms" 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">Booking Report</h4>
      </div>
      <div class="modal-body">
      
	  	

				<?PHP
//$session_data = $this->session->userdata('logged_in');

 $finalendate=date("Y-m-d H:59:59");
  $finalstartdate=date("Y-m-d 00:00:00");
  
  
  
//

				echo $this->session->flashdata('msg'); 
		
                 echo form_open('admin/searchreservedrooms' , array('class' => 'form-horizontal form-groups-bordered validate', 'enctype' => 'multipart/form-data'));
				 if(validation_errors()):?>
<div class='alert alert-danger text-center'><?php echo validation_errors(); ?></div>
<?php endif;?>

		


  
  
  
  
  

  <div class="form-group">
    <label for="inputfromdate" class="col-sm-2 control-label">From Date </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="fromdate" value="<?php echo set_value('fromdate',$finalstartdate); ?>" class="form-control" required placeholder="Enter start date">
		 
				
		<span class="text-danger"> <?php echo form_error('fromdate'); ?>
		
		</span>
	</div>
  </div>
  
  	<div class="form-group">
    <label for="inputtodate" class="col-sm-2 control-label">	To Date </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="todate" value="<?php echo set_value('todate',$finalendate); ?>" class="form-control" required placeholder="Enter End date">
		 
				
		<span class="text-danger"> <?php echo form_error('todate'); ?>
		
		</span>
	</div>
  </div>
  

  
    

   
  
  <div class="form-group">
    <label for="inputstatus" class="col-sm-2 control-label">Status </label>
    <div class="col-sm-10">
      <select name="status" required class="form-control" id="section_selector_holder">
		                            <option value="" >--Select Status--</option>
			                         			                         <option value="all">all</option>

									 
									 <option value="active">active</option>
									 			                         <option selected value="reserved">reserved</option>

									   	 <option value="closed">closed</option>

			                    </select>
		

		
	</div>
  </div>
  
  
     <div class="form-group">
   <label for="inputplotno" class="col-sm-2 control-label"> </label>

  
  <div class="col-sm-2">
					<div class="form-group">

                     		  		<input type="text" name="plotno" value="<?php echo set_value('plotno',"all"); ?>" class="form-control"  placeholder="Enter plot/House no ">

					</div>
				</div>
				<div class="col-sm-5">
					<div class="form-group">
					
                     		  		<input type="text" name="houseno" value="<?php echo set_value('houseno',"all"); ?>" class="form-control"  placeholder="Enter Rooms no ">


					</div>
				</div>
			
	</div>
			
  
  
  
  
  
  
	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="bookings" name="btn_BOOKINGS" class="btn btn-primary"> View SMS  </button>

    </div>
  </div>
  					<?php echo form_close();?>
			</div>							   
				
									
							
								
			<div class="modal-footer">

    

				</div>

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

	



	   <div id="myModal" 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">Delete</h4>
      </div>
      <div class="modal-body">
        <h3>Are you sure you want to delete this item? </h3>
      </div>
      <div class="modal-footer">
	  	

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

		
                 echo form_open('user/deleteallbyid' , 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" id="table"name="table" class="table" placeholder="bookroom" value="bookroom">
 <input type="hidden" id="view2"name="view2" class="view2" placeholder="view2" value="">

 <input type="hidden" id="view"name="view" class="view" placeholder="view" value="admin/viewpallmyplots">
 <input type="hidden" id="itemid"name="itemid" class="itemid" placeholder="itemid" value=""><br>
           <input type="hidden" id="houseno"name="houseno" class="form-control" placeholder="houseno"  value="">

          <input type="hidden" id="plotno1"name="plotno" class="form-control" placeholder="plotno"  value="">
 <button type="button" class="btn btn-success" data-dismiss="modal">No</button>
 		  	         <button type="submit" name="btn_delete" value="deletebyid" class="btn btn-danger"> Delete  </button>

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

  </div>

  </div>
</div>