Leave Management System
Leave Management System
Name:
Project
The Employee leave management
system provides an automated,
speedier, error-free, requires less
paperwork, and is simple way to
Abstract:
manage employee’s leave. The system
was created utilizing a software
architecture approach to provide an
automated system.
Employee Information Management,
Employee Schedule Monitoring,
Modules: Monitor Working days and Holidays, set
leave processing and Generate leave
reports.
Introduction, RRL (Review of Related
Documentation: Literature), Methodology, Evaluation,
and Recommendations.
ER, Diagram, Use Case Diagram, Data
UML Diagrams: Flow Diagram, Class Diagram, Activity
Diagram, and Sequence Diagram.
Front end: HTML, CSS, JavaScript
The Level 0 DFD for Employee Management System (known as context diagram)
represents the abstract view of the project. It possess the single process and external
parties that depict the overall structure as a whole.
The Level 1 DFD for Employee Management System provides a broader overview of
the context diagram. It widens the processes from the context diagram and
determines the sub-processes that complete the employee management system.
The DFD level 2 for Employee Management System tells the ideas on where does
the data inputs goes and inputs come within the project. It shows not only the
detailed processes of the system but also gives you the precise destination of the
data that flows in it.
Employee Leave Management System
Source Codes
index:
<html>
<head>
<style>
footer {
width:100%;
background-color : #cecece;
position: fixed;
bottom: 0;
font-size: 17px;
font-style: normal;
font-variant: normal;
font-weight: 500;
height : 30px;
text-align: center;
</style>
</head>
<body>
<center>
</center>
</
</body>
</html>
Source code of admin:
adminnani
<!DOCTYPE html>
<html>
<head>
<style>
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #f0f0f0;
font-size: 17px;
font-style: normal;
font-variant: normal;
font-weight: 500;
color: #000000;
}
li {
float: left;
font-size: 17px;
font-style: normal;
font-variant: normal;
font-weight: 500;
li a, .dropbtn {
display: inline-block;
color: white;
text-align: center;
text-decoration: none;
font-size: 17px;
font-style: normal;
font-variant: normal;
font-weight: 500;
color : #000000;
}
li a:hover, .dropdown:hover .dropbtn {
background-color: #949494;
li.dropdown {
display: inline-block;
.dropdown-content {
display: none;
position: absolute;
background-color: #f0f0f0;
min-width: 160px;
font-size: 17px;
font-style: normal;
font-variant: normal;
font-weight: 500;
color: #000000;
.dropdown-content a {
color: #fefefe;
display: block;
text-align: left;
font-size: 17px;
font-style: normal;
font-variant: normal;
font-weight: 500;
color: #000000;
.dropdown:hover .dropdown-content {
display: block;
</style>
</head>
<body>
<ul>
<li class="dropdown">
<a href="#" class="dropbtn">Admin Tools</a>
<div class="dropdown-content">
</div>
</li>
</ul>
</body>
</html>
Connect:
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "phpdb";
// Create connection
// Check connection
if ($conn->connect_error) {
die("Connection failed ");
?>
Accept leave:
<link rel="shortcut icon" type="image/png" href="favicon.png"/>
<?php
session_start();
?>
<html>
<head>
<title>::Leave Management::</title>
</head>
<body>
<?php
include 'adminnavi.php';
include 'connect.php';
include 'mailer.php';
if(filter_var($_GET['id'],FILTER_VALIDATE_INT) &&
filter_var($_GET['empid'],FILTER_VALIDATE_INT))
$id =$_GET['id'];
$empid =$_GET['empid'];
else
header('location:home.php');
if(isset($_SESSION['adminuser']))
$sql = "SELECT
id,EmpName,LeaveType,RequestDate,Status,LeaveDays,StartDate,EndDate FROM
emp_leaves WHERE id='".$id."'";
$result = $conn->query($sql);
if($result->num_rows > 0)
while($row = $result->fetch_assoc())
$leavedays = $row["LeaveDays"];
if($result2->num_rows > 0)
while($row2 = $result2->fetch_assoc())
$earnleave = $row2["EarnLeave"];
$diff1 = $earnleave-$leavedays;
$sickleave = $row2["SickLeave"];
$diff2 = $sickleave-$leavedays;
$casualleave = $row2["CasualLeave"];
$diff3 = $casualleave-$leavedays;
$email = $row2["EmpEmail"];
if($diff1 < 0)
else
if($diff2 < 0)
if($diff3 < 0)
else
$status = mailer($email,$msg);
else
?>
</div>
</body>
</html>
Extract Leave:
<?php
session_start();
error_reporting(0);
require_once ('dompdf_config.inc.php');
include 'connect.php';
if(isset($_SESSION['adminuser']))
include 'adminnavi.php';
$startdate = strip_tags(trim($_POST['yearstart']))."-
".strip_tags(trim($_POST['monthstart']))."-
".strip_tags(trim($_POST['datestart']));
$enddate = strip_tags(trim($_POST['yearend']))."-
".strip_tags(trim($_POST['monthend']))."-".strip_tags(trim($_POST['dateend']));
$sql = "SELECT * FROM emp_leaves WHERE (StartDate >= '".$startdate."' AND
EndDate <= '".$enddate."') OR (EndDate >= '".$enddate."' AND StartDate <=
'".$startdate."') AND Dept = '".$_SESSION['dept']."'";
$result = $conn->query($sql);
if($result->num_rows > 0)
echo "<table>
<tr>
<th>Employee Name</th>
<th>Leave Type</th>
<th>Request Date</th>
<th>Leave Days</th>
<th>Status</th>
<th>Starting Date</th>
<th>Ending Date</th>
<th>Department</th>
";
<table>
<tr>
<th>Employee Name</th>
<th>Leave Type</th>
<th>Request Date</th>
<th>Leave Days</th>
<th>Status</th>
<th>Starting Date</th>
<th>Ending Date</th>
<th>Department</th>
";
while($row = $result->fetch_assoc())
echo "<tr>
<td>".$row['EmpName']."</td>
<td>".$row['LeaveType']."</td>
<td>".$row['RequestDate']."</td>
<td>".$row['LeaveDays']."</td>
<td>".$row['Status']."</td>
<td>".$row['StartDate']."</td>
<td>".$row['EndDate']."</td>
<td>".$row['Dept']."</td>
</tr>";
$pdf_content .= "<tr>
<td>".$row['EmpName']."</td>
<td>".$row['LeaveType']."</td>
<td>".$row['RequestDate']."</td>
<td>".$row['LeaveDays']."</td>
<td>".$row['Status']."</td>
<td>".$row['StartDate']."</td>
<td>".$row['EndDate']."</td>
<td>".$row['Dept']."</td>
</tr>";
}
$name = $_SESSION['adminuser'].$_SESSION['dept'].strtotime('now').'.pdf';
echo "</table>";
else
else
$path='data-extract/';
$dompdf=new DOMPDF();
$dompdf->load_html($pdf_content);
$dompdf->render();
$output = $dompdf->output();
file_put_contents($path.$filename, $output);
return $filename;
echo "</div>";
?>
<title>::Leave Management::</title>
Employee Delete :
<?php
session_start();
?>
<?php
include 'connect.php';
include 'adminnavi.php';
if(isset($_SESSION['adminuser']))
if(filter_var($_GET['id'],FILTER_VALIDATE_INT))
{
$id = $_GET['id'];
else
header('location:home.php');
$user = filter_var($_GET['user'],FILTER_SANITIZE_STRING);
$file = "../client/pro-pic/".$user.".jpg";
if(file_exists($file))
unlink($file);
else
{}
echo "<center>";
else
$conn->close();
else
{
?>
Logout:
<?php
session_start();
session_unset();
session_destroy();
?>
Reject Leave:
<link rel="shortcut icon" type="image/png" href="favicon.png"/>
<?php
session_start();
?>
<html>
<head>
<title>::Leave Management::</title>
</head>
<body>
<?php
include 'adminnavi.php';
include 'connect.php';
include 'mailer.php';
if(filter_var($_GET['id'],FILTER_VALIDATE_INT) &&
filter_var($_GET['empid'],FILTER_VALIDATE_INT))
$id =$_GET['id'];
$empid =$_GET['empid'];
else
header('location:home.php');
if(isset($_SESSION['adminuser']))
$result = $conn->query($sql);
if($result->num_rows > 0)
while($row = $result->fetch_assoc())
$result2 = $conn->query($sql2);
if($result2->num_rows > 0)
while($row2 = $result2->fetch_assoc())
{
$email = $row2['EmpEmail'];
$status = mailer($email,$msg);
else
?>
</div>
</body>
</html>
Search Employee:
<link rel="shortcut icon" type="image/png" href="favicon.png"/>
<?php
session_start();
?>
<html>
<head>
<title>::Leave Management::</title>
</head>
<body>
<?php
echo "<div class = 'textview'>";
include 'adminnavi.php';
if(isset($_SESSION['adminuser']))
echo "<center>";
echo "<table>";
echo "</form>";
echo "</table>";
echo "</center>";
echo "</div>";
else
?>
</body>
</html>
View Leave:
<?php
session_start();
?>
<title>::Leave Management::</title>
<center>
<?php
include 'connect.php';
include 'adminnavi.php';
$count = 0;
if(isset($_SESSION['adminuser']))
$result = $conn->query($sql);
if($result->num_rows > 0)
while($row = $result->fetch_assoc())
if($_SESSION['adminuser'] == $row['username'])
$sql2 = "SELECT
e.Id,e.Dept,e.EmpName,el.EmpName,el.LeaveType,el.RequestDate,el.LeaveDays,el.Star
tDate,el.EndDate,el.id,el.Dept FROM employees e, emp_leaves el WHERE e.Dept =
el.Dept AND e.Dept = '".$row['Dept']."' AND el.Status = 'Requested' AND e.EmpName
= el.EmpName";
$result2 = $conn->query($sql2);
if($result2->num_rows > 0)
echo "<table>";
echo "<tr>";
echo "<th>Action</th>";
echo "</tr>";
echo "<tr>";
echo "<td>";
echo $row2['EmpName'];
echo "</td>";
echo "<td>";
echo $row2['LeaveType'];
echo "</td>";
echo "<td>";
echo $row2['RequestDate'];
echo "</td>";
echo "<td>";
echo $row2['LeaveDays'];
echo "</td>";
echo "<td>";
echo $row2['StartDate'];
echo "</td>";
echo "<td>";
echo $row2['EndDate'];
echo "</td>";
echo "<td><a href =
'acceptleave.php?id=".$row2['id']."&empid=".$row2["Id"]."'>Accept</a>
<a href =
'rejectleave.php?id=".$row2['id']."&empid=".$row2["Id"]."'>Reject</a></td>";
echo "</tr>";
$count++;
echo "</table>";
else
else
?>
</div>
</center>
Leave request:
<?php
include 'connect.php';
include 'clientnavi.php';
session_start();
if(isset($_SESSION['user']))
$user = $_SESSION['user'];
$result = $conn->query($sql);
if($result->num_rows > 0)
while($row = $result->fetch_assoc())
echo "<body>";
echo "<table>";
<td>
</select>
</select>
</select>
</td>
</tr>";
echo "<table>
<tr>
<th>Date </th>
<th>Time</th>
<th>Semester</th>
<th>Division/Batch</th>
<th>Room No.</th>
<th>Subject</th>
</tr>
<tr>
</tr>
<tr>
</tr>
<tr>
</tr>
</font>
</table>";
echo "</form>";
echo "</div>";
echo "</center>";
echo "</body>";
else
?>
<title>::Leave Management::</title>
<script type="text/javascript">
function noBack()
window.history.forward()
noBack();
window.onload = noBack;
</script>
Password:
<?php
session_start();
include 'clientnavi.php';
include 'connect.php';
if(isset($_SESSION['user']))
{
$oldpass = $_POST['oldpass'];
$newpass = $_POST['newpass'];
$cnfnewpass = $_POST['cnfnewpass'];
$uname = $_SESSION['user'];
if($newpass == $cnfnewpass)
if((strlen($newpass) >=10))
if($newpass != $_SESSION['user'])
$result = $conn->query($sql);
if($result->num_rows > 0)
while($row = $result->fetch_assoc())
if($uname == $row["UserName"])
$id = $row['id'];
if($oldpass == $row["EmpPass"])
$newpass = hash_hmac('sha512',
'salt'.$newpass, md5($uname));
{
header("location:home.php?msg=".urlencode('Password Succesfully Changed !'));
else
else
header('location:changepass.php?err='.urlencode('New
Password cannot be same as username !'));
else
header('location:changepass.php?err='.urlencode('New Password
must be atleast 10 characters long !'));
else
}
else
?>
Request leave:
<title>::Leave Management::</title>
<?php
session_start();
include 'connect.php';
if(isset($_SESSION['user']))
{
echo "<link rel='stylesheet' type='text/css' href='style.css'>";
echo "<center>";
include 'clientnavi.php';
if(isset($_GET['err']))
$result = $conn->query($sql);
if($result->num_rows > 0)
while($row = $result->fetch_assoc())
if($row['SickLeave'] > 0)
else
if($row['EarnLeave'] > 0)
{
echo "<button type = 'submit' name = 'type' value = 'Earn
Leave' class = 'login-button shadow'>Earn Leave</button>";
else
if($row['CasualLeave'] > 0)
else
echo "</form>";
else
}
?>
<script type="text/javascript">
function noBack()
window.history.forward()
noBack();
window.onload = noBack;
</script>
Update leave:
<?php
function update_leaves($user,$dept)
include 'connect.php';
$current_date = strtotime(date("Y-m-d"));
$sql2 = "SELECT SetSickLeave,SetCasualLeave,SetEarnLeave,Dept FROM admins
WHERE Dept = '".$dept."'";
if($conn->query($sql2) == TRUE)
$result2 = $conn->query($sql2);
if($result2->num_rows > 0)
while($row2 = $result2->fetch_assoc())
$setsickleave = $row2["SetSickLeave"];
$setearnleave = $row2["SetEarnLeave"];
$setcasualleave = $row2["SetCasualLeave"];
$result = $conn->query($sql);
if($result->num_rows > 0)
while($row = $result->fetch_assoc())
if(strtotime($row["DateOfJoin"]) == strtotime('today'))
return false;
{
$date = $row["DateOfJoin"];
$day = date("d",strtotime($date));
$month = date("m",strtotime($date));
$year = date("Y");
$joining_date = $year."-".$month."-".$day;
$joining_date = strtotime($joining_date);
if($current_date == $joining_date)
$earnleave = 300;
$casualleave = $setcasualleave;
if($conn->query($sql2) == TRUE)
return true;
else
return false;
$date = $row["DateOfJoin"];
$day = date("d",strtotime($date));
$month = date("m",strtotime($date));
$year = date("Y");
$joining_date = $year."-".$month."-".$day;
$joining_date = strtotime($joining_date);
if($current_date == $joining_date)
$earnleave = 300;
$casualleave = $setcasualleave;
if($conn->query($sql2) == TRUE)
return true;
else
{
return false;
else
return false;
?>