diff --git a/classes/PaymentModule.php b/classes/PaymentModule.php index 3e89319f2..6f79bddf0 100644 --- a/classes/PaymentModule.php +++ b/classes/PaymentModule.php @@ -1044,47 +1044,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->getTotalProductsWithoutTaxes(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_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 = (($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'])); // 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); @@ -1659,8 +1631,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']); @@ -1762,8 +1737,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']; @@ -1771,11 +1749,13 @@ 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); + $value['avg_paid_unit_price_tax_excl'] = Tools::ps_round($value['avg_paid_unit_price_tax_excl'] / $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); - } + } } $result['cart_htl_data'] = $cart_htl_data; 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 4a90cd1a5..201feca13 100755 --- a/mails/en/order_conf.html +++ b/mails/en/order_conf.html @@ -168,6 +168,34 @@ + + + + + + + + +
  + + 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..e7821ffb5 100755 --- a/mails/en/order_conf_admin.html +++ b/mails/en/order_conf_admin.html @@ -151,7 +151,9 @@ -   {discounts} + +   {discounts} +
@@ -182,6 +184,34 @@ + + + + + + + + +
  + + Extra Services Cost + +  
+ + + + + + + + +
  + + {additional_service_price_tax_excl} + +  
+ + diff --git a/mails/en/order_conf_cart_rules.tpl b/mails/en/order_conf_cart_rules.tpl index 742554d72..15f37048d 100644 --- a/mails/en/order_conf_cart_rules.tpl +++ b/mails/en/order_conf_cart_rules.tpl @@ -1,6 +1,6 @@ {foreach $list as $cart_rule} - -
+ @@ -13,7 +13,7 @@
+