function wpestate_create_invoice_form() { $invoice_id = 0; $bookid = intval($_POST['bookid']); $booking_from_date = esc_html(get_post_meta($bookid, 'booking_from_date', true)); $property_id = esc_html(get_post_meta($bookid, 'booking_id', true)); $booking_to_date = esc_html(get_post_meta($bookid, 'booking_to_date', true)); $booking_array = wpestate_booking_price($invoice_id, $property_id, $booking_from_date, $booking_to_date); $where_currency = esc_html(get_option('wp_estate_where_currency_symbol', '')); $currency = esc_html(get_option('wp_estate_submission_curency', '')); if ($booking_array['default_price'] != 0) { $price_show = wpestate_show_price_booking_for_invoice($booking_array['default_price'], $currency, $where_currency, 0, 1); $total_price_show = wpestate_show_price_booking_for_invoice($booking_array['total_price'], $currency, $where_currency, 0, 1); $deposit_show = wpestate_show_price_booking_for_invoice($booking_array['deposit'], $currency, $where_currency, 0, 1); $balance_show = wpestate_show_price_booking_for_invoice($booking_array['balance'], $currency, $where_currency, 0, 1); $city_fee_show = wpestate_show_price_booking_for_invoice($booking_array['city_fee'], $currency, $where_currency, 1, 1); $cleaning_fee_show = wpestate_show_price_booking_for_invoice($booking_array['cleaning_fee'], $currency, $where_currency, 1, 1); $inter_price_show = wpestate_show_price_booking_for_invoice($booking_array['inter_price'], $currency, $where_currency, 1, 1); } else { $price_show = ''; } if (trim($deposit_show) == '') { $deposit_show = 0; } print ' <div class="create_invoice_form"> <h3>' . esc_html__('Create Invoice', 'wpestate') . '</h3> <div class="invoice_table"> <div class="invoice_data"> <span class="date_interval"><span class="invoice_data_legend">' . esc_html__('Period', 'wpestate') . ' : </span>' . $booking_from_date . ' ' . esc_html__('to', 'wpestate') . ' ' . $booking_to_date . '</span> <span class="date_duration"><span class="invoice_data_legend">' . esc_html__('No of days', 'wpestate') . ': </span>' . $booking_array['numberDays'] . '</span> <span class="date_duration"><span class="invoice_data_legend">' . esc_html__('Price per night', 'wpestate') . ': </span>' . $price_show . '</span> </div> <div class="invoice_details"> <div class="invoice_row header_legend"> <span class="inv_legend"> ' . esc_html__('Cost', 'wpestate') . '</span> <span class="inv_data"> ' . esc_html__('Price', 'wpestate') . '</span> <span class="inv_exp"> ' . esc_html__('Detail', 'wpestate') . ' </span> </div> <div class="invoice_row invoice_content"> <span class="inv_legend"> ' . esc_html__('Subtotal', 'wpestate') . '</span> <span class="inv_data"> ' . $inter_price_show . '</span>'; if ($booking_array['numberDays'] == 1) { print ' <span class="inv_exp"> (' . $booking_array['numberDays'] . ' ' . esc_html__('day', 'wpestate') . ' | ' . $price_show . ' ' . esc_html__('per day', 'wpestate') . ') </span>'; } else { print ' <span class="inv_exp"> (' . $booking_array['numberDays'] . ' ' . esc_html__('days', 'wpestate') . ' | ' . $price_show . ' ' . esc_html__('per day', 'wpestate') . ') </span>'; } print ' </div>'; if ($booking_array['cleaning_fee'] != 0 && $booking_array['cleaning_fee'] != '') { print ' <div class="invoice_row invoice_content"> <span class="inv_legend"> ' . esc_html__('Cleaning fee', 'wpestate') . '</span> <span class="inv_data" id="cleaning-fee" data-cleaning-fee="' . $booking_array['cleaning_fee'] . '"> ' . $cleaning_fee_show . '</span> </div>'; } if ($booking_array['city_fee'] != 0 && $booking_array['city_fee'] != '') { print ' <div class="invoice_row invoice_content"> <span class="inv_legend"> ' . esc_html__('City fee', 'wpestate') . '</span> <span class="inv_data" id="city-fee" data-city-fee="' . $booking_array['city_fee'] . '"> ' . $city_fee_show . '</span> </div>'; } print ' <div class="invoice_row invoice_total"> <span class="inv_legend"><strong>' . esc_html__('Total', 'wpestate') . '</strong></span> <span class="inv_data" id="total_amm" data-total="' . $booking_array['total_price'] . '">' . $total_price_show . '</span> <span class="total_inv_span"><span class="inv_legend"> ' . esc_html__('Deposit Required', 'wpestate') . ':</span> <span id="inv_depozit">' . $deposit_show . '</span></br> <span class="inv_legend">' . esc_html__('Balance Owing', 'wpestate') . ':</span> <span id="inv_balance">' . $balance_show . '</span> </div> </div> '; $book_down = floatval(get_option('wp_estate_book_down', '')); if ($book_down != 0) { print '<div class="action1_booking" id="invoice_submit" data-bookid="' . $bookid . '">' . esc_html__('Send Invoice', 'wpestate') . '</div>'; } else { print '<div class="action1_booking" id="direct_confirmation" data-bookid="' . $bookid . '">' . esc_html__('Confirm Booking - No deposit required', 'wpestate') . '</div>'; } print ' </div>'; print ' <div class="invoice_actions"> <h4>' . esc_html__('Add extra expense', 'wpestate') . '</h4> <input type="text" id="inv_expense_name" size="40" name="inv_expense_name" placeholder="type expense name"> <input type="text" id="inv_expense_value" size="40" name="inv_expense_value" placeholder="type expense value"> <div class="action1_booking" id="add_inv_expenses">' . esc_html__('add', 'wpestate') . '</div> <h4>' . esc_html__('Add discount', 'wpestate') . '</h4> <input type="text" id="inv_expense_discount" size="40" name="inv_expense_discount" placeholder="type discount value"> <div class="action1_booking" id="add_inv_discount">' . esc_html__('add', 'wpestate') . '</div> </div>'; print wp_nonce_field('create_invoice_ajax_nonce', 'security-create_invoice_ajax_nonce') . ' </div>'; die; }
function 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) { if (trim($depozit_show) === '') { $depozit_show = 0; } print ' <div class="create_invoice_form">'; if ($invoice_id != 0) { print '<h3>' . esc_html__('Invoice INV', 'wpestate') . $invoice_id . '</h3>'; } print ' <div class="invoice_table"> <div class="invoice_data">'; if ($invoice_saved == 'Reservation fee') { $value = get_option('wp_estate_prices_per', ''); // CUSTOM MOD (switch) switch ($value) { case 'day': print ' <span class="date_interval"><span class="invoice_data_legend">' . esc_html__('Period', 'wpestate') . ' : </span>' . $booking_from_date . ' ' . esc_html__('to', 'wpestate') . ' ' . $booking_to_date . '</span> <span class="date_duration"><span class="invoice_data_legend">' . esc_html__('No of days', 'wpestate') . ': </span>' . $booking_array['numberDays'] . '</span> <span class="date_duration"><span class="invoice_data_legend">' . esc_html__('Price per night', 'wpestate') . ': </span>'; break; case 'week': print ' <span class="date_interval"><span class="invoice_data_legend">' . esc_html__('Period', 'wpestate') . ' : </span>' . $booking_from_date . ' ' . esc_html__('to', 'wpestate') . ' ' . $booking_to_date . '</span> <span class="date_duration"><span class="invoice_data_legend">' . esc_html__('No of Weeks', 'wpestate') . ': </span>' . $booking_array['numberDays'] . '</span> <span class="date_duration"><span class="invoice_data_legend">' . esc_html__('Price per Week', 'wpestate') . ': </span>'; break; case 'month': print ' <span class="date_interval"><span class="invoice_data_legend">' . esc_html__('Period', 'wpestate') . ' : </span>' . $booking_from_date . ' ' . esc_html__('to', 'wpestate') . ' ' . $booking_to_date . '</span> <span class="date_duration"><span class="invoice_data_legend">' . esc_html__('No of Months', 'wpestate') . ': </span>' . $booking_array['numberDays'] . '</span> <span class="date_duration"><span class="invoice_data_legend">' . esc_html__('Price per month', 'wpestate') . ':' . $booking_array['default_price'] . '</span>'; break; } ?> <?php if ($booking_array['has_custom'] != 0) { esc_html_e('custom price', 'wpestate'); } else { print $price_show; } print '</span>'; } print ' </div> <div class="invoice_details"> <div class="invoice_row header_legend"> <span class="inv_legend">' . esc_html__('Cost', 'wpestate') . '</span> <span class="inv_data"> ' . esc_html__('Price', 'wpestate') . '</span> <span class="inv_exp"> ' . esc_html__('Detail', 'wpestate') . '</span> </div>'; if (is_array($details)) { foreach ($details as $detail) { print '<div class="invoice_row invoice_content"> <span class="inv_legend"> ' . $detail[0] . '</span> <span class="inv_data"> ' . wpestate_show_price_booking_for_invoice($detail[1], $currency, $where_currency, 0, 1) . '</span> <span class="inv_exp"> '; if (trim($detail[0]) == esc_html__('Subtotal', 'wpestate')) { switch ($value) { case 'day': print $booking_array['numberDays'] . ' ' . esc_html__('days', 'wpestate') . ' x '; break; case 'week': print $booking_array['numberDays'] . ' ' . esc_html__('weeks', 'wpestate') . ' x '; break; case 'month': print $booking_array['numberDays'] . ' ' . esc_html__('months', 'wpestate') . ' x '; break; } if ($booking_array['has_custom'] != 0) { esc_html_e('custom price', 'wpestate'); } else { print $price_show; } } print ' </span> </div>'; } } else { } print ' <div class="invoice_row invoice_total"> <span class="inv_legend"><strong>' . esc_html__('Total', 'wpestate') . '</strong></span> <span class="inv_data" id="total_amm" data-total="' . $total_price . '">' . $total_price_show . '</span> <div class="deposit_show_wrapper total_inv_span"> '; if ($invoice_saved == 'Reservation fee') { print ' <span class="inv_legend">' . esc_html__('Deposit Required', 'wpestate') . ':</span> <span class="inv_depozit">' . $depozit_show . ' </span></br> <span class="inv_legend">' . esc_html__('Balance Owing', 'wpestate') . ':</span> <span class="inv_depozit">' . $balance_show . '</span>'; } else { echo $invoice_saved; } print ' </div> </div> </div> </div>'; }
</div> <div class="col-md-2"> <?php echo esc_html(get_post_meta($post->ID, 'invoice_type', true)); ?> </div> <div class="col-md-2"> <?php echo esc_html(get_post_meta($post->ID, 'biling_type', true)); ?> </div> <div class="col-md-2"> <?php echo esc_html(get_post_meta($post->ID, 'invoice_status', true)); ?> </div> <div class="col-md-2"> <?php $price = get_post_meta($post->ID, 'item_price', true); $currency = esc_html(get_post_meta($post->ID, 'invoice_currency', true)); echo wpestate_show_price_booking_for_invoice($price, $currency, $where_currency, 0, 1); ?> </div> </div>