
	

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



function getamount()
{
  var tempchargename = $("#chargename").val() ;

    //var multiply = $("#multiply").val() ;
	
	 const getypeamount = tempchargename.split("==");
let mycharge = getypeamount[1];

  document.getElementById("cost").value = mycharge;
   	 var cost = document.getElementById('cost').value;

  	 var pax = document.getElementById('pax').value;
  	 var qty = document.getElementById('myqty').value;
 var totalamount=pax * qty *cost;
  
  
    document.getElementById("totalamounttopay").value = totalamount;

 
}
  </script>
		 
						<script type="text/javascript">



function getamountDirectly()
{
 
   	 var cost = document.getElementById('cost').value;

  	 var pax = document.getElementById('pax').value;
  	 var qty = document.getElementById('myqty').value;
 var totalamount=pax * qty *cost;
  
  
    document.getElementById("totalamounttopay").value = totalamount;

 
}
  </script>
				 
				 
				<script type="text/javascript">



function getdays()
{
  var temproomtype = $("#roomtype").val() ;
  
    var multiply = $("#multiply").val() ;







 const getroomtypeamount = temproomtype.split("==");
let roomtype = getroomtypeamount[0];
  
  
	 var people = document.getElementById('people').value;

	 var checkin = document.getElementById('checkin').value;

	 var checkout = document.getElementById('checkout').value;
	     var date1 = new Date(checkin);
    var date2 = new Date(checkout);
   var Difference_In_Time = date2.getTime() - date1.getTime();
      
    // To calculate the no. of days between two dates
    var Difference_In_Days = Difference_In_Time / (1000 * 3600 * 24);
	 	 var myfinaltotal = roomtype*Difference_In_Days;
				
				if(multiply=="yes"){
					myfinaltotal=myfinaltotal*people;
				}
                 document.getElementById("totalamount").value = myfinaltotal;

//alert(myfinaltotal);
	 //var discount = document.getElementById('discount').value;

  var discount = $("#discount").val() ;
 const getdiscountamount = discount.split(":=");
let discamount = getdiscountamount[0];
let disctype = getdiscountamount[1];
var finaldiscount=0;
if (disctype =="Percentage"){
		finaldiscount=((discamount/100)*myfinaltotal);

}else{
	finaldiscount=discamount;
}
myfinaltotal=myfinaltotal-finaldiscount;
                 document.getElementById("totalamount").value = myfinaltotal;




}












      
</script> 
				


  <script type="text/javascript">
  
		
		
		 $(document).on("click", "#managebtndelete", function()
        {
          var myroomsalesid = $(this).data('id');
		  $("#myroomsalesid").val(myroomsalesid); 
		  
		  
		   var mytransactioncode = $(this).data('transactioncode');
		  $("#mytransactioncode").val(mytransactioncode); 
		  
		  
		   
		   var mytotal = $(this).data('total');
		  $("#mytotal").val(mytotal); 
		  
		   
		   
        });
		
		
		
		
    </script> 
  <script type="text/javascript">
  
		
		  $(document).on("click", "#editbtn", function()
        {
          var myupdatecategoryid = $(this).data('id');
		  $("#myupdatecategoryid").val(myupdatecategoryid); 
		   
 
		    var myqtys = $(this).data('myqtys');
		   $("#myqtys").val(myqtys); 
		   
		     var cost = $(this).data('cost');
		   $("#costs").val(cost); 
		 
		     var pax = $(this).data('uomqty');
		   $("#peoplepax").val(pax); 
		 
		 
		    var sales = $(this).data('sales');
		   $("#sales").val(sales); 
		 
		  
		   
        });
		
		
		
		
    </script> 
   <script type="text/javascript">
  
		
		 $(document).on("click", "#managecancelbtn", function()
        {
          var roomsalesid = $(this).data('id');
		  $("#roomsalesid").val(roomsalesid); 
		
		       var invoice = $(this).data('invoice');
		  $("#invoice").val(invoice); 
        });
		
		
			
		 $(document).on("click", "#managebtndelete2", function()
        {
          var itemid = $(this).data('id');
		  $("#itemid2").val(itemid); 
		  
		  
		   
        });
		
		
		
		
		
		
		
		
		
    </script> 

		      <script type="text/javascript">
  
		
	
		
		  $(document).on("click", "#editorderbtn", function()
        {
          var orderid = $(this).data('id');
		  $("#orderid").val(orderid); 
		   
 
		    var ordertotal = $(this).data('total');
		   $("#ordertotal").val(ordertotal); 
		   
		     var orderstatus = $(this).data('status');
		   $("#orderstatus").val(orderstatus); 
		   var invoice = $(this).data('invoice');
		   $("#myinvoice").val(invoice); 
		 
		  
		  
		   
        });
		
		
    </script> 
 
 <div class="row">
  
   	

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

  
		<div class="panel panel-default" data-collapsed="0">
        	<div class="panel-heading">
            	<div class="panel-title" id="redcolor" >
            		<i class="entypo-plus-circled"></i>
				 <span class="pull-right"> Update Payment methods</span>
				<a  id="more" class="btn btn-info" href="<?php echo base_url();?>admin/allocate?randomitemidentifier=<?php   if(isset($randomitemidentifier)) {echo $randomitemidentifier; } ?>&randomitemidentifier1=<?php   if(isset($randomitemidentifier1)) {echo $randomitemidentifier1; } ?>&roomidentifier=<?php   if(isset($randomitemidentifier1)) {echo $randomitemidentifier1; } ?>"> Go back to  </a>
									<a  id="more" class="btn btn-info" href="<?php echo base_url();?>admin/viewpallmyplots"> Go to next booking   </a>

									<a  id="more" class="btn btn-info" href="<?php echo base_url();?>admin/viewpallmyplots"> Go to next booking   </a>
				  <a class="btn btn-primary" target="_balank"   id="more" href="<?php echo base_url();?>admin/housereceiptbynoold?randomitemidentifier=<?php   {echo  $allsalesdetails[0]['transactioncode'];}  ?>">Print Receipt  </a>

				  <a class="btn btn-primary" target="_balank"   id="more" href="<?php echo base_url();?>admin/housereceiptbyno?randomitemidentifier=<?php   {echo  $allsalesdetails[0]['transactioncode'];}  ?>">Print(A4)  </a>
			 <a class="btn btn-primary"   target="_balank" id="more" href="<?php echo base_url();?>admin/printhouseinvoice?randomitemidentifier=<?php   {echo  $allsalesdetails[0]['transactioncode'];}  ?>"> Print Invoice </a>
			 <a class="btn btn-success"   target="_balank" id="more" href="<?php echo base_url();?>admin/printhouseinvoiceStatus?randomitemidentifier=<?php   {echo  $allsalesdetails[0]['transactioncode'];}  ?>&status=Active"> Print Active Invoice </a>
			 <a class="btn btn-success"   target="_balank" id="more" href="<?php echo base_url();?>admin/printhouseinvoiceStatus?randomitemidentifier=<?php   {echo  $allsalesdetails[0]['transactioncode'];}  ?>&status=Inactive"> Print Active Invoice </a>
	 		 		 						<a  id="more" class="btn btn-info" href="<?php echo base_url();?>admin/viewbalance?invoice=<?php echo $itemid ?>&randomitemidentifier=<?php echo $houseno ?>">  Receive Payment </a>

            	</div>
            </div>
			<div class="panel-body">


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

	

			
			
			
			
			
			
			
			
			<?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;
					}
									
 
 
   $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'];	
	 
	 	 $data['branchid'] = $session_data['branchid'];
	 $branchid = $data['branchid'];
	 
	 
	 
	 
	 
	 
	 

     $mpesaaction=$this->usermodel->populatuserpermissionsdataarray('sales','mpesa',$userid);
	      $chequeaction=$this->usermodel->populatuserpermissionsdataarray('sales','cheque',$userid);
 $voucheraction=$this->usermodel->populatuserpermissionsdataarray('sales','voucher',$userid);
	      $creditaction=$this->usermodel->populatuserpermissionsdataarray('sales','credit',$userid);
		   $pointsaction=$this->usermodel->populatuserpermissionsdataarray('sales','points',$userid);
	      $cardaction=$this->usermodel->populatuserpermissionsdataarray('sales','card',$userid);
	      $orderaction=$this->usermodel->populatuserpermissionsdataarray('sales','order',$userid);
		  	 	      $givediscount=$this->usermodel->populatuserpermissionsdataarray('accomodation','givediscount',$userid);
	 	 	      $changepayment=$this->usermodel->populatuserpermissionsdataarray('accomodation','changepayment',$userid);
    $addpeople=$this->usermodel->populatuserpermissionsdataarray('members','add',$userid);

  											      $updatecharges=$this->usermodel->populatuserpermissionsdataarray('accomodation','updatecharges',$userid);
	      $dailysales=$this->usermodel->populatuserpermissionsdataarray('accomodation','dailysales',$userid);

  $cancel=$this->usermodel->populatuserpermissionsdataarray('accomodation','cancel',$userid);
	 	 	      $clearsales=$this->usermodel->populatuserpermissionsdataarray('accomodation','clearsales',$userid);

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

