} if (substr($key,0,2) == "ex" && substr($key,2) == $_REQUEST["booking_id"]) { $ex=$value; $error_ex="input"; if (!is_numeric($ex)) { $error=1; $error_ex="class=input_error"; } } if (substr($key,0,2) == "re" && substr($key,2) == $_REQUEST["booking_id"]) { $re=$value; $error_re="input"; if (!is_numeric($re)) { $error=1; $error_re="class=input_error"; } } if (substr($key,0,2) == "in" && substr($key,2) == $_REQUEST["booking_id"]) { $in=$value; } if (substr($key,0,2) == "ad" && substr($key,2) == $_REQUEST["booking_id"]) { $ad = change_format_date($value); } } if (!$error) { $q="UPDATE bookings SET weekly_rate=$ra, laundry=$la, hc=$hc, printing=$pr, extra=$ex, received=$re, invoice_number='$in', departure='$ad' WHERE booking_id={$_REQUEST[booking_id]}"; //ver("q",$q); $r=mysql_query($q); } } if ($_REQUEST[operation]=="delete") { $q="DELETE FROM bookings WHERE booking_id={$_REQUEST[booking_id]}"; $r=mysql_query($q); // Now we check if this resident doesn't have any other booking. If it is true then we move him to received applications. $q="SELECT * FROM bookings WHERE resident_id={$_REQUEST[resident_id]}";
<script language="JavaScript"> new tcal ({ 'formname': 'myform', 'controlname': 'date_to' }); </script> </td>--> </tr> </form> </table> <br> <?php //ver_array("SESSION",$_SESSION); if (!$request['date_from'] && !$request['date_to'] && !$request['resident_id'] || $request["operation"] == "find") { $fr_pre = change_format_date($date_fr); $to_pre = change_format_date($date_to); $time = strtotime($fr_pre); $fr = date("Y/m/d", $time); $to = date("Y/m/d", $time); $r = mysql_query("SELECT * FROM rooms ORDER BY room"); if ($error) { ?> <p class="question" align="center"><?php echo $error; ?> </p><?php } ?> <table align="center" border="0" cellpadding="10" cellspacing="0"> <?php $i = 0;
foreach ($request as $key => $value) { if (substr($key, 0, 11) == "resident_id") { $id = $value; // Rules Date $rules_date = $request['rdate' . $id]; if ($rules_date == "" || $rules_date != "" && valid_date($rules_date)) { $rules_date = change_format_date($rules_date); $q = "UPDATE residents SET rules_date='{$rules_date}' WHERE resident_id={$id}"; $r = mysql_query($q); } else { $error = TRUE; } // Offered Date $offered_date = $request['odate' . $id]; if ($offered_date == "" || $offered_date != "" && valid_date($offered_date)) { $offered_date = change_format_date($offered_date); $q = "UPDATE residents SET offered_date='{$offered_date}' WHERE resident_id={$id}"; $r = mysql_query($q); } else { $error = TRUE; } $q1 = "UPDATE residents SET rules=0 WHERE resident_id={$id}"; //ver("q",$q); $r1 = mysql_query($q1); $q2 = "UPDATE residents SET interview=0 WHERE resident_id={$id}"; //ver("q",$q); $r2 = mysql_query($q2); $q3 = "UPDATE residents SET offered=0 WHERE resident_id={$id}"; //ver("q",$q); $r3 = mysql_query($q3); }
<td>To Date</td> <td> <input type="text" name="date_to" value="<?php echo $request['date_to']; ?> " /> <script language="JavaScript"> new tcal ({ 'formname': 'myform', 'controlname': 'date_to'}); </script> </td> </tr> </table> <br> <?php button("javascript:find_rooms()", "Find Rooms"); if ($request["operation"] == "find" || $request["operation"] == "book") { $date_fr_pre = change_format_date($request[date_from]); $date_to_pre = change_format_date($request[date_to]); // We add one day to the from date. Because the departure date is free. And we rest one for the same reason. $timefr_pre = strtotime($date_fr_pre); $timefr = $timefr_pre + 1 * 24 * 60 * 60; $date_fr = date("Y/m/d", $timefr); $timeto_pre = strtotime($date_to_pre); $timeto = $timeto_pre - 1 * 24 * 60 * 60; $date_to = date("Y/m/d", $timeto); $q = "SELECT room_id, room FROM rooms WHERE room_id NOT IN ( " . " SELECT room_id FROM bookings WHERE " . " bookings.arrival BETWEEN '{$date_fr}' AND '{$date_to}' OR " . " bookings.planned_departure BETWEEN '{$date_fr}' AND '{$date_to}' OR " . " (bookings.arrival <= '{$date_fr}' AND bookings.planned_departure >= '{$date_to}') ) " . "ORDER BY room"; $r = mysql_query($q); if ($error) { ?> <p class="question" align="center"><?php echo $error; ?> </p><?php