Esempio n. 1
0
 if ($payment_methods_id == 0) {
     $error = "Please select your preferred payment method";
     $focusId = "pay";
     $showFormPage = 4;
 } else {
     if (BookingsHelper::bookingExists($db, $email, $depart . ":00", $arrive . ":00")) {
         $error = "You have already requested a booking for these arrival and departure times.";
         $focusId = "email";
     } else {
         if (!$accepted_terms) {
             $error = "Please accept our terms and conditions";
             $focusId = "accept_terms";
             $showFormPage = 4;
         } else {
             // all good, insert booking
             $suggested_time_datetime = new DateTimeWrapper(0, $depart . ":00", -$suggested_time * 60);
             $keys = array();
             $keys[] = "first_name";
             $keys[] = "last_name";
             $keys[] = "email";
             $keys[] = "phone";
             $keys[] = "make";
             $keys[] = "reg";
             $keys[] = "colour";
             $keys[] = "flight";
             $keys[] = "depart";
             $keys[] = "arrive";
             $keys[] = "meet";
             $keys[] = "payment_methods_id";
             $keys[] = "statii_id";
             $values = array();
Esempio n. 2
0
$departure_value = "";
$quote = 0;
if ($_POST) {
    $arrival_value = $_POST['arrive'];
    $departure_value = $_POST['depart'];
    $valid_arrival = ValidationHelper::isMySqlDateTime($arrival_value, true);
    $valid_departure = ValidationHelper::isMySqlDateTime($departure_value, true);
    if ($valid_arrival !== true) {
        $error = $valid_arrival;
    } else {
        if ($valid_departure !== true) {
            $error = $valid_departure;
        } else {
            $bookings_data = '?' . http_build_query(array('arrive' => $arrival_value, 'depart' => $departure_value));
            $arr = new DateTimeWrapper(0, $arrival_value);
            $dep = new DateTimeWrapper(0, $departure_value);
            $arr_num = $arr->getInt();
            $dep_num = $dep->getInt();
            if ($arr_num > $dep_num) {
                $diff = $arr_num - $dep_num;
            } else {
                $diff = $dep_num - $arr_num;
            }
            $s_in_halfday = 3600 * 12;
            $halfdays = $s_in_halfday ? ceil($diff / $s_in_halfday) : 0;
            // 130.00 for day one
            // Every 12 hours thereafter R75.00 up until day 7.
            // From day 7 to reduce it to R100.00 per day so that would be R50.00 for
            // 12 hours.
            // Then from day 10 Ð 26 itÕs R75.00 from day 1 (still the same)
            // 30 days all bookings that exceed 30 only pay R50.00 as from day one