	      <script type="text/javascript">
  
		
		 $(document).on("click", "#managebtndelete", function()
        {
          var itemid = $(this).data('id');
		  $("#itemid1").val(itemid); 
		  
		  
		   
        });
		
		$(document).on("click", "#editbtn", function()
        {
          var mycategoryid = $(this).data('id');
		  $("#mycategoryid").val(mycategoryid); 
		   
		   		      var type = $(this).data('type');
		   $("#type").val(type);
   var branchid = $(this).data('branchid');
		   $("#branchid").val(branchid);
 
		    var name = $(this).data('type');
		   $("#name").val(name); 
		   
		     var description = $(this).data('description');
		   $("#description").val(description); 
		   var dateposted = $(this).data('dateposted');
		   $("#dateposted").val(dateposted); 
		  
		 
		   
        });
		
		
    </script> 

<ul class="nav nav-tabs bordered">
			<li class="active">
            	<a href="#list" data-toggle="tab"><i class="entypo-menu"></i> 
					All Door Locks/ Card History
                    	</a></li>
			<li>
            	<a href="#add" data-toggle="tab"><i class="entypo-plus-circled"></i>
					Upload Card / Door lock transactions
                    	</a></li>
				                	</a></li>
			<li>
            	
								 <a href="<?php echo base_url(); ?>admin/viewpallmyplots">Back</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('imagemsg1'); 
		      $mydate=date("Y-m-d H:i:s");
    echo $this->session->flashdata('deletemsg'); 

		    
$session_data = $this->session->userdata('logged_in');
 $data['usertype'] = $session_data['usertype'];
	 $usertype = $data['usertype'];	
	
$data['surname'] = $session_data['surname'];
$data['id'] = $session_data['id'];
 $data['companyid'] = $session_data['companyid'];
	 $companyid = $data['companyid'];
$surname=$data['surname'];
   $userid=$data['id'];

echo $this->session->flashdata('msg'); 
     

?>
 <div class="panel panel-primary" data-collapsed="0">
 
<table id="example"  cellspacing="1" class="table  table" width="100%">
             <thead>
		
         <tr>
  	<th>Date created</th> 

    <th>Charge Name </th>

		<th>Guest</th>
			 	<th>Room Type</th>
				     <th>Room No</th>
			 	<th>Guest Type</th>
				     <th>Charge Type</th>
			 	<th>Issued QTY</th>
				     <th>Recycled Card QTY</th>
			 	<th>State</th>
				     <th>Check in Time</th>
			 	<th>Departure Time</th>
			 	<th>Voucher No</th>
				     <th>Checkout Time</th>
			 	<th>Area 1</th>
				     <th>Area 2</th>
			 	<th>Operator</th>
				
					<th>Remark</th>
				     <th>Family Room</th>

		 
		 
		 
		 
		 
	<th>Description</th> 

<th>More</th> 


                 </tr>
             </thead>

<?PHP

 if(!is_array($doorlock)) 

 {


   echo "<tr  style='margin-bottom:0px;margin-top:0px;' '>";
      echo "<td colspan='3'>";
    
       echo '<div class="alert alert-warning text-center">There is no payment charges found by now from system..</div>';
    echo "</td>";
   echo "</tr>";
    }else {
?>
    
             <?php 
  
  	foreach ($doorlock as $c): 

		 

             ?>



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


?>
                     <td><?php echo $c->createdat; ?></td>   
			 
             <td><?php echo $c-> name ; ?></td> 
			 
			 
			 
             <td><?php echo $c->guest ; ?></td> 
			 	<td><?php echo $c->roomtype ; ?></td> 
				     <td><?php echo $c->roomno ; ?></td> 
			 	<td><?php echo $c->guesttype ; ?></td> 
				     <td><?php echo $c->chargetype ; ?></td> 
			 	<td><?php echo $c->issuedqty ; ?></td> 
				     <td><?php echo $c->recycledcardqty ; ?></td> 
			 	<td><?php echo $c->state ; ?></td> 
				     <td><?php echo $c->checkintime ; ?></td> 
			 	<td><?php echo $c->departuretime ; ?></td> 
			 	<td><?php echo $c->voucherno ; ?></td> 
				     <td><?php echo $c->checkouttime ; ?></td> 
			 	<td><?php echo $c->area1 ; ?></td> 
				     <td><?php echo $c->area2 ; ?></td> 
			 	<td><?php echo $c->operator ; ?></td> 
				
					<td><?php echo $c->remark ; ?></td> 
				     <td><?php echo $c->familyroom ; ?></td> 
				
				
				<td><?php echo $c->description ; ?></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">
                                        
                                        <!-- teacher EDITING LINK -->
                                      
											<?php
										if($usertype=="admin"){
											
											?>
											  <li> 
										 <a class="btn btn-danger managebtn" id="managebtndelete"		 data-id='<?php echo  $c->id;?>'     data-toggle='modal' data-target='#myModal<?php  $c->id; ?>'>	 


                                                <i class="glyphicon glyphicon-pencil"></i>
																Delete
                                                </a>
                                                        </li>
									
									
                                        <li class="divider"></li>
                                        
                                     
                                                     		
														
														
																<?php
										}
										?>
														
														                       <li class="divider"></li>
                                        
												<li> 
				<a  id="more" target="_blank"class="btn btn-default" href="<?php echo base_url();?>user/viewassignedbanks?mycode=<?php   {echo  $c->id;}  ?>"> 


                                                <i class="glyphicon glyphicon-pencil"></i>
															View Assigned Banks
                                                </a>
                                                        </li> 
                                        
                                    </ul>
									
                                </div>
		 
		 </td>
             </tr>

             <?php endforeach; ?>

              <?php }?>

        </table>

