-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfirmhrlevel.php
More file actions
388 lines (311 loc) · 11.7 KB
/
Copy pathconfirmhrlevel.php
File metadata and controls
388 lines (311 loc) · 11.7 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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
<?php
include "home.php";
?>
<style>
.tableFixHead { overflow-y: auto; height: 100px; }
.tableFixHead thead th { position: sticky; top: 0; }
</style>
<script>
$(document).ready(function(){
var i=1;
$('#add').click(function(){
i++;
$('#dynamic_field').append('<tr id="row'+i+'"><td><textarea name="skills[]" placeholder="Enter Required knowledge, skills and abilities of an employee" class="form-control name_list" size="10" rows="4" cols="30"></textarea></td><td><textarea name="benefits[]" placeholder="Enter Benefits of developing this new skill or competency" class="form-control name_list" size="10" rows="4" cols="30"></textarea></td><td><textarea name="action[]" placeholder="Enter Likely Action Steps" class="form-control name_list" size="10" rows="4" cols="30"></textarea></td><td><textarea name="resources[]" placeholder="Enter Required Resources/People" class="form-control name_list" size="10" rows="4" cols="30"></textarea></td><td><input type="text" name="timeframe[]" placeholder="Enter Time Frame" size="10"></td><td><button type="button" name="remove" id="'+i+'" class="btn btn-danger btn_remove">X</button></td></tr>');
});
$(document).on('click', '.btn_remove', function(){
var button_id = $(this).attr("id");
$('#row'+button_id+'').remove();
});
$('#submit').click(function(){
$.ajax({
url:"name.php",
method:"POST",
data:$('#add_name').serialize(),
success:function(data)
{
alert(data);
$('#add_name')[0].reset();
}
});
});
});
</script>
<script>
$(function() {
$( "#dateOfBirth" ).datepicker({
appendText:"(yy-mm-dd)",
changeMonth:true,
changeYear:true,
yearRange:"c-80:c+0",
dateFormat:"yy-mm-dd"
});
$( ".dateElement" ).datepicker({
appendText:"(yy-mm-dd)",
changeMonth:true,
changeYear:true,
yearRange:"c-35:c+0",
dateFormat:"yy-mm-dd"
});
});
</script>
<script type="text/javascript">
$(function() {
$(".tablelist tr:nth-child(even)").addClass("striped");
$(".tablelist tr:nth-child(odd)").addClass("nostriped");
});
$(document).ready(function () {
$('#dtBasicExample').DataTable();
$('.dataTables_length').addClass('bs-select');
});
</script>
<style type="text/css">
body,td {
font-size: 10pt;
}
table.tablelist {
/*background-color: black;*/
border: 1px black solid;
border-collapse: collapse;
}
th {
border: 1px outset silver;
background-color: grey;
color: white;
}
tr.nostriped {
background-color: white;
margin: 1px;
}
tr.striped {
/*background-color: #f09320;*/
background-color: whitesmoke;;
}
td {
padding: 1px 8px;
}
.normal {
font-weight: normal;
}
</style>
<script>
function uncheckrestrictided() {
document.getElementById("restrictided").checked = false;
}
function uncheckunrestricted() {
document.getElementById("unrestricted").checked = false;
}
function uncheckmedical() {
document.getElementById("medical").checked = false;
}
function unchecknonmedical() {
document.getElementById("nonmedical").checked = false;
}
</script>
<h1>APPROVALS CONFIRMATION<h1>
<br/>
<center>
<div style='height: 100%;width: 98%;overflow: scroll;' class="tableFixHead">
<?php
if(isset($_POST['perfomanceconfirm'])){
include("connect.php");
include 'createEmail.php';
$employee_id=$_POST['employee_id'];
$fy=$_POST['fy'];
$userId=$_SESSION['hruseridsession'];
$supervisor_id=$_POST['supervisor_id'];
$updateconfirmationOfEmployee=mysqli_query($conn,"update hr_performance_ap set hr_office_emp_id='$userId',hr_office_emp_approval='YES',hr_office_emp_approval_date=now() where FY='$fy' and employee_id='$employee_id' ");
$reqError=mysqli_error($conn);
if($reqError==null || $reqError=="") {
$receivers=mysqli_query($conn,"select email,concat(firstname,' ',lastname) as empname,department from users where userid='$employee_id'");
$names= $_SESSION['firstnamesession']." ".$_SESSION['lastnamesession'];
$subject="APPOVAL FROM HR OF PA";
$message="We would like to notify you that HR officer(<b>".$names."</b>) confirm your performance appraisal.";
$emp_name="";
$department="";
while($rowrec=mysqli_fetch_array($receivers)){
$receverEmail=$rowrec['email'];
$emp_name=$rowrec['empname'];
$department=$rowrec['department'];
sendEmail($receverEmail,$subject,$message);
}
//$dpt=$_SESSION['department'];
//print("$names , $emp_name , $department");
$subject="APPOVAL OF PA FROM HR";
$message="We would like to notify you that HR Officer(<b>".$names."</b>) finish to confirm a performance appraisal of <b> ".$emp_name."</b>";
$leaderreceivers=mysqli_query($conn,"select email from users where userid='$supervisor_id'");
while($rowlrec=mysqli_fetch_array($leaderreceivers)){
$receverlEmail=$rowlrec['email'];
sendEmail($receverlEmail,$subject,$message);
}
print("
<script>
alert('Thank you for this confirmation');
</script>");
}
}
?>
<?php
include("connect.php");
$fys=mysqli_query($conn,"SELECT FY FROM hr_performance_ap_targets t group by t.fy");
if(mysqli_num_rows($fys)) {
print("<table><tr>");
while($row=mysqli_fetch_array($fys)){
$fy=$row['FY'];
$employee=$row['employee'];
$employeeid=$row['employee_id'];
print("<td>
<form action='confirmhrlevel.php' method='post'>
<input type='hidden' name='fy' value='$fy'>
<input type='submit' name='showselected' value='$fy' class='hrbutton'>");
print("</form>
</td>");
}
print("</tr></table>");
}
?>
<!-- Function -->
<?php
//function showRequest($fy,$employeeid) {
include("connect.php");
$userId=$_SESSION['hruseridsession'];
$fy="FY". (date('y'));
if(isset($_POST['fy'])){
$fy=$_POST['fy'];
}
$dpt=$_SESSION['department'];
$position=$_SESSION['position'];
// perfomance confirm
$checkCompletedPerfomanceConfirm=mysqli_query($conn,"SELECT *,( select concat(firstname,' ',lastname) from users where userid=hpa.employee_id) as empname FROM hr_performance_ap hpa where hpa.employee_id !='$userId' and hpa.employee_id in (select userid from users where position!='Chief') and hpa.FY='$fy' and (hpa.hr_office_emp_approval is null or hpa.hr_office_emp_approval='')");
if($position=="Chief") {
$checkCompletedPerfomanceConfirm=mysqli_query($conn,"SELECT *,( select concat(firstname,' ',lastname) from users where userid=hpa.employee_id) as empname FROM hr_performance_ap hpa where hpa.employee_id !='$userId' and hpa.FY='$fy' and (hpa.hr_office_emp_approval is null or hpa.hr_office_emp_approval='')");
}
if(mysqli_num_rows($checkCompletedPerfomanceConfirm)) {
print("<br /><br /><fieldset>
<legend>REQUIRED CONFIRMATIONS</legend>
<table width='100%' class='tablelist' id='dynamic_field'><thead>
<tr>
<th>Names</th>
<th>Score</th>
<th>Employee Confirmation</th>
<th>Employee Confirmation Date</th>
<th>Supervisor Confirmation</th>
<th>Supervisor Confirmation Date</th>
<th>Head Confirmation</th>
<th>Head Confirmation Date</th>
<th>HR Confirmation</th>
<th>HR Confirmation Date</th>
<th>Show details</th>
<th>Confirm</th>
</tr></thead>");
while($confirmRow=mysqli_fetch_array($checkCompletedPerfomanceConfirm)){
$names=$confirmRow['empname'];
$employeeid=$confirmRow['employee_id'];
$score=$confirmRow['score'];
$supervisor_id=$confirmRow['supervisor_id'];
$employee_accept=$confirmRow['employee_accept'];
$employee_accept_date=$confirmRow['employee_accept_date'];
$supervisor_accept=$confirmRow['supervisor_accept'];
$supervisor_accept_date=$confirmRow['supervisor_accept_date'];
$head_of_dpt_approval=$confirmRow['head_of_dpt_approval'];
$head_of_dpt_date=$confirmRow['head_of_dpt_date'];
$hr_office_emp_approval=$confirmRow['hr_office_emp_approval'];
$hr_office_emp_approval_date=$confirmRow['hr_office_emp_approval_date'];
print("<tr>
<td>$names</td>
<td><b>$score</b></td>
<td>$employee_accept</td>
<td>$employee_accept_date</td>
<td>$supervisor_accept</td>
<td>$supervisor_accept_date</td>
<td>$head_of_dpt_approval</td>
<td>$head_of_dpt_date</td>
<td>$hr_office_emp_approval</td>
<td>$hr_office_emp_approval_date</td>
<td>
<form action='showtargets.php' method='post'>
<input type='hidden' name='fy' value='$fy'>
<input type='hidden' name='employeeid' value='$employeeid'>
<input type='submit' name='show' value='Show' class='hrbutton'></form>
</td>
<td>
<form action='confirmhrlevel.php' method='post'>
<input type='hidden' name='fy' value='$fy'><input type='hidden' name='employee_id' value='$employeeid'><input type='hidden' name='supervisor_id' value='$supervisor_id'>
<!-- <select name='confirm'>
<option value='YES'>YES</option>
<option value='DENIED'>DENIED</option>
</select> -->
<!-- <input type='submit' value='CONFIRM' onclick=\"this.disabled=true; this.value='Please wait...'; document.getElementById('perfomanceconfirmID').click();\" class='hrbutton'> -->
<input type='submit' name='perfomanceconfirm' value='CONFIRM' id='perfomanceconfirmID' class='hrbutton'></div>
</form>
</td>
</tr>");
}
print("</table></fieldset>");
}
print("<br /> <hr />");
//Display only
// perfomance confirm
$position=$_SESSION['position'];
// perfomance confirm
$checkCompletedPerfomanceConfirm=mysqli_query($conn,"SELECT *,( select concat(firstname,' ',lastname) from users where userid=hpa.employee_id) as empname FROM hr_performance_ap hpa where hpa.FY='$fy' and hpa.employee_id in (select userid from users where position!='Chief') and hpa.hr_office_emp_approval is not null");
if($position=="Chief") {
$checkCompletedPerfomanceConfirm=mysqli_query($conn,"SELECT *,( select concat(firstname,' ',lastname) from users where userid=hpa.employee_id) as empname FROM hr_performance_ap hpa where hpa.FY='$fy' and hpa.hr_office_emp_approval is not null");
}
if(mysqli_num_rows($checkCompletedPerfomanceConfirm)) {
print("<br />
<fieldset>
<legend>ALREADY CONFIRMED</legend>
<table width='100%' class='tablelist' id='dynamic_field'><thead>
<tr>
<th>Names</th>
<th>Score</th>
<th>Employee Confirmation</th>
<th>Employee Confirmation Date</th>
<th>Supervisor Confirmation</th>
<th>Supervisor Confirmation Date</th>
<th>Head Confirmation</th>
<th>Head Confirmation Date</th>
<th>HR Confirmation</th>
<th>HR Confirmation Date</th>
<th>Show details</th>
</tr></thead>");
while($confirmRow=mysqli_fetch_array($checkCompletedPerfomanceConfirm)){
$names=$confirmRow['empname'];
$employeeid=$confirmRow['employee_id'];
$score=$confirmRow['score'];
$employee_accept=$confirmRow['employee_accept'];
$employee_accept_date=$confirmRow['employee_accept_date'];
$supervisor_accept=$confirmRow['supervisor_accept'];
$supervisor_accept_date=$confirmRow['supervisor_accept_date'];
$head_of_dpt_approval=$confirmRow['head_of_dpt_approval'];
$head_of_dpt_date=$confirmRow['head_of_dpt_date'];
$hr_office_emp_approval=$confirmRow['hr_office_emp_approval'];
$hr_office_emp_approval_date=$confirmRow['hr_office_emp_approval_date'];
print("<tr>
<td>$names</td>
<td><b>$score</b></td>
<td>$employee_accept</td>
<td>$employee_accept_date</td>
<td>$supervisor_accept</td>
<td>$supervisor_accept_date</td>
<td>$head_of_dpt_approval</td>
<td>$head_of_dpt_date</td>
<td>$hr_office_emp_approval</td>
<td>$hr_office_emp_approval_date</td>
<td>
<form action='showtargets.php' method='post'>
<input type='hidden' name='fy' value='$fy'>
<input type='hidden' name='employeeid' value='$employeeid'>
<input type='submit' name='show' value='Show' class='hrbutton'></form>
</td>
</tr>");
}
print("</table></fieldset>");
}
print("</div>");
//}
?>
</div>
</center>
</body>
</html>