diff --git a/classes/pdf/HTMLTemplateInvoice.php b/classes/pdf/HTMLTemplateInvoice.php
index 7c9494d8b..70284fd87 100644
--- a/classes/pdf/HTMLTemplateInvoice.php
+++ b/classes/pdf/HTMLTemplateInvoice.php
@@ -169,7 +169,11 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
$order_detail['unit_price_tax_excl_before_specific_price'] = $order_detail['unit_price_tax_excl_including_ecotax'] + $order_detail['reduction_amount_tax_excl'];
} elseif ($order_detail['reduction_percent'] > 0) {
$has_discount = true;
- $order_detail['unit_price_tax_excl_before_specific_price'] = (100 * $order_detail['unit_price_tax_excl_including_ecotax']) / (100 - $order_detail['reduction_percent']);
+ if ($order_detail['reduction_percent'] >= 100) {
+ $order_detail['unit_price_tax_excl_before_specific_price'] = $order_detail['original_product_price'];
+ } else {
+ $order_detail['unit_price_tax_excl_before_specific_price'] = (100 * $order_detail['unit_price_tax_excl_including_ecotax']) / (100 - $order_detail['reduction_percent']);
+ }
}
// Set tax_code
diff --git a/modules/blockcart/blockcart.tpl b/modules/blockcart/blockcart.tpl
index 347cab3f9..f2d03ddae 100644
--- a/modules/blockcart/blockcart.tpl
+++ b/modules/blockcart/blockcart.tpl
@@ -161,7 +161,7 @@
{/block}
{block name='blockcart_shopping_cart_total_convenience_fee'}
{if isset($total_convenience_fee)}
-
+
{l s='Convenience Fees' mod='blockcart'}
{if $use_taxes && $display_tax_label}
diff --git a/modules/hotelreservationsystem/classes/HotelBookingDetail.php b/modules/hotelreservationsystem/classes/HotelBookingDetail.php
index b4ae5b8ea..2672d223a 100644
--- a/modules/hotelreservationsystem/classes/HotelBookingDetail.php
+++ b/modules/hotelreservationsystem/classes/HotelBookingDetail.php
@@ -4423,6 +4423,7 @@ class HotelBookingDetail extends ObjectModel
*/
public static function getPaymentMethodStats(array $params)
{
+ $paymentMethod = isset($params['payment_method']) ? pSQL($params['payment_method']) : '';
$dateFrom = pSQL($params['date_from']);
$dateTo = pSQL(isset($params['date_to']) ? $params['date_to'] : $params['date_from']);
$idsHotel = isset($params['ids_hotel']) ? $params['ids_hotel'] : (isset($params['id_hotel']) ? $params['id_hotel'] : false);
@@ -4441,12 +4442,32 @@ class HotelBookingDetail extends ObjectModel
AND hbd.`date_add` BETWEEN "'.$dateFrom.' 00:00:00" AND "'.$dateTo.' 23:59:59"'
.($idCustomer ? ' AND hbd.`id_customer` = '.$idCustomer : '')
.($bookingType ? ' AND hbd.`booking_type` = '.$bookingType : '')
+ .($paymentMethod ? ' AND o.`payment` = \''.$paymentMethod.'\'' : '')
.HotelBranchInformation::addHotelRestriction($idsHotel, 'hbd').'
GROUP BY o.`payment`, o.`module`
ORDER BY revenue_incl DESC'
);
}
+ /**
+ * Distinct payment method names stored on valid hotel orders, used to filter the Payment Methods report.
+ *
+ * @param int|false $idHotel
+ * @return array rows: payment_method
+ */
+ public static function getDistinctOrderPaymentMethods($idHotel = false)
+ {
+ return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(
+ 'SELECT DISTINCT o.`payment` AS payment_method
+ FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
+ INNER JOIN `'._DB_PREFIX_.'orders` o ON (o.`id_order` = hbd.`id_order` AND o.`valid` = 1)
+ WHERE hbd.`id_status` != '.self::STATUS_CANCELLED.' AND o.`payment` != ""'
+ .HotelBranchInformation::addHotelRestriction($idHotel, 'hbd').'
+ ORDER BY o.`payment`'
+ );
+ }
+
+
/**
* Tax breakdown per booking line for the Tax Report.
* Delegates to ServiceProductOrderDetail::getTaxBreakdown() for service revenue.
diff --git a/modules/qlohotelreports/qlohotelreports.php b/modules/qlohotelreports/qlohotelreports.php
index 9febdd8af..489af99ce 100644
--- a/modules/qlohotelreports/qlohotelreports.php
+++ b/modules/qlohotelreports/qlohotelreports.php
@@ -760,17 +760,28 @@ class QloHotelReports extends Module
if ($report === 'source' || $report === 'payment-method') {
$bookingSource = pSQL(Tools::getValue('booking_source', ''));
+ $paymentMethod = pSQL(Tools::getValue('payment_method', ''));
$filterBaseUrl = $baseUrl . '&tab=' . $report
- . ($idHotel ? '&id_hotel=' . $idHotel : '')
- . ($bookingSource ? '&booking_source=' . $bookingSource : '');
+ . ($idHotel ? '&id_hotel=' . $idHotel : '');
$baseParams = array(
- 'date_from' => $dateFrom,
- 'date_to' => $dateTo,
- 'id_hotel' => $idHotel ?: false,
- 'booking_source' => $bookingSource,
+ 'date_from' => $dateFrom,
+ 'date_to' => $dateTo,
+ 'id_hotel' => $idHotel ?: false,
);
+ if ($report === 'payment-method') {
+ $filterBaseUrl .= ($paymentMethod ? '&payment_method=' . urlencode($paymentMethod) : '');
+ $baseParams['payment_method'] = $paymentMethod;
+ $this->context->smarty->assign(array(
+ 'filter_payment_method' => $paymentMethod,
+ 'payment_methods' => HotelBookingDetail::getDistinctOrderPaymentMethods($idHotel ?: false),
+ ));
+ } else {
+ $filterBaseUrl .= ($bookingSource ? '&booking_source=' . $bookingSource : '');
+ $baseParams['booking_source'] = $bookingSource;
+ }
+
$this->context->smarty->assign(array(
'filter_base_url' => $filterBaseUrl,
'filter_booking_source' => $bookingSource,
@@ -1658,6 +1669,10 @@ class QloHotelReports extends Module
'id_hotel' => $idHotel ?: false,
);
+ if ($report === 'payment-method') {
+ $baseParams['payment_method'] = pSQL(Tools::getValue('payment_method', ''));
+ }
+
if ($report === 'source') {
$rows = HotelBookingDetail::getChannelStats($baseParams);
$totalRevExcl = 0.0;
diff --git a/modules/qlohotelreports/views/templates/hook/group-channels.tpl b/modules/qlohotelreports/views/templates/hook/group-channels.tpl
index c4d973271..3b33d4f89 100644
--- a/modules/qlohotelreports/views/templates/hook/group-channels.tpl
+++ b/modules/qlohotelreports/views/templates/hook/group-channels.tpl
@@ -40,6 +40,21 @@
+ {if $active_report == 'payment-method'}
+