Fixed: Orders List KPIs in back office AND added tpl.txt mail files for text format
This commit is contained in:
@@ -972,10 +972,21 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
||||
FROM `'._DB_PREFIX_.'orders` o
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_state` os ON os.`id_order_state` = o.`current_state`
|
||||
WHERE o.`invoice_date` BETWEEN "'.pSQL(date('Y-m-d', strtotime('-'.($daysForAvgOrderVal + 1).' day'))).' 00:00:00"
|
||||
AND "'.pSQL(date('Y-m-d')).' 23:59:59" AND os.`logable` = 1 AND EXISTS (
|
||||
SELECT 1
|
||||
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
WHERE hbd.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($idHotels).'
|
||||
AND "'.pSQL(date('Y-m-d')).' 23:59:59" AND os.`logable` = 1
|
||||
AND (
|
||||
EXISTS (
|
||||
SELECT 1
|
||||
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
WHERE hbd.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($idHotels).'
|
||||
) OR EXISTS (
|
||||
SELECT 1
|
||||
FROM `'._DB_PREFIX_.'service_product_order_detail` spod
|
||||
WHERE spod.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($idHotels, 'spod').'
|
||||
)'.(!$idHotels ? ' OR EXISTS (
|
||||
SELECT 1
|
||||
FROM `'._DB_PREFIX_.'service_product_order_detail` spod
|
||||
WHERE spod.`id_order` = o.`id_order` AND spod.`id_hotel` = 0 AND spod.`id_htl_booking_detail` = 0
|
||||
)' : '').'
|
||||
)');
|
||||
$value = Tools::displayPrice($row['orders'] ? $row['total_paid_tax_excl'] / $row['orders'] : 0, $currency).' ('.$this->l('tax excl.').')';
|
||||
|
||||
@@ -2555,11 +2566,21 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_state` os ON o.current_state = os.id_order_state
|
||||
WHERE 1 ' .
|
||||
($invalidOrderStates ? ' AND o.`current_state` NOT IN ('.implode(',', $invalidOrderStates).')' : '') .
|
||||
(($dateFrom && $dateTo) ? ' AND o.`date_add` BETWEEN "'.pSQL($dateFrom).' 00:00:00" AND "'.pSQL($dateTo).' 23:59:59"' : '').
|
||||
' AND EXISTS (
|
||||
SELECT 1
|
||||
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
WHERE hbd.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($idHotel).'
|
||||
(($dateFrom && $dateTo) ? ' AND o.`date_add` BETWEEN "'.pSQL($dateFrom).' 00:00:00" AND "'.pSQL($dateTo).' 23:59:59"' : '').'
|
||||
AND (
|
||||
EXISTS (
|
||||
SELECT 1
|
||||
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
WHERE hbd.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($idHotel).'
|
||||
) OR EXISTS (
|
||||
SELECT 1
|
||||
FROM `'._DB_PREFIX_.'service_product_order_detail` spod
|
||||
WHERE spod.`id_order` = o.`id_order`' . HotelBranchInformation::addHotelRestriction($idHotel, 'spod').'
|
||||
)'.(!$idHotel ? ' OR EXISTS (
|
||||
SELECT 1
|
||||
FROM `'._DB_PREFIX_.'service_product_order_detail` spod
|
||||
WHERE spod.`id_order` = o.`id_order` AND spod.`id_hotel` = 0 AND spod.`id_htl_booking_detail` = 0
|
||||
)' : '').'
|
||||
)';
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user