-
Notifications
You must be signed in to change notification settings - Fork 0
/
date_cost.php
executable file
·201 lines (164 loc) · 6.31 KB
/
date_cost.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
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
<!DOCTYPE html>
<?php
session_name("Project");
session_start();
require_once('dbconn.php');
if(!checkUserSession($_SESSION["user"]))
{
header("Location:login.php");
}
if(checkProjectPermission("VIEW") == false)
{
header("Location:error.php");
}
?>
<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="../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>
<?php
include 'header.php';
?>
<br>
<div class="colmask leftmenu">
<div class="colleft">
<div class="col1" id="example-content">
<!-- Example scripts go here -->
<div id="chart1" style="height:550px; width:950px;"></div>
<?php
require_once('dbconn.php');
$con=getConnection();
$sql1 = "
select report_month,s1,s2,s3,s4,ifnull(amt,0)/100000 from (
select report_month,sum(
case when customer not in ('Internal','Management') then UnifiedCost else 0 end/100000.0)
+sum(expense_amt/100000.0) s1,
sum(
case when customer not in ('Internal','Management') then UnifiedCost else 0 end/100000.0) s2,sum(ifnull(expense_amt,0)/100000) s3,
sum(cost/100000.0) s4
from monthly_timesheet
where date_sub(current_timestamp,interval 24 month) < report_month
group by report_month
) a
left join invoice_paid b on a.report_month = b.month
order by report_month asc
";
$result = mysqli_query($con,$sql1) or die($sql."<br/><br/>".mysql_error());
while($row = mysqli_fetch_array($result))
{
$i = $row[1]+0;
$i1 = $row[2]+0;
$i2 = $row[3]+0;
$i3 = $row[4]+0;
$i4 = $row[5]+0;
$date_cost[] = array($row[0],$i+0);
$date_labour[] = array($row[0],$i1+0);
$date_expense[] = array($row[0],$i2+0);
$date_base_cost[] = array($row[0],$i3+0);
$date_paid[] = array($row[0],$i4+0);
//$activities[] = $row;
}
//echo json_encode($date_base_cost);
?>
<script class="code" type="text/javascript">
<?php
$js_array_cost = json_encode($date_cost);
echo "var tempArr_cost = ". $js_array_cost . ";\n";
$js_array_cost = json_encode($date_labour);
echo "var tempArr_labour = ". $js_array_cost . ";\n";
$js_array_cost = json_encode($date_expense);
echo "var tempArr_expense = ". $js_array_cost . ";\n";
$js_array_cost = json_encode($date_base_cost);
echo "var tempArr_base = ". $js_array_cost . ";\n";
$js_array_cost = json_encode($date_paid);
echo "var tempArr_paid = ". $js_array_cost . ";\n";
?>
$(document).ready(function(){
$.jqplot.config.enablePlugins = true;
var plot1 = $.jqplot('chart1', [tempArr_cost,tempArr_labour,tempArr_base,tempArr_paid,tempArr_expense], {
title:'Cost Trend',
axes:{
xaxis:{
renderer:$.jqplot.DateAxisRenderer,
label:"Months",
labelRenderer: $.jqplot.CanvasAxisLabelRenderer,
rendererOptions:{
tickRenderer:$.jqplot.CanvasAxisTickRenderer
},
tickOptions:{
fontSize:'10pt',
fontFamily:'Tahoma',
formatString:'%b-%Y',
angle:-40
}
},
yaxis:{
rendererOptions:{
tickRenderer:$.jqplot.CanvasAxisTickRenderer},
label:"Cost in Lakhs(INR)",
labelRenderer: $.jqplot.CanvasAxisLabelRenderer,
/*labelOptions: {
fontFamily: 'Georgia, Serif',
fontSize: '12pt'
},*/
tickOptions:{
fontSize:'10pt',
fontFamily:'Tahoma',
formatString:"%'.2f",
angle:30
}
}
},
legend: {
show: true ,
location: 'e',
placement: 'outside'
},
seriesDefaults: {
rendererOptions: {
smooth: true
},
pointLabels: { show:true }
},
series:[
{ label: 'Total Cost' },
{ label: 'Unified Labour Cost' },
{ label: 'Base Labour Cost' },
{ label: 'Payment Received' },
{ label: 'Project Expense Cost' },
{
lineWidth:4, markerOptions:{ style:'circle' }
}
],
cursor:{
zoom:true,
looseZoom: true
}
});
});
</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 -->
<!-- to render rotated axis ticks, include both the canvasText and canvasAxisTick renderers -->
<script language="javascript" type="text/javascript" src="analytics/plugins/jqplot.canvasTextRenderer.min.js"></script>
<script language="javascript" type="text/javascript" src="analytics/plugins/jqplot.canvasAxisLabelRenderer.min.js"></script>
<script language="javascript" type="text/javascript" src="analytics/plugins/jqplot.enhancedLegendRenderer.min.js"></script>
<script language="javascript" type="text/javascript" src="analytics/plugins/jqplot.pointLabels.min.js"></script>
<script language="javascript" type="text/javascript" src="analytics/plugins/jqplot.canvasAxisTickRenderer.min.js"></script>
<script language="javascript" type="text/javascript" src="analytics/plugins/jqplot.dateAxisRenderer.min.js"></script>
<script language="javascript" type="text/javascript" src="analytics/plugins/jqplot.cursor.min.js"></script>
<!-- End additional plugins -->
</body>
</html>