-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsalestat.js.php
65 lines (61 loc) · 1.29 KB
/
salestat.js.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
<?php
include "class/Database.class.php";
$db = new \pos\Database("localhost", "root", "root", "ehackb_pos");
$salesByHour = $db->getDbObject()->query("SELECT purchasedate, SUM(amount) FROM sales GROUP BY DAY(purchasedate), HOUR(purchasedate);");
$cumul = 0;
foreach ($salesByHour as $sale) {
$data[] = "['Cijfer om " . $sale[0] . "', $sale[1], $sale[2]]";
$cumul += $sale[2];
}
?>
var chart = new Highcharts.Chart({
title: {
text: 'Totale omzet',
x: -20 //center
},
subtitle: {
text: 'Pintjes!',
x: -20
},
xAxis: {
tickInterval: 1,
labels: {
enabled: false
},
},
yAxis: {
min: 0,
title: {
text: 'Omzet in EUR'
}
},
tooltip: {
valueSuffix: ' EUR'
},
legend: {
enabled: true
},
chart: {
renderTo: 'totalChart',
type: 'column'
},
credits: {
enabled: false
},
series: [{
name: 'Omzet',
data: [<?php echo join($data, ',') ?>]
}, {
type: 'line',
name: 'Lijn',
data: [<?php echo join($data, ',') ?>],
marker: {
enabled: false
},
states: {
hover: {
lineWidth: 0
}
}
}]
});