/
search_archive.php
341 lines (263 loc) · 12 KB
/
search_archive.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
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
<?php
session_start();
?>
<?php
require("db.php");
require("functions/document functions.php");
require("functions/general functions.php");
require("functions/routing process.php");
require("functions/user functions.php");
require("functions/form functions.php");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<meta name="description" content="">
<meta name="author" content="ThemeBucket">
<link rel="shortcut icon" href="#" type="image/png">
<title>Document Tracking System - Search in Archive</title>
<link href="css/font-awesome.min.css" rel="stylesheet">
<link href="css/bootstrap_banzhow.css" rel="stylesheet">
<link href="css/bootstrap_adminex.css" rel="stylesheet">
<!-- custom CSS -->
<link href="css/style_adminex.css" rel="stylesheet">
<!--
<link href="css/style_1.css" rel="stylesheet">
-->
<!--pickers css-->
<link rel="stylesheet" type="text/css" href="js/bootstrap-datepicker/css/datepicker-custom.css" />
<link rel="stylesheet" type="text/css" href="js/bootstrap-timepicker/css/timepicker.css" />
<link rel="stylesheet" type="text/css" href="js/bootstrap-colorpicker/css/colorpicker.css" />
<link rel="stylesheet" type="text/css" href="js/bootstrap-daterangepicker/daterangepicker-bs3.css" />
<link rel="stylesheet" type="text/css" href="js/bootstrap-datetimepicker/css/datetimepicker-custom.css" />
<link href="css/banzhow_nav.css" rel="stylesheet">
<!--
<link href="css/style-responsive.css" rel="stylesheet">
-->
<link rel="stylesheet" href="js/data-tables/DT_bootstrap.css" />
<link href="js/advanced-datatable/css/demo_page.css" rel="stylesheet" />
<link href="js/advanced-datatable/css/demo_table.css" rel="stylesheet" />
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="js/html5shiv.js"></script>
<script src="js/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class='banzhow'>
<div class="sticky-header" >
<?php require("nav_menu.php"); ?>
</div>
<div class='adminex'>
<section>
<!-- left side start-->
<div class="left-side sticky-left-side">
<!--logo and iconic logo start-->
<div class="logo">
<a href="index.html"><img src="images/logo.png" alt=""></a>
</div>
<div class="logo-icon text-center">
<a href="index.html"><img src="images/logo_icon.png" alt=""></a>
</div>
<!--logo and iconic logo end-->
<?php require("sidebar.php"); ?>
</div>
<div class="main-content" >
<div class="header-section">
<!--
<form class="searchform" action="index.html" method="post">
<input type="text" class="form-control" name="keyword" placeholder="Search here..." />
</form>
-->
<a class="toggle-btn"><i class="fa fa-bars"></i></a>
<!--notification menu start -->
<?php
require("notification menu.php");
?>
<!--notification menu end -->
</div>
<!-- header section end-->
<!-- page heading start-->
<div class="page-heading">
<h3>
Search in Archive <small>date pickers, datetime pickers, time pickers and color pickers</small>
</h3>
<ul class="breadcrumb">
<li>
<a href="#">New Action</a>
</li>
<li class="active"> Search in Archive </li>
</ul>
</div>
<div class="wrapper">
<div class="row">
<div class="col-sm-12">
<section class="panel">
<header class="panel-heading">
Document Archives
<span class="tools pull-right">
<a class="fa fa-search" data-toggle="modal" href="#myModal2"></a>
<a href="javascript:;" class="fa fa-chevron-down"></a>
<a href="javascript:;" class="fa fa-times"></a>
</span>
</header>
<div class="panel-body">
<div class="adv-table">
<table class="display table table-bordered table-striped" id="dynamic-table">
<thead>
<tr>
<th>Subject</th>
<th>Originating Office</th>
<th>Document Date</th>
<th>Received Date</th>
<th>Reference Number</th>
</tr>
</thead>
<?php
$db=connectDb();
if(isset($_POST['from_date'])){
$from_date=date("Y-m-d H:i:s",strtotime($_POST['from_date']." 00:00:00"));
$to_date=date("Y-m-d H:i:s",strtotime($_POST['to_date']." 23:23:59"));
$dateClause=" where receive_date between '".$from_date."' and '".$to_date."'";
}
else {
$dateClause=" where receive_date receive_date like '".date("Y-m")."%%'";
}
if(isset($_POST['subject'])){
$subjectClause=" and subject like '%%".str_replace(' ','%',$_POST['subject'])."%%'";
}
if(isset($_POST['classification'])){
$class=$_POST['classification'];
$classificationClause=" and classification_id='".$class."'";
}
if(isset($_POST['reference'])){
$referenceClause=" and (select reference_id from document_receipt where document_id=document.ref_id) like '%%".$_POST['reference']."%%'";
}
$searchSQL="select * from document ".$dateClause.$subjectClause.$classificationClause.$referenceClause." and ((sending_office='".$_SESSION['division_code']."' and security in ('divSecured','GMsecured')) or (security='unsecured'))";
$searchRS=$db->query($searchSQL);
$searchNM=$searchRS->num_rows;
?>
<tbody>
<?php
for($i=0;$i<$searchNM;$i++){
$searchRow=$searchRS->fetch_assoc();
?>
<tr>
<td><?php echo $searchRow['subject']; ?></td>
<td><?php echo getOriginatingOffice($db,$searchRow['originating_office']); ?></td>
<td><?php echo $searchRow['document_date']; ?></td>
<td><?php echo $searchRow['receive_date']; ?></td>
<td><?php echo calculateReferenceNumber($db,$searchRow,adjustControlNumber($searchRow['ref_id'])); ?></td>
</tr>
<?php
}
?>
</tbody>
<tfoot>
<tr>
<th>Subject</th>
<th>Originating Office</th>
<th>Document Date</th>
<th>Received Date</th>
<th>Reference Number</th>
</tr>
</tfoot>
</table>
</div>
</div>
<div class="modal fade" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Filter Search</h4>
</div>
<form action="search_archive.php" method=post class="form-horizontal ">
<div class="modal-body">
<div class="form-group">
<label class="control-label col-md-4">Subject</label>
<div class="col-md-6">
<input class='form-control' type='text' name='subject' />
</div>
</div>
<div class="form-group">
<label class="control-label col-md-4">Classification</label>
<div class="col-md-6">
<select class='form-control' name='classification' id='classification' onchange='checkAlternate(this,5,"classification_search")' >
<option></option>
<?php
$db=connectDb();
$sql="select * from classification inner join division_classification on classification.id=classification_id where division_id in ('ALL','".$_SESSION['division_code']."') order by classification_desc";
$rs=$db->query($sql);
$nm=$rs->num_rows;
for($i=0;$i<$nm;$i++){
$row=$rs->fetch_assoc();
?>
<option value='<?php echo $row['id']; ?>'><?php echo $row['classification_desc']; ?></option>
<?php
}
?>
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-4">Date Range</label>
<div class="col-md-6">
<div class="input-group input-large custom-date-range" data-date="13/07/2013" data-date-format="mm/dd/yyyy">
<input type="text" class="form-control dpd1" name="from_date">
<span class="input-group-addon">To</span>
<input type="text" class="form-control dpd2" name="to_date">
</div>
<span class="help-block">Select date range</span>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-4">Reference Number</label>
<div class="col-md-6">
<input class='form-control' type='text' name='reference' />
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-primary" type="submit">Search</button>
</div>
</form>
</div>
</div>
</div>
</section>
</div>
</div>
</section>
</div>
<!-- Placed js at the end of the document so the pages load faster -->
<script src="js/jquery-1.10.2.min.js"></script>
<script src="js/jquery-ui-1.9.2.custom.min.js"></script>
<script src="js/jquery-migrate-1.2.1.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/modernizr.min.js"></script>
<script src="js/jquery.nicescroll.js"></script>
<!--dynamic table-->
<script type="text/javascript" language="javascript" src="js/advanced-datatable/js/jquery.dataTables.js"></script>
<script type="text/javascript" src="js/data-tables/DT_bootstrap.js"></script>
<!--dynamic table initialization -->
<script src="js/dynamic_table_init.js"></script>
<script type="text/javascript" src="js/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
<script type="text/javascript" src="js/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js"></script>
<script type="text/javascript" src="js/bootstrap-daterangepicker/moment.min.js"></script>
<script type="text/javascript" src="js/bootstrap-daterangepicker/daterangepicker.js"></script>
<script type="text/javascript" src="js/bootstrap-colorpicker/js/bootstrap-colorpicker.js"></script>
<script type="text/javascript" src="js/bootstrap-timepicker/js/bootstrap-timepicker.js"></script>
<!--pickers initialization-->
<script src="js/pickers-init.js"></script>
<!--common scripts for all pages-->
<script src="js/scripts.js"></script>
<style type='text/css'>
#exception:hover {
background-color:white;
}
</style>
</body>
</html>