-
Notifications
You must be signed in to change notification settings - Fork 0
/
activity_cost_last_qtr.php
executable file
·121 lines (87 loc) · 3.33 KB
/
activity_cost_last_qtr.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
<!DOCTYPE html>
<html>
<head>
<title>Activity</title>
<link class="include" rel="stylesheet" type="text/css" href="analytics/jquery.jqplot.min.css" />
<link rel="stylesheet" type="text/css" href="analytics/charts/examples.min.css" />
<link type="text/css" rel="stylesheet" href="analytics/charts/syntaxhighlighter/styles/shCoreDefault.min.css" />
<link type="text/css" rel="stylesheet" href="analytics/charts/syntaxhighlighter/styles/shThemejqPlot.min.css" />
<!--[if lt IE 9]><script language="javascript" type="text/javascript" src="analytics/excanvas.js"></script><![endif]-->
<script class="include" type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
</head>
<body>
<div class="colmask leftmenu">
<div class="colleft">
<div class="col1" id="example-content"/>
<!-- Example scripts go here -->
<div id="pie21" style="margin-top:20px; margin-left:20px; width:400px; height:400px;"></div>
<?php
require_once('dbconn.php');
$con=getConnection();
$activities_cost = array();
$sql1 = "select activity,sum(UnifiedCost+expense_amt) from monthly_timesheet
where activity is not null
and date_sub(current_timestamp,interval 3 month) < report_month
group by activity
having sum(UnifiedCost+expense_amt) <> 0
order by sum(UnifiedCost+expense_amt) desc
LIMIT 10
";
$result = mysqli_query($con,$sql1) or die($sql."<br/><br/>".mysql_error());
while($row = mysqli_fetch_array($result))
{
$i = number_format($row[1],0);
$activities_cost[] = array($row[0],$i+0);
//$activities[] = $row;
}
?>
<script class="code" type="text/javascript">
<?php
$js_array_cost = json_encode($activities_cost);
echo "var tempArr_cost = ". $js_array_cost . ";\n";
?>
$(document).ready(function(){
var plot8 = $.jqplot('pie21', [tempArr_cost], {
grid: {
drawBorder: true,
drawGridlines: true,
background: '#ffffff',
shadow:true
},
axesDefaults: {
},
seriesDefaults:{
renderer:$.jqplot.PieRenderer,
rendererOptions: {
showDataLabels: true,
diameter: undefined
}
},
title: {
text: 'Top 10 Activities - Cost(Last 3 Months)',
show: true
},
legend: {
show: true,
location: 'e'
},
highlighter: {
show: true,
useAxesFormatters: false, // must be false for piechart
tooltipLocation: 'sw',
formatString:'%s'
}
});
});
</script>
<!-- Don't touch this! -->
<script class="include" type="text/javascript" src="analytics/jquery.jqplot.min.js"></script>
<script type="text/javascript" src="analytics/charts/syntaxhighlighter/scripts/shCore.min.js"></script>
<script type="text/javascript" src="analytics/charts/syntaxhighlighter/scripts/shBrushJScript.min.js"></script>
<script type="text/javascript" src="analytics/charts/syntaxhighlighter/scripts/shBrushXml.min.js"></script>
<!-- End Don't touch this! -->
<!-- Additional plugins go here -->
<script class="include" type="text/javascript" src="analytics/plugins/jqplot.pieRenderer.min.js"></script>
<!-- End additional plugins -->
</body>
</html>