-
Notifications
You must be signed in to change notification settings - Fork 0
/
buku_tamu_fungsi.php
executable file
·261 lines (254 loc) · 9.75 KB
/
buku_tamu_fungsi.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
<?php
session_start();
include_once 'koneksi.php';
if (isset($_SESSION['username']) || isset($_SESSION['fungsi'])){
?>
<!DOCTYPE html>
<html>
<head>
<title><?php echo $_SESSION['fungsi']; ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" sizes="250x250" href="img/logo.png">
<link href="css/bootstrap.css" rel="stylesheet">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/admin.css" rel="stylesheet">
<link rel="stylesheet" href="css/jquery-ui.css">
<link href="css/bootstrap-datepicker.css" rel="stylesheet"/>
<script type="text/javascript" src="js/jam.js"></script>
<style>
.report{
width: 100px;
}
.form-group{
margin-top: 5px;
margin-left: 7%;
}
.col-md-12{margin-left: 15px}
button.btn{
margin-right: 80%;
}
</style>
</head>
<body onload="tampilkanwaktu();setInterval('tampilkanwaktu()', 1000);">
<?php include_once 'menu.php'; ?>
<section class="content row">
<?php include_once 'nav.php'; ?>
<section class="main-content col-md-10 text-center">
<div class="row" style="margin-top: 10px;">
<h1>Buku Tamu</h1><br/>
<div class="col-md-6">
<form method="POST" action="?tampil=hari" class="form-horizontal" role="form">
<div class="form-group">
<label style="padding-left: 15px; text-align: left; padding-right: 0;" for="firstname" class="col-md-offset-2 col-md-2 control-label">Perhari</label>
<div class="col-md-3" style="padding-right: 0;">
<input type="text" name="tgl" class="form-control" id="tgl_hari" placeholder="dd/mm/yyyy">
</div>
<div class="col-md-3" style="padding-left: 0;">
<button type="submit" class="btn btn-success">OK</button>
</div>
</div>
</form>
<form class="form-horizontal" action="?tampil=bulan" method="POST" role="form">
<div class="form-group">
<label style="padding-left: 15px;text-align: left;padding-right: 0;" for="firstname" class="col-md-offset-2 col-md-2 control-label">Perbulan</label>
<div class="col-md-3" style="padding-right: 0;">
<input type="text" name="bulan" class="form-control" id="tgl_bulan" placeholder="mm/yyyy">
</div>
<div class="col-md-3" style="padding-left: 0;">
<button type="submit" class="btn btn-success">OK</button>
</div>
</div>
</form>
</div>
<div class="col-md-6">
<div class="row">
<div class="col-md-10" style="text-align: right; padding-top: 5px;"><a href="" class="btn btn-success report" style="width: 20%; padding-left: initial;"><span class="glyphicon glyphicon-print" style="width: 45%"></span>PDF</a></div>
<div class="col-md-10" style="text-align: right; padding-top: 15px;"><a href="" class="btn btn-success report" style="width: 20%; padding-left: initial;"><span class="glyphicon glyphicon-print" style="width: 45%"></span>EXCEL</a></div>
</div>
</div>
<div class="col-md-10 col-md-offset-1">
<table class="table table-striped">
<?php
@$tampil = $_GET['tampil'];
if($tampil == 'hari'){
?>
<thead style=" background: #06a0e9;">
<tr>
<td>No</td>
<td>Nama</td>
<td>Asal/Instansi/lembaga</td>
<td>Keperluan</td>
<td>No Visitor</td>
<td>Waktu Masuk</td>
<td>Waktu Keluar</td>
</tr>
</thead>
<tbody>
<?php
$tgl = @$_POST['tgl'];
$exp = explode('-',$tgl);
$query = mysqli_query($koneksi,"SELECT pengunjung.id_pengunjung, buku_tamu.asal, pengunjung.nama, buku_tamu.keperluan, buku_tamu.no_visitor, buku_tamu.masuk, buku_tamu.keluar FROM pengunjung, buku_tamu WHERE pengunjung.id_pengunjung = buku_tamu.id_pengunjung
AND year(buku_tamu.masuk) = '$exp[2]'
AND month(buku_tamu.masuk) = '$exp[1]'
AND day(buku_tamu.masuk) = '$exp[0]'
ORDER BY buku_tamu.masuk ASC");
$no = 1;
while (@$data = mysqli_fetch_array($query)) {
?>
<tr>
<td><?php echo $no++; ?></td>
<td><?php echo $data['nama']; ?></td>
<td><?php echo $data['asal']; ?></td>
<td><?php echo $data['keperluan']; ?></td>
<td style="text-align: center;">
<span class="label label-info"><?php echo $data['no_visitor']; ?></span>
</td>
<td>
<?php
$space1 = explode(' ',$data['masuk']);
// $data['masuk'];
echo '<STRONG style="color:#5cb85c;">'.$space1[1].'</STRONG>';
?>
</td>
<td>
<?php
$keluar =$data['keluar'];
$space2 = explode(' ',$data['keluar']);
if($keluar == ""){
// echo '<a id="myButton1" data-end-text="The End" data-load-text="Loading..." class="btn btn-danger waktu-keluar" href="keluar.php?id='.$data['id_pengunjung'].'&waktu='.$data['masuk'].'" autocomplete="off">Keluar</a>';
echo '<STRONG style="color:#428bca;">BELUM KELUAR</STRONG>';
} else if($keluar != ""){
echo '<STRONG style="color:#d9534f;">'.$space2[1].'</STRONG>';
}
?>
</td>
<?php
}
} else if($tampil == 'bulan'){
?>
<thead style="background: #06a0e9;">
<tr>
<td>No</td>
<td>Tanggal</td>
<td>Nama</td>
<td>Asal/Instansi/lembaga</td>
<td>Keperluan</td>
<td>No Visitor</td>
<td>Waktu Masuk</td>
<td>Waktu Keluar</td>
</tr>
</thead>
<tbody>
<?php
$bulan = @$_POST['bulan'];
$exp = explode('-',$bulan);
$query = mysqli_query($koneksi,"SELECT pengunjung.id_pengunjung, buku_tamu.asal, pengunjung.nama, buku_tamu.keperluan, buku_tamu.no_visitor, buku_tamu.masuk, buku_tamu.keluar FROM pengunjung, buku_tamu WHERE pengunjung.id_pengunjung = buku_tamu.id_pengunjung
AND year(buku_tamu.masuk) = '$exp[1]'
AND month(buku_tamu.masuk) = '$exp[0]'
ORDER BY buku_tamu.masuk ASC");
$no = 1;
while (@$data = mysqli_fetch_array($query)) {
?>
<tr>
<td><?php echo $no++; ?></td>
<td>
<?php
$exp_bln = explode(' ',$data['masuk']);
echo $exp_bln[0];
?>
</td>
<td><?php echo $data['nama']; ?></td>
<td><?php echo $data['asal']; ?></td>
<td><?php echo $data['keperluan']; ?></td>
<td style="text-align: center;">
<span class="label label-info"><?php echo $data['no_visitor']; ?></span>
</td>
<td>
<?php
$space1 = explode(' ',$data['masuk']);
echo $space1[1];
?>
</td>
<td>
<?php
$keluar =$data['keluar'];
$space2 = explode(' ',$data['keluar']);
if($keluar == ""){
// echo '<a id="myButton1" data-end-text="The End" data-load-text="Loading..." class="btn btn-danger waktu-keluar" href="keluar.php?id='.$data['id_pengunjung'].'&waktu='.$data['masuk'].'" autocomplete="off">Keluar</a>';
echo "BELUM KELUAR";
} else if($keluar != ""){
echo $space2[1];
}
?>
</td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
</div>
</section>
</section>
<?php include_once 'footer.php'; ?>
<div class="modal fade" id="myModal" 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" id="myModalLabel">
This Modal title
</h4>
</div>
<div class="modal-body">
Press ESC button to exit.
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default"
data-dismiss="modal">Close
</button>
<button type="button" class="btn btn-primary">
Submit changes
</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div>
<script src="js/jquery-3.1.1.js"></script>
<script src="js/jquery-ui.js"></script>
<script src="js/bootstrap.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/bootstrap-datepicker.js"></script>
<script>
$(function() {
$('#tgl_hari').datepicker({
format: "dd-mm-yyyy",
// format: "yyyy-mm-dd",
autoclose:true
});
$('#tgl_bulan').datepicker({
format: "mm-yyyy",
// format: "yyyy-mm-dd",
autoclose:true
});
$('#myButton1').on("click", function() {
$('#myButton1').button("load");
setTimeout(function() {
$('#myButton1').button("end");
$('#myButton1').attr('disabled', 'disabled');
}, 1000);
});
} );
</script>
</body>
</html>
<?php
} else {
header("location: index.php");
}
?>