<?php
session_start();
  if(!$_SESSION['id']){
    header('location:index.php');
  }
require_once '../system/conn.php';

$e_id=$_GET['e-id'];
$branch=$_GET['branch'];
$date=date('Y-m-d');
$doj=$_GET['doj'];
$status=1;

$query = "UPDATE `emp_details` SET status=0 where e_id='$e_id' AND branch='$branch'";
$statement = $conn->prepare($query)->execute($data);
if($statement){
  $query1 = " INSERT INTO `left_employee`(`emp_id`, `d_o_l`, `entry_date`, `branch`, `status`) VALUES ('$e_id','$date','$doj','$branch','$status') ";
  $statement1 = $conn->prepare($query1)->execute($data); 
  //print_r($statement1);exit;
  
  echo "<script>window.location.assign('all-employees.php')</script>";
}else{
    echo "not deleted";
  }

?>