function wpestate_super_invoice_details($invoice_id) { $bookid = esc_html(get_post_meta($invoice_id, 'item_id', true)); $booking_from_date = esc_html(get_post_meta($bookid, 'booking_from_date', true)); $booking_prop = esc_html(get_post_meta($bookid, 'booking_id', true)); // property_id $booking_to_date = esc_html(get_post_meta($bookid, 'booking_to_date', true)); $booking_array = wpestate_booking_price($invoice_id, $booking_prop, $booking_from_date, $booking_to_date); // and you might want to convert to integer $price_per_day = $booking_array['default_price']; $cleaning_fee = $booking_array['cleaning_fee']; $city_fee = $booking_array['city_fee']; $total_price = get_post_meta($invoice_id, 'item_price', true); $default_price = get_post_meta($invoice_id, 'default_price', true); $total_price_comp = $total_price - $cleaning_fee - $city_fee; $wp_estate_book_down = get_post_meta($invoice_id, 'invoice_percent', true); $depozit = round($wp_estate_book_down * $total_price_comp / 100, 2); $balance = 0; $balance = $total_price - $depozit; $depozit_show = ''; $balance_show = ''; $currency = esc_html(get_post_meta($invoice_id, 'invoice_currency', true)); $where_currency = esc_html(get_option('wp_estate_where_currency_symbol', '')); $details = get_post_meta($invoice_id, 'renting_details', true); $invoice_status = esc_html(get_post_meta($invoice_id, 'invoice_status', true)); $depozit_paid = floatval(get_post_meta($invoice_id, 'depozit_paid', true)); $price_show = wpestate_show_price_booking_for_invoice($default_price, $currency, $where_currency, 0, 1); $total_price_show = wpestate_show_price_booking_for_invoice($total_price, $currency, $where_currency, 0, 1); $depozit_show = wpestate_show_price_booking_for_invoice($depozit, $currency, $where_currency, 0, 1); $balance_show = wpestate_show_price_booking_for_invoice($balance, $currency, $where_currency, 0, 1); $invoice_saved = esc_html(get_post_meta($invoice_id, 'invoice_type', true)); wpestate_print_create_form_invoice($invoice_id, $invoice_saved, $booking_from_date, $booking_to_date, $booking_array, $price_show, $details, $currency, $where_currency, $total_price, $total_price_show, $depozit_show, $balance_show); }
function wpestate_ajax_show_booking_costs() { $property_id = intval($_POST['property_id']); $booking_from_date = esc_html($_POST['fromdate']); $booking_to_date = esc_html($_POST['todate']); $invoice_id = 0; $booking_array = wpestate_booking_price($invoice_id, $property_id, $booking_from_date, $booking_to_date); $deposit_show = ''; $balance_show = ''; $currency = esc_html(get_option('wp_estate_currency_symbol', '')); //currency_symbol $where_currency = esc_html(get_option('wp_estate_where_currency_symbol', '')); //where_currency_symbol if ($booking_array['default_price'] != 0) { $price_show = wpestate_show_price_booking($booking_array['default_price'], $currency, $where_currency, 1); $total_price_show = wpestate_show_price_booking($booking_array['total_price'], $currency, $where_currency, 1); $deposit_show = wpestate_show_price_booking($booking_array['deposit'], $currency, $where_currency, 1); $balance_show = wpestate_show_price_booking($booking_array['balance'], $currency, $where_currency, 1); $city_fee_show = wpestate_show_price_booking($booking_array['city_fee'], $currency, $where_currency, 1); $monthly_fee = wpestate_show_price_booking($booking_array['month_price'], $currency, $where_currency, 1); $cleaning_fee_show = wpestate_show_price_booking($booking_array['cleaning_fee'], $currency, $where_currency, 1); $inter_price_show = wpestate_show_price_booking($booking_array['inter_price'], $currency, $where_currency, 1); } else { $price_show = ''; } print ' <div class="show_cost_form" id="show_cost_form" > <div class="cost_row"> <div class="cost_explanation">'; $value = get_option('wp_estate_prices_per', ''); // CUSTOM MOD switch ($value) { case 'day': if ($booking_array['has_custom'] == 0) { print $price_show . ' x ' . $booking_array['numberDays'] . ' ' . esc_html__('nights', 'wpestate'); } else { print $booking_array['numberDays'] . ' ' . esc_html__('nights with custom price', 'wpestate'); } break; case 'week': if ($booking_array['has_custom'] == 0) { print $price_show . ' x ' . $booking_array['numberDays'] . ' ' . esc_html__('weeks', 'wpestate'); } else { print $booking_array['numberDays'] . ' ' . esc_html__('weeks with custom price', 'wpestate'); } break; case 'month': if ($booking_array['has_custom'] == 0) { // $booking_array['numberDays'] contain numbers of months $date_in = new DateTime($booking_from_date); $date_out = new DateTime($booking_to_date); $date_out->modify('+1 day'); $diff = $date_in->diff($date_out); if ($diff->d > 0 && $booking_array['numberDays'] > 0) { print $price_show . ' x ' . $booking_array['numberDays'] . ' ' . esc_html__('months', 'wpestate') . ' and ' . $diff->d . ' ' . esc_html__('days', 'wpestate'); } elseif ($diff->d <= 0 && $booking_array['numberDays'] > 0) { print $price_show . ' x ' . $booking_array['numberDays'] . ' ' . esc_html__('months', 'wpestate'); } elseif ($diff->d > 0 && $booking_array['numberDays'] <= 0) { print $price_show . ' x ' . $diff->d . ' ' . esc_html__('days', 'wpestate'); } } else { print $booking_array['numberDays'] . ' ' . esc_html__('months with custom price', 'wpestate'); } break; } print '</div> <div class="cost_value">' . $inter_price_show . '</div> </div>'; if ($booking_array['cleaning_fee'] != 0 && $booking_array['cleaning_fee'] != '') { print ' <div class="cost_row"> <div class="cost_explanation">' . esc_html__('Application Fee', 'wpestate') . '</div> <div class="cost_value">' . $cleaning_fee_show . '</div> </div>'; } if ($booking_array['city_fee'] != 0 && $booking_array['city_fee'] != '') { print ' <div class="cost_row"> <div class="cost_explanation">' . esc_html__('Moving Fee', 'wpestate') . '</div> <div class="cost_value">' . $city_fee_show . '</div> </div>'; } if ($booking_array['month_price'] != 0) { print ' <div class="cost_row"> <div class="cost_explanation">' . esc_html__('Monthly Fee', 'wpestate') . '</div> <div class="cost_value">' . $monthly_fee . '</div> </div>'; } print ' <div class="cost_row"> <div class="cost_explanation"><strong>' . esc_html__('TOTAL', 'wpestate') . '</strong></div> <div class="cost_value">' . $total_price_show . '</div> </div> </div>'; die; }
function wpestate_ajax_show_booking_costs() { $property_id = intval($_POST['property_id']); $booking_from_date = esc_html($_POST['fromdate']); $booking_to_date = esc_html($_POST['todate']); $invoice_id = 0; $booking_array = wpestate_booking_price($invoice_id, $property_id, $booking_from_date, $booking_to_date); $deposit_show = ''; $balance_show = ''; $currency = esc_html(get_option('wp_estate_currency_symbol', '')); //currency_symbol $where_currency = esc_html(get_option('wp_estate_where_currency_symbol', '')); //where_currency_symbol if ($booking_array['default_price'] != 0) { $price_show = wpestate_show_price_booking($booking_array['default_price'], $currency, $where_currency, 1); $total_price_show = wpestate_show_price_booking($booking_array['total_price'], $currency, $where_currency, 1); $deposit_show = wpestate_show_price_booking($booking_array['deposit'], $currency, $where_currency, 1); $balance_show = wpestate_show_price_booking($booking_array['balance'], $currency, $where_currency, 1); $city_fee_show = wpestate_show_price_booking($booking_array['city_fee'], $currency, $where_currency, 1); $cleaning_fee_show = wpestate_show_price_booking($booking_array['cleaning_fee'], $currency, $where_currency, 1); $inter_price_show = wpestate_show_price_booking($booking_array['inter_price'], $currency, $where_currency, 1); } else { $price_show = ''; } print ' <div class="show_cost_form" id="show_cost_form" > <div class="cost_row"> <div class="cost_explanation">'; if ($booking_array['has_custom'] == 0) { print $price_show . ' x ' . $booking_array['numberDays'] . ' ' . esc_html__('nights', 'wpestate'); } else { print $booking_array['numberDays'] . ' ' . esc_html__('nights with custom price', 'wpestate'); } print '</div> <div class="cost_value">' . $inter_price_show . '</div> </div>'; if ($booking_array['cleaning_fee'] != 0 && $booking_array['cleaning_fee'] != '') { print ' <div class="cost_row"> <div class="cost_explanation">' . esc_html__('Cleaning Fee', 'wpestate') . '</div> <div class="cost_value">' . $cleaning_fee_show . '</div> </div>'; } if ($booking_array['city_fee'] != 0 && $booking_array['city_fee'] != '') { print ' <div class="cost_row"> <div class="cost_explanation">' . esc_html__('City Fee', 'wpestate') . '</div> <div class="cost_value">' . $city_fee_show . '</div> </div>'; } print ' <div class="cost_row"> <div class="cost_explanation"><strong>' . esc_html__('TOTAL', 'wpestate') . '</strong></div> <div class="cost_value">' . $total_price_show . '</div> </div> </div>'; die; }
<?php global $post; global $where_currency; global $currency; global $user_login; $link = esc_url(get_permalink()); $booking_status = get_post_meta($post->ID, 'booking_status', true); $booking_id = get_post_meta($post->ID, 'booking_id', true); $booking_from_date = get_post_meta($post->ID, 'booking_from_date', true); $booking_to_date = get_post_meta($post->ID, 'booking_to_date', true); $booking_guests = get_post_meta($post->ID, 'booking_guests', true); $preview = wp_get_attachment_image_src(get_post_thumbnail_id($booking_id), 'wpestate_blog_unit'); $author = get_the_author(); $invoice_no = get_post_meta($post->ID, 'booking_invoice_no', true); $booking_array = wpestate_booking_price($invoice_no, $booking_id, $booking_from_date, $booking_to_date); $invoice_no = get_post_meta($post->ID, 'booking_invoice_no', true); $booking_pay = $booking_array['total_price']; $booking_company = get_post_meta($post->ID, 'booking_company', true); $no_of_days = $booking_array['numberDays']; $property_price = $booking_array['default_price']; $event_description = get_the_content(); if ($invoice_no == 0) { $invoice_no = '-'; } $price_per_booking = wpestate_show_price_booking($booking_array['total_price'], $currency, $where_currency, 1); ?> <div class="col-md-12 "> <div class="dasboard-prop-listing">