

				   	 <script type="text/javascript">
        
        
            $(document).ready(function() { 

                
                $("#plotno").change(function(){
                 	var plotnoid = $("#plotno").val();
                     /*dropdown post *///
                      $.ajax({
			 		url:"<?php echo base_url();?>admin/populatehouseid",
			 		
					 data: {plotno: $(this).val()},

                    type: "POST",
                    success:function(data){
                        
                        $("#houseid").html(data);
                    }
                
                    });

               
                });

            });
               $(function () {
        $("#plotno").change(function () {
            if ($(this).val() == "") {
                $("#house").hide();
            } 
            else {
                $("#house").show();
            }
        });
    });
          
        </script>
	
        <script>
        $(function() {
<!--             $(".datepicker").datepicker(); -->
<!--             $(".uniform_on").uniform() -->;
            $(".chzn-select").chosen();
   <!--          $('.textarea').wysihtml5(); -->

        });
        </script>
                  

	 <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 type="text/javascript">
  	 $(document).on("click", "#managebtncheckoutstatus", function()
        {
          var roomidentifier3 = $(this).data('id');
		  $("#roomidentifier3").val(roomidentifier3); 
		  
		    var houseno3 = $(this).data('houseno');
		  $("#houseno3").val(houseno3); 
		     var plotno3 = $(this).data('plotno');
		  $("#plotno3").val(plotno3); 
		   
        });
		
  
		 $(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); 
		   
        });
		
		
		 $(document).on("click", "#managebtndelete", function()
        {
          var itemid = $(this).data('id');
		  $("#roomid").val(itemid); 
		  
		  
		   
		   
        });
		
		
    function selectAllCheckBoxes(obj){
        $('input:checkbox:not(:disabled).checkBoxInLoop').prop('checked', jQuery(obj).prop('checked'));
    }

    function unselectCheckBoxUnik(){

        /*first you verify if the quantity of checkboxes equals number of checkboxes*/
        a = $('input:checkbox:not(:disabled).checkBoxInLoop:checked').size();
        b = $('input:checkbox:not(:disabled).checkBoxInLoop').size();

        /*if equals, mark a checkBoxUnik*/
        ((a == b)? $('#checkBoxUnik').prop("checked", true) : $('#checkBoxUnik').prop("checked", false));
    }

		
    </script>     

      




<ul class="nav nav-tabs bordered">
			<li class="active">
            	<a href="#add" data-toggle="tab"><i class="entypo-menu"></i> 
			View Meter Details
                    	</a></li>
						
							<li>
            	<a href="#list" data-toggle="tab"><i class="entypo-plus-circled"></i>
			
				 <a class="btn btn-info"href="<?php echo base_url(); ?>admin/viewpallmyplots">	Go back</a>
                    	</a></li>
			
						
		</ul>
    	<!------CONTROL TABS END------>
        
		
		<?php
					echo $this->session->flashdata('deletemsg'); 
		   $session_data = $this->session->userdata('logged_in');

   
 	$data['id'] = $session_data['id'];
        
		 $userid = $data['id'];
