-
Notifications
You must be signed in to change notification settings - Fork 0
/
dashboard_v5.php
193 lines (172 loc) · 5.41 KB
/
dashboard_v5.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
<?php include('inc_meta_header.php'); ?>
<title>Dashboard <?php include('inc_page_title.php'); ?></title>
<?php include('inc_head.php'); ?>
<?php include('backend/dashboard.php'); ?>
<?php
$DATEDG = '';
if (isset($_POST['srchfilter'])) //submit button name
{
$srch_DATEFROM = $_POST['DATEFROM'];
$srch_DATETO = $_POST['DATETO'];
//Get previous Date From-----------------------
if ($srch_DATEFROM) {
$srch_DATEFROM = strtotime($srch_DATEFROM);
//$srch_DATEFROM = strtotime('-1 day', $srch_DATEFROM);
$srch_DATEFROM = date('Y-m-d', $srch_DATEFROM);
} else {
$srch_DATEFROM = '';
}
//----------------------------------------------
//Get previous Date To-----------------------
if ($srch_DATETO) {
$srch_DATETO = strtotime($srch_DATETO);
$srch_DATETO = strtotime('+1 day', $srch_DATETO);
$srch_DATETO = date('Y-m-d', $srch_DATETO);
} else {
$srch_DATETO = '';
}
//----------------------------------------------
if (!empty($srch_DATEFROM != NULL && $srch_DATETO != NULL)) {
$DATEDG = "AND DATE(DATED) BETWEEN '$srch_DATEFROM' AND '$srch_DATETO'";
}
if (!empty($srch_DATEFROM != NULL && $srch_DATETO != NULL)) {
$DATEDG_other = "AND DATE(calls_start_time) BETWEEN '$srch_DATEFROM' AND '$srch_DATETO'";
}
$no_of_calls = call_record($link, $DATEDG_other);
// For Profile Completed
$Profile_Completed_arr = profile_completed($link, $DATEDG);
// For Lead Converted
$Lead_Converted_arr = lead_converted($link, $DATEDG);
}
?>
<script>
window.onload = function() {
var chart = new CanvasJS.Chart("chartContainer", {
animationEnabled: true,
theme: "light", // "light1", "dark1", "dark2"
animationDuration: 2000,
title: {
text: "Number of Calls"
},
axisX: {
interval: 1,
labelMaxWidth: 180,
labelAngle: -70, //90,
labelFontFamily: "verdana0"
},
data: [{
type: "column",
indexLabel: "{y}",
dataPoints: <?php echo $no_of_calls; ?>
}],
options: {
indexAxis: 'x',
scales: {
x: {
type: 'time',
source: 'data',
ticks: {
autoSkip: false
}
},
}
}
});
chart.render();
//Multi Chart
var chart_multi = new CanvasJS.Chart("chartContainer_multi", {
animationEnabled: true,
theme: "light2", // "light1", "dark1", "dark2"
animationDuration: 2000,
title: {
text: "Targets"
},
axisX: {
interval: 1,
labelMaxWidth: 180,
labelAngle: -70, //90,
labelFontFamily: "verdana0"
},
legend: {
cursor: "pointer",
verticalAlign: "bottom",
horizontalAlign: "center",
itemclick: toggleDataSeries
},
data: [{
type: "column",
name: "Profile Completed",
indexLabel: "{y}",
yValueFormatString: "#,###.##", //$#0.##
showInLegend: true,
dataPoints: <?php echo $Profile_Completed_arr; ?>
}, {
type: "column",
name: "Lead Converted",
indexLabel: "{y}",
yValueFormatString: "#,###.##", //$#0.##
showInLegend: true,
dataPoints: <?php echo $Lead_Converted_arr; ?>
}]
});
chart_multi.render();
function toggleDataSeries(e) {
if (typeof(e.dataSeries.visible) === "undefined" || e.dataSeries.visible) {
e.dataSeries.visible = false;
} else {
e.dataSeries.visible = true;
}
chart_multi.render();
}
}
</script>
<body class="nav-md">
<div class="container body">
<div class="main_container">
<div class="col-md-3 left_col">
<?php include('inc_nav.php'); ?>
</div>
<?php include('inc_header.php'); ?>
<!-- breadcrumb -->
<div class="breadcrumb_content">
<div class="breadcrumb_text">Dashboard / <!--<a href="dashboard.php">Dashboard</a> / -->
</div>
</div>
<!-- /breadcrumb -->
<!-- page content -->
<div class="right_col bg_fff" role="main">
<div class="container">
<form action="" method="post">
<div class="col-lg-12">
<div class="col-lg-10 col-md-10 col-sm-12 col-xs-12 col-lg-offset-1">
<div class="form-group al-right" style="padding-top: 7px;">
<div class="col-lg-11">
<div class="input-daterange input-group">
<input type="date" class="form-control input-date-picker datepicker-dropdown" id="DATEFROM" name="DATEFROM" placeholder="Start Date" autocomplete="off" value="<?php if ($srch_DATEFROM != NULL) {
echo $_POST['DATEFROM'];
} ?>" />
<span class="input-group-addon"><i class="fa fa-angle-left"></i> From DATE To <i class="fa fa-angle-right"></i></span>
<input type="date" class="form-control input-date-picker" id="DATETO" name="DATETO" placeholder="End Date" autocomplete="off" value="<?php if ($srch_DATETO != NULL) {
echo $_POST['DATETO'];
} ?>" />
</div>
</div>
<div class="col-lg-1">
<button type="submit" name="srchfilter" class="btn btn-success"><i class="fa fa-search"></i> Search</button>
</div>
</div>
</div>
</div>
</form>
</div>
<div class="container">
<div id="chartContainer_multi" style="height: 400px; width: 100%;"></div>
<div id="chartContainer" style="height: 400px; width: 100%;margin-top: 1%;"></div>
</div>
</div>
<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
<!-- /page content -->
<?php include('inc_footer.php'); ?>
</div>
</div>
<?php include('inc_foot.php'); ?>