-
Notifications
You must be signed in to change notification settings - Fork 0
/
filter.php
128 lines (110 loc) · 3.79 KB
/
filter.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
<?php
//echo "<script>alert('Hello');</script>";
if(isset($_POST["from_date"], $_POST["to_date"]))
{
include('config.php');
$output = '';
$date=$_POST['from_date'];
$tdate=$_POST['to_date'];
//echo "<script>alert('$date');</script>";die;
$query = "SELECT * FROM attendance_table WHERE date BETWEEN '".$_POST["from_date"]."' AND '".$_POST["to_date"]."' GROUP BY employee_code";
$result = mysqli_query($con, $query);
$output .='
<div class="panel-heading">
<h4 class="panel-title">View Attendance :</h4>
</div><!-- panel-heading -->
<table id="basicTable" class="table table-striped table-bordered responsive">
<tr>
<th>Employee ID</th>
<th>Name</th>
<th>'.$date.'</th>
<th>'.date('d/m/y' ,strtotime ($date. '+ 1 days')).'</th>
<th>'.date('d/m/y' ,strtotime ($date. '+ 2 days')).'</th>
<th>'.date('d/m/y' ,strtotime ($date. '+ 3 days')).'</th>
<th>'.date('d/m/y' ,strtotime ($date. '+ 4 days')).'</th>
<th>'.date('d/m/y' ,strtotime ($date. '+ 5 days')).'</th>
</tr>
';
if(mysqli_num_rows($result)>0)
{
while($row= mysqli_fetch_array($result))
{
$emp_code = $row["employee_code"];
$ques1=mysqli_query($con,"select shift_id from add_employee where employee_code = '$emp_code' ");
if($res1=mysqli_fetch_array($ques1))
{
$shift_emp_id=$res1['shift_id'];
}
$query3=mysqli_query($con,"select * from shift_time where id = '$shift_emp_id' ");
if($result3=mysqli_fetch_array($query3))
{
$sintime=$result3['intime'];
$souttime=$result3['outtime'];
}
$output .= '
<tr>
<td>'.$emp_code.'</td>
<td>'.$row["name"].'</td>
';
$query4=mysqli_query($con,"select * from attendance_table WHERE employee_code = '$emp_code' AND date BETWEEN '$date' AND '$tdate' LIMIT 6 ");
while($result5=mysqli_fetch_array($query4))
{
//$chkdate=date('y-m-d' , strtotime($date. '+ 1 days'));
$ddate=$result5['intime'];
$attendance=$result5['attendance'];
$result_msg = '';
$result7=mysqli_query($con,"select * from holiday1 where msg = '$ddate' ");
while($result10=mysqli_fetch_array($result7))
{
$result_msg=$result10['msg'];
}
if($result_msg != '')
{
$alert = $result_msg;
}
else{
if($attendance == 'Sunday')
{
$alert = "<span style='color:blue';>Sunday</span>";
}
else
{
if($attendance == 'A')
{
$alert="<span style='color:red;'>absent</span>";
}
else
{
if ($sintime < $result5['intime'] or $souttime > $result5['outtime'])
{
$alert= "<span style='color:yellow'>Half Day</span><br>In Time: ".$result5['intime'];
}
else
{
$alert= "<span style='color:green'>On Time</span>";
$alert= "<br>";
$alert= 'In Time: '.$result5['intime'];
$alert= "<br>";
$alert= 'Out Time: '.$result5['outtime'];
}
}
}
}
$output .= '<td>'.$alert.'</td>';
}
'</tr>
';
}
}
else
{
$output .= '
<tr>
<td>No Date Found</td>
</tr>
';
}
$output .= '</table>';
echo $output;
}
?>