$data['companyid'] = $session_data['companyid'];
	 $companyid = $data['companyid'];
		 $data['usertype'] = $session_data['usertype'];
	 $usertype = $data['usertype'];	
	      $viewhouse=$this->usermodel->populatuserpermissionsdataarray('accomodation','viewhouse',$userid);


			?>
            <!----TABLE LISTING STARTS-->
          	<div class="row">
	<div class="col-md-10">
	





				<?PHP

 $transactionid = 'rand' .rand(100, 9900) . 'trc' . time();
				$date= Date('Y-m-d');

                 echo form_open('admin/searchrooms' , 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;?>
					
				<input type="hidden" name="page" value="pmsdata/searchallhouse" id="page" class="form-control" required placeholder="Enter End  Date">

   <div class="form-group" style="margin:0px; padding:0px">
 	
   </div>
						<label for="field-2" class="col-md-1 control-label"> Name</label>
		                    <div class="col-md-2">
		                        <select name="plotno" class="chzn-select" id="plotno"  required style="margin:0px; padding:0px; width:200px">
		                            <option selected value="">--Select House--</option>
									   <?php
									$plot = $this->accomodationmodel->populateallplots();


if(is_array($plot)) {

   foreach($plot as $plotrow){

    ?>
	    <option  value="<?php echo set_value('plotno',$plotrow->id); ?> "><?=$plotrow->name;?></option>

   
    <?php

}} else {
    echo 'There is no plot in the system.... Please add plot first.';
}

?>
			                        
			                    </select>
			                </div>

	
		
	   <div style="margin:0px; padding:0px">
						<label for="field-2" class="col-md-2 control-label">Meter No</label>
		                    <div class="col-md-2" id="house" style="display: none" >
		                        <select name="houseno" class="form-control"  id="houseid"   >
		                            <option selected value="none" >--All meters--</option>
									  
			                        
			                    </select>
								
								     <span class="text-danger"><?php echo form_error('houseno'); ?></span>
			                </div>
	</div>
	

	
   <div>
						<label for="status" class="col-md-1 control-label">Status</label>
		                    <div class="col-md-2" id="status">
		                        <select name="status" class="form-control"   >
		                            <option selected value="none" >-None-</option>
									   <option  value="all" >-All-</option>
									   <option  value="vacant" >-Vacant Ready-</option>
									   <option  value="occupied" >-Occupied Ready-</option>

				
										 <option selected value="Vacant Dirty" >Vacant Dirty</option>
										<option value="Occupied Dirty" >Occupied Dirty </option>
										 <option value="Blocked" >Blocked</option>
										  <option value="Reserved" >Reserved</option>
									   <option  value="freezed" >-Freezed-</option>


			                        
			                    </select>
								
								     <span class="text-danger"><?php echo form_error('houseno'); ?></span>
			                </div>
							
							
	       <button type="submit" name="btn_tenant"value="tenant" class="btn btn-primary">Search Meter</button>
		              <a id="non-printable"  class="btn btn-default"  href="<?php echo base_url(); ?>admin/viewpallmyplotsbuttons">Refresh</a>

	</div>
	

    
  
  


     
    <?php echo form_close();?>
 
  </div>
	<div class="col-md-12">


	 
   

<table id="example"  cellspacing="1" class="table  table" width="100%">
             <thead>
			
         <tr>
	
  <th> No </th>
	<th>Meter No</th>
	
    <th>Status</th>   
 <th>Description</th>  	
    <th>Customer</th>       
	<th>Payment Status</th>     
    <th>Credit</th> 
	<th>Checkin/out</th> 

<td> More</td>
                 </tr>
             </thead>
<?php
 $grandtotal=0;
echo $this->session->flashdata('msg'); 
 if(!is_array($house)) 

 {



  
    
       echo '<div class="alert alert-danger text-center">There is no  House found by now from system.Try again</div>';
   
    }else {
?>
    
             <?php 
   

	  $allplotno;
  	foreach ($house as $c): 

		 

             ?>



             <tr>
                
            <?php 
		 $houseno=$c->houseno;
	 $plotno=$c->plotno;
 $houseid=$c->id;
 
 $booking  = $this->usermodel->populatealldatanorraythree('bookroom','plotno', $plotno,'houseno', $houseno,'status','active');



	  $roomidentifier=$booking[0]['id'];
						 
   
						   

						$checkstatus=$booking[0]["paymentstatus"];
								$creditpaid=$booking[0]["credit"];

?>


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

$allplotno=$c->plotno;				?></td> 
				

					<td><?php
					
			$mystatus=$c->status ;
			if($mystatus=="vacant"){
			
			?>
			<div class="btn-warning">
			<?php  echo $c->status ; 	?>
			</div>
			<?php
			}else if($mystatus=="occupied"){
				?>
			<div class="btn-success">
			<?php  echo $c->status ; 	?>
			</div>
			<?php
			
			}else if($mystatus=="freezed"){
			?>
			<div class="btn-primary">
			<?php  echo $c->status ; 	?>
			</div>
			<?php
			}else{
				 echo $c->status ; 
				
			}
			
		
			?>
					
					</td> 
					             <td><?php echo $c->description ; ?></td> 

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

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

    $names=$tenantsrow->lastname. " ".$tenantsrow->firstname ; 
   
   ?>
   
                     <a 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 $checkstatus ; ?></td>  
					<td><?php echo $creditpaid ; ?></td> 
					
					

              
			  
			  
			  
			  
			  
			  
			  
			  
			  		<td><?php
					
			$mystatus=$c->status ;
			if($mystatus=="vacant"){
			
			?>
			                     <a class="btn btn-warning" id="more" href="<?php echo base_url();?>admin/allocate?randomitemidentifier=<?php   {echo  $houseno;}  ?>&randomitemidentifier1=<?php   {echo  $plotno;}  ?>&roomidentifier=<?php   {echo  $houseid;}  ?>">Allocate </a>

			<?php
			}else if($mystatus=="occupied"){
				?>
			 <a class="btn btn-danger managebtn" id="managebtncheckout"	data-plotno='<?php echo  $c->plotno;?>' data-houseno='<?php echo  $c->houseno;?>' 	 data-id='<?php echo  $c->id;?>'     data-toggle='modal' data-target='#myCheckout<?php  $c->id; ?>'>                      Check-out
						</a>
	 
			
			<?php
			
			}else if($mystatus=="freezed"){
			?>
				 <a class="btn btn-danger managebtn" id="managebtncheckout"	data-plotno='<?php echo  $c->plotno;?>' data-houseno='<?php echo  $c->houseno;?>' 	 data-id='<?php echo  $c->id;?>'     data-toggle='modal' data-target='#myCheckout<?php  $c->id; ?>'>                      Check-out
						</a>
	 

			<?php
			}else{
				?>
<a class="btn btn-danger managebtn" id="managebtncheckout"	data-plotno='<?php echo  $c->plotno;?>' data-houseno='<?php echo  $c->houseno;?>' 	 data-id='<?php echo  $c->id;?>'     data-toggle='modal' data-target='#myCheckout<?php  $c->id; ?>'>                      Check-out
						</a>
			<?php
				
			}
			
		
			?>
			 <a class="btn btn-info managebtn" id="managebtncheckoutstatus"	data-plotno='<?php echo  $c->plotno;?>' data-houseno='<?php echo  $c->houseno;?>' 	 data-id='<?php echo  $c->id;?>'     data-toggle='modal' data-target='#myCheckoutstatus<?php  $c->id; ?>'>  Edit  Status
						</a>		
					
         </td>
		   
		 
		 
		 
		 
		 <td> 

 
 
					<div class="btn-group">
                                    <button type="button" class="btn btn-primary btn-sm dropdown-toggle" data-toggle="dropdown">
                                        More <span class="caret"></span>
                                    </button>
									
                                    <ul class="dropdown-menu dropdown-primary pull-right" role="menu">
                                  <?php
										if($booking!=FALSE){
											
											?>
										
											  <li> 
										
                                         <li> 
						<a  id="more" class="btn btn-warning" href="<?php echo base_url();?>user/mychangepayment?myid=<?php echo $c->id ?>&randomitemidentifier=<?php echo $houseno ?>&randomitemidentifier1=<?php echo $plotno ?>&roomidentifier=<?php echo $roomidentifier ?>"> Update Payment  </a>


                                                </a>
                                                        </li> 
                                                        </li>
														  <li class="divider"></li>

										<?php
										}
										?>      
                                        
												<li> 
										                     <a class="btn btn-primary"  id="more" href="<?php echo base_url();?>admin/editroom?randomitemidentifier=<?php   {echo  $houseid;}  ?>">Update/Charges  </a>

                                                        </li> 
  <li class="divider"></li>
														<?php
										if($usertype=="admin"){
											
											?>
										
											  <li> 
										 <a class="btn btn-danger managebtn" id="managebtndelete"		 data-id='<?php echo  $c->id;?>'   data-plotno='<?php echo  $c->plotno;?>'  data-toggle='modal' data-target='#myModal<?php  $c->id; ?>'>	 


                                                <i class="glyphicon glyphicon-pencil"></i>
																Delete
                                                </a>
                                                        </li>
										<?php
										}
										?>
									
                                                                           
                                    </ul>
										
                                </div>
</td>
             </tr>

             <?php endforeach; ?>

              <?php }?>
			 
			 

        </table>


</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">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/myupdatechekout' , 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="">

 
 	<select class="form-control" name="status" required>
	<option  value=""  >--Select status-</option>
   <option value="vacant" selected="selected">Vacant</option>
									  
							<option value="occupied">occupied</option>
									  
								<option value="reserved">reserved</option>
								<option value="freezed">freezed </option>
								<option value="Pending">Pending </option>
								<option value="Cleaned">Cleaned </option>

																 									   <option value="Pending">Pending</option>



	
</select>
 <input type="hidden" id="view"name="view" class="view" placeholder="view" value="admin/viewpallmyplotsbuttons">
 <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="checkout" 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="myCheckoutstatus" 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">Change Status</h4>
      </div>
      <div class="modal-body">
        <h3>Are you sure you want to update this room? </h3>
      </div>
      <div class="modal-footer">
	  	

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

		
                 echo form_open('admin/myupdatechekout' , 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="roomidentifier3" name="roomidentifier" class="roomidentifier" placeholder="roomidentifier" value="">

 
 	<select class="form-control" name="status" required>
   <option value="vacant" selected="selected"></option>
									  
							
   <option value="vacant"  >Vacant Ready</option>
  <option value="occupied">Occupied Ready</option>

<option value="Occupied Dirty" >Occupied Dirty </option>
	<option selected value="Vacant Dirty" >Vacant Dirty</option>
   <option value="Reserved" >Reserved</option>					 									   <option value="Pending">Pending</option>

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





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

          <input type="hidden" id="plotno3"name="plotno" class="form-control" placeholder="plotno"  value="">
 		   		  	         <button type="submit" name="updatecheckout" value="checkout" 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="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">
        <h4>Are you sure you want to Check out all customers whoes check out time is below this date and time? </h4>
      </div>
      <div class="modal-footer">
	  	

     
		<?PHP
				$session_data = $this->session->userdata('adminlogged_in');
 echo $this->session->flashdata('msg'); 
    $closedatedate=date("Y-m-d 10:01:01");

		
                 echo form_open('admin/updatebulkchekout' , 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;?>  								  		

 <div class="form-group">
    <label for="inputidno" class="col-sm-2 control-label">Check-Out  Time</label>
    <div class="col-sm-7">
				<input type="text" name="checkoutdate" value="<?php echo set_value('checkoutdate',$closedatedate); ?>" id="idno" class="form-control" required placeholder="Enter End  Date">
        <span class="text-danger"><?php echo form_error('checkoutdate'); ?></span>
	</div>
  </div>
 <input type="hidden" id="table"name="table" class="table" placeholder="bookroom" value="bookroom">

 
 <input type="hidden" id="view"name="view" class="view" placeholder="view" value="admin/viewpallmyplots">

 		   		  	         <button type="submit" name="bulkcheckout" value="checkout" 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="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/deletebyid' , 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="view" value="house">

 <input type="hidden" id="view"name="view" class="view" placeholder="view" value="admin/viewpallmyplots">
 <input type="hidden" id="roomid"name="itemid" class="itemid" placeholder="itemid" value=""><br>
          <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>
		<!----CREATION FORM STARTS---->
	
</div>




			