diff --git a/controllers/admin/AdminStatsController.php b/controllers/admin/AdminStatsController.php
index 2d48927a2..3b8a944e5 100644
--- a/controllers/admin/AdminStatsController.php
+++ b/controllers/admin/AdminStatsController.php
@@ -842,8 +842,9 @@ class AdminStatsControllerCore extends AdminStatsTabController
$totalDepartures = Db::getInstance()->getValue(
'SELECT COUNT(hbd.`id_room`)
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
- WHERE hbd.`is_refunded` = 0 AND hbd.`is_back_order` = 0
- AND hbd.`id_status` = '.(int) HotelBookingDetail::STATUS_CHECKED_IN.'
+ WHERE hbd.`is_refunded` = 0
+ AND ((hbd.`id_status` = '.(int) HotelBookingDetail::STATUS_CHECKED_IN.') OR
+ (hbd.`check_in` != "0000:00:00 00:00:00" AND hbd.`check_out` != "0000:00:00 00:00:00"))
AND hbd.`date_to` BETWEEN "'.pSQL($date).' 00:00:00" AND "'.pSQL($date).' 23:59:59"'.
HotelBranchInformation::addHotelRestriction($idHotel, 'hbd')
);
@@ -851,9 +852,10 @@ class AdminStatsControllerCore extends AdminStatsTabController
$departed = Db::getInstance()->getValue(
'SELECT COUNT(hbd.`id_room`)
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
- WHERE hbd.`is_refunded` = 0 AND hbd.`is_back_order` = 0
+ WHERE hbd.`is_refunded` = 0
AND hbd.`date_to` BETWEEN "'.pSQL($date).' 00:00:00" AND "'.pSQL($date).' 23:59:59"
- AND hbd.`id_status` = '.(int) HotelBookingDetail::STATUS_CHECKED_OUT.
+ AND hbd.`id_status` = '.(int) HotelBookingDetail::STATUS_CHECKED_OUT.'
+ AND hbd.`check_in` != "0000:00:00 00:00:00"'.
HotelBranchInformation::addHotelRestriction($idHotel, 'hbd')
);
@@ -1143,8 +1145,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
DATEDIFF(hbd.`date_to`, hbd.`date_from`) AS los
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = hbd.`id_customer`)
- WHERE hbd.`is_refunded` = 0 AND hbd.`is_back_order` = 0
- AND hbd.`date_from` = "'.pSQL($date).' 00:00:00"
+ WHERE hbd.`is_refunded` = 0 AND hbd.`date_from` = "'.pSQL($date).' 00:00:00"
AND hbd.`id_status` != '.(int) HotelBookingDetail::STATUS_CHECKED_IN.'
AND hbd.`id_status` != '.(int) HotelBookingDetail::STATUS_CHECKED_OUT.
(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : '');
@@ -1159,8 +1160,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
DATEDIFF(hbd.`date_to`, hbd.`date_from`) AS los
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = hbd.`id_customer`)
- WHERE hbd.`is_refunded` = 0 AND hbd.`is_back_order` = 0
- AND hbd.`date_to` = "'.pSQL($date).' 00:00:00"
+ WHERE hbd.`is_refunded` = 0 AND hbd.`date_to` = "'.pSQL($date).' 00:00:00"
AND hbd.`id_status` = '.(int) HotelBookingDetail::STATUS_CHECKED_IN.'
AND hbd.`id_status` != '.(int) HotelBookingDetail::STATUS_CHECKED_OUT.
(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : '');
@@ -1175,8 +1175,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
DATEDIFF(hbd.`date_to`, hbd.`date_from`) AS los
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = hbd.`id_customer`)
- WHERE hbd.`is_refunded` = 0 AND hbd.`is_back_order` = 0
- AND hbd.`id_status` = '.(int) HotelBookingDetail::STATUS_CHECKED_IN.'
+ WHERE hbd.`is_refunded` = 0 AND hbd.`id_status` = '.(int) HotelBookingDetail::STATUS_CHECKED_IN.'
AND hbd.`id_status` != '.(int) HotelBookingDetail::STATUS_CHECKED_OUT.
(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : '');
$result = Db::getInstance()->executeS($sql);
@@ -1194,8 +1193,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl
ON (osl.`id_order_state` = o.`current_state` AND osl.`id_lang` = '.(int) Context::getContext()->language->id.')
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = hbd.`id_customer`)
- WHERE hbd.`is_refunded` = 0 AND hbd.`is_back_order` = 0
- AND hbd.`date_add` BETWEEN "'.pSQL($date).' 00:00:00" AND "'.pSQL($date).' 23:59:59"'.
+ WHERE hbd.`date_add` BETWEEN "'.pSQL($date).' 00:00:00" AND "'.pSQL($date).' 23:59:59"'.
(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : '').'
GROUP BY hbd.`id_order`';
$result = Db::getInstance()->executeS($sql);
@@ -1205,21 +1203,20 @@ class AdminStatsControllerCore extends AdminStatsTabController
public static function getCancellationsInfoByDate($date, $idHotel = null)
{
- $sql = 'SELECT orr.`id_customer`, hbd.`room_num`, hbd.`id_product`, hbd.`room_type_name`,
+ $sql = 'SELECT orr.`id_order_return`, orr.`id_customer`, hbd.`room_num`, hbd.`id_product`, hbd.`room_type_name`,
CONCAT(c.`firstname`, " ", c.`lastname`) AS customer_name,
hbd.`id_hotel`, hbd.`hotel_name`, SUM(hbd.`adult` + hbd.`children`) AS total_guests,
- hbd.`date_from`, hbd.`date_to`, orr.`id_order`,
- o.`total_paid_tax_excl`, o.`id_currency`, orsl.`name` AS `state_name`
+ hbd.`date_from`, hbd.`date_to`, orr.`id_order`
FROM `'._DB_PREFIX_.'order_return` orr
LEFT JOIN `'._DB_PREFIX_.'order_return_detail` ord ON (ord.`id_order_return` = orr.`id_order_return`)
LEFT JOIN `'._DB_PREFIX_.'orders` o ON (o.`id_order` = orr.`id_order`)
LEFT JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd ON (hbd.`id` = ord.`id_htl_booking`)
- LEFT JOIN `'._DB_PREFIX_.'order_return_state_lang` orsl
- ON (orsl.`id_order_return_state` = orr.`state` AND orsl.`id_lang` = '.(int) Context::getContext()->language->id.')
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = orr.`id_customer`)
- WHERE orr.`date_add` BETWEEN "'.pSQL($date).' 00:00:00" AND "'.pSQL($date).' 23:59:59"'.
+ WHERE orr.`date_add` BETWEEN "'.pSQL($date).' 00:00:00" AND "'.pSQL($date).' 23:59:59"
+ AND orr.`state` = '.(int) OrderReturnState::ORDER_RETRUN_FIRST_STATUS.
(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : '').'
- GROUP BY orr.`id_order_return`';
+ GROUP BY ord.`id_htl_booking`
+ ORDER BY orr.`date_add` DESC';
$result = Db::getInstance()->executeS($sql);
return $result;
diff --git a/modules/dashguestcycle/dashguestcycle.php b/modules/dashguestcycle/dashguestcycle.php
index 7539d96b4..0eadea29b 100644
--- a/modules/dashguestcycle/dashguestcycle.php
+++ b/modules/dashguestcycle/dashguestcycle.php
@@ -131,7 +131,7 @@ class DashGuestCycle extends Module
public function getTableArrivalsByDate($date, $idHotel)
{
$header = array(
- 'name' => array('title' => $this->l('Name'), 'class' => 'text-left'),
+ 'name' => array('title' => $this->l('Customer Name'), 'class' => 'text-left'),
'room_num' => array('title' => $this->l('Room No.'), 'class' => 'text-center'),
'room_type' => array('title' => $this->l('Room Type'), 'class' => 'text-left'),
'hotel' => array('title' => $this->l('Hotel'), 'class' => 'text-left'),
@@ -191,7 +191,7 @@ class DashGuestCycle extends Module
public function getTableDeparturesByDate($date, $idHotel)
{
$header = array(
- 'name' => array('title' => $this->l('Name'), 'class' => 'text-left'),
+ 'name' => array('title' => $this->l('Customer Name'), 'class' => 'text-left'),
'room_num' => array('title' => $this->l('Room No.'), 'class' => 'text-center'),
'room_type' => array('title' => $this->l('Room Type'), 'class' => 'text-left'),
'hotel' => array('title' => $this->l('Hotel'), 'class' => 'text-left'),
@@ -251,7 +251,7 @@ class DashGuestCycle extends Module
public function getTableInHouseByDate($date, $idHotel)
{
$header = array(
- 'name' => array('title' => $this->l('Name'), 'class' => 'text-left'),
+ 'name' => array('title' => $this->l('Customer Name'), 'class' => 'text-left'),
'room_num' => array('title' => $this->l('Room No.'), 'class' => 'text-center'),
'room_type' => array('title' => $this->l('Room Type'), 'class' => 'text-left'),
'hotel' => array('title' => $this->l('Hotel'), 'class' => 'text-left'),
@@ -316,11 +316,11 @@ class DashGuestCycle extends Module
public function getTableNewBookingsByDate($date, $idHotel)
{
$header = array(
- 'name' => array('title' => $this->l('Name'), 'class' => 'text-left'),
+ 'order_id' => array('title' => $this->l('Order ID'), 'class' => 'text-center'),
+ 'name' => array('title' => $this->l('Customer Name'), 'class' => 'text-left'),
+ 'hotel' => array('title' => $this->l('Hotel'), 'class' => 'text-left'),
'total' => array('title' => $this->l('Total Rooms'), 'class' => 'text-center'),
'guests' => array('title' => $this->l('Guests'), 'class' => 'text-center'),
- 'hotel' => array('title' => $this->l('Hotel'), 'class' => 'text-left'),
- 'order_id' => array('title' => $this->l('Order ID'), 'class' => 'text-center'),
'order_total' => array('title' => $this->l('Order Total'), 'class' => 'text-right'),
'order_status' => array('title' => $this->l('Order Status'), 'class' => 'text-left'),
);
@@ -336,18 +336,14 @@ class DashGuestCycle extends Module
$objCurrency = Currency::getCurrency($newBookingInfo['id_currency']);
$tr = array();
+ $tr[] = array(
+ 'value' => '#'.Tools::htmlentitiesUTF8($newBookingInfo['id_order']).'',
+ 'class' => 'text-center',
+ );
$tr[] = array(
'value' => ''.Tools::htmlentitiesUTF8($newBookingInfo['customer_name']).'',
'class' => 'text-left',
);
- $tr[] = array(
- 'value' => $newBookingInfo['total_rooms'],
- 'class' => 'text-center',
- );
- $tr[] = array(
- 'value' => $newBookingInfo['total_guests'],
- 'class' => 'text-center',
- );
if ($idHotel == 0) {
$tr[] = array(
@@ -357,7 +353,11 @@ class DashGuestCycle extends Module
}
$tr[] = array(
- 'value' => '#'.Tools::htmlentitiesUTF8($newBookingInfo['id_order']).'',
+ 'value' => $newBookingInfo['total_rooms'],
+ 'class' => 'text-center',
+ );
+ $tr[] = array(
+ 'value' => $newBookingInfo['total_guests'],
'class' => 'text-center',
);
$tr[] = array(
@@ -378,7 +378,8 @@ class DashGuestCycle extends Module
public function getTableCancellationsByDate($date, $idHotel)
{
$header = array(
- 'name' => array('title' => $this->l('Name'), 'class' => 'text-left'),
+ 'request_id' => array('title' => $this->l('Request ID'), 'class' => 'text-center'),
+ 'name' => array('title' => $this->l('Customer Name'), 'class' => 'text-left'),
'room_num' => array('title' => $this->l('Room No.'), 'class' => 'text-center'),
'room_type' => array('title' => $this->l('Room Type'), 'class' => 'text-left'),
'hotel' => array('title' => $this->l('Hotel'), 'class' => 'text-left'),
@@ -386,7 +387,6 @@ class DashGuestCycle extends Module
'check_in' => array('title' => $this->l('Check-in'), 'class' => 'text-left'),
'check_out' => array('title' => $this->l('Check-out'), 'class' => 'text-left'),
'order_id' => array('title' => $this->l('Order ID'), 'class' => 'text-center'),
- 'order_status' => array('title' => $this->l('Cancel Status'), 'class' => 'text-left'),
);
if ($idHotel != 0) {
@@ -400,6 +400,10 @@ class DashGuestCycle extends Module
$objCurrency = Currency::getCurrency($cancellationInfo['id_currency']);
$tr = array();
+ $tr[] = array(
+ 'value' => '#'.Tools::htmlentitiesUTF8($cancellationInfo['id_order_return']).'',
+ 'class' => 'text-center',
+ );
$tr[] = array(
'value' => ''.Tools::htmlentitiesUTF8($cancellationInfo['customer_name']).'',
'class' => 'text-left',
@@ -436,10 +440,6 @@ class DashGuestCycle extends Module
'value' => '#'.Tools::htmlentitiesUTF8($cancellationInfo['id_order']).'',
'class' => 'text-center',
);
- $tr[] = array(
- 'value' => $cancellationInfo['state_name'],
- 'class' => 'text-left',
- );
$body[] = $tr;
}