-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdashboard.php
More file actions
343 lines (316 loc) · 12 KB
/
dashboard.php
File metadata and controls
343 lines (316 loc) · 12 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
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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
<!DOCTYPE html>
<html lang="en">
<head>
<?php
set_time_limit(300); //300 seconds, 5 minutes
include('general.php');
include('dashboard_charts.php');
putScripts();
putLinks();
?>
<title>CHROMIS BACKOFFICE</title>
</head>
<body>
<nav class="navbar navbar-default" role="navigation">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand tada animated" href="./index.php">CHROMIS BACKOFFICE</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
<!-- <ul class="nav navbar-nav navbar-left">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Products <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="/chromisphp/productsearch.php">Search</a></li>
<li><a href="#">New Product</a></li>
<li><a href="/chromisphp/productpurchase.php">Purchase</a></li>
<li><a href="#">Distribution</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Masters <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="./Locations.php">Locations</a></li>
<li><a href="./categories.php">Categories</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Uploads <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="./newproductupload.php">All Purchases</a></li>
<li><a href="./csvupload.php">Quantity from CSV</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Reports <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="./Report_ProductSalesProfit.php">Itemwise Profit</a></li>
<li><a href="./Report_ProductSalesProfitMonthly.php">Monthly Profit</a></li>
<li><a href="./Report_CustomerInvoices.php">Customer Invoices</a></li>
<li><a href="./Report_CustomerItems.php">Customer Items</a></li>
<li role="separator" class="divider"></li>
<li><a href="./Report_CashReceipts.php">Cash Receipts Search</a></li>
<li><a href="./Report_CashReceiptsItems.php">Cash Receipts Product Search</a></li>
</ul>
</li>
</ul> -->
</div><!-- /.navbar-collapse -->
</nav>
<header class="site__header island">
<div class="wrap">
<span id="animationSandbox" style="display: block; color:red;" class="tada animated">
<h1 class="site__title mega text-center">Grand Dashboard</h1>
</span>
</div>
</header>
<div class="container-fluid">
<div class="row">
<div class="col-xs-2 col-sm-2 col-md-2 col-lg-2 text-center">
<canvas id="YearlyTotalSalesChart" width="100" height="100"></canvas>
</div>
<div class="col-xs-2 col-sm-2 col-md-2 col-lg-2 text-center">
<canvas id="YearlyCashSalesChart" width="150" height="150"></canvas>
</div>
<div class="col-xs-2 col-sm-2 col-md-2 col-lg-2 text-center">
<canvas id="YearlyCustSalesChart" width="150" height="150"></canvas>
</div>
<div class="col-xs-2 col-sm-2 col-md-2 col-lg-2 text-center">
<canvas id="CurrMonthCashSalesChart" width="150" height="150"></canvas>
</div>
<div class="col-xs-2 col-sm-2 col-md-2 col-lg-2 text-center">
<canvas id="CurrMonthCustSalesChart" width="100" height="100"></canvas>
</div>
<div class="col-xs-2 col-sm-2 col-md-2 col-lg-2 text-center">
<canvas id="TotalYearlyProfitChart" width="100" height="100"></canvas>
</div>
</div>
</div> <!-- container -->
<script>
function Mround(value, decimals) {
return Number(Math.round(value+'e'+decimals)+'e-'+decimals);
}
</script>
<script>
// Define a plugin to provide data labels
Chart.plugins.register({
afterDatasetsDraw: function(chart) {
var ctx = chart.ctx;
chart.data.datasets.forEach(function(dataset, i) {
var meta = chart.getDatasetMeta(i);
if (!meta.hidden) {
meta.data.forEach(function(element, index) {
// Draw the text in black, with the specified font
ctx.fillStyle = 'rgb(98,0,234)';
var fontSize = 10;
var fontStyle = 'bold';
var fontFamily = 'Arial'; //'Helvetica Neue';
ctx.font = Chart.helpers.fontString(fontSize, fontStyle, fontFamily);
// Just naively convert to string for now
//var dataString = dataset.data[index].toString();
var dataString = Mround(dataset.data[index],2).toString();
// Make sure alignment settings are correct
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
var padding = 5;
var position = element.tooltipPosition();
ctx.fillText(dataString, position.x, position.y - (fontSize / 2) - padding);
});
}
});
}
});
</script>
<?php //Yearly Total Sales
TotalYearlySales();
?>
<script>
var ctx = document.getElementById('YearlyTotalSalesChart').getContext('2d');
var chart = new Chart(ctx, {
// The type of chart we want to create
type: 'bar',
// The data for our dataset
data: {
labels: <?php echo json_encode($outputYears);?>,
datasets: [{
label: "Yearly Total Sales",
backgroundColor: 'rgb(255,23,68)',
borderColor: 'rgb(255,23,68)',
data: <?php echo json_encode($outputInvAmount);?>,
}]
},
// Configuration options go here
options: {
scales: {
yAxes: [{
ticks: {
beginAtZero: true
}
}]
}
}
});
</script>
<?php //Yearly Total Sales
TotalYearlyProfit();
?>
<script>
var ctx = document.getElementById('TotalYearlyProfitChart').getContext('2d');
var chart = new Chart(ctx, {
// The type of chart we want to create
type: 'bar',
// The data for our dataset
data: {
labels: <?php echo json_encode($outputYears);?>,
datasets: [{
label: "Yearly Total Profit",
backgroundColor: 'rgb(118,255,3)',
borderColor: 'rgb(118,255,3)',
data: <?php echo json_encode($outputInvAmount);?>,
}]
},
// Configuration options go here
options: {
scales: {
yAxes: [{
ticks: {
beginAtZero: true
}
}]
}
}
});
</script>
<?php //Yearly Sales Cash
YearlySalesCash();
?>
<script>
var ctx = document.getElementById('YearlyCashSalesChart').getContext('2d');
var chart = new Chart(ctx, {
// The type of chart we want to create
type: 'bar',
// The data for our dataset
data: {
labels: <?php echo json_encode($outputYears);?>,
datasets: [{
label: "Yearly Cash Sales",
backgroundColor: 'rgb(255,235,59)',
borderColor: 'rgb(255,235,59)',
data: <?php echo json_encode($outputInvAmount);?>,
}]
},
// Configuration options go here
options: {
scales: {
yAxes: [{
ticks: {
beginAtZero: true
}
}]
}
}
});
</script>
<?php //Yearly Sales Customers
YearlySalesCustomers();
?>
<script>
var ctx = document.getElementById('YearlyCustSalesChart').getContext('2d');
var chart = new Chart(ctx, {
// The type of chart we want to create
type: 'bar',
// The data for our dataset
data: {
labels: <?php echo json_encode($outputYears);?>,
datasets: [{
label: "Yearly Customer Sales",
backgroundColor: 'rgb(213,0,249)',
borderColor: 'rgb(213,0,249)',
data: <?php echo json_encode($outputInvAmount);?>,
}]
},
// Configuration options go here
options: {
scales: {
yAxes: [{
ticks: {
beginAtZero: true
}
}]
}
}
});
</script>
<?php //current month cash Sales
//previous years vs current year
CurrentMonthCashSales();
?>
<script>
var ctx = document.getElementById('CurrMonthCashSalesChart').getContext('2d');
var chart = new Chart(ctx, {
// The type of chart we want to create
type: 'bar',
// The data for our dataset
data: {
labels: <?php echo json_encode($outputYears);?>,
datasets: [{
label: "This Month Cash Sales",
backgroundColor: 'rgb(21,101,192)',
borderColor: 'rgb(21,101,192)',
data: <?php echo json_encode($outputInvAmount);?>,
}]
},
// Configuration options go here
options: {
scales: {
yAxes: [{
ticks: {
beginAtZero: true
}
}]
}
}
});
</script>
<?php //Current month sales customers
//Previous Years vs current year
CurrentMonthCustSales();
?>
<script>
var ctx = document.getElementById('CurrMonthCustSalesChart').getContext('2d');
var chart = new Chart(ctx, {
// The type of chart we want to create
type: 'bar',
// The data for our dataset
data: {
labels: <?php echo json_encode($outputYears);?>,
datasets: [{
label: "This Month Cust Sales",
backgroundColor: 'rgb(245,0,87)',
borderColor: 'rgb(245,0,87)',
data: <?php echo json_encode($outputInvAmount);?>,
}]
},
// Configuration options go here
options: {
scales: {
yAxes: [{
ticks: {
beginAtZero: true
}
}]
}
}
});
</script>
<?php
stickfooter();
?>
</body>
</html>