-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbus-booking-history.php
More file actions
342 lines (243 loc) · 10.1 KB
/
bus-booking-history.php
File metadata and controls
342 lines (243 loc) · 10.1 KB
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
342
<?php
session_start();
error_reporting(0);
include('includes/config.php');
include('includes/config1.php');
$useremail=$_SESSION['login'];
$sql12 = "SELECT id from tblusers WHERE EmailId = '$useremail'";
$result12=mysqli_query($conn,$sql12);
if (mysqli_num_rows($result12) > 0){
$row = mysqli_fetch_assoc($result12);
$userid = $row['id'];
}
if(isset($_REQUEST['tkbid']))
{
$bid=intval($_GET['tkbid']);
$status=1;
$sql = "UPDATE tblusrtktbook SET status=:status WHERE bookid=:bid";
$query = $dbh->prepare($sql);
$query -> bindParam(':status',$status, PDO::PARAM_STR);
$query-> bindParam(':bid',$bid, PDO::PARAM_STR);
$query -> execute();
if($query->rowCount() > 0){
$msg="Booking Cancelled successfully";
}
}
?>
<!DOCTYPE HTML>
<html>
<head>
<title>TMS | Package Details</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="applijewelleryion/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
<link href="css/bootstrap.css" rel='stylesheet' type='text/css' />
<link href="css/style.css" rel='stylesheet' type='text/css' />
<link href='//fonts.googleapis.com/css?family=Open+Sans:400,700,600' rel='stylesheet' type='text/css'>
<link href='//fonts.googleapis.com/css?family=Roboto+Condensed:400,700,300' rel='stylesheet' type='text/css'>
<link href='//fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'>
<link href="css/font-awesome.css" rel="stylesheet">
<!-- Custom Theme files -->
<script src="js/jquery-1.12.0.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<!--animate-->
<link href="css/animate.css" rel="stylesheet" type="text/css" media="all">
<script src="js/wow.min.js"></script>
<link rel="stylesheet" href="css/jquery-ui.css" />
<script>
new WOW().init();
</script>
<script src="js/jquery-ui.js"></script>
<script>
$(function() {
$( "#datepicker,#datepicker1" ).datepicker();
});
</script>
<style>
.errorWrap {
padding: 10px;
margin: 0 0 20px 0;
background: #fff;
border-left: 4px solid #dd3d36;
-webkit-box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
}
.succWrap{
padding: 10px;
margin: 0 0 20px 0;
background: #fff;
border-left: 4px solid #5cb85c;
-webkit-box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
}
</style>
</head>
<body>
<!-- top-header -->
<?php include('includes/header.php');?>
<div class="banner-3">
<div class="container">
<h1 class="wow zoomIn animated animated" data-wow-delay=".5s" style="visibility: visible; animation-delay: 0.5s; animation-name: zoomIn;"> Tours and Travel</h1>
</div>
</div>
<!--- /banner ---->
<!--- selectroom ---->
<div class="selectroom">
<div class="container">
<?php if($error){?><div class="errorWrap"><strong>ERROR</strong>:<?php echo htmlentities($error); ?> </div><?php }
else if($msg){?><div class="succWrap"><strong>SUCCESS</strong>:<?php echo htmlentities($msg); ?> </div><?php }?>
<?php
$pid=intval($_GET['pkgid']);?>
<div class="row d-flex">
<div class="col-md-12">
<table id="example" class="table table-striped table-bordered" style="width:100%">
<thead>
<tr>
<th style="text-align: center;">#</th>
<th style="text-align: center;">Bus Name</th>
<th style="text-align: center;">Bus Number</th>
<th style="text-align: center;">Bus Route</th>
<th style="text-align: center;">Departing Date</th>
<th style="text-align: center;">Seat Number</th>
<th style="text-align: center;">Total Price</th>
<th style="text-align: center;">Action</th>
</tr>
</thead>
<tbody>
<?php
/*$ql = "";
$quer = $dbh->prepare($ql);
$quer->execute();
$resul=$quer->fetchAll(PDO::FETCH_OBJ);
if($quer->rowCount() > 0)
{
foreach($resul as $result1)
{
$brid = $result1->brid;
}
}*/
$sql="SELECT * FROM `tblusrtktbook` WHERE userid = '$userid' GROUP BY bookid ORDER BY bkdate DESC";
$query1=$dbh->prepare($sql);
$query1->execute();
$result2 = $query1->fetchAll(PDO::FETCH_OBJ);
$cnt=1;
if($query1->rowCount() > 0)
{
foreach ($result2 as $fetch1) {
?>
<tr>
<td style="text-align: center;"><?php echo $cnt; ?></td>
<td style="text-align: center;"><?php ;?>
<?php
$pkid = $fetch1->busid;
$sql16 = "SELECT * from tblbus where busid= '$pkid' ";
$result16=mysqli_query($conn,$sql16);
if (mysqli_num_rows($result16) > 0){
$row2 = mysqli_fetch_assoc($result16);
print $row2['busname'];
?>
</td>
<td style="text-align: center;"><?php print $row2['busnumber'];?></td>
<td style="text-align: center;"><?php
$routeid = $row2['busroute'];
$sql20 = "SELECT * from tblbusroute where brid= '$routeid' ";
$result20=mysqli_query($conn,$sql20);
$row3 = mysqli_fetch_assoc($result20);
if (mysqli_num_rows($result20)>0){
print $row3['busfrom'].' to '.$row3['busto'];}
?></td>
<td style="text-align: center;">
<?php
$bookdate = $row2['busdate'];
$bookdate = date('d-m-Y',strtotime($bookdate));
echo $bookdate;
?> </td>
<td style="text-align: center;">
<?php
$busid = $fetch1->busid;
$status = $fetch1->bookid;
$sql21="SELECT seatnumber from tblusrtktbook where busid = $busid AND userid = '$userid' AND bookid = '$status' ";
$query21=$dbh->prepare($sql21);
$query21->execute();
$result21 = $query21->fetchAll(PDO::FETCH_OBJ);
if($query21->rowCount() > 0)
{
foreach ($result21 as $fetch21){
echo htmlentities($fetch21->seatnumber); echo " ";}}
?>
</td>
<td style="text-align: center;">
<?php
$busid = $fetch1->busid;
$sql22="SELECT count(seatnumber) as seatvalue from tblusrtktbook where busid = $busid AND userid = '$userid' AND bookid = '$status'";
$query22=$dbh->prepare($sql22);
$query22->execute();
$result22 = $query22->fetchAll(PDO::FETCH_OBJ);
if($query22->rowCount() > 0)
{
foreach ($result22 as $fetch22){
$val1 = ($fetch22->seatvalue);
$val2 = $row2['bustktprice'];
$totalamount = $val1*$val2;
print $totalamount."TK";
}
}
?>
</td>
<td style="text-align: center;">
<?php
$status = $fetch1->status;
$pkbid = $fetch1->bookid;
if ($status == 1){ ?>
<a href="#" href="" class="btn btn-danger">Cancelled</a> <?php } ?>
<?php }
if($status == 2){ ?>
<a href="#" href="" class="btn btn-success">Paid</a>
<a href="ticket-invoice.php?bktid=<?php echo htmlentities($fetch1->bookid); ?>" class="btn btn-success">Invoice</a>
<?php }
if ($status == 0) { ?>
<!--<button class="btn btn-danger" type="submit" name="cancel">Cancel</button> -->
<a href="bus-booking-history.php?tkbid=<?php echo $pkbid; ?>" class="btn btn-danger" onclick="return confirm('Do you really want to cancel booking')">cancel</a>
<a href="payment.php?amount=<?php print $totalamount; ?>&bktid=<?php echo htmlentities($fetch1->bookid); ?> " class="btn btn-success ml-2">Pay</a>
<a href="ticket-invoice.php?bktid=<?php echo htmlentities($fetch1->bookid); ?>" class="btn btn-success">Invoice</a>
<?php }?>
</form>
<a href="history.php?delid=<?php echo $pkbid; ?>" class="btn" onclick="return confirm('Are you sure you want to delete this item?');"><i class="fas fa-trash-alt"></i></a>
</td>
</tr>
<?php $cnt=$cnt+1; }} ?>
</tbody>
</table>
</div> <!--col end-->
<!-- <div class="col-md-6">
<table id="example" class="table table-striped table-bordered" style="width:100%">
<thead>
<tr>
<th style="text-align: center;">#</th>
<th style="text-align: center;">Bus Name</th>
<th style="text-align: center;">Total Seat</th>
<th style="text-align: center;">Ticket Price</th>
<th style="text-align: center;">Departing Time</th>
<th style="text-align: center;">Action</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div> -->
</div>
</div>
</div>
<!--- /selectroom ---->
<<!--- /footer-top ---->
<?php include('includes/footer.php');?>
<!-- signup -->
<?php include('includes/signup.php');?>
<!-- //signu -->
<!-- signin -->
<?php include('includes/signin.php');?>
<!-- //signin -->
<!-- write us -->
<?php include('includes/write-us.php');?>
</body>
</html>