diff --git a/classes/pdf/HTMLTemplateBookingVoucher.php b/classes/pdf/HTMLTemplateBookingVoucher.php index a05a632b2..03cf50a15 100644 --- a/classes/pdf/HTMLTemplateBookingVoucher.php +++ b/classes/pdf/HTMLTemplateBookingVoucher.php @@ -310,6 +310,7 @@ class HTMLTemplateBookingVoucherCore extends HTMLTemplate $totalTourismTax = OrderTaxDetail::getOrderTourismTaxTotal((int) $this->order->id); $footer['total_tax_without_discount'] = max(0, $totalWithoutDiscountTaxIncl - $footer['total_without_discount_te'] - $totalTourismTax); $footer['total_tourism_tax'] = $totalTourismTax; + $footer['show_tourism_tax_separately'] = (bool) Configuration::get('QLO_TOURISM_TAX_SHOW_SEPARATE_DOCS'); $grandTotal = max(0.0, $totalWithoutDiscountTaxIncl - $productDiscountsTaxIncl); $footer['product_discounts_tax_incl'] = $productDiscountsTaxIncl; $footer['total_paid_tax_incl'] = $grandTotal; diff --git a/classes/pdf/HTMLTemplateInvoice.php b/classes/pdf/HTMLTemplateInvoice.php index ceddfd2f0..7c9494d8b 100644 --- a/classes/pdf/HTMLTemplateInvoice.php +++ b/classes/pdf/HTMLTemplateInvoice.php @@ -618,6 +618,7 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate if ($footer['total_tax_without_discount'] < 0) { $footer['total_tax_without_discount'] = 0; } + $footer['show_tourism_tax_separately'] = (bool) Configuration::get('QLO_TOURISM_TAX_SHOW_SEPARATE_DOCS'); $data = array( 'cart_htl_data' => $cart_htl_data, diff --git a/controllers/admin/AdminTaxesController.php b/controllers/admin/AdminTaxesController.php index 1f2433087..a087c0252 100644 --- a/controllers/admin/AdminTaxesController.php +++ b/controllers/admin/AdminTaxesController.php @@ -143,7 +143,23 @@ class AdminTaxesControllerCore extends AdminController if (Configuration::get('QLO_USE_TOURISM_TAX') || Tools::getValue('QLO_USE_TOURISM_TAX')) { $this->fields_options['general']['fields']['QLO_TOURISM_TAX_GROSSED_UP'] = array( 'title' => $this->l('Include tourism tax in displayed prices'), - 'desc' => $this->l('When enabled, tourism tax is included in displayed prices. The applicable tourism tax is always shown as a separate line if applicable.'), + 'desc' => $this->l('When enabled, tourism tax is included in displayed prices. Whether the applicable tourism tax is also shown as a separate line depends on the settings below.'), + 'validation' => 'isBool', + 'cast' => 'intval', + 'type' => 'bool', + ); + + $this->fields_options['general']['fields']['QLO_TOURISM_TAX_SHOW_SEPARATE'] = array( + 'title' => $this->l('Show tourism tax separately in price summary'), + 'desc' => $this->l('When enabled, tourism tax is shown as its own line, separate from the room/service tax, on the cart summary, order confirmation, and order detail pages.'), + 'validation' => 'isBool', + 'cast' => 'intval', + 'type' => 'bool', + ); + + $this->fields_options['general']['fields']['QLO_TOURISM_TAX_SHOW_SEPARATE_DOCS'] = array( + 'title' => $this->l('Show tourism tax separately on invoices / booking vouchers'), + 'desc' => $this->l('When enabled, tourism tax is shown as its own line, separate from the room/service tax, on the invoice and booking voucher totals.'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', @@ -1134,7 +1150,7 @@ class AdminTaxesControllerCore extends AdminController parent::setMedia(); if ($this->display == 'edit' || $this->display == 'add') { $this->addCSS(_MODULE_DIR_ . 'hotelreservationsystem/views/css/HotelReservationAdmin.css'); - $this->addJs(_MODULE_DIR_ . 'hotelreservationsystem/views/js/TourismTaxForm.js'); + $this->addJs(_PS_JS_DIR_ . 'admin/tourism_tax_form.js'); } } diff --git a/controllers/front/GuestTrackingController.php b/controllers/front/GuestTrackingController.php index 0839f9a28..13b9c41fa 100644 --- a/controllers/front/GuestTrackingController.php +++ b/controllers/front/GuestTrackingController.php @@ -557,6 +557,7 @@ class GuestTrackingControllerCore extends FrontController 'guestInformations' => (array)$customer, 'view_on_map' => Configuration::get('WK_GOOGLE_ACTIVE_MAP'), 'total_tourism_tax' => isset($total_tourism_tax) ? $total_tourism_tax : 0, + 'show_tourism_tax_separately' => (bool) Configuration::get('QLO_TOURISM_TAX_SHOW_SEPARATE'), )); } diff --git a/controllers/front/OrderConfirmationController.php b/controllers/front/OrderConfirmationController.php index 3babfaa6c..cd3de3304 100644 --- a/controllers/front/OrderConfirmationController.php +++ b/controllers/front/OrderConfirmationController.php @@ -415,6 +415,7 @@ class OrderConfirmationControllerCore extends FrontController } } + $orderTotalInfo['show_tourism_tax_separately'] = (bool) Configuration::get('QLO_TOURISM_TAX_SHOW_SEPARATE'); $this->context->smarty->assign('orderTotalInfo', $orderTotalInfo); $this->context->smarty->assign('orders_has_invoice', $orders_has_invoice); } diff --git a/controllers/front/OrderDetailController.php b/controllers/front/OrderDetailController.php index 805cac5ba..d357211a4 100644 --- a/controllers/front/OrderDetailController.php +++ b/controllers/front/OrderDetailController.php @@ -403,6 +403,7 @@ class OrderDetailControllerCore extends FrontController 'total_convenience_fee_ti' => $total_convenience_fee_ti, 'total_convenience_fee_te' => $total_convenience_fee_te, 'total_tourism_tax' => $totalTourismTax, + 'show_tourism_tax_separately' => (bool) Configuration::get('QLO_TOURISM_TAX_SHOW_SEPARATE'), 'any_back_order' => $anyBackOrder, 'shw_bo_msg' => Configuration::get('WK_SHOW_MSG_ON_BO'), 'back_ord_msg' => Configuration::get('WK_BO_MESSAGE'), diff --git a/controllers/front/ParentOrderController.php b/controllers/front/ParentOrderController.php index d445b6e4c..3fa526a22 100644 --- a/controllers/front/ParentOrderController.php +++ b/controllers/front/ParentOrderController.php @@ -406,6 +406,7 @@ class ParentOrderControllerCore extends FrontController } } $this->context->smarty->assign($summary); + $this->context->smarty->assign('show_tourism_tax_separately', (bool) Configuration::get('QLO_TOURISM_TAX_SHOW_SEPARATE')); $this->context->smarty->assign(array( 'HOOK_SHOPPING_CART' => Hook::exec('displayShoppingCartFooter', $summary), 'HOOK_SHOPPING_CART_EXTRA' => Hook::exec('displayShoppingCart', $summary) @@ -476,6 +477,7 @@ class ParentOrderControllerCore extends FrontController } $this->context->smarty->assign($summary); + $this->context->smarty->assign('show_tourism_tax_separately', (bool) Configuration::get('QLO_TOURISM_TAX_SHOW_SEPARATE')); $this->context->smarty->assign(array( 'token_cart' => Tools::getToken(false), 'isLogged' => $this->isLogged, diff --git a/install/data/xml/configuration.xml b/install/data/xml/configuration.xml index b5cb8b5c2..6c7728f25 100644 --- a/install/data/xml/configuration.xml +++ b/install/data/xml/configuration.xml @@ -994,6 +994,18 @@ 5 + + + 0 + + + 0 + + + 1 + + + 1 diff --git a/modules/hotelreservationsystem/views/js/TourismTaxForm.js b/js/admin/tourism_tax_form.js similarity index 86% rename from modules/hotelreservationsystem/views/js/TourismTaxForm.js rename to js/admin/tourism_tax_form.js index 80e478c60..7a89f73f4 100644 --- a/modules/hotelreservationsystem/views/js/TourismTaxForm.js +++ b/js/admin/tourism_tax_form.js @@ -1,24 +1,24 @@ -/** - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License version 3.0 - * that is bundled with this package in the file LICENSE.md - * It is also available through the world-wide-web at this URL: - * https://opensource.org/license/osl-3-0-php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to support@qloapps.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade this module to a newer - * versions in the future. If you wish to customize this module for your needs - * please refer to https://store.webkul.com/customisation-guidelines for more information. - * - * @author Webkul IN - * @copyright Since 2010 Webkul - * @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0 - */ +/* +* NOTICE OF LICENSE +* +* This source file is subject to the Open Software License version 3.0 +* that is bundled with this package in the file LICENSE.md +* It is also available through the world-wide-web at this URL: +* https://opensource.org/license/osl-3-0-php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to support@qloapps.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade this module to a newer +* versions in the future. If you wish to customize this module for your needs +* please refer to https://store.webkul.com/customisation-guidelines for more information. +* +* @author Webkul IN +* @copyright Since 2010 Webkul +* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0 +*/ $(document).ready(function () { var CALCULATION_TYPE_PERCENTAGE = 1; diff --git a/modules/hotelreservationsystem/classes/HotelHelper.php b/modules/hotelreservationsystem/classes/HotelHelper.php index 40a54ea9f..81a4d7f4b 100644 --- a/modules/hotelreservationsystem/classes/HotelHelper.php +++ b/modules/hotelreservationsystem/classes/HotelHelper.php @@ -1114,8 +1114,6 @@ class HotelHelper Configuration::updateValue('PS_MIN_BOOKING_OFFSET', 0); Configuration::updateValue('HTL_FEATURE_PRICING_PRIORITY', 'specific_date;special_day;date_range'); - Configuration::updateValue('QLO_USE_TOURISM_TAX', 0); - Configuration::updateValue('QLO_TOURISM_TAX_GROSSED_UP', 0); Configuration::updateValue('WK_GOOGLE_ACTIVE_MAP', 0); Configuration::updateValue('WK_MAP_HOTEL_ACTIVE_ONLY', 1); diff --git a/modules/hotelreservationsystem/hotelreservationsystem.php b/modules/hotelreservationsystem/hotelreservationsystem.php index b16409435..a52fe9fdc 100644 --- a/modules/hotelreservationsystem/hotelreservationsystem.php +++ b/modules/hotelreservationsystem/hotelreservationsystem.php @@ -622,8 +622,6 @@ class HotelReservationSystem extends Module 'QLO_HEADER_SLIDER_AUTO_PLAY', 'QLO_HEADER_SLIDER_INTERVAL', 'QLO_HEADER_SLIDER_ANIM_TYPE', - 'QLO_USE_TOURISM_TAX', - 'QLO_TOURISM_TAX_GROSSED_UP', ); foreach ($configKeys as $key) { if (!Configuration::deleteByName($key)) { diff --git a/pdf/booking-voucher.tpl b/pdf/booking-voucher.tpl index 9ff85b2a5..25aae5901 100644 --- a/pdf/booking-voucher.tpl +++ b/pdf/booking-voucher.tpl @@ -255,17 +255,24 @@ {l s='Total (Tax excl.)' pdf='true'} {displayPrice currency=$order->id_currency price=$footer.total_without_discount_te} - {if $footer.total_tax_without_discount > 0} - - {l s='Room and Service Tax' pdf='true'} - {displayPrice currency=$order->id_currency price=$footer.total_tax_without_discount} - - {/if} - {if isset($footer.total_tourism_tax) && $footer.total_tourism_tax > 0} + {if (!isset($footer.show_tourism_tax_separately) || $footer.show_tourism_tax_separately) && isset($footer.total_tourism_tax) && $footer.total_tourism_tax > 0} + {if $footer.total_tax_without_discount > 0} + + {l s='Room and Service Tax' pdf='true'} + {displayPrice currency=$order->id_currency price=$footer.total_tax_without_discount} + + {/if} {l s='Total Tourism Tax' pdf='true'} {displayPrice currency=$order->id_currency price=$footer.total_tourism_tax} + {else} + {if ($footer.total_tax_without_discount + $footer.total_tourism_tax) > 0} + + {l s='Total Taxes' pdf='true'} + {displayPrice currency=$order->id_currency price=($footer.total_tax_without_discount + $footer.total_tourism_tax)} + + {/if} {/if} {if isset($footer.product_discounts_tax_incl) && $footer.product_discounts_tax_incl > 0} diff --git a/pdf/invoice.total-tab.tpl b/pdf/invoice.total-tab.tpl index 51f4a5455..f11e113a6 100644 --- a/pdf/invoice.total-tab.tpl +++ b/pdf/invoice.total-tab.tpl @@ -106,25 +106,36 @@ {displayPrice currency=$order->id_currency price=$footer.total_without_discount_te} - {if $footer.total_tax_without_discount > 0} - - - {l s='Room and Service Tax' pdf='true'} - - - {displayPrice currency=$order->id_currency price=$footer.total_tax_without_discount} - - - {/if} - {if isset($footer.total_tourism_tax) && $footer.total_tourism_tax > 0} - - - {l s='Total Tourism Tax' pdf='true'} - - - {displayPrice currency=$order->id_currency price=$footer.total_tourism_tax} - - + {if (!isset($footer.show_tourism_tax_separately) || $footer.show_tourism_tax_separately) && isset($footer.total_tourism_tax) && $footer.total_tourism_tax > 0} + {if $footer.total_tax_without_discount > 0} + + + {l s='Room and Service Tax' pdf='true'} + + + {displayPrice currency=$order->id_currency price=$footer.total_tax_without_discount} + + + {/if} + + + {l s='Total Tourism Tax' pdf='true'} + + + {displayPrice currency=$order->id_currency price=$footer.total_tourism_tax} + + + {else} + {if ($footer.total_tax_without_discount + $footer.total_tourism_tax) > 0} + + + {l s='Total Taxes' pdf='true'} + + + {displayPrice currency=$order->id_currency price=($footer.total_tax_without_discount + $footer.total_tourism_tax)} + + + {/if} {/if} {if $footer.product_discounts_tax_incl > 0} diff --git a/themes/hotel-reservation-theme/cart-total-block.tpl b/themes/hotel-reservation-theme/cart-total-block.tpl index e9f88356b..990f8738c 100644 --- a/themes/hotel-reservation-theme/cart-total-block.tpl +++ b/themes/hotel-reservation-theme/cart-total-block.tpl @@ -90,16 +90,21 @@ {hook h='displayBeforeCartTotalTax'} {/block} {if $show_taxes} -

- {l s='Room and Service Tax'} - {displayPrice price=($total_tax_without_discount)} -

- {/if} - {if $show_taxes && isset($total_tourism_tax) && $total_tourism_tax > 0} -

- {l s='Total Tourism Tax'} - {displayPrice price=$total_tourism_tax} -

+ {if (!isset($show_tourism_tax_separately) || $show_tourism_tax_separately) && isset($total_tourism_tax) && $total_tourism_tax > 0} +

+ {l s='Room and Service Tax'} + {displayPrice price=($total_tax_without_discount)} +

+

+ {l s='Total Tourism Tax'} + {displayPrice price=$total_tourism_tax} +

+ {else} +

+ {l s='Total Taxes'} + {displayPrice price=($total_tax_without_discount + $total_tourism_tax)} +

+ {/if} {/if}

diff --git a/themes/hotel-reservation-theme/order-confirmation.tpl b/themes/hotel-reservation-theme/order-confirmation.tpl index 74450385f..a6714f68b 100644 --- a/themes/hotel-reservation-theme/order-confirmation.tpl +++ b/themes/hotel-reservation-theme/order-confirmation.tpl @@ -469,15 +469,15 @@ {/if} - - - {l s='Room and Service Tax'} - - - {displayWtPriceWithCurrency price=$orderTotalInfo['total_tax_without_discount'] currency=$objOrderCurrency convert=1} - - - {if isset($orderTotalInfo['total_tourism_tax']) && $orderTotalInfo['total_tourism_tax'] > 0} + {if (!isset($orderTotalInfo['show_tourism_tax_separately']) || $orderTotalInfo['show_tourism_tax_separately']) && isset($orderTotalInfo['total_tourism_tax']) && $orderTotalInfo['total_tourism_tax'] > 0} + + + {l s='Room and Service Tax'} + + + {displayWtPriceWithCurrency price=$orderTotalInfo['total_tax_without_discount'] currency=$objOrderCurrency convert=1} + + {l s='Total Tourism Tax'} @@ -486,6 +486,15 @@ {displayWtPriceWithCurrency price=$orderTotalInfo['total_tourism_tax'] currency=$objOrderCurrency} + {else} + + + {l s='Total Taxes'} + + + {displayWtPriceWithCurrency price=($orderTotalInfo['total_tax_without_discount'] + $orderTotalInfo['total_tourism_tax']) currency=$objOrderCurrency convert=1} + + {/if} {if $order->total_discounts > 0} diff --git a/themes/hotel-reservation-theme/order-detail.tpl b/themes/hotel-reservation-theme/order-detail.tpl index 6a00a6ce3..7ee617deb 100644 --- a/themes/hotel-reservation-theme/order-detail.tpl +++ b/themes/hotel-reservation-theme/order-detail.tpl @@ -373,20 +373,27 @@ {/if} - - {l s='Room and Service Tax'} - - {displayWtPriceWithCurrency price=($total_tax_without_discount) currency=$currency} - - + {if (!isset($show_tourism_tax_separately) || $show_tourism_tax_separately) && isset($total_tourism_tax) && $total_tourism_tax > 0} + + {l s='Room and Service Tax'} + + {displayWtPriceWithCurrency price=($total_tax_without_discount) currency=$currency} + + - {if isset($total_tourism_tax) && $total_tourism_tax > 0} {l s='Total Tourism Tax'} {displayWtPriceWithCurrency price=$total_tourism_tax currency=$currency} + {else} + + {l s='Total Taxes'} + + {displayWtPriceWithCurrency price=($total_tax_without_discount + $total_tourism_tax) currency=$currency} + + {/if} {if $order->total_discounts > 0} @@ -801,19 +808,26 @@ {/if} - - {l s='Room and Service Tax'} - - {displayWtPriceWithCurrency price=($total_tax_without_discount) currency=$currency} - - - {if isset($total_tourism_tax) && $total_tourism_tax > 0} + {if (!isset($show_tourism_tax_separately) || $show_tourism_tax_separately) && isset($total_tourism_tax) && $total_tourism_tax > 0} + + {l s='Room and Service Tax'} + + {displayWtPriceWithCurrency price=($total_tax_without_discount) currency=$currency} + + {l s='Total Tourism Tax'} {displayWtPriceWithCurrency price=$total_tourism_tax currency=$currency} + {else} + + {l s='Total Taxes'} + + {displayWtPriceWithCurrency price=($total_tax_without_discount + $total_tourism_tax) currency=$currency} + + {/if} {if $order->total_discounts > 0}