<?php 
		
                 echo form_open('admin/updatepayments' , 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="invoice" value="<?php echo $itemid; ?>"  id="itemid" class="form-control" required placeholder="Enter itemid">

<input type="hidden" name="myid" value="<?php echo set_value('id',$allsalesdetails[0]['id']); ?>" id="itemid" class="form-control" required placeholder="Enter id">

				
				
				
	 <div class="form-group">
    <label for="inputidno" class="col-sm-2 control-label">Customer  Name</label>
    <div class="col-sm-7">
<select name="tenantid"  class="chzn-select" style="width:50%" required>

		<?php 
		
		  if(isset($allsalesdetails[0]['tenantid']) && ($allsalesdetails[0]['tenantid'] !="")) {
 	$myrealtenant = $this->usermodel->populateall('people', 'id',$allsalesdetails[0]['tenantid']);


if(is_array($myrealtenant)) {

   foreach($myrealtenant as $myrealtenantrow){

    ?>
	    <option selected value="<?php echo set_value('tenant',$myrealtenantrow->id); ?> "><?=$myrealtenantrow->company." ".$myrealtenantrow->firstname." IDNO ".$myrealtenantrow->idno."  ".$myrealtenantrow->phone;?></option>

   
    <?php

}} else {
    echo 'There is no customer.';
}
		  }else{
			  ?>
		<option value="" selected >---Select group for checkin--</option>
	  
			 <?php	  
		  }
?>
			  
		 <?php

///$nation = $this->nationmodel->populatenation();
//$mytenant=false;
	 					$mytenant = $this->usermodel->populateall('people', 'companyid',$companyid);


if(is_array($mytenant)) {

   foreach($mytenant as $mytenantrow){

    ?>
	    <option value="<?php echo set_value('tenant',$mytenantrow->id); ?> "><?=$mytenantrow->company." ".$mytenantrow->firstname." IDNO ".$mytenantrow->idno."  ".$mytenantrow->phone;?></option>

   
    <?php

}} else {
    echo 'There is no customer.';
}

?>
	</select>
		  <?php

 if( $addpeople==true){
 ?>
						<a data-toggle='modal' data-target='#addModal' class="btn btn-warning">New Profile/Business </a>

 
<?php	
}
  ?>
	  

		<span class="text-danger"><?php echo form_error('tenantid'); ?></span>
	</div>
  </div>			
				
				
				
			<?php if($allsalesdetails[0]['category'] !=="Service Only"){
				?>		
				
				
				
	  <div class="form-group">

    <label for="inputhouseno" class="col-sm-2 control-label">Room Number</label>
    <div class="col-sm-10">
	
		
									
					  		<input type="text" readonly name="houseno" value="<?php echo set_value('houseno',$houseno); ?>"id="bookingno" class="form-control" required placeholder="Enter booking number">

											


     <span class="text-danger"><?php echo form_error('houseno'); ?></span>
   </div>
   
   <?PHP
   
   if($houseno !="Group"){
	   
	   ?>
   				 <a class="btn btn-warning" id="non-printable"  style="margin:5px"  id="more" href="<?php echo base_url();?>admin/transferroom?randomid=<?php echo$allsalesdetails[0]['id'];?>&housno=<?php echo$allsalesdetails[0]['houseno']?>&plotno= <?php echo $allsalesdetails[0]['plotno'];?>&transactioncode=<?php echo$allsalesdetails[0]['transactioncode']; ?>">Transfer Room  </a>
   <?PHP
   
   }else{
	   echo "You can't transfer group room";
	   
   }
	   
	   ?>
      				 <a class="btn btn-info" id="non-printable"  style="margin:5px"  id="more" href="<?php echo base_url();?>admin/updatebookingdetails?randomid=<?php echo$allsalesdetails[0]['id'];?>&housno=<?php echo$allsalesdetails[0]['houseno']?>&plotno= <?php echo $allsalesdetails[0]['plotno'];?>&transactioncode=<?php echo$allsalesdetails[0]['transactioncode']; ?>">Adjust  Stay/ Room type  </a>

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

    <label for="inputplotno" class="col-sm-2 control-label">House No</label>
    <div class="col-sm-10">
	<?php if($usertype=="admin"){
											?>
					<input type="text"  name="plotno" readonly value="<?php echo set_value('plotno',$pltono); ?>"id="bookingno" class="form-control" required placeholder="Enter booking number">
	
											<?php
											}else{
											?>
					<input type="text"  readonly name="plotno" value="<?php echo set_value('plotno',$pltono); ?>"id="bookingno" class="form-control" required placeholder="Enter booking number">
		
											
											<?php
											}
											
											?>


     <span class="text-danger"><?php echo form_error('plotno'); ?></span>
   </div>
  </div>
	
	
  <div class="form-group">
    <label for="inputroomtype" class="col-md-2 control-label">Room type?:</label>
    <div class="col-md-10">
				    	
			  	<select name="roomtype" readonly id="roomtype2" onchange="getdays()" class="form-control" required>
<option value="" >---Select charges type---</option>

<?php
if($allsalesdetails[0]['plotno'] == "Group"){
	?>
<option value="Group" >Group</option>
<option value="Service Only" >Service Only</option>

		<?php 
}else{
      $mycharges = $this->usermodel->populateall('charges','id', $allsalesdetails[0]['chargeid']);


if(is_array($mycharges)) {

   foreach($mycharges as $chargesrow1){


//
$roomdata1=$allsalesdetails[0]['roomtype']."==".$allsalesdetails[0]['chargeid'];
  
   ?>
   
	    <option selected value="<?php echo $roomdata1; ?> "><?=$chargesrow1->type.":" .$allsalesdetails[0]['roomtype']; ?></option>

   
    <?php   



   
   
  

}} else {
    echo 'There is no any  charges for this house.... PLease add charges first.';
}

?>




	<?php 

//$nation = $this->nationmodel->populatenation();


if(is_array($charges)) {

   foreach($charges as $chargesrow){

  

      $chargename = $this->usermodel->populateallarray('charges','id', $chargesrow->chargeid);

	 $chargename=$chargename[0]['type'];
//
$roomdata=$chargesrow->cost."==".$chargesrow->chargeid;
  
   ?>
   
	    <option value="<?php echo $roomdata; ?> "><?=$chargename."(" .$chargesrow->name.":" .$chargesrow->cost.")"; ?></option>

   
    <?php   


   
   
  

}} else {
    echo 'There is no any  charges for this house.... PLease add charges first.';
}
}
?>









<!--<option value="all" >---ALL ---</option>-->

	</select>

	  <span class="text-danger"><?php echo form_error('roomtype'); ?></span>
	</div>
    </div>
	
	
	
	
	
	
	
	
	
	
	
		<div class="form-group">
    <label for="inputcreatedat" class="col-sm-2 control-label">	Check-In Date<span style="color:red;">*</span></label>
    <div class="col-sm-10">

											  		<input type="text"  readonly  name="createdat" id="createdat"  value="<?php echo set_value('createdat',$allsalesdetails[0]['createdat']); ?>" class="form-control" required placeholder="Enter check in date">
		
											
		 
				
		<span class="text-danger"> <?php echo form_error('createdat'); ?>
		
		</span>
	</div>
  </div>


		<div class="form-group">
    <label for="inputcheckoutdate" class="col-sm-2 control-label">	Check-Out Date<span style="color:red;">*</span></label>
    <div class="col-sm-10">

											  		<input type="text"  readonly name="checkoutdate" id="checkoutdate"  value="<?php echo set_value('checkoutdate',$allsalesdetails[0]['checkoutdate']); ?>" class="form-control" required placeholder="Enter check out date">
		
									
		 
				
		<span class="text-danger"> <?php echo form_error('checkoutdate'); ?>
		
		</span>
	</div>
  </div>

	<?php
	}else{
	
	?>
	
<input type="hidden"  readonly name="checkoutdate" id="checkoutdate"  value="<?php echo set_value('checkoutdate',$allsalesdetails[0]['checkoutdate']); ?>" class="form-control" required placeholder="Enter check out date">
<input type="hidden"  readonly name="roomtype" id="roomtype"  value="<?php echo set_value('roomtype',$allsalesdetails[0]['roomtype']); ?>" class="form-control" required placeholder="Enter check out date">

<input type="hidden"  readonly  name="createdat" id="createdat"  value="<?php echo set_value('createdat',$allsalesdetails[0]['createdat']); ?>" class="form-control" required placeholder="Enter check in date">

	
	<?php
	}
	
	?>
	
	
	<div class="form-group">
    <label for="inputcash" class="col-sm-2 control-label">	TT MONEY EXPECTED <span style="color:red;">*</span></label>
    <div class="col-sm-10">

											  		<input readonly type="number"   name="total" id="total"  value="<?php echo set_value('total',$allsalesdetails[0]['total']); ?>" class="form-control" required placeholder="Enter total e.g 500">
		
										
		 
				
		<span class="text-danger"> <?php echo form_error('total'); ?>
		
		</span>
	</div>
  </div>


  	<div class="form-group">
    <label for="inputpeople" class="col-sm-2 control-label">	PAX <span style="color:red;"></span></label>
    <div class="col-sm-10">
	
		  		<input type="TEXT"    name="people"  id="people"  value="<?php echo set_value('people',$allsalesdetails[0]['people']); ?>" class="form-control" required placeholder="Enter e.g 1">
		 
				
		<span class="text-danger"> <?php echo form_error('people'); ?>
		
		</span>
	</div>
  </div>









  	<div class="form-group">
    <label for="inputamount" class="col-sm-2 control-label">	CASH <span style="color:red;">*</span></label>
    <div class="col-sm-10">
	
		  		<input type="TEXT"   onkeyup='OnChange(this.value)' name="amount"  id="cash"  value="<?php echo set_value('amount',$allsalesdetails[0]['amount']); ?>" class="form-control" required placeholder="Enter cash e.g 500">
		 
				
		<span class="text-danger"> <?php echo form_error('cash'); ?>
		
		</span>
	</div>
  </div>


<div class="form-group">
    <label for="inputmpesa" class="col-sm-2 control-label">	MPESA</label>
    <div class="col-sm-10">
		  		<input type="number" readonly onkeyup="OnChange(this.value)" name="mpesa"  id="mpesa"  value="<?php echo set_value('mpesa',$allsalesdetails[0]['mpesa']); ?>" class="form-control" required placeholder="Enter mpesa e.g 500">

			
		<span class="text-danger"> <?php echo form_error('mpesa'); ?>
		
		</span>
	</div>
  </div>

		

  	<div class="form-group">
    <label for="inputcredit" class="col-sm-2 control-label">	CREDIT <span style="color:red;">*</span></label>
    <div class="col-sm-10">
	
		  		<input type="text"  onkeyup='OnChange(this.value)' name="credit"  id="credit"  value="<?php echo set_value('credit',$allsalesdetails[0]['credit']); ?>" class="form-control"  placeholder="Enter cash e.g  300">
		 
				
		<span class="text-danger"> <?php echo form_error('credit'); ?>
		
		</span>
	</div>
  </div>



 <div class="form-group">
    <label for="inputvoucher" class="col-sm-2 control-label">	VOUCHER <span style="color:red;">*</span></label>
    <div class="col-sm-10">
	
		  		<input type="number" readonly onkeyup='OnChange(this.value)' name="voucher"  id="voucher" value="<?php echo set_value('voucher',$allsalesdetails[0]['voucher']); ?>" class="form-control"  placeholder="Enter cash e.g  300">
		 
				
		<span class="text-danger"><?php echo form_error('voucher'); ?>
		
		</span>
	</div>
  </div>
  
 
    	<div class="form-group">
    <label for="inputcheque" class="col-sm-2 control-label">	CHEQUE <span style="color:red;">*</span></label>
    <div class="col-sm-10">
	
		  		<input type="number" readonly onkeyup='OnChange(this.value)' name="cheque"  id="cheque" value="<?php echo set_value('cheque',$allsalesdetails[0]['cheque']); ?>" class="form-control"  placeholder="Enter cash e.g  300">
		 
				
		<span class="text-danger"><?php echo form_error('cheque'); ?>
		
		</span>
	</div>
  </div>
  
  
  	<div class="form-group">
    <label for="inputpoints" class="col-sm-2 control-label">L POINTS <span style="color:red;">*</span></label>
    <div class="col-sm-10">
	
		  		<input type="number" readonly  onkeyup='OnChange(this.value)' name="points" id="points"  value="<?php echo set_value('points',$allsalesdetails[0]['points']); ?>" class="form-control"  placeholder="Enter cash e.g  300">
		 
				
		<span class="text-danger"><?php echo form_error('points'); ?>
		
		</span>
	</div>
  </div>
  	
  
    	<div class="form-group">
    <label for="inputcard" class="col-sm-2 control-label">	CARD <span style="color:red;">*</span></label>
    <div class="col-sm-10">
	
		  		<input type="number"  readonly onkeyup='OnChange(this.value)' name="card"   id="card" value="<?php echo set_value('card',$allsalesdetails[0]['card']); ?>" class="form-control"  placeholder="Enter cash e.g  300">
		 
				
		<span class="text-danger">E.g Visa card <?php echo form_error('card'); ?>
		
		</span>
	</div>
  </div>
  	
  	<div class="form-group">
    <label for="inputpaymentcode" class="col-sm-2 control-label">Transaction Code<span style="color:red;">*</span></label>
    <div class="col-sm-10">
	
		  		<input type="text"    name="paymentcode" value="<?php echo set_value('paymentcode',$allsalesdetails[0]['paymentcode']); ?>"  id="cashier"class="form-control"  placeholder="Enter MPESA code e.g X3232">
		 
				
		<span class="text-danger"> <?php echo form_error('paymentcode'); ?>
		
		</span>
	</div>
  </div>
  	<?php if($allsalesdetails[0]['category'] !=="Service Only"){
				?>
    <div class="form-group">
						<label for="field-2" class="col-sm-2 control-label">Payment status</label>
		                    <div class="col-sm-10">
		                        <select name="paymentstatus" class="form-control" id="section_selector_holder">
			                         <option selected value="<?php echo set_value('paymentstatus',$allsalesdetails[0]['paymentstatus']); ?>"><?php echo set_value('paymentstatus',$allsalesdetails[0]['paymentstatus']); ?></option>

			                           <option value="Cleared">Cleared</option>
									   <option value="Not Cleared">Not Cleared</option>
									   
										<?php if($usertype=="admin"){
											?>
									   <option value="Approved">Approved</option>

											<?php
											}
											?>


			                    </select>
							 <span class="text-danger"><?php echo form_error('paymentstatus'); ?></span>

			                </div>
			 </div>
 
  
    <div class="form-group">
						<label for="field-2" class="col-sm-2 control-label">Room Status</label>
		                    <div class="col-sm-10">
		                        <select name="status" class="form-control" id="section_selector_holder">
			                         <option selected value="<?php echo set_value('status',$allsalesdetails[0]['status']); ?>"><?php echo set_value('status',$allsalesdetails[0]['status']); ?></option>

			                         <option  value="active">Check in</option>
									<option value="reserved">Reserved</option>

			                    </select>
							 <span class="text-danger"><?php echo form_error('status'); ?></span>

			                </div>
			 </div>
			  <?php
	}
  
  ?>
			 	
				
				
				
				
  <?php
  
   if( $givediscount==true){
	 ?>
	<div class="form-group">
    <label for="inputdiscount" class="col-sm-2 control-label">Discount <span style="color:red;">*</span></label>
    <div class="col-sm-10">
	
											  		<input type="number"   name="discount" id="discount"  value="<?php echo set_value('discount',$allsalesdetails[0]['discount']); ?>" class="form-control" required placeholder="Enter total discount">
		
										
		 
				
		<span class="text-danger"> <?php echo form_error('discount'); ?>
		
		</span>
	</div>
  </div>
     


	 	<?php	

 }else{
	 ?>
	 
	 
											  		<input type="hidden"   name="discount" id="discount"  value="<?php echo set_value('discount',$allsalesdetails[0]['discount']); ?>" class="form-control" required placeholder="Enter total discount">

	 	<?php
	 
 }
  ?>
    
  
				
				
				
				
				
				
				
				
				
				
				
	


  	<div class="form-group">
    <label for="inputchange" class="col-sm-2 control-label">	BALANCE/CHANGE <span style="color:red;">*</span></label>
    <div class="col-sm-10">
	
		  		<input type="text"    name="change" value="<?php echo set_value('balance',$allsalesdetails[0]['balance']); ?>"  id="change"class="form-control" required placeholder="balance">
		 
				
		<span class="text-danger"> <?php echo form_error('change'); ?>
		
		</span>
<input type="hidden"  readonly  name="transactioncode" id="transactioncode"  value="<?php echo set_value('transactioncode',$allsalesdetails[0]['transactioncode']); ?>" class="form-control" required placeholder="Enter vat">

  </br>
Vat:<input type="text"  readonly  name="tax1" id="tax1"  value="<?php echo set_value('tax1',$allsalesdetails[0]['tax1']); ?>" class="form-control" required placeholder="Enter vat">
 </br>
Levy:<input type="text"  readonly  name="tax2" id="tax2"  value="<?php echo set_value('tax2',$allsalesdetails[0]['tax2']); ?>" class="form-control" required placeholder="Enter vat">
	</div>
  </div>
    	<div class="form-group">
    <label for="inputdescription" class="col-sm-2 control-label">	Description <span style="color:red;">*</span></label>
    <div class="col-sm-10">
	
	<textarea name="description" id="description" rows="5" placeholder="add Description" class="form-control"><?php echo set_value('description',$allsalesdetails[0]['description']); ?></textarea>
		 
				
		<span class="text-danger"> <?php echo form_error('change'); ?>
		
		</span>
	</div>
  </div>
  
  
  <input type="hidden" name="myview" value="user/mychangepayment?myid=<?php   if(isset($itemid)) {echo $itemid; } ?>&randomitemidentifier=<?php   if(isset($randomitemidentifier)) {echo $randomitemidentifier; } ?>&randomitemidentifier1=<?php   if(isset($randomitemidentifier1)) {echo $randomitemidentifier1; } ?>&roomidentifier=<?php   if(isset($roomidentifier)) {echo $roomidentifier; } ?>"  id="itemid" class="form-control" required placeholder="Enter itemid">

  
  
  <?php
  
   if( $changepayment==true){
	 ?>
	<div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
		         <button type="submit"   value="user/mychangepayment?myid=<?php   if(isset($itemid)) {echo $itemid; } ?>&randomitemidentifier=<?php   if(isset($randomitemidentifier)) {echo $randomitemidentifier; } ?>&randomitemidentifier1=<?php   if(isset($randomitemidentifier1)) {echo $randomitemidentifier1; } ?>&roomidentifier=<?php   if(isset($roomidentifier)) {echo $roomidentifier; } ?>" name="btn_updatepaymetmode" class="btn btn-primary"> Update payment   </button>

     	         <button type="submit"  value="<?php echo base_url();?>admin/allocate?randomitemidentifier=<?php   if(isset($randomitemidentifier)) {echo $randomitemidentifier; } ?>&randomitemidentifier1=<?php   if(isset($randomitemidentifier1)) {echo $randomitemidentifier1; } ?>&roomidentifier=<?php   if(isset($randomitemidentifier1)) {echo $randomitemidentifier1; } ?>" name="btn_updatepaymetmode" class="btn btn-primary"> Update and go back to same  booking   </button>

	      	         <button type="submit"   value="admin/viewpallmyplots" name="btn_updatepaymetmode" class="btn btn-primary"> Update payment  and go to new bookings  </button>


    </div>
  </div>

	 	<?php	

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

    

				</div>
			
			
			
					</div>
		   	<div class="col-md-6">
<CENTER>OTHER  CHARGES</CENTER>




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

             <thead>
         <tr>
   
  
	    <th>Receipt No</th>	
	  <th>Amount</th>	
   <th>Date</th>
   <th>Sold By</th>	   
      <th>Status</th>	   

  <th>More</th>	 
	

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



							//	 $roomsales = $this->usermodel->populatealldatanoarrayfour('roomsales','houseno', $randomitemidentifier,'plotno', $randomitemidentifier1,'description', $allsalesdetails[0]['id'],'customerid', $allsalesdetails[0]['tenantid']);			   

									 $roomsales= $this->usermodel->populateall('roomsales','transactioncode',$allsalesdetails[0]['transactioncode']);

				
				
				
				
 if(!is_array($roomsales)) 

 {


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

		   $total=$total+$row->total;


             ?>



             <tr>
                
            <?php 
$myid=$row->id;

$getreceipt = $this->usermodel->populateallarray('sales','invoice', $row->invoice);
$myinvoice=$row->invoice;
	 $mycode=$getreceipt[0]['id'];
?>


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


	  </td>
     <td><?php 
	 	if(isset($row->total)) {echo   formatMoney($row->total, true); }
		?></td>

     <td><?php echo $row->dateposted ; ?></td>         

   
    <td>
												 
	<?php 
					// $branch="";
					 $userid=$row->userid;

					 $user= $this->usermodel->populateall('people','id',$userid);



if(is_array($user)) {

   foreach($user as $userhrow){

   echo $userhrow->surname;
 
 
}} else {
    echo 'No Name.';
}
	
?>
												 
	 </td>	

		      <td><?php
if($row->status =="merged"){
	
	?>
	
	
		   <a  id="non-printable" target="_blank" class=" btn-warning"  href="<?php echo base_url();?>admin/mergedsales?invoice=<?php   if(isset($myinvoice)) {echo $myinvoice; } ?>">  <span style="color:red"> <?php   echo $row->status ;  ?> </span> </a>

	
	<?php
		  echo "At: ".$row->updatedat ;
}else{

			  echo $row->status ;	
}

 ?></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>
									<?php
										if($clearsales==true){
											
											?>
                                    <ul class="dropdown-menu dropdown-primary pull-right" role="menu">
                                        
                                        <!-- teacher EDITING LINK -->
                                      
									



									<li> 

				 <a class="btn btn-info managecancelbtn" id="managecancelbtn"	   	 data-id='<?php echo  $row->id ;?>'  data-invoice='<?php echo  $row->invoice ;?>'   data-toggle='modal' data-target='#mycancelModal<?php  $row->id ; ?>'>	 

                                                <i class="glyphicon glyphicon-pencil"></i>
																Merge Receipts
                                                </a>
                                                        </li>
									
											</br>
                                        
                                     	  <li> 

	 <a class="btn btn-primary editorderbtn" id="editorderbtn" data-invoice='<?php echo  $row->invoice;?>' data-status='<?php echo  $row->status;?>' data-total='<?php echo  $row->total;?>'  data-id='<?php echo  $row->id;?>' data-toggle='modal' data-target='#editorderModel'> 	 

                                                <i class="glyphicon glyphicon-pencil"></i>
																Update
                                                </a>
                                                        </li>
														                                        <li class="divider"></li>
	<?php
										}
										?>
										<?php
									
											
											?>
											<?php
										if($usertype=="admin"){
											
											?>
									
																		  <li> 
										 <a class="btn btn-danger managebtn" id="managebtndelete2"		 data-id='<?php echo  $row->id;?>'    data-toggle='modal' data-target='#myModal2<?php  $row->id; ?>'>	 


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

	<?php endforeach;
	
	} ?>
<tr>
<td> <h3>Total Amount: </h3></td>
<td colspan="5">
  <h3> <?php 
  								if(isset($total)) {echo   formatMoney($total, true); }

  ?>
  </h3>

</td>
</tr>
</tbody>
        </table>
  
  <div class="panel panel-primary" data-collapsed="0">
        <center>	<b>All Charges</b></center>
			<div class="panel-body">
				<?PHP
				echo $this->session->flashdata('roommsg'); 
		 echo $this->session->flashdata('deletemsg'); 

                 echo form_open('user/adddailyroomcharges' , 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="plotno" value="<?php echo set_value('plotno',$randomitemidentifier1); ?>"id="plotno" class="form-control" required placeholder="Enter plot number">
							  		<input type="hidden" name="houseno" value="<?php echo set_value('houseno',$randomitemidentifier); ?>"id="plotno" class="form-control" required placeholder="Enter house number">
							  		<input type="hidden" name="myid" value="<?php echo set_value('itemid',$itemid); ?>"id="plotno" class="form-control" required placeholder="Enter house number">
								  		<input type="hidden" name="roomidentifier" value="<?php  echo $roomidentifier ; ?>"id="roomidentifier" class="form-control"  placeholder="Enter roomidentifier">
								  		<input type="hidden" name="transactioncode" value="<?php  echo $itemid ; ?>"id="transactioncode" class="form-control"  placeholder="Enter itemid">




 	  <div class="form-group">
    <label for="inputidno" class="col-sm-2 control-label">Charge Name</label>
    <div class="col-sm-7">
			<select  style ="width:100%" name="name" id="chargename" onchange="getamount()" class="chzn-select" required>
  	
	<option value=""   >---Select Select service-</option>

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

if(is_array($main)) {

   foreach($main as $mainrow){
											// $myproducts = $this->usermodel->populateallarray('productlist','code', $childrow->code);

   //echo $courserow->coursename;
    ?>
		    <option value="<?php echo $mainrow->code."==".$mainrow->sellingprice; ?> "><?=$mainrow->name." (".$mainrow->sellingprice.")";?></option>




	<?php

}} else {
	

	
}





	
?>
</select>
		
		
		
		
		
	</div>
  </div>
	






		
	 
  <div class="form-group">
    <label for="inputcost" class="col-sm-2 control-label">Cost</label>
    <div class="col-sm-7">
				<input type="text" id="cost"  name="cost" onchange="getamountDirectly()" value="<?php echo set_value('cost'); ?>" id="cost" class="form-control" required placeholder="Enter the cost">
        <span class="text-danger"><?php echo form_error('cost'); ?></span>
	</div>
  </div>
  

  <div class="form-group">

    <label for="inputname" class="col-sm-2 control-label">Qty</label>
    <div class="col-sm-7">

			  		<input type="text" onchange="getamountDirectly()" onfocus="getamountDirectly()" name="qty" value="<?php echo set_value('qty',1); ?>"id="myqty" class="form-control"  placeholder="Enter qty">


     <span class="text-danger"><?php echo form_error('name'); ?></span>
   </div>
  </div>
 
  

	<div class="form-group">

    <label for="inputname" class="col-sm-2 control-label">Pax</label>
    <div class="col-sm-7">

			  		<input type="text" onchange="getamountDirectly()" id="pax" name="pax" value="<?php echo set_value('pax',1); ?>" class="form-control"  placeholder="Enter pax or No of people">
</BR>
				TT:<input type="text"  readonly name="totalamount" value="" id="totalamounttopay" class="form-control2" required placeholder="Exp Total amount(Auto calculated)">

     <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">Remarks</label>
    <div class="col-sm-7">

			  		<input type="text"   name="description" value="<?php echo set_value('description'); ?>"id="description" class="form-control"  placeholder="Enter description">


     <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_addroomdailycharges"value="charges" class="btn btn-primary">Add Charges</button>

		   
		   
		   
		   
		   
		   
    </div>
  </div>
  
     <?php echo form_close();?>
  
  
  
  						
									
  <table cellpadding="0" cellspacing="0" border="0" class="table  table-striped" id="example2" style="border-color:#CCCCCC; width:100%;"  >

             <thead>
         <tr>
   
     <th>Charge</th>
	   
	<th>Cost</th>	
  <th>Qty</th>	
  <th>Pax</th>	
  <th>Total</th>	

	 <th>Status</th>	   
  <th>More</th>	 
	

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



        		$roomcharges = $this->usermodel->populateallstatus('dailycharges','transactioncode', $itemid,'id >', 0);

				
				
				
				
				
				
 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->sales ; ?></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>
									<?php
										if($dailysales==true){
	
											?>
                                    <ul class="dropdown-menu dropdown-primary pull-right" role="menu">
                                        
                                        <!-- teacher EDITING LINK -->
                                  
										
											  <li> 
											   <a class="btn btn-danger managebtndelete" id="managebtndelete"	data-transactioncode='<?php echo  $c->transactioncode ;?>'  data-total='<?php echo  $c->amount ;?>' 	 data-id='<?php echo  $c->id ;?>'    data-toggle='modal' data-target='#mycancelModal1<?php  $c->id ; ?>'>	 

                                                <i class="glyphicon glyphicon-pencil"></i>
																Cancel
                                                </a>
												
												
										
                                                        </li>
								
                                        <li class="divider"></li>
                                  
                                     	  <li> 
	 <a class="btn btn-primary editbtn" id="editbtn"data-myqtys='<?php echo  $c->qty;?>' data-uomqty='<?php echo  $c->uomqty;?>' data-sales='<?php echo  $c->sales;?>' data-cost='<?php echo  $c->cost;?>'  data-id='<?php echo  $c->id;?>' data-toggle='modal' data-target='#editProductModel'> 	 

                                                <i class="glyphicon glyphicon-pencil"></i>
																Update
                                                </a>
                                                        </li>
                                        		<?php
										}
										?>
									
                                    </ul>
										
                                </div>
</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 class="panel panel-primary" data-collapsed="0">
        <center>	<b>Other Guests</b></center>
			<div class="panel-body">
				<?PHP
				echo $this->session->flashdata('roommsg'); 
		 echo $this->session->flashdata('deletemsg'); 

                 echo form_open('user/addmoreguests' , 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="plotno" value="<?php echo set_value('plotno',$randomitemidentifier1); ?>"id="plotno" class="form-control" required placeholder="Enter plot number">
							  		<input type="hidden" name="houseno" value="<?php echo set_value('houseno',$randomitemidentifier); ?>"id="plotno" class="form-control" required placeholder="Enter house number">
							  		<input type="hidden" name="myid" value="<?php echo set_value('itemid',$itemid); ?>"id="plotno" class="form-control" required placeholder="Enter house number">
								  		<input type="hidden" name="roomidentifier" value="<?php  echo $roomidentifier ; ?>"id="roomidentifier" class="form-control"  placeholder="Enter roomidentifier">
								  		<input type="hidden" name="transactioncode" value="<?php  echo $itemid ; ?>"id="transactioncode" class="form-control"  placeholder="Enter itemid">

			  		
	<div class="form-group">
    <label for="inputname" class="col-sm-2 control-label">	Customer Name </label>
    <div class="col-sm-10">

		  		<input type="text" name="customer" value="<?php echo set_value('customer'); ?>" id="customer" class="form-control" required placeholder="Enter customer name">
		 
				
		<span class="text-danger"> <?php echo form_error('customer'); ?>
		
		</span>
	</div>
  </div>


  
		<div class="form-group">
    <label for="inputidno" class="col-sm-2 control-label">	ID No.  </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="idno" value="<?php echo set_value('idno'); ?>" id="idno2" class="form-control" required placeholder="Enter ID NO">
		 
				
		<span class="text-danger"> <?php echo form_error('idno'); ?>
		
		</span>
	</div>
  </div>

		<div class="form-group">
    <label for="inputphone" class="col-sm-2 control-label">	Phone No. </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="phone" value="<?php echo set_value('phone'); ?>" id="phone2" class="form-control" required placeholder="Enter Phone No.">
		 
				
		<span class="text-danger"> <?php echo form_error('phone'); ?>
		
		</span>
	</div>
  </div>
  

    <label for="inputdescription" class="col-sm-2 control-label">RM/Remarks</label>
    <div class="col-sm-7">

			  		<input type="text"   name="description" value="<?php echo set_value('description'); ?>"id="description" class="form-control"  placeholder="Enter description">


     <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_addextraguets"value="guest" class="btn btn-primary">Add Etra Guests</button>

		   
		   
		   
		   
		   
		   
    </div>
  </div>
  
     <?php echo form_close();?>
  
  
  
  						
									
  <table cellpadding="0" cellspacing="0" border="0" class="table  table-striped" id="example2" style="border-color:#CCCCCC; width:100%;"  >

             <thead>
         <tr>
        <th>#</th>
     <th>Name</th>
	   
	<th>Id No</th>	
  <th>Phone</th>	
  <th>Description</th>	

	  
  <th>Date </th>	 
	  <th>Room No </th>	 


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



        		$guests = $this->usermodel->populateallstatus('dailycharges','transactioncode', $itemid,'customer<>', "");


				
				
				
				
				
 if(!is_array($guests)) 

 {


   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;
    $i=0;
  	foreach ($guests as $c){

		    $i++;

             ?>



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


?>

             
     <td><?php echo $i; ?></td> 

     <td><?php echo $c->customer ; ?></td>
     <td><?php echo $c->idno ; ?></td>
     <td><?php echo $c->phone ; ?></td>
     <td><?php echo $c->description ; ?></td>
     <td><?php echo $c->createdat ; ?></td>
     <td><?php echo $c->houseno ; ?></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>
			
			
			
		
		
  

 
</div>

</div>

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

		
			
  
  	
		<div id="addModal" 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">Add new Profile/ Company /Group</h4>
      </div>
      <div class="modal-body">
      
	  	


		
				  		
	

				<?PHP

 $transactionid = 'rand' .rand(100, 9900) . 'trc' . time();
		 $imgid = rand(100, 990000).time();

 
		 $date=date("Y-m-d");

                 echo form_open('addtenant' , 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="inputfirstname" class="col-md-3 control-label">Company Name</label>
    <div class="col-sm-7">
	
	
	
					 <input type="hidden" name="type"    value="tenant"  class="form-control">
 <input type="hidden" id="view"name="view" class="view" placeholder="view" value="user/mychangepayment?myid=<?php   if(isset($itemid)) {echo $itemid; } ?>" >

	
				 <input type="hidden" name="img_id"    value="<?php echo set_value('img_id', $imgid); ?>"  class="form-control">

	<input type="hidden" name="action" value="<?php echo set_value('action','insert'); ?>"id="action" class="form-control" required placeholder="Enter action">
	<input type="hidden" name="transactionid" value="<?php echo set_value('transactionid'); ?>"id="transactionid" class="form-control" required placeholder="Enter transactionid">
		  		<input type="hidden" name="firstname" value="<?php echo set_value('firstname'); ?>"id="firstname" class="form-control" required placeholder="Enter customer name">

		  		<input type="text" name="company" value="<?php echo set_value('company'); ?>"id="company" class="form-control" required placeholder="Enter company name">
     <span class="text-danger"><?php echo form_error('company'); ?></span>
   </div>
  </div>
    <div class="form-group" style="display:none">
    <label for="inputlastname" class="col-md-3 control-label">Last Name</label>
    <div class="col-sm-7">
		<input type="text" name="lastname" value="<?php echo set_value('lastname') ;?>" id="lastname" class="form-control"  placeholder="Enter lastname">
       <span class="text-danger"><?php echo form_error('lastname'); ?></span>
   </div>
  </div>
    <div class="form-group">
    <label for="inputphone3" class="col-md-3 control-label">Company PIN   </label>
    <div class="col-sm-7">
				<input type="phone" name="idno" value="<?php echo set_value('idno'); ?>" id="idno" class="form-control"  placeholder="Enter PIN / ID">
    <span class="text-danger"><?php echo form_error('idno'); ?></span>
   </div>
  </div>
  
	
   
		
 
  <div class="form-group">
    <label for="inputphone" class="col-md-3 control-label">Phone Number</label>
    <div class="col-sm-7">
				<input type="text" name="phone" value="<?php echo set_value('phone'); ?>" id="phone" class="form-control"  placeholder="Enter Your phone">
        <span class="text-danger"><?php echo form_error('phone'); ?></span>
	</div>
  </div>
  <div class="form-group">
						<label for="field-2" class="col-md-3 control-label">Country</label>
		                    <div class="col-sm-7">
		                        <select name="country" class="form-control" id="section_selector_holder">
		                            <option value="">--Select Country--</option>
									   <?php
									$country = $this->accomodationmodel->populateallcountries();


if(is_array($country)) {

   foreach($country as $countryrow){

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

   
    <?php

}} else {
    echo 'There is no other  country for this house.... Please add country first.';
}

?>
			                        
			                    </select>
								     <span class="text-danger"><?php echo form_error('country'); ?></span>
			                </div>
	</div>
	
   <div class="form-group">
						<label for="field-2" class="col-md-3 control-label">County</label>
		                    <div class="col-sm-7">
		                        <select name="county" class="form-control" id="section_selector_holder">
		                            <option selected="select" value="">--Select County--</option>
									   <?php
									$county = $this->accomodationmodel->populateallallacounties();


if(is_array($county)) {

   foreach($county as $countyrow){

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

   
    <?php

}} else {
    echo 'There is no other  county for this house.... Please add county first.';
}

?>
			                        
			                    </select>
								     <span class="text-danger"><?php echo form_error('county'); ?></span>
			                </div>
	</div>
	
	
  	 		
     <div class="form-group"  style="display:none" >
    <label for="inputlocation" class="col-md-3 control-label">Company</label>
    <div class="col-sm-7">
				<input type="text" name="location" value="<?php echo set_value('location') ;?>" id="exampleInputlocation" class="form-control"  placeholder="Enter Your company/business name">
    <span class="text-danger"><?php echo form_error('location'); ?></span>
	</div>
  </div>
   <div class="form-group">
    <label for="inputEmail" class="col-md-3 control-label">Email</label>
    <div class="col-sm-7">
				<input type="email" name="email" value="<?php echo set_value('email') ;?>" id="exampleInputEmail" class="form-control"  placeholder="Enter Your email">
    <span class="text-danger"><?php echo form_error('email'); ?></span>
	</div>
  </div>

 
 <div class="form-group" style="display:none"  >
						<label for="field-2" class="col-md-3 control-label">Gender</label>
		                    <div class="col-sm-7">
		                        <select name="gender"  class="form-control" id="section_selector_holder">
		                            <option value="" selected>--Select Gender--</option>
			                         <option value="Male">Male</option>
									   <option value="Female">Female</option>
			                    </select>
							 <span class="text-danger"><?php echo form_error('gender'); ?></span>

			                </div>
	</div>	
	
	
		
			
	
	
	
	
	
		
		
		
		
		
	   <div class="form-group" >
    <label for="inputphone3" class="col-md-3 control-label">Entry Date </label>
    <div class="col-sm-7">
				<input type="phone" name="entrydate" value="<?php echo set_value('entrydate',$date); ?>" id="idno" class="form-control"  placeholder="Enter Entry date">
    <span class="text-danger"><?php echo form_error('entrydate'); ?></span>
   </div>
  </div>
  	  <div class="form-group" style="display:none">
						<label for="field-2" class="col-md-3 control-label">House Status</label>
		                    <div class="col-sm-7">
		                        <select name="status" required class="form-control" id="section_selector_holder">
		                            <option value="" >--Select Status--</option>
			                         <option selected="selected"value="active">active</option>
									   <option value="inactive">inactive</option>
			                    </select>
							 <span class="text-danger"><?php echo form_error('gender'); ?></span>

			                </div>
	</div>
	
	 <div class="form-group" style="display:none">
						<label for="field-2" class="col-md-3 control-label"> photo</label>
		                    <div class="col-sm-7">
		                      		<input type="file" name="photo" width="400"  value="<?php echo set_value('photo') ;?>" placeholder="Select Image"  class="form-control"  >

							 <span class="text-danger"><?php echo form_error('photo'); ?></span>

			                </div>
	</div>
	
	
	

   <div class="form-group" style="display:none">
    <label for="inputphone3" class="col-md-3 control-label">Comments </label>
    <div class="col-sm-7">
	<textarea name="description" id="ttt" rows="5" placeholder="Add any description/comment" 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-10">
     
	       <button type="submit" name="btn_tenant"value="tenant" class="btn btn-primary">Save</button>

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

    

				</div>

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

  
  
  
  
  

<div id="editorderModel" 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  FOOD/DRINKS DETAILS</h4>
      </div>
      <div class="modal-body">
      
	  	   
		 
				<?PHP
//$session_data = $this->session->userdata('logged_in');



				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/updatesalesroomcharges' , 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="randomitemidentifier1" value="<?php echo set_value('plotno',$randomitemidentifier1); ?>"id="bookingno" class="form-control" required placeholder="Enter booking number">
<input type="hidden" name="randomitemidentifier" value="<?php echo set_value('houseno',$randomitemidentifier); ?>"id="plotno" class="form-control" required placeholder="Enter house number">
	<input type="hidden" name="roomidentifier" value="<?php  echo $roomidentifier ; ?>"id="roomidentifier" class="form-control"  placeholder="Enter roomidentifier">
	<input type="hidden" name="invoice" value="" id="myinvoice" class="form-control" required placeholder="Enter invoice">
	<input type="hidden" name="myid" value="<?php  echo $myid ; ?>"id="myid" class="form-control"  placeholder="Enter myid">
	<input type="hidden" name="itemid" value="<?php  echo $itemid ; ?>"id="itemid" class="form-control"  placeholder="Enter itemid">

	<input type="hidden" name="mycategoryid" value="" id="orderid" class="form-control" required placeholder="Enter mycategoryid">
			
     <div class="form-group">
    <label for="inputstatus" class="col-sm-2 control-label">Payment Status?</label>
    <div class="col-sm-10">
	<select class="form-control" name="status"  id="orderstatus"  required>
		<option value=""  selected="selected" ></option>
	<option value=""  >---Select Payment Status---</option>

	<option value="Cleared"  >Cleared</option>
	<option value="No"  >Not Cleared</option>

	
</select>
		
						<span class="text-danger"><?php echo form_error('status'); ?>

	</div>
  </div>
  	

  
  		
	<div class="form-group" >
    <label for="inputtotal" class="col-sm-2 control-label">	Total </label>
    <div class="col-sm-10">
	
		  		<input type="text" readonly name="total" value="<?php echo set_value('total'); ?>" id="ordertotal" class="form-control" required placeholder="Enter total">
		 
				
		<span class="text-danger"> <?php echo form_error('total'); ?>
		
		</span>
	</div>
  </div>


	

	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     		         <button type="submit"   value="roomcharges" name="btn_updateroomcharges" class="btn btn-primary"> Update  food/drink payment   </button>


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

    

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

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



				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/updateroomcharges' , 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="houseno" value="<?php echo set_value('houseno',$randomitemidentifier); ?>"id="plotno" class="form-control" required placeholder="Enter house number">
							  		<input type="hidden" name="myid" value="<?php echo set_value('itemid',$itemid); ?>"id="plotno" class="form-control" required placeholder="Enter house number">
								  		<input type="hidden" name="roomidentifier" value="<?php  echo $roomidentifier ; ?>"id="roomidentifier" class="form-control"  placeholder="Enter roomidentifier">


	<input type="hidden" name="mycategoryid" value=""id="myupdatecategoryid" class="form-control" required placeholder="Enter mycategoryid">
			  		
	<div class="form-group">
    <label for="inputname" class="col-sm-2 control-label">	QTY </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="qty" value="<?php echo set_value('qty'); ?>" id="myqtys" class="form-control" required placeholder="Enter qty">
		 
				
		<span class="text-danger"> <?php echo form_error('qty'); ?>
		
		</span>
	</div>
  </div>



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


		<div class="form-group">
    <label for="inputpeople" class="col-sm-2 control-label">	Pax </label>
    <div class="col-sm-10">
	
		  		<input type="text" id="peoplepax" name="people" value="<?php echo set_value('people'); ?>" id="costs" class="form-control" required placeholder="Enter pax">
		 
				
		<span class="text-danger"> <?php echo form_error('people'); ?>
		
		</span>
	</div>
  </div>
  <div class="form-group">
    <label for="inputordersales" class="col-sm-2 control-label">Status?</label>
    <div class="col-sm-10">

	<select class="form-control" name="sales" id="sales" required>
	
		<option value="" selected></option>
		<option value=""  >---Select Status---</option>
		<option value="Active"  >Active</option>
		<option value="Inactive"  >Inactive</option>

	

</select>
		
						<span class="text-danger"><?php echo form_error('status'); ?>

	</div>
  </div>
  

	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
          		         <button type="submit"   value="user/mychangepayment?myid=<?php   if(isset($itemid)) {echo $itemid; } ?>&randomitemidentifier=<?php   if(isset($randomitemidentifier)) {echo $randomitemidentifier; } ?>&randomitemidentifier1=<?php   if(isset($randomitemidentifier1)) {echo $randomitemidentifier1; } ?>&roomidentifier=<?php   if(isset($roomidentifier)) {echo $roomidentifier; } ?>" name="btn_updateroomcharges" class="btn btn-primary"> Update  charges   </button>


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

    

				</div>

		</div>
	    </div>
    </div>
	
	
	
	
					<div id="myModal2" 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">Cancel</h4>
      </div>
      <div class="modal-body">
        <h3>Are you sure you want to Cancel 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="roomsales">
 <input type="hidden" id="view"name="view" class="view" placeholder="view" value="user/mychangepayment?myid=<?php   if(isset($itemid)) {echo $itemid; } ?>" >

 <input type="hidden" id="itemid2"name="itemid" class="itemid" placeholder="itemid" value=""><br>
 <button type="button" class="btn btn-success" data-dismiss="modal">No</button>
 		  	         <button type="submit" name="btn_delete" value="deletebyid" class="btn btn-danger"> Cancel  </button>

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

  </div>

  </div>


	
	
	
	
	
	
	

					<div id="myModal111111" 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="roomcharges">
 <input type="text" id="itemid" name="itemid" class="itemid" placeholder="itemid" value=""><br>

 <input type="hidden" id="view"name="view" class="view" placeholder="view" value="user/mychangepayment?myid=<?php   if(isset($itemid)) {echo $itemid; } ?>" >
 <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 id="mycancelModal" 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">Merge / Transfer Sales</h4>
      </div>
      <div class="modal-body">
        <h3>Are you sure you want to merge /transfer this sale? </h3>
      </div>
      <div class="modal-footer">
	  	

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

		
                 echo form_open('admin/mergesales' , 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="roomsales">
 <input type="hidden" id="roomsalesid" name="itemid" class="itemid" placeholder="itemid" value="">
 <input type="hidden" id="invoice" name="invoice" class="invoice" placeholder="invoice" value="">
 <input type="hidden" id="transactioncodes" name="transactioncode" class="invoice" placeholder="invoice" value="<?php   {echo  $allsalesdetails[0]['transactioncode'];}  ?>">
 <input type="hidden" id="view"name="view" class="view" placeholder="view" value="user/mychangepayment?myid=<?php   if(isset($itemid)) {echo $itemid; } ?>" >

 <button type="button" class="btn btn-success" data-dismiss="modal">No</button>
 		  	         <button type="submit" name="btn_mergesales" value="merge" class="btn btn-danger"> Merge now  </button>

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

  </div>

  </div>



  
  
  
  

					<div id="mycancelModal1" 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">Cancel</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('admin/deletebyiddailyroomsales' , 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="dailycharges">
 <input type="hidden" id="myroomsalesid" name="itemid" class="itemid" placeholder="itemid" value=""><br>
 <input type="hidden" id="mytotal" name="mytotal" class="myamount" placeholder="amount" value="">
 <input type="hidden" id="mytransactioncode" name="mytransactioncode" class="myamount" placeholder="transactioncode" value="">

 <input type="hidden" id="view"name="view" class="view" placeholder="view" value="user/mychangepayment?myid=<?php   if(isset($itemid)) {echo $itemid; } ?>" >
 <button type="button" class="btn btn-success" data-dismiss="modal">No</button>
 		  	         <button type="submit" name="btn_delete" value="deletebyid" class="btn btn-danger"> Cancel  </button>

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

  </div>

  </div>


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

	













