-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgenerateReports.php
241 lines (203 loc) · 10.6 KB
/
generateReports.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
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
<!DOCTYPE html>
<?php
session_start();
if (!isset($_SESSION['id'])) {
header("location:login.html");
$id=$_SESSION['id'];
}
?>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>MSP| Schedule management</title>
<!-- Bootstrap Core CSS -->
<link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- MetisMenu CSS -->
<link href="vendor/metisMenu/metisMenu.min.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="dist/css/sb-admin-2.css" rel="stylesheet">
<!-- Morris Charts CSS -->
<link href="vendor/morrisjs/morris.css" rel="stylesheet">
<!-- Custom Fonts -->
<link href="vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<link href="vendor/datatables-plugins/dataTables.bootstrap.css" rel="stylesheet">
<!-- DataTables Responsive CSS -->
<link href="vendor/datatables-responsive/dataTables.responsive.css" rel="stylesheet">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div id="wrapper">
<?php
include("template/top.php");
?>
<div id="page-wrapper">
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">Reports</h1>
</div>
<!-- /.col-lg-12 -->
</div>
<div id="page-content">
<?php
include('private/conn.php');
if (isset($_POST["searchCriteria"])) {
$startDate = $_POST["startDate"];
$endDate = $_POST["endDate"];
}
?>
<form role="form" method="POST" class="form-inline" style="margin-bottom: 20px;">
<div class="form-group col-sm-4">
<label for="startDate" style="margin-right: 10%;">Start Date: </label>
<input name="startDate" value="<?php echo $startDate;?>" type="date"class="form-control">
</div>
<div class="form-group col-sm-4">
<label for="endDate" style="margin-right: 10%;">End Date:</label>
<input name="endDate" value="<?php echo $endDate;?>" type="date" class="form-control">
</div>
<button type="submit" name="searchCriteria" class="btn btn-primary">Search</button>
</form>
<!-- /.row -->
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-heading" id="load123">
<b> Generate Event Report</b>
</div>
<!-- /.panel-heading -->
<div class="panel-body">
<ul class="list-inline pull-right">
<li class="list-inline-item"><span class="pull-right bold">Hide Columns==> </span><li class="list-inline-item">
<li class="list-inline-item"><a class="toggle-vis pull-right" data-column="6">Venue </a></li>
<li class="list-inline-item"> <a class="toggle-vis pull-right" data-column="5">End Time </a></li>
<li class="list-inline-item"><a class="toggle-vis pull-right" data-column="4">Start Time </a></li>
<li class="list-inline-item"><a class="toggle-vis pull-right" data-column="2">Description </a></li>
</ul>
<table width="100%" class="table table-striped table-bordered table-hover" id="dataTables-example">
<thead>
<tr>
<th>Sr.No</th>
<th>Event Name</th>
<th>Description</th>
<th>Date</th>
<th>Start Time</th>
<th>End Time</th>
<th>Venue</th>
</tr>
</thead>
<tbody>
<?php
if (isset($_POST["searchCriteria"])) {
$startDate = $_POST["startDate"];
$endDate = $_POST["endDate"];
$result = $db->get_results("SELECT * FROM `create_event` where date >= '$startDate' and date<='$endDate' and host_id='$id' or event_id in (select event_id from guests where guest_id='$id')");
} else {
$result = $db->get_results("select * from create_event where host_id='$id' or event_id in (select event_id from guests where guest_id='$id')");
}
#
$count = 1;
if (isset($result)) {
foreach ($result as $row) {
?>
<tr class="odd gradeX">
<td><?php echo $count; ?></td>
<td><?php echo $row->title; ?></td>
<td><?php echo $row->description; ?></td>
<td class="center"><?php echo $row->date; ?></td>
<td class="center"><?php echo date('H:i:s', strtotime($row->start_time)); ?></td>
<td class="center"><?php echo date('H:i:s', strtotime($row->end_time)); ?></td>
<td class="center"><?php echo $row->venue; ?></td>
</tr>
<?php
$count=$count+1;
}
}
?>
</tbody>
</table>
</div>
<!-- /.panel-body -->
</div>
<!-- /.panel -->
</div>
<!-- /.col-lg-12 -->
</div>
<!-- /.row -->
</div>
</div>
</div>
<?php
include("template/bottomScripts.php");
?>
<script>
function loadDoc(filename) {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("page-content").innerHTML = this.responseText;
}
};
xhttp.open("GET", "component/" + filename, true);
xhttp.send();
}
</script>
<!-- DataTables JavaScript -->
<script>
$(document).ready(function () {
var table= $('#dataTables-example').DataTable({
responsive: true,
dom: 'Bfrtip',
buttons: [
{
extend: 'copy',
text: 'Copy',
className: "btn btn-primary",
}, {
extend: 'csv',
text: 'CSV',
className: "btn btn-primary",
}, {
extend: 'excel',
text: 'Excel',
className: "btn btn-primary",
},
{
extend: 'pdf',
text: 'Save AS PDF',
className: "btn btn-primary",
},
{
extend: 'print',
text: 'Print',
className: "btn btn-primary"
}
]
});
$('a.toggle-vis').on( 'click', function (e) {
e.preventDefault();
// Get the column API object
var column = table.column( $(this).attr('data-column') );
// Toggle the visibility
column.visible( ! column.visible() );
} );
}) ;
</script>
<script src="vendor/datatables/js/jquery.dataTables.min.js"></script>
<script src="vendor/datatables-plugins/dataTables.bootstrap.min.js"></script>
<script src="vendor/datatables-responsive/dataTables.responsive.js"></script>
<script src="https://cdn.datatables.net/buttons/1.5.1/js/dataTables.buttons.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/pdfmake.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/vfs_fonts.js"></script>
<script src="https://cdn.datatables.net/buttons/1.5.1/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.5.1/js/buttons.print.min.js"></script>
</body>
</html>