-
Notifications
You must be signed in to change notification settings - Fork 0
/
empleave.php
84 lines (65 loc) · 2.5 KB
/
empleave.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
require_once ('process/dbh.php');
//$sql = "SELECT * from `employee_leave`";
$sql = "Select employee.id, employee.firstName, employee.lastName, employee_leave.start, employee_leave.end, employee_leave.reason, employee_leave.status, employee_leave.token From employee, employee_leave Where employee.id = employee_leave.id order by employee_leave.token";
//echo "$sql";
$result = mysqli_query($conn, $sql);
?>
<html>
<head>
<title>Employee Leave | Admin Panel | XYZ Corporation</title>
<link rel="stylesheet" type="text/css" href="styleview.css">
</head>
<body>
<header>
<nav>
<h1>XYZ Corp.</h1>
<ul id="navli">
<li><a class="homeblack" href="aloginwel.php">HOME</a></li>
<li><a class="homeblack" href="addemp.php">Add Employee</a></li>
<li><a class="homeblack" href="viewemp.php">View Employee</a></li>
<li><a class="homeblack" href="assign.php">Assign Tasks</a></li>
<li><a class="homeblack" href="assignTask.php">Task Status</a></li>
<li><a class="homeblack" href="salaryemp.php">Salary Table</a></li>
<li><a class="homered" href="empleave.php">Employee Leave</a></li>
<li><a class="homeblack" href="alogin.html">Log Out</a></li>
</ul>
</nav>
</header>
<div class="divider"></div>
<div id="divimg">
<table>
<tr>
<th>Emp. ID</th>
<th>Token</th>
<th>Name</th>
<th>Start Date</th>
<th>End Date</th>
<th>Total Days</th>
<th>Reason</th>
<th>Status</th>
<th>Options</th>
</tr>
<?php
while ($employee = mysqli_fetch_assoc($result)) {
$date1 = new DateTime($employee['start']);
$date2 = new DateTime($employee['end']);
$interval = $date1->diff($date2);
$interval = $date1->diff($date2);
//echo "difference " . $interval->days . " days ";
echo "<tr>";
echo "<td>".$employee['id']."</td>";
echo "<td>".$employee['token']."</td>";
echo "<td>".$employee['firstName']." ".$employee['lastName']."</td>";
echo "<td>".$employee['start']."</td>";
echo "<td>".$employee['end']."</td>";
echo "<td>".$interval->days."</td>";
echo "<td>".$employee['reason']."</td>";
echo "<td>".$employee['status']."</td>";
echo "<td><a href=\"approve.php?id=$employee[id]&token=$employee[token]\" onClick=\"return confirm('Are you sure you want to Approve the request?')\">Approve</a> | <a href=\"cancel.php?id=$employee[id]&token=$employee[token]\" onClick=\"return confirm('Are you sure you want to Canel the request?')\">Cancel</a></td>";
}
?>
</table>
</div>
</body>
</html>