forked from adi0311/ApplicationTracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathleave_data_fac.php
More file actions
65 lines (62 loc) · 2.07 KB
/
leave_data_fac.php
File metadata and controls
65 lines (62 loc) · 2.07 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
<?php
$value=$_POST['value'];
$roll_no=$_POST['roll'];
$strdate=$_POST['date'];
$endate=$_POST['edate'];
$link = mysqli_connect('localhost', 'root', '');
if(!$link)
{
die('Failed to connect to server: ' . mysqli_error($link));
}
$db = mysqli_select_db($link,'file tracking');
if(!$db)
{
die("Unable to select database");
}
if($value == 2)
{
$query="UPDATE application_faculty SET result='Rejected' WHERE faculty_id='$roll_no' and strdate='$strdate'";
$result1 = mysqli_query($link, $query);
$query="UPDATE application_faculty SET status='Acad' WHERE faculty_id='$roll_no' and strdate='$strdate'";
$result = mysqli_query($link, $query);
if($result1 and $result)
echo'<a class="ui red label">Rejected</a>';
}
if($value == 1)
{
$query="UPDATE application_faculty SET status='HOD' WHERE faculty_id='$roll_no' and strdate='$strdate'";
$result1 = mysqli_query($link, $query);
$query="UPDATE application_faculty SET result='Pending' WHERE faculty_id='$roll_no' and strdate='$strdate'";
$result = mysqli_query($link, $query);
if($result1 and $result)
echo'<a class="ui green label">Accepted</a>';
}
if($value == 3)
{
$query="SELECT casual,earned,halfpay,compensatory, maternity FROM leave_faculty";
$result = mysqli_query($link, $query);
$query1="SELECT type FROM application_faculty WHERE faculty_id='$roll_no' and strdate='$strdate'";
$result1 = mysqli_query($link, $query1);
$info=mysqli_fetch_array($result);
$info1=mysqli_fetch_array($result1);
if($result){
if($info1['type'] == 'casual')
$sum=$info['casual'];
if($info1['type'] == 'earned')
$sum=$info['earned'];
if($info1['type'] == 'compensatory')
$sum=$info['compensatory'];
if($info1['type'] == 'halfpay')
$sum=$info['halfpay'];
if($info1['type'] == 'maternity')
$sum=$info['maternity'];
}
else
$sum=0;
$diff = date_diff(date_create($strdate), date_create($endate));
if($sum >= $diff->format("%R%a") and $diff->format("%R%a") > 0)
echo'<a class="ui green label">Eligible</a>';
else
echo'<a class="ui red label">Not Eligible</a>';
}
?>