-
Notifications
You must be signed in to change notification settings - Fork 0
/
performance_measurement.php
93 lines (68 loc) · 1.8 KB
/
performance_measurement.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
<?php
include "dbconnect.php";
include "header.php";
$today=date("Y-m-d");
?>
<table border="2" cellspacing="0" cellpadding="0">
<tr>
<th>Employee Name</th>
<th>Total Tasks</th>
<th>Completed Tasks</th>
<th>Complete On Time</th>
<th>Performance</th>
</tr>
<?
$sql=mysql_query("select * from admin");
while($sql1=mysql_fetch_array($sql))
{
echo "<tr>";
$first_name=$sql1['first_name'];
//echo $email=$sql1['email'];
$id=$sql1['id'];
$total_tasks = total_number_tasks($id);
$total_completed_task = total_completed_task($id);
$total_on_time = total_on_time($id);
echo "<td>".$first_name;
echo "</td>";
echo "<td>".$total_tasks;
echo "</td>";
echo "<td>".$total_completed_task;
echo "</td>";
//echo "<td>".$total_on_time;
//echo "</td>";
if($total_tasks != 0)
{
$performance=round (($total_completed_task*100)/$total_tasks,2);
}
else
{
$performance = 0;
}
echo "<td>";
echo "</td>";
echo "<td>".$performance ."%";
//echo "</td>";
echo "</tr>";
}
function total_number_tasks($id)
{
$query=mysql_query("select * from tasks where assigned_to='$id' or assigned_to=' $id' or assigned_to like '%$id%' ");
$ml=mysql_num_rows($query);
return $ml;
}
function total_completed_task($id)
{
$query=mysql_query("select * from tasks where assigned_to like '%$id%' AND status like '%completed%' ");
$ml=mysql_num_rows($query);
return $ml;
}
function total_on_time($id)
{
// $query=mysql_query("select * from tasks where assigned_to='$id' or assigned_to=' $id' or assigned_to like '%$id%' AND status like '%completed%' AND end_date<= '".$today."' ");
//$ml=mysql_num_rows($query);
//return $ml;
}
echo
'</table>';
include "footer.php";
?>