-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathemponleave.php
More file actions
executable file
·159 lines (138 loc) · 7.77 KB
/
emponleave.php
File metadata and controls
executable file
·159 lines (138 loc) · 7.77 KB
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<?php
session_start();
error_reporting(0);
include('includes/config.php');
if(strlen($_SESSION['alogin'])==0)
{
header('location:index.php');
}
else{
?>
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Title -->
<title>Employees on Leave </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<meta charset="UTF-8">
<meta name="description" content="Responsive Admin Dashboard Template" />
<meta name="keywords" content="admin,dashboard" />
<meta name="author" content="Steelcoders" />
<!-- Styles -->
<link type="text/css" rel="stylesheet" href="assets/plugins/materialize/css/materialize.min.css"/>
<link href="http://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="assets/plugins/material-preloader/css/materialPreloader.min.css" rel="stylesheet">
<link href="assets/plugins/datatables/css/jquery.dataTables.min.css" rel="stylesheet">
<link href="assets/plugins/google-code-prettify/prettify.css" rel="stylesheet" type="text/css"/>
<!-- Theme Styles -->
<link href="assets/css/alpha.min.css" rel="stylesheet" type="text/css"/>
<link href="assets/css/custom.css" rel="stylesheet" type="text/css"/>
<link href="assets/css/onleave.css" rel="stylesheet" type="text/css"/>
<style>
</style>
</head>
<body>
<main class="mn-inner">
<div class="row">
<div class="col s12">
<div class="page-title">List of Employees who are on leave on <?php echo htmlentities(date('m/d/Y h:i:s a'))?></div>
</div>
<div class="col s12 m12 l12">
<div class="card">
<div class="card-content">
<!-- <span class="card-title">Approved Leave History</span>
--><?php if($msg){?><div class="succWrap"><strong>SUCCESS</strong> : <?php echo htmlentities($msg); ?> </div><?php }?>
<table id="example" class="display responsive-table ">
<thead>
<tr>
<th width="50">#</th>
<th width="200">Employe Name</th>
<th width="150">Employe ID</th>
<th width="150">Department</th>
<th width="200">Leave Type</th>
<th width="150">From Date</th>
<th width="150">To Date</th>
<th width="300">Description</th>
</tr>
</thead>
<tbody>
<?php
$today = (string)date("Y-m-d");
$status=1;
$sql = "SELECT tblleaves.id,tblleaves.Description,tblemployees.Department as dept,tblemployees.FirstName,tblemployees.LastName,tblemployees.EmpId,tblemployees.id,tblleaves.LeaveType,tblleaves.FromDate,tblleaves.ToDate,tblleaves.Status from tblleaves join tblemployees on tblleaves.empid=tblemployees.id where tblleaves.Status=1 AND tblleaves.FromDate<=:date AND tblleaves.ToDate>=:date order by dept desc";
$query = $dbh -> prepare($sql);
$query->bindParam(':date',$today,PDO::PARAM_STR);
$query->execute();
$results=$query->fetchAll(PDO::FETCH_OBJ);
$cnt=1;
// echo $query->rowCount();
if($query->rowCount() > 0)
{
foreach($results as $result)
{
?>
<tr>
<td> <b><?php echo htmlentities($cnt);?></b></td>
<td><a href="editemployee.php?empid=<?php echo htmlentities($result->id);?>" target="_blank"><?php echo htmlentities($result->FirstName." ".$result->LastName);?></a></td>
<td><?php echo htmlentities($result->EmpId);?></td>
<td><?php echo htmlentities($result->Department);?></td>
<td><?php echo htmlentities($result->LeaveType);?></td>
<td><?php echo htmlentities($result->FromDate);?></td>
<td><?php echo htmlentities($result->ToDate);?></td>
<td><button id="myBtn" style="background:#cddeef; width: 70px;" onclick="openmodal(<?php echo $cnt; ?>)" >View</button>
<div id="myModal<?php echo $cnt; ?>" class="modal">
<div class="modal-content">
<div class="modal-header">
<span class="close" onclick="closemodal(<?php echo $cnt; ?>)">×</span>
<h2 style="font-size: 4vw;">Description of Holiday</h2>
</div>
<div class="modal-body">
<p><?php echo htmlentities($result->Description);?></p>
</div>
</div>
</div>
</td>
</tr>
<?php $cnt++;} }?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</main>
</div>
<div class="left-sidebar-hover"></div>
<!-- Javascripts -->
<script src="assets/plugins/jquery/jquery-2.2.0.min.js"></script>
<script src="assets/plugins/materialize/js/materialize.min.js"></script>
<script src="assets/plugins/material-preloader/js/materialPreloader.min.js"></script>
<script src="assets/plugins/jquery-blockui/jquery.blockui.js"></script>
<script src="assets/plugins/datatables/js/jquery.dataTables.min.js"></script>
<script src="assets/js/alpha.min.js"></script>
<script src="assets/js/pages/table-data.js"></script>
<script src="assets/js/pages/ui-modals.js"></script>
<script src="assets/plugins/google-code-prettify/prettify.js"></script>
<script>
var modal = document.getElementsByClassName('modal');
function openmodal(i){
var modal = document.getElementById('myModal'+i);
modal.style.display = "block";
}
function closemodal(i){
var modal = document.getElementById('myModal'+i);
$("#myModal"+i).fadeOut();
//modal.style.display = "none";
}
window.onclick = function(event) {
for (var i = 0; i < modal.length; i++) {
if(event.target==modal[i]) {
$("#myModal"+(i+1)).fadeOut();
//modal[i].style.display = "none";
}
}
}
</script>
</body>
</html>
<?php } ?>