<?php 
    session_start();
    if(!$_SESSION['id']){
        header('location:index.php');
    }
    require_once '../system/conn.php';
?>
<!doctype html>
<html lang="en" class="semi-dark">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<link href="assets/css/pace.min.css" rel="stylesheet" />
	<script src="assets/js/pace.min.js"></script>
    <link href="assets/plugins/perfect-scrollbar/css/perfect-scrollbar.css" rel="stylesheet" />
    <link href="assets/plugins/simplebar/css/simplebar.css" rel="stylesheet" />
    <link href="assets/plugins/metismenu/css/metisMenu.min.css" rel="stylesheet" />
    <link href="assets/plugins/datatable/css/dataTables.bootstrap5.min.css" rel="stylesheet" />
    <link href="assets/css/bootstrap.min.css" rel="stylesheet">
    <link href="assets/css/bootstrap-extended.css" rel="stylesheet">
    <link href="assets/css/style.css" rel="stylesheet">
    <link href="assets/css/icons.css" rel="stylesheet">
	<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.2/font/bootstrap-icons.css">
    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap" rel="stylesheet">
    <link href="assets/css/dark-theme.css" rel="stylesheet" />
    <link href="assets/css/semi-dark.css" rel="stylesheet" />
    <link href="assets/css/header-colors.css" rel="stylesheet" />
    <title>Left Employees List</title>
  </head>
  <body>
    <div class="wrapper">
    <?php include'system/header.php'?>
	    <div class="page-content-wrapper">
         <div class="page-content">
          <!--start breadcrumb-->
          <div class="page-breadcrumb d-none d-sm-flex align-items-center mb-3">
            <div class="breadcrumb-title pe-3">Left Employees List</div>
            <div class="ms-auto">
                <a href="excel-left-employees.php"><button type="button" class="btn btn-primary px-5">Excel Download</button></a>
            </div>
          </div>
			<hr/>
				<div class="card">
					<div class="card-body">
						<div class="table-responsive">
							<table id="example2" class="table table-striped table-bordered">
								<thead>
									<tr>
										<th>SR No</th>
            							<th>Id No</th>
            							<th>Left Date</th>
            							<th>Join Date</th>
                                        <th>Employee Name</th>
            							<th>Branch</th>
                                        <th>Father Name</th>
                                        <th>Mobile</th>
                                        <th>Adhar Number</th>
                                        <th>Pan Number</th>
                                        <th>Designation</th>
                                        <th>Salary</th>
                                        <th>Account</th>
									</tr>
								</thead>
								<tbody>
								    <?php
                                        $cnt = 1;
                                        $stmt1 = $conn->prepare("SELECT emp_details.`sn`,emp_details.`e_id`,emp_details.`branch`,emp_details.`e_name`,emp_details.`fname`,emp_details.`mobile_num`,emp_details.`aadhar_num`,emp_details.`pan_card`,emp_details.`designation`,emp_details.`salary`,emp_details.`bank_ac_no`,left_employee.d_o_l,left_employee.entry_date,left_employee.id FROM emp_details LEFT JOIN left_employee ON emp_details.`e_id`=left_employee.emp_id AND emp_details.branch=left_employee.branch WHERE emp_details.status='0' and left_employee.status='1' ");
                                        //print_r($stmt1);exit;
                                        
                                        $stmt1->execute();
                                        $sql = $stmt1->fetchAll(); 
                                        foreach($sql as $row) 
                                        { ?>
                                    <tr>
                                        <td><?php echo $cnt;?></td>
                                        <td>
                                           <a href="view-details-all-emp.php?id=<?php echo $row['sn'];?>"><?php echo $row['e_id'];?></a>
                                        </td>
                                        <td><?php echo $row['d_o_l'];?></td>
                                        <td><?php echo $row['entry_date'];?></td>
                                        <td><?php echo $row['e_name'];?></td> 
                                        <td>
                                            <?php
                                              $sth1 = $conn->prepare("SELECT * FROM `branch` where id='".$row['branch']."' ");
                                              $sth1->execute();
                                              $row1 = $sth1->fetch(PDO::FETCH_ASSOC);
                                              echo $row1['name']; ?>
                                        </td> 
                                        <td><?php echo $row['fname'];?></td> 
                                        <td><?php echo $row['mobile_num'];?></td> 
                                        <td><?php echo $row['aadhar_num'];?></td> 
                                        <td><?php echo $row['pan_card'];?></td> 
                                        <td><?php echo $row['designation'];?></td>
                                        <td><?php echo $row['salary'];?></td>
                                        <td><?php echo $row['bank_ac_no'];?></td> 
                                        
                                    </tr>
                                    <?php  $cnt=$cnt+1; }?>
								</tbody>
								<tfoot>
									<tr>
										<th>SR No</th>
            							<th>Id No</th>
            							<th>Left Date</th>
                                        <th>Employee Name</th>
                                        <th>Father Name</th>
                                        <th>Mobile</th>
                                        <th>Adhar Number</th>
                                        <th>Pan Number</th>
                                        <th>Designation</th>
                                        <th>Salary</th>
                                        <th>Account</th>
									</tr>
								</tfoot>
							</table>
						</div>
					</div>
				</div>
             

          </div>
          <!-- end page content-->
         </div>
<?php include'system/footer.php'?>