

 
 <div class="row">
  
   										<?php
 
   $session_data = $this->session->userdata('logged_in');

      $mydate=date("Y-m-d H:i:s");
 $date = Date('Y-m-d') ;
		 	 $year = Date('Y') ;
		  $month = Date('m') ;
 	$data['id'] = $session_data['id'];
        
		 $userid = $data['id'];
$data['companyid'] = $session_data['companyid'];
	 $companyid = $data['companyid'];
		 $data['usertype'] = $session_data['usertype'];
	 $usertype = $data['usertype'];	
	         		$config = $this->usermodel->populateallarray('people','id',$userid);


 $names = $config[0]['firstname']." ".$config[0]['surname'];
	 
	  $contact = $config[0]['phone'];
	  
	  				
$finalsalesid ="EXP-".$userid.time();

 //$data['finalsalesid']="EXP-".$finalsalesid;

	  


    $leavesetup=$this->usermodel->populatuserpermissionsdataarray('humanresource','leavesetup',$userid);
			    $allleaves=$this->usermodel->populatuserpermissionsdataarray('humanresource','allleaves',$userid);
 
 
  $mydate=date("Y-m-d H:i:s");



  
  ?>
		
		

   	<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>
			View my leave balance
			 <a href="<?php echo base_url();?>user/viewleaves" class="btn btn-info">  Go back Leaves</a>	
			 
			 													<?php  
													 
	
	 if($allleaves==TRUE){

	 ?>
 															<li ><a href="<?php echo base_url(); ?>user/leavebalance"><span class="btn btn-default">Back All Leaves Balance</span></a></li>

	 
<?php 
		
	 }

	?>

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

			
										
					<div class="row">
						<div class="col-md-12">
							
							<div class="panel-body">
	
									
									
							
<table id="example"  cellspacing="1" border="1" class="table-striped" width="100%">
             <thead>
         <tr>
     <th>Leave Type</th>
     <th>Days</th>
	     <th>Used</th>
		 	     <th>Remaining</th>

	    





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

   
 	$data['id'] = $session_data['id'];
         $postedtime = date('Y-m-d');
		$currenttime = date('h:i:sa');
 		$postedtime =  ($postedtime)." ".$currenttime ;
		 $userid = $data['id'];

 if(!is_array($announcement)) 

 {


   echo "<tr  style='margin-bottom:0px;margin-top:0px;' '>";
      echo "<td colspan='1'>";
    
       echo '<div class="alert alert-warning text-center">There are no leave balances to show for now.</div>';
    echo "</td>";
   echo "</tr>";
    }else {
?>
    
             <?php 
  $rmaining=0;
  	foreach ($announcement as $c): 

		 

             ?>



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


?>
<td><?php 
	
								 
 
					// $branch="";
					  $mytype=$c->type;

					 $leavetype= $this->usermodel->populateall('leavetypes','id',$mytype);



if(is_array($leavetype)) {

   foreach($leavetype as $leavetyperow){

   echo $leavetyperow->name;
 
 
}} else {
    echo 'No type';
}
	
?>
	
	
</td>
              
  <td><?php echo $c->days ; ?></td>
  
  
  
  <td><?php 
	
						$useddays=0;		 
 
					// $branch="";
					 $mytype=$c->type;

					 $leavetype= $this->usermodel->Getuseddays($userid,$mytype);
					$useddays=$leavetype[0]['duration'];

if($useddays==0){
	echo 0.0;
}else{
	echo$useddays;
}
						
?>
	
	
</td>
  
  
  
  
  
   
	  <td><?php  $totaldays=$c->days ;
echo$rmaining=$totaldays-$useddays;

	  ?></td>
   
  
            
             </tr>

	<?php endforeach;} ?>

           

        </table>

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

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

 
</div>


















