Merge pull request #1992 from Azhar-Webkul/gli-3332
Fixed : Multiple calculation issues
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -161,7 +161,7 @@
|
||||
{/block}
|
||||
{block name='blockcart_shopping_cart_total_convenience_fee'}
|
||||
{if isset($total_convenience_fee)}
|
||||
<div class="cart-prices-line">
|
||||
<div class="cart-prices-line"{if !$total_convenience_fee} style="display:none"{/if}>
|
||||
<span class="price cart_block_convenience_fee ajax_cart_convenience_fee">{convertPrice price=$total_convenience_fee}</span>
|
||||
<span class="price">{l s='Convenience Fees' mod='blockcart'}</strong>
|
||||
</div>
|
||||
@@ -343,7 +343,7 @@
|
||||
</div> -->
|
||||
{block name='blockcart_layer_cart_total_convenience_fee'}
|
||||
{if isset($total_convenience_fee)}
|
||||
<div class="layer_cart_row">
|
||||
<div class="layer_cart_row"{if !$total_convenience_fee} style="display:none"{/if}>
|
||||
<strong class="dark">
|
||||
{l s='Convenience Fees' mod='blockcart'}
|
||||
{if $use_taxes && $display_tax_label}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -40,6 +40,21 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{if $active_report == 'payment-method'}
|
||||
<div class="row">
|
||||
<label class="col-xs-3">{l s='Payment Method' mod='qlohotelreports'}</label>
|
||||
<div class="col-xs-9">
|
||||
<select name="payment_method" class="form-control">
|
||||
<option value=""{if !$filter_payment_method} selected="selected"{/if}>{l s='All' mod='qlohotelreports'}</option>
|
||||
{foreach $payment_methods as $pm}
|
||||
<option value="{$pm.payment_method|escape:'html':'UTF-8'}"{if $filter_payment_method == $pm.payment_method} selected="selected"{/if}>
|
||||
{$pm.payment_method|escape:'html':'UTF-8'}
|
||||
</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{else}
|
||||
<div class="row">
|
||||
<label class="col-xs-3">{l s='Booking Source' mod='qlohotelreports'}</label>
|
||||
<div class="col-xs-9">
|
||||
@@ -48,6 +63,7 @@
|
||||
placeholder="{l s='All sources' mod='qlohotelreports'}">
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="actions">
|
||||
<hr>
|
||||
<span class="pull-right">
|
||||
|
||||
@@ -161,8 +161,8 @@
|
||||
{/if}
|
||||
{/block}
|
||||
{block name='blockcart_shopping_cart_total_convenience_fee'}
|
||||
{if isset($total_convenience_fee) && $total_convenience_fee}
|
||||
<div class="cart-prices-line">
|
||||
{if isset($total_convenience_fee)}
|
||||
<div class="cart-prices-line"{if !$total_convenience_fee} style="display:none"{/if}>
|
||||
<span class="price cart_block_convenience_fee ajax_cart_convenience_fee">{convertPrice price=$total_convenience_fee}</span>
|
||||
<span class="price">{l s='Convenience Fees' mod='blockcart'}</strong>
|
||||
</div>
|
||||
@@ -343,8 +343,8 @@
|
||||
</span>
|
||||
</div> -->
|
||||
{block name='blockcart_layer_cart_total_convenience_fee'}
|
||||
{if isset($total_convenience_fee) && $total_convenience_fee}
|
||||
<div class="layer_cart_row">
|
||||
{if isset($total_convenience_fee)}
|
||||
<div class="layer_cart_row"{if !$total_convenience_fee} style="display:none"{/if}>
|
||||
<strong class="dark">
|
||||
{l s='Convenience Fees' mod='blockcart'}
|
||||
{if $use_taxes && $display_tax_label}
|
||||
|
||||
Reference in New Issue
Block a user