<?php 
  ob_start();
  session_start();
  error_reporting( ~E_NOTICE );
  require_once '../includes/conn.php';
  require_once '../includes/dbconfig.php';
  include('../scripts2.php'); 
  ?> 
  
<!DOCTYPE html>
<html lang="en">

<head>
<?php   require_once 'head_link.php'; ?>

<style type="text/css"> 
.left{width:30%;}
</style>

</head>

<body class="bg-white">
 
<?php //  require_once 'header1.php'; ?> 
<?php 
if(isset($_GET['view']) && !empty($_GET['view']))
{
    
    $get_emp_id = $_GET['view'];
    
    $stmt_edit = $DB_con->prepare('SELECT * FROM employees_salary_details
			LEFT JOIN employees ON employees.id = employees_salary_details.emp_id
			
    
	
	WHERE employees_salary_details.emp_id = :uid'); 
	
    $stmt_edit->execute(array(':uid' => $get_emp_id));
    $edit_row = $stmt_edit->fetch(PDO::FETCH_ASSOC);
    extract($edit_row);
}
else
{
    header("Location: index");
}
?>

 

 
 

<?php // require_once 'sidebar.php'; ?>


   <section class="section bg-white">
      <div class="row1">
    <div class="col-lg-7 m-auto my-3 pb-3 border rounded"> 
    
	<table class="table table-hover table-responsive mb-5 ">
	
	<tr>  
            <?php 
$sql = $con->query("select * from stuff where userid ='".$_SESSION['id']."' ");
$row = $sql->fetch_assoc();
$BizLogo =$row['photo'];
$BizNam =$row['business_name'];
$BizDetails =$row['business_details'];
$BizPhn =$row['business_phone']; 
$BizEml =$row['business_email'];
$BizWeb =$row['biz_web'];
$BizAdr =$row['business_address'];
?>
            
    <header class="clearfix text-center">
      <div id="logo">
	  <img src="../<?php if($BizLogo==""){echo "../img/user.jpg";}else{echo $BizLogo;} ?>" width="110px"> 
      </div>
      <div id="company"> 
        <h5 class="name"><b><?php echo $BizNam ; ?></b> <br><?php// echo $BizDetails ; ?></h5>
		<span style="font-size:15;">
	 Monthly Salary Pay Voucher <br>
	
			 
			 Print Date : <?php echo date("M d, Y") ;?> |  Time   : <?php date_default_timezone_set("Asia/Dhaka"); echo  date("h:i:sa");?>
</span>
     </div>
      </div>
    </header>
            
	</tr>
   
		<tr> <td> </td> <td> </td></tr>
	
	
	<tr>
    	<td><label class="control-label">Employee Name</label></td>
    	<td><label class="control-label"><?php echo $emp_name; ?></label></td>
    </tr>
	
	<tr>
    	<td><label class="control-label">Position</label></td>
    	<td><label class="control-label"><?php echo $position; ?></label></td>
    </tr>
	
	 
	
	<tr>
    	<td><label class="control-label"> Salary </label></td>
    	<td><label class="control-label"><?php echo $salary; ?> /-</label></td>
    </tr>
	
	
	 </table>
	 
	 
	 <table class="table table-hover datatable">
               <thead class="bg-light">
                           
                            <tr>
                                <th>Date</th> 
                                <th>Month</th>  
								<th> Bonus</th> 
								<th> Advance </th> 
								<th> Total Paid </th>
								<th> Due</th>
								<th> Status</th> 
                            </tr>
							
                        </thead>
						
						
              <tbody id="tbody">

	
	
	<?php
	$eq=mysqli_query($con,"select * from employees_salary_details  
	Left JOIN employees ON employees.id = employees_salary_details.emp_id
	where  employees_salary_details.emp_id='$get_emp_id' AND sal_type=5
	ORDER BY employees_salary_details.id DESC  ");
	
	$GTotalPaid= "";
	while($eqrow=mysqli_fetch_array($eq)){
	$GTotalPaid=$eqrow['adv_paid'] + $eqrow['full_paid'] ;
	
	?>
			<tr>
			<td><?php echo date("d-M-Y", strtotime($eqrow['entry_date'])); ?></td>
			
			 
			<td><?php echo $eqrow['month']; ?>-<?php echo $eqrow['year']; ?></td>  
											<td><?php echo $eqrow['bonus']; ?></td>
							<!--			<td><?php echo $eqrow['total_salary']; ?></td> -->
											<td><?php echo $eqrow['adv_paid']; ?></td>
								<!--		<td><?php echo $eqrow['full_paid']; ?></td>-->
											<td><?php echo $GTotalPaid; ?></td>
											<td><?php echo $eqrow['recent_due']; ?></td> 
											<td class="text-primary"><?php echo $eqrow['comment']; ?></td>
 
            		
          </tr>				
<?php
}
?>

</tbody>
              </table>
		
	 <footer class="text-center my-4">       
      <div id="company">  
       <div><?php echo $BizAdr ; ?></div>  
      <div>Call : <?php echo $BizPhn ; ?>, Email : <a href="mailto:<?php echo $BizEml ; ?>"><?php echo $BizEml ; ?></a> , Website : <?php echo $BizWeb ; ?></div>
	  </div>
      </div>
    </footer>
        
      
    </section>
	
	
	<section class="section bg-white my-5">
      <div class="row1">
    <div class="col-lg-7 m-auto mt-3  pb-5 border rounded">
  
    
	<table class="table table-hover table-responsive mb-5 ">
	
	<tr>  
	
    <header class="clearfix text-center">
      <div id="logo">
	  <img src="../<?php if($BizLogo==""){echo "../img/user.jpg";}else{echo $BizLogo;} ?>" width="110px"> 
      </div>
      <div id="company"> 
        <h5 class="name"><b><?php echo $BizNam ; ?></b> <br><?php// echo $BizDetails ; ?></h5>
		<span style="font-size:15;">
	Monthly Salary Pay Voucher <br>
	
			 
			 Print Date : <?php echo date("M d, Y") ;?> |  Time   : <?php date_default_timezone_set("Asia/Dhaka"); echo  date("h:i:sa");?>
</span>
     </div>
      </div>
    </header>
            
	</tr>
   
		<tr> <td> </td> <td> </td></tr>
	<tr>
    	<td><label class="control-label">Employee Name</label></td>
    	<td><label class="control-label"><?php echo $emp_name; ?></label></td>
    </tr>
	
	<tr>
    	<td><label class="control-label">Position</label></td>
    	<td><label class="control-label"><?php echo $position; ?></label></td>
    </tr>
	
	 
	
	<tr>
    	<td><label class="control-label"> Salary </label></td>
    	<td><label class="control-label"><?php echo $salary; ?> /-</label></td>
    </tr>
	
	
		 
    </table>
	
	 <table class="table table-hover datatable">
               <thead class="bg-light">
                           
                            <tr>
                                <th>Date</th> 
                                <th>Month</th>  
								<th> Bonus</th> 
								<th> Advance </th> 
								<th> Total Paid </th>
								<th> Due</th>
								<th> Status</th> 
                            </tr>
							
                        </thead>
						
						
              <tbody id="tbody">

	
	
	<?php
	$eq=mysqli_query($con,"select * from employees_salary_details  
	Left JOIN employees ON employees.id = employees_salary_details.emp_id
	where  employees_salary_details.emp_id='$get_emp_id' AND sal_type=5
	ORDER BY employees_salary_details.id DESC  ");
	
	$GTotalPaid= "";
	while($eqrow=mysqli_fetch_array($eq)){
	$GTotalPaid=$eqrow['adv_paid'] + $eqrow['full_paid'] ;
	
	?>
			<tr>
			<td><?php echo date("d-M-Y", strtotime($eqrow['entry_date'])); ?></td>
			
			 
			<td><?php echo $eqrow['month']; ?>-<?php echo $eqrow['year']; ?></td>  
											<td><?php echo $eqrow['bonus']; ?></td>
							<!--			<td><?php echo $eqrow['total_salary']; ?></td> -->
											<td><?php echo $eqrow['adv_paid']; ?></td>
								<!--		<td><?php echo $eqrow['full_paid']; ?></td>-->
											<td><?php echo $GTotalPaid; ?></td>
											<td><?php echo $eqrow['recent_due']; ?></td> 
											<td class="text-primary"><?php echo $eqrow['comment']; ?></td>
 
            		
          </tr>				
<?php
}
?>

</tbody>
              </table>
            
	
	 
	
	
		
	 <footer class="text-center pt-4">       
      <div id="company">  
       <div><?php echo $BizAdr ; ?></div>  
      <div>Call : <?php echo $BizPhn ; ?>, Email : <a href="mailto:<?php echo $BizEml ; ?>"><?php echo $BizEml ; ?></a> , Website : <?php echo $BizWeb ; ?></div>
	  </div>
      </div>
    </footer>
        </div>

        </div>

      
    </section>


    <?php // require_once 'footer1.php'; ?>