-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhotelbookingreceipt.php
277 lines (258 loc) · 9.56 KB
/
hotelbookingreceipt.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
<?php
include("header.php");
$sqlpayment = "SELECT * FROM payment LEFT JOIN customer ON payment.customer_id=customer.customer_id LEFT JOIN room_booking ON room_booking.room_booking_id = payment.room_booking_id WHERE payment_id='$_GET[paymentid]'";
$qsqlpayment = mysqli_query($con, $sqlpayment);
$rspayment = mysqli_fetch_array($qsqlpayment);
?>
<!-- Sub Banner Start -->
<div class="mg_sub_banner">
<div class="container">
<h2>Hotel Booking Payment Receipt</h2>
</div>
</div>
<!-- Sub Banner Start -->
<!--start main -->
<div class="main_bg">
<div class="wrap">
<div class="main">
<div>
<div>
<div>
<div class="col-md-12" id="divprintarea">
<div>
<table class="table table-bordered">
<thead>
<tr>
<th colspan="2">
<center>
<img src="images/findmystay1.png" alt="" width="250px;" style="height:80px;"><br>
Visit Lanka<br>
ABC avenue, Colombo<br>
Sri Lanka
</center>
</th>
</tr>
<tr>
<th style="width:50%">Name : <?php echo $rspayment['customer_name']; ?></td>
<th style="width:50%">Bill No. <?php echo $rspayment['payment_id']; ?></th>
</tr>
<tr>
<th style="width:50%">
Address:<br> <?php echo $rspayment['address']; ?>, <?php echo $rspayment['city']; ?>, <?php echo $rspayment['pincode']; ?><br>
Contact No. <?php echo $rspayment['contact_no']; ?><br>
Email ID. <?php echo $rspayment['email_id']; ?>
</th>
<th style="width:50%;">
Bill Date: <?php echo date("d-M-Y", strtotime($rspayment['payment_date'])); ?>
<hr>
Note: <br>
<?php echo $rspayment['note']; ?>
</th>
</tr>
</tbody>
</table>
<table id="dataTable" class="table table-striped table-bordered" cellspacing="0" width="100%">
<thead>
<tr>
<th>Bill No.</th>
<th>Hotel</th>
<th>Room Type</th>
<?php
if (!isset($_SESSION['customer_id'])) {
?>
<th>Customer</th>
<?php
}
?>
<th>Booked for</th>
<th>Booking date</th>
<th>Cost</th>
</tr>
</thead>
<tbody>
<?php
$sql = "SELECT * FROM room_booking LEFT JOIN hotel ON room_booking.hotel_id=hotel.hotel_id LEFT JOIN room_type ON room_booking.room_typeid=room_type.room_typeid LEFT JOIN customer ON room_booking.customer_id=customer.customer_id LEFT JOIN payment ON payment.room_booking_id=room_booking.room_booking_id WHERE room_booking.status='Active' AND payment.food_order_id='0' AND payment.cab_bookingid='0'";
if (isset($_SESSION['customer_id'])) {
$sql = $sql . " AND room_booking.customer_id='$_SESSION[customer_id]'";
}
$sql = $sql . " AND payment.payment_id='$_GET[paymentid]' ORDER BY room_booking.room_booking_id desc";
$qsql = mysqli_query($con, $sql);
echo mysqli_error($con);
while ($rs = mysqli_fetch_array($qsql)) {
$sqlhotel_image = "SELECT * FROM hotel_image WHERE hotel_id='$rs[1]' AND room_typeid='$rs[room_typeid]'";
$qsqlhotel_image = mysqli_query($con, $sqlhotel_image);
$rshotel_image = mysqli_fetch_array($qsqlhotel_image);
$hotname = $rs['hotel_name'];
if (mysqli_num_rows($qsqlhotel_image) == 0) {
$imgname = "images/noimage.png";
} else {
if (file_exists("imghotel/$rshotel_image[hotel_image]")) {
$imgname = "imghotel/$rshotel_image[hotel_image]";
} else {
$imgname = "images/noimage.png";
}
}
$checkin = date("d-M-Y", strtotime($rs['check_in']));
$checkout = date("d-M-Y", strtotime($rs['check_out']));
$checkintime = date("h:i A", strtotime($rs['checkintime']));
$checkouttime = date("h:i A", strtotime($rs['checkouttime']));
echo "<tr>
<th>
<center>
<p style='color:red;font-size:25px;'><br>
$rs[payment_id]</p>
</center>
</th>
<td>$rs[hotel_image] $rs[hotel_name]<br><img src='$imgname' style='width:150px;height:100px;'></td>
<td>$rs[room_type]<br>(Rs. $rs[cost] / day)</td>";
if (!isset($_SESSION['customer_id'])) {
echo "<td>$rs[customer_name]</td>";
}
echo "<td>Adults : $rs[no_ofadults]<br>Children: $rs[no_ofchildren]</td>
<td>
<b>CheckIn :</b><br>$checkin $checkintime <br><b>Checkout :</b><br>$checkout $checkouttime<br><b style='color:green;'>";
$checkin = strtotime($rs['check_in']);
$checkout = strtotime($rs['check_out']);
$datediff = $checkout - $checkin;
$nodays = round($datediff / (60 * 60 * 24));
$nodays = $nodays + 1;
if ($nodays == 1) {
echo $nodays . " Day";
} else {
echo $nodays . " Days";
}
$total = ($rs['cost'] * $nodays) - $rs['discount_amount'];
echo "</b></td>
<td>Rs. " . $total . "</td></tr>";
}
?>
</tbody>
</table>
<table class="table table-bordered">
<thead>
<tr>
<th style="width:75%;">Description</th>
<th style="width:25%;">Amount</th>
</tr>
</thead>
<tbody>
<tr>
<td>Room booking </td>
<td>Rs. <?php echo $rspayment['total_amt']; ?></td>
</tr>
<?php
if ($rspayment['discount_amount'] != 0) {
?>
<tr>
<td class="text-right">
<h4><strong>Sub Total: </strong></h4>
</td>
<td class="text-left text-danger">
<h4>Rs. <?php echo $rspayment['total_amt']; ?></strong></h4>
</td>
</tr>
<tr>
<td class="text-right">
<h4><strong>Discount Amount: </strong></h4>
</td>
<td class="text-left text-danger">
<h4>Rs. <?php echo $rspayment['discount_amount']; ?></strong></h4>
</td>
</tr>
<tr>
<td class="text-right">
<h4><strong>Total Amount: </strong></h4>
</td>
<td class="text-left text-danger">
<h4>Rs. <?php echo $totamt = $rspayment['total_amt'] - $rspayment['discount_amount']; ?></strong></h4>
</td>
</tr>
<?php
} else {
?>
<tr>
<td class="text-right">
<h2><strong>Total: </strong></h2>
</td>
<td class="text-left text-danger">
<h2>Rs. <?php echo $totamt = $rspayment['total_amt']; ?></strong></h2>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<hr>
<h2>Tax Receipt:</h2>
<table class="table table-bordered">
<thead>
<tr>
<th rowspan="2" style="width: 450px;text-align: center;">Description<br> </th>
<th rowspan="2" style="text-align: center;">Taxable Value<br> </th>
<th colspan="2" style="text-align: center;">GST Tax</th>
<th colspan="2" style="text-align: center;">Economic Service Charge (ESC)</th>
</tr>
<tr>
<th style="text-align: center;">Rate</th>
<th style="text-align: center;">Amount</th>
<th style="text-align: center;">Rate</th>
<th style="text-align: center;">Amount</th>
</tr>
<tr>
<td style="text-align: center;"><?php echo $hotname; ?></td>
<td style="text-align: center;">Rs. <?php echo $totamt; ?></td>
<td style="text-align: center;">7%</td>
<td style="text-align: center;">Rs. <?php
echo $cgst = ($totamt * 7 / 100);
?></td>
<td style="text-align: center;">7%</td>
<td style="text-align: center;">Rs. <?php
echo $cgst = ($totamt * 7 / 100);
?></td>
</tr>
<tr>
<th style="text-align: right;">Total</th>
<th style="text-align: center;">Rs. <?php echo $totamt; ?></th>
<th style="text-align: center;">5%</th>
<th style="text-align: center;">Rs. <?php
echo $cgst = ($totamt * 5 / 100);
?></th>
<th style="text-align: center;">5%</th>
<th style="text-align: center;">Rs. <?php
echo $cgst = ($totamt * 5 / 100);
?></th>
</tr>
</thead>
</tbody>
</table>
<hr>
<center><input type="button" class="btn btn-info" value="Print" style="width:500px;" onclick="PrintElem('divprintarea')"></center>
<hr>
</div>
</div>
</div>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</div>
<!--start main -->
<?php
include("footer.php");
?>
<script>
function PrintElem(elem) {
var mywindow = window.open('', 'PRINT', 'height=400,width=600');
mywindow.document.write('<html><head><title>' + document.title + '</title>');
mywindow.document.write('</head><body >');
mywindow.document.write('<h1>' + document.title + '</h1>');
mywindow.document.write(document.getElementById(elem).innerHTML);
mywindow.document.write('</body></html>');
mywindow.document.close(); // necessary for IE >= 10
mywindow.focus(); // necessary for IE >= 10*/
mywindow.print();
return true;
}
</script>