</div>

</div>
<div class="tab-pane box" id="add" style="padding: 5px">




		
<div class="row">
	<div class="col-md-12">
		<div class="panel panel-primary" data-collapsed="0">
        	<div class="panel-heading">
            	<div class="panel-title" >
            		<i class="entypo-plus-circled"></i>
				Upload  new Door locks / Cards data
            	</div>
            </div>
			<div class="panel-body">





				<?PHP
				echo $this->session->flashdata('msg'); 
		
                 echo form_open('admin/uploaddoorlocks' , 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" id="view"name="view" class="view" placeholder="view" value="admin/viewalldoorlocks">
		
  <div class="form-group">  <div class="form-group">

    <label for="inputfile" class="col-sm-2 control-label">Upload file</label>
    <div class="col-sm-7">
		  		<input type="file" name="file" value="<?php echo set_value('file'); ?>"id="file" class="form-control"  placeholder="Enter Country Name">
     <span class="text-danger"><?php echo form_error('file'); ?></span>
   </div>
  </div>

    <label for="inputname" class="col-sm-2 control-label">Uploaded By? (Name)</label>
    <div class="col-sm-7">
<input type="text" name="name" value="<?php echo set_value('name'); ?>"id="name" class="form-control" required placeholder="Enter name">
     <span class="text-danger"><?php echo form_error('name'); ?></span>
   </div>
  </div>
   			
  		<input type="hidden" name="action" value="<?php echo set_value('action','insert'); ?>"id="action" class="form-control" required placeholder="Enter action">

  
  
  
    <div class="form-group">

    <label for="inputcreatedat" class="col-sm-2 control-label">Date</label>
    <div class="col-sm-7">
<input type="date" name="createdat" value="<?php echo set_value('createdat'); ?>"id="createdat" class="form-control" required placeholder="Enter date">
     <span class="text-danger"><?php echo form_error('date'); ?></span>
   </div>
  </div>
  
  
  
  
  
  
  
   <div class="form-group">
    <label for="inputphone3" class="col-sm-2 control-label">Description </label>
    <div class="col-sm-7">
	<textarea name="description" id="description" rows="5" placeholder="add Description" class="form-control"></textarea>
    <span class="text-danger"><?php echo form_error('description'); ?></span>
   </div>
  </div>
    
  
  
  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-7">
     
	       <button type="submit" name="btn_uploaddoorlockdata"value="upload" class="btn btn-primary">Upload Now</button>

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



</div>


    </div>
</div>

	<div id="editProductModel" 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">Assign Charges to banks</h4>
      </div>
      <div class="modal-body">
      
	  	

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



		
                 echo form_open('user/assignbank' , 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="action" value="insert"id="view" class="form-control" required placeholder="Enter action">
	<input type="hidden" name="categoryid" value=""id="mycategoryid" class="form-control" required placeholder="Enter mycategoryid">

	 <div class="form-group">
    <label for="inputbranchname" class="col-sm-2 control-label">Branch</label>
    <div class="col-sm-10">
	<select class="form-control" name="branchid"  id="branchid" required >
		<option value="" >---Select Branch/Counter Name--</option>



						
	<?php 
					 
					 		$maincategory = $this->usermodel->populateall('branch','companyid',$companyid);


							


if(is_array($maincategory)) {

   foreach($maincategory as $maincategoryrow){

   //echo $courserow->coursename;
    ?>
					<option selected value="<?=  $maincategoryrow->id;   ?>"><?=  $maincategoryrow->name; ?></option>



	<?php

}} else {
    echo 'No main counter available.';
}
	
?>

</select>
		

		
	</div>
  </div>
     
	 	<div class="form-group">
    <label for="inputname" class="col-sm-2 control-label">	Charge name  :  </label>
    <div class="col-sm-10">
	
		  		<input type="text" required id="name" name="name" value="<?php echo set_value('name'); ?>" class="form-control"  placeholder="Enter payment method name">
		 
				
		<span class="text-danger"> <?php echo form_error('name'); ?>
		
		</span>
	</div>
  </div>

	 

	

  	<div class="form-group">
    <label for="inputdateposted" class="col-sm-2 control-label">Date Opened:</label>
    <div class="col-sm-10">
	
		  		<input type="text" required name="dateposted" value="<?php echo set_value('dateposted', $mydate); ?>" class="form-control" required placeholder="Enter dateposted ">
		 
				
		<span class="text-danger"> <?php echo form_error('dateposted'); ?>
		
		</span>
	</div>
  </div>
  

 

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

				<textarea id="description" name="description" value="<?php echo set_value('description'); ?>"  class="form-control"  placeholder="Enter remarks"></textarea>
			
		<span class="text-danger"> <?php echo form_error('description'); ?>
		
		</span>
	</div>
  </div>
		

	      <div class="form-group">
    <label for="inputtype" class="col-sm-2 control-label">Bank Account?</label>
    <div class="col-sm-10">
	<select class="form-control" name="type"  id="type" required>
		<option value=""  selected="selected"></option>

	<option value="" >---Select Bank Account to assign---</option>
	<option value="na"  >N/A</option>

	<?php 
	
					 
										$banking= $this->usermodel->populatealldatanoarray('glaccounts','companyid',$companyid,'accounttype','27');


	
if(is_array($banking)) {

   foreach($banking as $bankingrow){

   //echo $courserow->coursename;
    ?>
				<option value="<?=  $bankingrow->number;   ?>"><?=  $bankingrow->accountname ."(Acc No:". $bankingrow->number.")"; ?></option>




	<?php

}} else {
    echo 'No bank available.';
}
	
?>
</select>
		
						<span class="text-danger"><?php echo form_error('type'); ?>

	</div>
  </div>
  
	 
	 
	
 	<div class="form-group">
    <label for="inputcode" class="col-sm-2 control-label">	Alternative  Bank code  :  </label>
    <div class="col-sm-10">
	
		  		<input type="text"  name="code" value="<?php echo set_value('code'); ?>" class="form-control"  placeholder="Enter alternative bank code">
		 
				
		<span class="text-danger"> Only use this if the account to assign is not among the bank accounts above<?php echo form_error('code'); ?>
		
		</span>
	</div>
  </div>

	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="bank" name="btn_assignbank" class="btn btn-primary"> Update Payment Methods    </button>

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

    

				</div>

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






	<div id="updateProductModel" 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">Update Charges </h4>
      </div>
      <div class="modal-body">
      
	  	

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



		
                 echo form_open('user/assignbank' , 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="action" value="insert"id="view" class="form-control" required placeholder="Enter action">
	<input type="hidden" name="categoryid" value=""id="mycategoryid" class="form-control" required placeholder="Enter mycategoryid">

	 <div class="form-group">
    <label for="inputbranchname" class="col-sm-2 control-label">Branch</label>
    <div class="col-sm-10">
	<select class="form-control" name="branchid"  id="branchid" required >
		<option value="" >---Select Branch/Counter Name--</option>



						
	<?php 
					 
					 		$maincategory = $this->usermodel->populateall('branch','companyid',$companyid);


							


if(is_array($maincategory)) {

   foreach($maincategory as $maincategoryrow){

   //echo $courserow->coursename;
    ?>
					<option selected value="<?=  $maincategoryrow->id;   ?>"><?=  $maincategoryrow->name; ?></option>



	<?php

}} else {
    echo 'No main counter available.';
}
	
?>

</select>
		

		
	</div>
  </div>
     
	 	<div class="form-group">
    <label for="inputname" class="col-sm-2 control-label">	Charge name  :  </label>
    <div class="col-sm-10">
	
		  		<input type="text" required id="name" name="name" value="<?php echo set_value('name'); ?>" class="form-control"  placeholder="Enter payment method name">
		 
				
		<span class="text-danger"> <?php echo form_error('name'); ?>
		
		</span>
	</div>
  </div>

	 

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

				<textarea id="description" name="description" value="<?php echo set_value('description'); ?>"  class="form-control"  placeholder="Enter remarks"></textarea>
			
		<span class="text-danger"> <?php echo form_error('description'); ?>
		
		</span>
	</div>
  </div>
	
	 
	 
	
 	<div class="form-group">
    <label for="inputpriority" class="col-sm-2 control-label">	Priority  </label>
    <div class="col-sm-10">
	
		  		<input type="text"  name="priority" value="<?php echo set_value('priority'); ?>" class="form-control"  placeholder="Enter priority">
		 
				
		<span class="text-danger"> Priority<?php echo form_error('priority'); ?>
		
		</span>
	</div>
  </div>
 <div class="form-group">
    <label for="inputreading" class="col-sm-2 control-label">Has Meter Reading</label>
    <div class="col-sm-10">
	<select class="form-control" name="reading"  id="reading" required >
		<option value="" >--Enable meeting reading?--</option>
		<option value="No" >No</option>
		<option value="Yes" >Yes</option>



</select>
		

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

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="bank" name="btn_assignbank" class="btn btn-primary"> Update    </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/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="doorlock">

 <input type="hidden" id="view"name="view" class="view" placeholder="view" value="admin/viewalldoorlocks">
 <input type="hidden" id="itemid1"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>

