function testAllDay($roomID, $roomNumber, $dayto, $daygo) { $n = NumDayStay($dayto, $daygo); $flag = 1; list($day, $month, $year) = split('[-]', $dayto); for ($i = 0; $i < $n; $i++) { $daytest = date($year . "-" . $month . "-" . $day); $day += 1; $listtemp = getroomofdate($daytest); $id_temp = "id_" . $roomID; if (getroomtype($roomID, $listtemp[$id_temp]) < $roomNumber) { $flag = 0; } } return $flag; }
$listing_split1 = new splitPageResults($listing_sql1, MAX_DISPLAY_SEARCH_RESULTS); $listing_query1 = tep_db_query($listing_split1->sql_query); // } //if($count>0) while ($row = tep_db_fetch_array($listing_query1)) { foreach ($_SESSION['cart_room'] as $cartItems) { if ($cartItems['roomtypeId'] == $row[room_type_id]) { try { $sql_data_array = array('detail_booking_form_type_room_id' => $cartItems['roomtypeId'], 'detail_booking_form_id' => $booking_form_id, 'detail_booking_form_dateto' => $cartItems['dayto'], 'detail_booking_form_datego' => $cartItems['daygo'], 'detail_booking_form_staydate' => $cartItems['staydate'], 'detail_booking_form_number_room' => $cartItems['qty'], 'detail_booking_form_price' => $row[room_type_price]); tep_db_perform(detail_booking_form, $sql_data_array); list($year, $month, $day) = split('[-]', $cartItems['dayto']); $n = $cartItems['staydate']; for ($i = 0; $i < $n; $i++) { $daytest = date($year . "-" . $month . "-" . $day); $day += 1; $listing2 = getroomofdate($daytest); $id_status_room = "id_" . $cartItems['roomtypeId']; list($name, $room_id) = split('[_]', $cartItems['roomtypeId']); $num_room = $listing2[$id_status_room] + $cartItems['qty']; tep_db_query("update status_room set " . $id_status_room . " = '" . (int) $num_room . "' where status_room_dayofyear = '" . $daytest . "'"); } } catch (Exception $e) { echo 'Exception caught: ', $e->getMessage(), "\n"; } } } } // echo "ma hoa don".$order_code."hoa don ".$osCsid." ma khach hang: ".$id_customer; $keys = array_search($cartItems, $_SESSION['cart_room']); $html .= "<div align=\"center\">Cảm ơn qúy khách,quá trình thanh toán đã được hoàn tất!</div>"; echo $html;