/
bookings_list.php
227 lines (215 loc) · 7.22 KB
/
bookings_list.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
<?php
session_start();
error_reporting(E_ALL & ~E_NOTICE);
include_once("login_check.inc.php");
include_once ("queryfunctions.php");
include_once ("functions.php");
if (isset($_POST['Submit'])){
$conn=db_connect(HOST,USER,PASS,DB,PORT);
$action=$_POST['Submit'];
switch ($action) {
case 'List':
return;
break;
case 'Find':
//check if user is searching using name, payrollno, national id number or other fields
$search=$_POST["search"];
$sql="Select agentname,agents_ac_no,contact_person,telephone,fax,email,billing_address,town,postal_code,road_street,building From agents where agentcode='$search'";
$results=mkr_query($sql,$conn);
$agent=fetch_object($results);
break;
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="css/new.css" rel="stylesheet" type="text/css">
<title>Hotel Management Information System</title>
<script type="text/javascript">
<!--
var request;
var dest;
function loadHTML(URL, destination){
dest = destination;
if (window.XMLHttpRequest){
request = new XMLHttpRequest();
request.onreadystatechange = processStateChange;
request.open("GET", URL, true);
request.send(null);
} else if (window.ActiveXObject) {
request = new ActiveXObject("Microsoft.XMLHTTP");
if (request) {
request.onreadystatechange = processStateChange;
request.open("GET", URL, true);
request.send();
}
}
}
function processStateChange(){
if (request.readyState == 4){
contentDiv = document.getElementById(dest);
if (request.status == 200){
response = request.responseText;
contentDiv.innerHTML = response;
} else {
contentDiv.innerHTML = "Error: Status "+request.status;
}
}
}
function loadHTMLPost(URL, destination){
dest = destination;
if (window.XMLHttpRequest){
request = new XMLHttpRequest();
request.onreadystatechange = processStateChange;
request.open("POST", URL, true);
request.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
request.setRequestHeader("Content-length", parameters.length);
request.setRequestHeader("Connection", "close");
request.send("good");
} else if (window.ActiveXObject) {
request = new ActiveXObject("Microsoft.XMLHTTP");
if (request) {
request.onreadystatechange = processStateChange;
request.open("POST", URL, true);
request.send();
}
}
}
//-->
</script>
<script language="JavaScript" src="js/highlight.js" type="text/javascript"></script>
</head>
<body>
<form action="bookings.php" method="post" enctype="multipart/form-data">
<table width="100%" border="0" cellpadding="1" align="center" bgcolor="#66CCCC">
<tr valign="top">
<td width="17%" bgcolor="#FFFFFF">
<table width="100%" border="0" cellpadding="1">
<tr>
<td width="15%" bgcolor="#66CCCC">
<table cellspacing=0 cellpadding=0 width="100%" align="left" bgcolor="#FFFFFF">
<tr><td width="110" align="center"><a href="index.php"><img src="images/titanic1.gif" width="70" height="74" border="0"/><br>
Home</a></td>
</tr>
<tr><td> </td>
</tr>
<tr>
<td align="center">
<?php signon(); ?>
</td></tr>
</table></td></tr>
<?php require_once("menu_header.php"); ?>
</table>
</td>
<td width="67%" bgcolor="#FFFFFF"><table width="100%" border="0" cellpadding="1">
<tr>
<td align="center"></td>
</tr>
<tr>
<td>
<h2>Booking List </h2>
</td>
</tr>
<tr>
<td><div id="Requests">
<?php
$sql="Select guests.guestid,concat_ws(' ',guests.firstname,guests.middlename,guests.lastname) as guest,booking.checkin_date,
booking.checkout_date,DATEDIFF(booking.checkout_date,booking.checkin_date) nights,
booking.meal_plan,booking.no_adults,booking.no_child,booking.roomid,booking.checkedin_by,rooms.roomno,booking.book_id
From booking
Inner Join guests ON booking.guestid = guests.guestid
Inner Join rooms ON booking.roomid = rooms.roomid";
$conn=db_connect(HOST,USER,PASS,DB,PORT);
$results=mkr_query($sql,$conn);
echo "<table align=\"center\">";
//get field names to create the column header
echo "<tr bgcolor=\"#009999\">
<th colspan=\"2\">Action</th>
<th>Room No.</th>
<th>Guest</th>
<th>Meal Plan</th>
<th>Check-In Date</th>
<th>Check-Out Date</th>
<th>Nights</th>
<th>Adults</th>
<th>Children</th>
</tr>";
//end of field header
//get data from selected table on the selected fields
while ($booking = fetch_object($results)) {
//alternate row colour
$j++;
if($j%2==1){
echo "<tr id=\"row$j\" onmouseover=\"javascript:setColor('$j')\" onmouseout=\"javascript:origColor('$j')\" bgcolor=\"#CCCCCC\">";
}else{
echo "<tr id=\"row$j\" onmouseover=\"javascript:setColor('$j')\" onmouseout=\"javascript:origColor('$j')\" bgcolor=\"#EEEEF8\">";
}
echo "<td><a href=\"bookings.php?search=$booking->book_id\"><img src=\"images/button_view.png\" width=\"16\" height=\"16\" border=\"0\" title=\"view booking details\"/></a></td>";
echo "<td><a href=\"billings.php?search=$booking->guestid\"><img src=\"images/button_signout.png\" width=\"16\" height=\"16\" border=\"0\" title=\"bill guest\"/></a></td>";
echo "<td>" . $booking->roomno . "</td>";
echo "<td>" . trim($booking->guest) . "</td>";
echo "<td>" . $booking->meal_plan . "</td>";
echo "<td>" . $booking->checkin_date . "</td>";
echo "<td>" . $booking->checkout_date . "</td>";
echo "<td>" . $booking->nights . "</td>";
echo "<td>" . $booking->no_adults . "</td>";
echo "<td>" . $booking->no_child . "</td>";
echo "</tr>"; //end of - data rows
} //end of while row
echo "</table>";
?>
</div></td>
</tr>
<tr bgcolor="#66CCCC" >
<td align="left"><div id="RequestDetails"></div>
</td>
</tr>
</table></td>
<td width="16%" bgcolor="#FFFFFF">
<table width="100%" border="0" cellpadding="1">
<tr>
<td width="15%" bgcolor="#66CCCC">
<table width="100%" border="0" cellpadding="1" bgcolor="#FFFFFF">
<tr>
<td>Image</td>
</tr>
<tr>
<td><input type="button" name="Submit" value="List" onclick="self.location='bookings_list.php'"/></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td>
<label> Search By:<br />
<input type="radio" name="optFind" value="Name" />
Card No.</label>
<br />
<label>
<input type="radio" name="optFind" value="Payrollno" />
Room No. </label>
<br>
<input type="text" name="search" width="100" /><br>
<input type="submit" name="Submit" value="Find"/>
</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</td></tr></table>
</td>
</tr>
<?php require_once("footer1.php"); ?>
</table>
</form>
</body>
</html>