plugin_path . 'includes/models/methods-api.php';
$method = new Methods();
include $controller->plugin_path . 'includes/translations/translations.php';
$txt = new Translation;
$status = sanitize_text_field($_POST['param1']);
$filter_date_from = sanitize_text_field($_POST['param2']);
$filter_date_to = sanitize_text_field($_POST['param3']);
$guest = sanitize_text_field($_POST['param4']);
$filter_timestamp_from = strtotime($filter_date_from);
$filter_timestamp_to = strtotime($filter_date_to);
?>
| txt("Booking ID") ?> |
txt("Date") ?> |
txt("Status") ?> |
txt("Guest") ?> |
prefix . 'hotel_has_booking';
$query_result = $wpdb->get_results("SELECT * FROM `$booking` WHERE status = 2 OR status = 1 OR status = 3",
ARRAY_A);
if ($guest != ''){
$query_result = $wpdb->get_results("SELECT * FROM `$booking` WHERE status = true AND (name LIKE '%$guest%' OR phone LIKE '%$guest%') ",
ARRAY_A);
}
foreach ($query_result as $row):
// Finding the room allocation date range
$booking_id = $row['booking_id'];
$booking_room_table = $wpdb->prefix . 'hotel_has_booking_room';
$room_allocation_minimum_timestamp = $wpdb->get_var("SELECT MIN(checkin_timestamp) FROM $booking_room_table WHERE booking_id = $booking_id");
$room_allocation_maximum_timestamp = $wpdb->get_var("SELECT MAX(checkout_timestamp) FROM $booking_room_table WHERE booking_id = $booking_id");
// Check if this booking is within the filtered date range
if ($status != 2){
$flag = 0;
if ($room_allocation_minimum_timestamp >= $filter_timestamp_from && $room_allocation_minimum_timestamp <= $filter_timestamp_to){
$flag = 1;
}
if ($room_allocation_maximum_timestamp >= $filter_timestamp_from && $room_allocation_maximum_timestamp <= $filter_timestamp_to){
$flag = 1;
}
if ($room_allocation_minimum_timestamp <= $filter_timestamp_from && $room_allocation_maximum_timestamp >= $filter_timestamp_to){
$flag = 1;
}
if ($flag == 0){
continue;
}
}
?>
|
-
|
txt("Pending") ?>txt("Approved") ?>txt("Canceled") ?>
|
|
txt('Total') . ' ' . $counter . ' ' . $txt->txt("bookings found") ?>