<ul class="nav nav-tabs bordered">
			<li class="active">
            	<a href="#thirdtab" data-toggle="tab"><i class="entypo-menu"></i> 
					Invoice Coparent 
                    	</a></li>
							<li>
						<a href="#payment" data-toggle="tab"><i class="entypo-menu"></i> 
									 	Lipa Mcopo</a>

                    	</li>
						<li>
						<a href="#list" data-toggle="tab"><i class="entypo-menu"></i> 
									 	View payment and Invoice</a>

                    	</li>
			<li>
						<a href="#back" data-toggle="tab"><i class="entypo-menu"></i> 
									 <a href="<?php echo base_url(); ?>admin/newcoparent" class="btn-primary">	Go back</a></a>

                    	</li>
					
					
		</ul>
    	<!------CONTROL TABS END------>
        
		<div class="tab-content">
            <!----TABLE LISTING STARTS-->
    
		
   
   <div class="tab-pane box active" id="thirdtab" 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>
				Approve Coparent
            	</div>
            </div>
			<div class="panel-body">





				<?PHP
				
				
							$session_data = $this->session->userdata('adminlogged_in');
$data['username'] = $session_data['username'];
$username = $data['username'];


				
				
				
				
				
				
				
				
				
				
				echo $this->session->flashdata('msg'); 
		 $date = Date('Y-m-d') ;
		 	 $year = Date('Y') ;
		  $month = Date('m') ;
                 echo form_open('addinvoicecoparent' , 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="inputhouseno" class="col-sm-2 control-label">House Number</label>
    <div class="col-sm-7">
			  		<input type="text"  readonly name="houseno" value="<?php echo set_value('houseno',$tenant[0]['houseno']); ?>"id="Paymentno" class="form-control" required placeholder="Enter Payment number">
  		<input type="hidden" name="action" value="<?php echo set_value('action','update'); ?>"id="action" class="form-control" required >


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

    <label for="inputplotno" class="col-sm-2 control-label">Plot Number</label>
    <div class="col-sm-7">
	<input type="text" name="plotno" readonly value="<?php echo set_value('plotno',$tenant[0]['plotno']); ?>"id="plotno" class="form-control" required placeholder="Enter Payment number">


     <span class="text-danger"><?php echo form_error('plotno'); ?></span>
   </div>
  </div>
  
 <div class="form-group">
    <label for="inputidno" class="col-sm-2 control-label">Tenant Name</label>
    <div class="col-sm-7">
       	<input type="hidden" readonly name="tenantid" value="<?php echo set_value('tenantid',$tenant[0]['tenantid']); ?>" id="idno" class="form-control" required placeholder="Enter Name">
 
		
		<?php 
		$tenantid=$tenant[0]['tenantid'];
		$tenantsdetails = $this->adminusermodel->gettenantbyid($tenantid);
								


if(is_array($tenantsdetails)) {

   foreach($tenantsdetails as $tenantsdetailsrow){

    $names=$tenantsdetailsrow->lastname. " ".$tenantsdetailsrow->firstname ; 
    ?>

	<input type="text" name="mytenantid" readonly  value="<?php echo set_value('tenantid',$names); ?>" id="idno" class="form-control" required placeholder="Enter Name">

	<?php

}} else {
  
  
         echo '<div class="alert alert-warning text-center">No tenant .</div>';


	
}
				 
		
	?>	
		
		<span class="text-danger"><?php echo form_error('tenantid'); ?></span>
	</div>
  </div>
  
   <div class="form-group">
    <label for="inputamount" class="col-sm-2 control-label">Amount</label>
    <div class="col-sm-7">
				<input type="text" name="amount" readonly value="<?php echo set_value('amount',$tenant[0]['amount']); ?>" id="amount" class="form-control" required placeholder="Enter amount">
        <span class="text-danger"><?php echo form_error('amount'); ?></span>
	</div>
  </div>
  
  
  
		 		  <div class="form-group">
    <label for="inputtotalamounto" class="col-sm-2 control-label">Expected Amount:</label>
    <div class="col-sm-7">
				    	
				<input type="text" name="totalamount" readonly value="<?php echo set_value('totalamount',$tenant[0]['totalamount']); ?>" id="totalamount" class="form-control" required placeholder="Enter total amount">

		

	  <span class="text-danger"><?php echo form_error('totalamount'); ?></span>
	</div>
  </div>	
		 
  
  
     <div class="form-group" >
						<label for="field-2" class="col-sm-2 control-label">Request Status</label>
		                    <div class="col-sm-7" id="approval"  >
		                        <select name="approval" required class="form-control"  id="approval"   >
										 <option selected value="<?php echo $tenant[0]['approval']?>"><?php echo $tenant[0]['approval']?></option>

									      <option  value="approved">approved</option>
			                        <option  value="rejected">rejected</option>
									<option  value="new">new</option>
			                    </select>
								
								     <span class="text-danger"><?php echo form_error('approval'); ?></span>
			                </div>
	</div>
  
  
  
  
  
  
  
  
  
  
 <div class="form-group">
    <label for="inputidno" class="col-sm-2 control-label">Approved By:</label>
    <div class="col-sm-7">
					<input type="text" readonly name="id" value="<?php echo set_value('id',$tenant[0]['id']); ?>" id="id" class="form-control" required placeholder="id">

				<input type="hidden" readonly name="approvedby" value="<?php echo set_value('approvedby',$tenant[0]['approvedby']); ?>" id="approvedby" class="form-control" required placeholder="Approved by (Name)">
        <span class="text-danger"><?php echo form_error('year'); ?></span>
	</div>
  </div>  
    <div class="form-group">
    <label for="inputidno" class="col-sm-2 control-label">Month of Payment</label>
    <div class="col-sm-7">
				<input type="text" name="month" value="<?php echo set_value('month',$tenant[0]['month']); ?>" id="idno" class="form-control" required placeholder="Enter month">
        <span class="text-danger"><?php echo form_error('year'); ?></span>
	</div>
  </div>
   <div class="form-group">
    <label for="inputrate" class="col-sm-2 control-label">Intrest Rate (%)</label>
    <div class="col-sm-7">
				<input type="text" name="rate" value="<?php echo set_value('rate','10'); ?>" id="rate" class="form-control" required placeholder="Enter rate">
        <span class="text-danger"><?php echo form_error('rate'); ?></span>
	</div>
  </div>
  <div class="form-group">
    <label for="inputtransactioncode" class="col-sm-2 control-label">Receipt No</label>
    <div class="col-sm-7">
				<input type="text" readonly name="transactioncode" value="<?php echo set_value('transactioncode',$tenant[0]['transactioncode']); ?>" id="transactioncode" class="form-control" required placeholder="Enter transactioncode">
        <span class="text-danger"><?php echo form_error('transactioncode'); ?></span>
	</div>
  </div>
  <div class="form-group">
    <label for="inputidno" class="col-sm-2 control-label">Year of Payment</label>
    <div class="col-sm-7">
				<input type="text" readonly name="year" value="<?php echo set_value('year',$tenant[0]['year']); ?>" id="idno" class="form-control" required placeholder="Enter year">
        <span class="text-danger"><?php echo form_error('year'); ?></span>
	</div>
  </div>
 <div class="form-group">
    <label for="inputidno" class="col-sm-2 control-label">Application Date</label>
    <div class="col-sm-7">
				<input type="text" readonly name="createdat" value="<?php echo set_value('createdat',$tenant[0]['createdat']); ?>" id="idno" class="form-control" required placeholder="Enter Start Date">
        <span class="text-danger"><?php echo form_error('createdat'); ?></span>
	</div>
  </div>
   <div class="form-group">
    <label for="inputidno" class="col-sm-2 control-label">Approval Date</label>
    <div class="col-sm-7">
				<input type="text" readonly name="approvaldate" value="<?php echo set_value('approvaldate',$tenant[0]['approvaldate']); ?>" id="idno" class="form-control" required placeholder="Automatic ">
        <span class="text-danger"><?php echo form_error('approvaldate'); ?></span>
	</div>
  </div>
		  <div class="form-group">
    <label for="inputidno" class="col-sm-2 control-label">Payment Mode</label>
    <div class="col-sm-7">
				    	
			  	<select name="paymentmode" readonly class="form-control" required>

		<?php 
 $methode = $this->adminusermodel->getpaymentsectionid($tenant[0]['paymentmode']);


if(is_array($methode)) {

   foreach($methode as $methoderow){

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

   
    <?php

}} else {
    echo 'No payment Mode';
}

?>
	</select>
				

	  <span class="text-danger"><?php echo form_error('paymentmode'); ?></span>
	</div>
  </div>			
  
    	 
	   <div class="form-group">
    <label for="inputpaymentcode" class="col-sm-2 control-label">Payment Code</label>
    <div class="col-sm-7">
				<input type="text" name="paymentcode" value="<?php echo set_value('paymentcode',$tenant[0]['paymentcode']); ?>" id="idno" class="form-control"  placeholder="Enter paymentcode">
        <span class="text-danger"><?php echo form_error('paymentcode'); ?></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="ttt" rows="5" placeholder="add Description" class="form-control"><?php echo set_value('description',$tenant[0]['description']); ?></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_addinvoice" value="invoicerent" class="btn btn-primary">Invoice Coparent</button>

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

   </div>
   
   <div class="tab-pane box active" id="payment" 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>
				Pay Mcopo
            	</div>
            </div>
			<div class="panel-body">





				<?PHP
				
				
							$session_data = $this->session->userdata('adminlogged_in');
$data['username'] = $session_data['username'];
$username = $data['username'];


				
				
				
				
				
				
				
				
				
				
				echo $this->session->flashdata('msg'); 
		 $date = Date('Y-m-d') ;
		 	 $year = Date('Y') ;
		  $month = Date('m') ;
                 echo form_open('addpaymentcoparent' , 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="inputhouseno" class="col-sm-2 control-label">House Number</label>
    <div class="col-sm-7">
			  		<input type="text"  readonly name="houseno" value="<?php echo set_value('houseno',$tenant[0]['houseno']); ?>"id="Paymentno" class="form-control" required placeholder="Enter Payment number">
  		<input type="hidden" name="action" value="<?php echo set_value('action','update'); ?>"id="action" class="form-control" required >


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

    <label for="inputplotno" class="col-sm-2 control-label">Plot Number</label>
    <div class="col-sm-7">
	<input type="text" name="plotno" readonly value="<?php echo set_value('plotno',$tenant[0]['plotno']); ?>"id="plotno" class="form-control" required placeholder="Enter Payment number">


     <span class="text-danger"><?php echo form_error('plotno'); ?></span>
   </div>
  </div>
  
 <div class="form-group">
    <label for="inputidno" class="col-sm-2 control-label">Tenant Name</label>
    <div class="col-sm-7">
       	<input type="hidden" readonly name="tenantid" value="<?php echo set_value('tenantid',$tenant[0]['tenantid']); ?>" id="idno" class="form-control" required placeholder="Enter Name">
 
		
		<?php 
		$tenantid=$tenant[0]['tenantid'];
		$tenantsdetails = $this->adminusermodel->gettenantbyid($tenantid);
								


if(is_array($tenantsdetails)) {

   foreach($tenantsdetails as $tenantsdetailsrow){

    $names=$tenantsdetailsrow->lastname. " ".$tenantsdetailsrow->firstname ; 
    ?>

	<input type="text" name="mytenantid" readonly  value="<?php echo set_value('tenantid',$names); ?>" id="idno" class="form-control" required placeholder="Enter Name">

	<?php

}} else {
  
  
         echo '<div class="alert alert-warning text-center">No tenant .</div>';


	
}
				 
		
	?>	
		
		<span class="text-danger"><?php echo form_error('tenantid'); ?></span>
	</div>
  </div>
  
   <div class="form-group">
    <label for="inputamount" class="col-sm-2 control-label">Loan Issued</label>
    <div class="col-sm-7">
				<input type="text" name="amount" readonly value="<?php echo set_value('amount',$tenant[0]['amount']); ?>" id="amount" class="form-control" required placeholder="Enter amount">
        <span class="text-danger"><?php echo form_error('amount'); ?></span>
	</div>
  </div>
  
  
  
		 		  <div class="form-group">
    <label for="inputtotalamounto" class="col-sm-2 control-label">Expected Amount:</label>
    <div class="col-sm-7">
				    	
				<input type="text" name="totalamount" readonly value="<?php echo set_value('totalamount',$tenant[0]['totalamount']); ?>" id="totalamount" class="form-control" required placeholder="Enter total amount">

		

	  <span class="text-danger"><?php echo form_error('totalamount'); ?></span>
	</div>
  </div>	
		 
  
  
     <div class="form-group" >
						<label for="field-2" class="col-sm-2 control-label">Request Status</label>
		                    <div class="col-sm-7" id="approval"  >
		                        <select name="approval" readonly required class="form-control"  id="approval"   >
										 <option selected value="<?php echo $tenant[0]['approval']?>"><?php echo $tenant[0]['approval']?></option>

									 
			                    </select>
								
								     <span class="text-danger"><?php echo form_error('approval'); ?></span>
			                </div>
	</div>
  
  
  
  
  
  
  
  
  
  
 <div class="form-group">
    <label for="inputidno" class="col-sm-2 control-label">Approved By:</label>
    <div class="col-sm-7">
					<input type="text" readonly name="id" value="<?php echo set_value('id',$tenant[0]['id']); ?>" id="id" class="form-control" required placeholder="id">

				<input type="hidden" readonly name="approvedby" value="<?php echo set_value('approvedby',$tenant[0]['approvedby']); ?>" id="approvedby" class="form-control" required placeholder="Approved by (Name)">
        <span class="text-danger"><?php echo form_error('year'); ?></span>
	</div>
  </div>  
    <div class="form-group">
    <label for="inputidno" class="col-sm-2 control-label">Amount Paid</label>
    <div class="col-sm-7">
				<input type="text" name="month" value="<?php echo set_value('month',$tenant[0]['month']); ?>" id="idno" class="form-control" required placeholder="Enter month">
        <span class="text-danger"><?php echo form_error('year'); ?></span>
	</div>
  </div>
   <div class="form-group">
    <label for="inputrate" class="col-sm-2 control-label">Intrest Rate (%)</label>
    <div class="col-sm-7">
				<input type="text" name="rate" value="<?php echo set_value('rate','10'); ?>" id="rate" class="form-control" required placeholder="Enter rate">
        <span class="text-danger"><?php echo form_error('rate'); ?></span>
	</div>
  </div>
  <div class="form-group">
    <label for="inputtransactioncode" class="col-sm-2 control-label">Receipt No</label>
    <div class="col-sm-7">
				<input type="text" readonly name="transactioncode" value="<?php echo set_value('transactioncode',$tenant[0]['transactioncode']); ?>" id="transactioncode" class="form-control" required placeholder="Enter transactioncode">
        <span class="text-danger"><?php echo form_error('transactioncode'); ?></span>
	</div>
  </div>
  <div class="form-group">
    <label for="inputidno" class="col-sm-2 control-label">Year of Payment</label>
    <div class="col-sm-7">
				<input type="text" readonly name="year" value="<?php echo set_value('year',$tenant[0]['year']); ?>" id="idno" class="form-control" required placeholder="Enter year">
        <span class="text-danger"><?php echo form_error('year'); ?></span>
	</div>
  </div>
 <div class="form-group">
    <label for="inputidno" class="col-sm-2 control-label">Application Date</label>
    <div class="col-sm-7">
				<input type="text" readonly name="createdat" value="<?php echo set_value('createdat',$tenant[0]['createdat']); ?>" id="idno" class="form-control" required placeholder="Enter Start Date">
        <span class="text-danger"><?php echo form_error('createdat'); ?></span>
	</div>
  </div>
   <div class="form-group">
    <label for="inputidno" class="col-sm-2 control-label">Approval Date</label>
    <div class="col-sm-7">
				<input type="text" readonly name="approvaldate" value="<?php echo set_value('approvaldate',$tenant[0]['approvaldate']); ?>" id="idno" class="form-control" required placeholder="Automatic ">
        <span class="text-danger"><?php echo form_error('approvaldate'); ?></span>
	</div>
  </div>
		  <div class="form-group">
    <label for="inputidno" class="col-sm-2 control-label">Payment Mode</label>
    <div class="col-sm-7">
				    	
			  	<select name="paymentmode" readonly class="form-control" required>

		<?php 
 $methode = $this->adminusermodel->getpaymentsectionid($tenant[0]['paymentmode']);


if(is_array($methode)) {

   foreach($methode as $methoderow){

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

   
    <?php

}} else {
    echo 'No payment Mode';
}

?>
	</select>
				

	  <span class="text-danger"><?php echo form_error('paymentmode'); ?></span>
	</div>
  </div>			
  
    	 
	   <div class="form-group">
    <label for="inputpaymentcode" class="col-sm-2 control-label">Payment Code</label>
    <div class="col-sm-7">
				<input type="text" name="paymentcode" value="<?php echo set_value('paymentcode',$tenant[0]['paymentcode']); ?>" id="idno" class="form-control"  placeholder="Enter paymentcode">
        <span class="text-danger"><?php echo form_error('paymentcode'); ?></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="ttt" rows="5" placeholder="add Description" class="form-control"><?php echo set_value('description',$tenant[0]['description']); ?></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_addinvoice" value="invoicerent" class="btn btn-primary">Invoice Coparent</button>

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

   </div>
   
      <div class="tab-pane box " id="list" style="padding: 5px">
  
<table id="example"  cellspacing="1" class="table  table" width="100%">
             <thead>
			
         <tr>
    
    <th>House Number </th>
	<th>Plot Name</th>
    
	<th>Type</th> 	
	<th>Tenant </th> 
	<th>Amount </th> 
		<th> Invoice Name</th> 
		<th> Month </th> 
		<th> Year </th> 
	<th> Invoice Date </th> 
	<th>Due Date</th> 
 
	 




                 </tr>
             </thead>
<?php

	echo $this->session->flashdata('msg'); 
		if(validation_errors()):
		 endif;
		 $invoiceid=$tenant[0]['transactioncode'];
		 $invoice = $this->adminusermodel->getcoparentbyreceiptid($invoiceid);
 if(!is_array($invoice)) 

 {



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

		 

             ?>



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


?>

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

                 <td><?php  $tenantid=$c->tenantid ; 
				 
				 
				    $tenants = $this->adminusermodel->gettenantbyid($tenantid);
								


if(is_array($tenants)) {

   foreach($tenants as $tenantsrow){

   echo $tenantsrow->lastname. "  ".$tenantsrow->firstname ; 
    

}} else {
    echo $c->tenantid;
}
				 
				 
				 
				 
				 
				 ?></td>
				       <td><?php echo $c->amount ; 
					   
					   $total=$total + $c->amount ; 
    
					   
					   ?></td>
					   <td><?php echo $c->type ; ?></td> 
					          <td><?php echo $c->month ; ?></td>
							         <td><?php echo $c->year ; ?></td>
                     <td><?php echo $c->createdat; ?></td>
					     <td><?php echo $c->duedate; ?></td>
				
         				
            
             </tr>

             <?php endforeach; ?>

              <?php }?>
			  <tfoot>
	  <tr>
    
 
	 
	
 <th>House no </th>
	<th> </th>
	<th></th>
	<th></th>
      
	<th ><?php echo $total." /=" ?></th> 

	<Th></th>
	<Th></th>
	<th></th> 
<th></th> 

<th>date</th> 



                 </tr></tfoot>
        </table>
      </div>
   

   </div>
   
</div>




			