diff --git a/classes/PaymentModule.php b/classes/PaymentModule.php index d162178b6..10e01167b 100644 --- a/classes/PaymentModule.php +++ b/classes/PaymentModule.php @@ -1045,47 +1045,19 @@ abstract class PaymentModuleCore extends Module $normal_products_data_txt = $this->getEmailTemplateContent('hotel-service-product-data-text.tpl', Mail::TYPE_TEXT, $orderServiceProducts); // total room price - $room_price_tax_excl = $order->getTotalProductsWithoutTaxes(false, true); - $room_price_tax_incl = $order->getTotalProductsWithTaxes(false, true); - $room_tax = ($order->getTotalProductsWithTaxes(false, true) - $order->getTotalProductsWithoutTaxes(false, true)); + $room_price_tax_excl = $order->getTotalProductsWithoutTaxes(false, true) + $order->getTotalProductsWithoutTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE, 1, Product::PRICE_ADDITION_TYPE_WITH_ROOM); + $room_price_tax_incl = $order->getTotalProductsWithTaxes(false, true) + $order->getTotalProductsWithTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE, 1, Product::PRICE_ADDITION_TYPE_WITH_ROOM); + $room_tax = ($room_price_tax_incl - $room_price_tax_excl); // extra services - $additional_service_price_tax_excl = ($order->getTotalProductsWithoutTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE) + $cart_booking_data['total_extra_demands_te']); - $additional_service_price_tax_incl = ($order->getTotalProductsWithTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE) + $cart_booking_data['total_extra_demands_ti']); - $additional_service_tax = (($order->getTotalProductsWithTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE) + $cart_booking_data['total_extra_demands_ti']) - ($order->getTotalProductsWithoutTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE) + $cart_booking_data['total_extra_demands_te'])); + $additional_service_price_tax_excl = ($order->getTotalProductsWithoutTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE, 0) + $cart_booking_data['total_extra_demands_te']); + $additional_service_price_tax_incl = ($order->getTotalProductsWithTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE, 0) + $cart_booking_data['total_extra_demands_ti']); + $additional_service_tax = ($additional_service_price_tax_incl - $additional_service_price_tax_excl); + // convenience fee price - $objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail(); - $total_convenience_fee_ti = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts( - $order->id, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - Product::PRICE_ADDITION_TYPE_INDEPENDENT - ); - $total_convenience_fee_te = $objRoomTypeServiceProductOrderDetail->getroomTypeServiceProducts( - $order->id, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - Product::PRICE_ADDITION_TYPE_INDEPENDENT - ); - $additional_service_price_tax_excl = $additional_service_price_tax_excl - $total_convenience_fee_te; - $additional_service_price_tax_incl = $additional_service_price_tax_incl - $total_convenience_fee_ti; - $room_price_tax_excl = $room_price_tax_excl + $additional_service_price_tax_excl; - $room_price_tax_incl = $room_price_tax_incl + $additional_service_price_tax_incl; + $total_convenience_fee_ti = $order->getTotalProductsWithTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE, 1, Product::PRICE_ADDITION_TYPE_INDEPENDENT); + $total_convenience_fee_te = $order->getTotalProductsWithoutTaxes(false, false, Product::SERVICE_PRODUCT_WITH_ROOMTYPE, 1, Product::PRICE_ADDITION_TYPE_INDEPENDENT); // service products // $service_products_price_tax_excl = $order->getTotalProductsWithoutTaxes(false, false, Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE); @@ -1662,8 +1634,11 @@ abstract class PaymentModuleCore extends Module ); $cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_incl']/$num_days; - $cart_htl_data[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_incl'] += ($cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] + $cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te']); + $cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] = $data_v['total_price_tax_excl']/$num_days; + $cart_htl_data[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_incl'] += ($cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] + $cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti']); + $cart_htl_data[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_excl'] += ($cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] + $cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te']); $cart_htl_data[$type_key]['date_diff'][$date_join]['amount_tax_incl'] += ($data_v['total_price_tax_incl'] + $cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te']); + $cart_htl_data[$type_key]['date_diff'][$date_join]['amount_tax_excl'] += ($data_v['total_price_tax_excl'] + $cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te']); } else { $num_days = $obj_htl_bk_dtl->getNumberOfDays($data_v['date_from'], $data_v['date_to']); @@ -1765,8 +1740,11 @@ abstract class PaymentModuleCore extends Module ); $cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_incl']/$num_days; - $cart_htl_data[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_incl'] = ($cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] + $cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te']); - $cart_htl_data[$type_key]['date_diff'][$date_join]['amount_tax_incl'] = ($data_v['total_price_tax_incl'] + $cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te']); + $cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] = $data_v['total_price_tax_excl']/$num_days; + $cart_htl_data[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_incl'] = ($cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] + $cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti']); + $cart_htl_data[$type_key]['date_diff'][$date_join]['avg_paid_unit_price_tax_excl'] = ($cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_excl'] + $cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te']); + $cart_htl_data[$type_key]['date_diff'][$date_join]['amount_tax_incl'] = ($data_v['total_price_tax_incl'] + $cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_ti']); + $cart_htl_data[$type_key]['date_diff'][$date_join]['amount_tax_excl'] = ($data_v['total_price_tax_excl'] + $cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_auto_add_te']); $result['total_extra_demands_te'] += $cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_te']; $result['total_extra_demands_ti'] += $cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands_price_ti']; @@ -1774,10 +1752,10 @@ abstract class PaymentModuleCore extends Module $result['total_additional_services_ti'] += $cart_htl_data[$type_key]['date_diff'][$date_join]['additional_services_price_ti']; } } - } - // calculate averages now - foreach ($cart_htl_data[$type_key]['date_diff'] as $key => &$value) { - $value['avg_paid_unit_price_tax_incl'] = Tools::ps_round($value['avg_paid_unit_price_tax_incl'] / $value['num_rm'], 6); + // calculate averages now + foreach ($cart_htl_data[$type_key]['date_diff'] as $key => &$value) { + $value['avg_paid_unit_price_tax_incl'] = Tools::ps_round($value['avg_paid_unit_price_tax_incl'] / $value['num_rm'], 6); + } } } } diff --git a/mails/en/hotel-booking-cart-data-text.tpl b/mails/en/hotel-booking-cart-data-text.tpl index 4a7b7c068..5b4b314fb 100644 --- a/mails/en/hotel-booking-cart-data-text.tpl +++ b/mails/en/hotel-booking-cart-data-text.tpl @@ -9,7 +9,7 @@ {$rm_v['adults']} {l s='Adults'}, {$rm_v['children']} {l s='Children'} -{convertPrice price=$rm_v['avg_paid_unit_price_tax_incl']} +{convertPrice price=$rm_v['avg_paid_unit_price_tax_excl']} {$rm_v['num_rm']} @@ -17,7 +17,7 @@ {$rm_v['data_to']|date_format:"%d-%b-%G"} -{$rm_v['amount_tax_incl']} +{$rm_v['amount_tax_excl']} {/foreach} diff --git a/mails/en/hotel-booking-cart-data.tpl b/mails/en/hotel-booking-cart-data.tpl index ce55e44e7..49d7b9f94 100644 --- a/mails/en/hotel-booking-cart-data.tpl +++ b/mails/en/hotel-booking-cart-data.tpl @@ -62,7 +62,7 @@   - {convertPrice price=$rm_v['avg_paid_unit_price_tax_incl']} + {convertPrice price=$rm_v['avg_paid_unit_price_tax_excl']}   @@ -114,7 +114,7 @@   - {convertPrice price=$rm_v['amount_tax_incl']} + {convertPrice price=$rm_v['amount_tax_excl']}   diff --git a/mails/en/order_conf.html b/mails/en/order_conf.html index 532f88563..1f701f139 100755 --- a/mails/en/order_conf.html +++ b/mails/en/order_conf.html @@ -169,6 +169,35 @@ + + + + + + + + +
  + + Total Extra Services Cost + +  
+ + + + + + + + +
  + + {additional_service_price_tax_excl} + +  
+ + + diff --git a/mails/en/order_conf_admin.html b/mails/en/order_conf_admin.html index a7004f008..c6e2a41a1 100755 --- a/mails/en/order_conf_admin.html +++ b/mails/en/order_conf_admin.html @@ -182,6 +182,34 @@
+ + + + + + + + +
  + + Extra Services Cost + +  
+ + + + + + + + +
  + + {additional_service_price_tax_excl} + +  
+ +