-
Notifications
You must be signed in to change notification settings - Fork 12
/
applyleave.php
137 lines (91 loc) · 3.9 KB
/
applyleave.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<?php
$id = (isset($_GET['id']) ? $_GET['id'] : '');
require_once ('process/dbh.php');
$sql = "SELECT * FROM `employee` where id = '$id'";
$result = mysqli_query($conn, $sql);
$employee = mysqli_fetch_array($result);
$empName = ($employee['firstName']);
//echo "$id";
?>
<html>
<head>
<title>Apply Leave | Employee Panel | XYZ Corporation</title>
<link rel="stylesheet" type="text/css" href="styleapply.css">
</head>
<body bgcolor="#F0FFFF">
<header>
<nav>
<h1>XYZ Corp.</h1>
<ul id="navli">
<li><a class="homeblack" href="eloginwel.php?id=<?php echo $id?>"">HOME</a></li>
<li><a class="homeblack" href="myprofile.php?id=<?php echo $id?>"">My Profile</a></li>
<li><a class="homeblack" href="empproject.php?id=<?php echo $id?>"">My Projects</a></li>
<li><a class="homered" href="applyleave.php?id=<?php echo $id?>"">Apply Leave</a></li>
<li><a class="homeblack" href="elogin.html">Log Out</a></li>
</ul>
</nav>
</header>
<div class="divider"></div>
<div class="page-wrapper bg-blue p-t-100 p-b-100 font-robo">
<div class="wrapper wrapper--w680">
<div class="card card-1">
<div class="card-heading"></div>
<div class="card-body">
<h2 class="title">Apply Leave Form</h2>
<form action="process/applyleaveprocess.php?id=<?php echo $id?>" method="POST">
<div class="input-group">
<input class="input--style-1" type="text" placeholder="Reason" name="reason">
</div>
<div class="row row-space">
<div class="col-2">
<p>Start Date</p>
<div class="input-group">
<input class="input--style-1" type="date" placeholder="start" name="start">
</div>
</div>
<div class="col-2">
<p>End Date</p>
<div class="input-group">
<input class="input--style-1" type="date" placeholder="end" name="end">
</div>
</div>
</div>
<div class="p-t-20">
<button class="btn btn--radius btn--green" type="submit">Submit</button>
</div>
</form>
</div>
</div>
</div>
</div>
<table>
<tr>
<th align = "center">Emp. ID</th>
<th align = "center">Name</th>
<th align = "center">Start Date</th>
<th align = "center">End Date</th>
<th align = "center">Total Days</th>
<th align = "center">Reason</th>
<th align = "center">Status</th>
</tr>
<?php
$sql = "Select employee.id, employee.firstName, employee.lastName, employee_leave.start, employee_leave.end, employee_leave.reason, employee_leave.status From employee, employee_leave Where employee.id = $id and employee_leave.id = $id order by employee_leave.token";
$result = mysqli_query($conn, $sql);
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 "<tr>";
echo "<td>".$employee['id']."</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>";
}
?>
</table>
</body>
</html>