Merge pull request #1791 from varunkewlani322/gli-3071
Added: Hotel reports module and functions needed for reports in their respective classes
This commit is contained in:
@@ -25,10 +25,15 @@
|
||||
<div id="container" class="row">
|
||||
<div class="sidebar navigation col-md-3">
|
||||
<nav class="list-group categorieList">
|
||||
{if count($modules)}
|
||||
{foreach $modules as $module}
|
||||
{if $module_instance[$module.name]}
|
||||
<a class="list-group-item{if ($current_module_name && $current_module_name == $module.name)} active{/if}" href="{$current|escape:'html':'UTF-8'}&token={$token|escape:'html':'UTF-8'}&module={$module.name}">{$module_instance[$module.name]->displayName}</a>
|
||||
{if count($module_tabs)}
|
||||
{foreach $module_tabs as $module_name => $moduleData}
|
||||
{if isset($moduleData.tabs) && $moduleData.tabs}
|
||||
{foreach $moduleData.tabs as $tab}
|
||||
{assign var="tab_active" value=($current_module_name == $module_name && $current_tab == $tab.key)}
|
||||
<a class="list-group-item{if $tab_active} active{/if}" href="{$current|escape:'html':'UTF-8'}&token={$token|escape:'html':'UTF-8'}&module={$module_name|escape:'html':'UTF-8'}&tab={$tab.key|escape:'html':'UTF-8'}">{$tab.label}</a>
|
||||
{/foreach}
|
||||
{else}
|
||||
<a class="list-group-item{if $current_module_name == $module_name} active{/if}" href="{$current|escape:'html':'UTF-8'}&token={$token|escape:'html':'UTF-8'}&module={$module_name|escape:'html':'UTF-8'}">{$moduleData.display_name}</a>
|
||||
{/if}
|
||||
{/foreach}
|
||||
{else}
|
||||
|
||||
@@ -3144,4 +3144,138 @@ class OrderCore extends ObjectModel
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// ── REPORT METHODS ────────────────────────────────────────────────────────
|
||||
|
||||
/**
|
||||
* Orders with unpaid balance for the outstanding-payments report.
|
||||
*
|
||||
* @param array $params date_from, date_to, id_hotel, id_order
|
||||
* @return array
|
||||
*/
|
||||
public static function getOutstandingBalance(array $params)
|
||||
{
|
||||
$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);
|
||||
$idOrder = isset($params['id_order']) ? (int) $params['id_order'] : 0;
|
||||
|
||||
$hotelFilter = HotelBranchInformation::addHotelRestriction($idsHotel, 'hbd');
|
||||
$hotelExists = $hotelFilter
|
||||
? ' AND EXISTS (SELECT 1 FROM `'._DB_PREFIX_.'htl_booking_detail` hbd WHERE hbd.`id_order` = o.`id_order`'.$hotelFilter.')'
|
||||
: '';
|
||||
|
||||
return Db::getInstance()->executeS(
|
||||
'SELECT o.`id_order`, o.`reference`, o.`id_customer`,
|
||||
CONCAT(c.`firstname`, " ", c.`lastname`) AS customer_name,
|
||||
c.`email`, a.`phone`,
|
||||
o.`total_paid_tax_incl` / o.`conversion_rate` AS total_charges,
|
||||
IFNULL((
|
||||
SELECT SUM(op.`amount`)
|
||||
FROM `'._DB_PREFIX_.'order_payment` op
|
||||
WHERE op.`order_reference` = o.`reference`
|
||||
), 0) / o.`conversion_rate` AS total_paid,
|
||||
(o.`total_paid_tax_incl` - IFNULL((
|
||||
SELECT SUM(op.`amount`)
|
||||
FROM `'._DB_PREFIX_.'order_payment` op
|
||||
WHERE op.`order_reference` = o.`reference`
|
||||
), 0)) / o.`conversion_rate` AS balance_due,
|
||||
(
|
||||
SELECT MAX(op.`date_add`)
|
||||
FROM `'._DB_PREFIX_.'order_payment` op
|
||||
WHERE op.`order_reference` = o.`reference`
|
||||
) AS last_payment_date
|
||||
FROM `'._DB_PREFIX_.'orders` o
|
||||
INNER JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = o.`id_customer`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'address` a ON (a.`id_address` = o.`id_address_invoice`)
|
||||
WHERE o.`valid` = 1
|
||||
AND o.`date_add` BETWEEN "'.$dateFrom.' 00:00:00" AND "'.$dateTo.' 23:59:59"'
|
||||
.($idOrder ? ' AND o.`id_order` = '.$idOrder : '')
|
||||
.$hotelExists.'
|
||||
HAVING balance_due > 0.01
|
||||
ORDER BY balance_due DESC'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Total order-level discounts applied to hotel orders in the date range.
|
||||
* Returns positive number representing the discount amount.
|
||||
*
|
||||
* @param array $params date_from, date_to, id_hotel, id_customer
|
||||
* @return float
|
||||
*/
|
||||
public static function getTotalDiscounts(array $params)
|
||||
{
|
||||
$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);
|
||||
$idCustomer = isset($params['id_customer']) ? (int) $params['id_customer'] : 0;
|
||||
|
||||
$hotelExists = ' AND EXISTS (
|
||||
SELECT 1 FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
WHERE hbd.`id_order` = o.`id_order`'
|
||||
.HotelBranchInformation::addHotelRestriction($idsHotel, 'hbd')
|
||||
.')';
|
||||
|
||||
return (float) Db::getInstance()->getValue(
|
||||
'SELECT IFNULL(SUM(o.`total_discounts_tax_excl` / o.`conversion_rate`), 0)
|
||||
FROM `'._DB_PREFIX_.'orders` o
|
||||
WHERE o.`valid` = 1
|
||||
AND o.`date_add` BETWEEN "'.$dateFrom.' 00:00:00" AND "'.$dateTo.' 23:59:59"'
|
||||
.($idCustomer ? ' AND o.`id_customer` = '.$idCustomer : '')
|
||||
.$hotelExists
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Guest directory — one row per customer with lifetime stay stats and contact info.
|
||||
* Date range (if given) filters by stay overlap (HAVING).
|
||||
*
|
||||
* @param array $params date_from, date_to, id_hotel, id_product, id_lang
|
||||
* @return array
|
||||
*/
|
||||
public static function getGuestDirectory(array $params)
|
||||
{
|
||||
$dateFrom = isset($params['date_from']) ? pSQL($params['date_from']) : '';
|
||||
$dateTo = isset($params['date_to']) ? pSQL($params['date_to']) : '';
|
||||
$idsHotel = isset($params['ids_hotel']) ? $params['ids_hotel'] : (isset($params['id_hotel']) ? $params['id_hotel'] : false);
|
||||
$idProduct = isset($params['id_product']) ? (int) $params['id_product'] : 0;
|
||||
$idLang = isset($params['id_lang']) ? (int) $params['id_lang'] : 0;
|
||||
if (!$idLang) {
|
||||
$idLang = Context::getContext()->language->id;
|
||||
}
|
||||
|
||||
return Db::getInstance()->executeS(
|
||||
'SELECT c.`id_customer`,
|
||||
CONCAT(c.`firstname`, " ", c.`lastname`) AS customer_name,
|
||||
c.`email`,
|
||||
c.`phone`, a.`address1`, a.`address2`, a.`city`, a.`postcode`, a.`vat_number`, a.`company`,
|
||||
cl.`name` AS country,
|
||||
st.`name` AS state,
|
||||
COUNT(DISTINCT o.`id_order`) AS total_stays,
|
||||
SUM(DATEDIFF(hbd.`date_to`, hbd.`date_from`)) AS total_nights,
|
||||
IFNULL(SUM(hbd.`total_price_tax_incl` / o.`conversion_rate`), 0) AS lifetime_revenue,
|
||||
IFNULL(SUM(hbd.`total_price_tax_incl` / o.`conversion_rate`) / NULLIF(COUNT(DISTINCT o.`id_order`), 0), 0) AS avg_spend_per_stay,
|
||||
MAX(hbd.`date_from`) AS last_stay
|
||||
FROM `'._DB_PREFIX_.'orders` o
|
||||
INNER JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = o.`id_customer`)
|
||||
INNER JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
ON (hbd.`id_order` = o.`id_order` AND hbd.`is_cancelled` = 0 AND hbd.`is_refunded` = 0)
|
||||
LEFT JOIN `'._DB_PREFIX_.'address` a
|
||||
ON (a.`id_customer` = c.`id_customer` AND a.`deleted` = 0
|
||||
AND a.`id_address` = (SELECT MAX(`id_address`) FROM `'._DB_PREFIX_.'address`
|
||||
WHERE `id_customer` = c.`id_customer` AND `deleted` = 0))
|
||||
LEFT JOIN `'._DB_PREFIX_.'country_lang` cl
|
||||
ON (cl.`id_country` = a.`id_country` AND cl.`id_lang` = '.(int) $idLang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'state` st ON (st.`id_state` = a.`id_state`)
|
||||
WHERE o.`valid` = 1'
|
||||
.($idProduct ? ' AND hbd.`id_product` = '.$idProduct : '')
|
||||
.HotelBranchInformation::addHotelRestriction($idsHotel, 'hbd').'
|
||||
GROUP BY c.`id_customer`'
|
||||
.($dateFrom && $dateTo
|
||||
? ' HAVING MAX(IF(hbd.`date_from` <= "'.$dateTo.'" AND hbd.`date_to` > "'.$dateFrom.'", 1, 0)) = 1'
|
||||
: '').'
|
||||
ORDER BY total_stays DESC, lifetime_revenue DESC'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,4 +160,63 @@ class OrderPaymentCore extends ObjectModel
|
||||
return Db::getInstance()->getValue('SELECT (SUM(`amount` * `conversion_rate`) / SUM(`amount`)) FROM `'._DB_PREFIX_.'order_payment` WHERE `order_reference` = \''.pSQL($order_reference).'\' AND `id_currency` = '.(int)$idCurrency);
|
||||
}
|
||||
|
||||
// ── REPORT METHODS ────────────────────────────────────────────────────────
|
||||
|
||||
/**
|
||||
* Payment detail rows for the payment report.
|
||||
*
|
||||
* @param array $params date_from, date_to, id_hotel, id_order, id_customer, payment_method
|
||||
* @return array
|
||||
*/
|
||||
public static function getPaymentsInfo(array $params)
|
||||
{
|
||||
$dateFrom = pSQL($params['date_from']);
|
||||
$dateTo = pSQL(isset($params['date_to']) ? $params['date_to'] : $params['date_from']);
|
||||
$idHotel = isset($params['id_hotel']) ? $params['id_hotel'] : false;
|
||||
$idOrder = isset($params['id_order']) ? (int) $params['id_order'] : 0;
|
||||
$idCustomer = isset($params['id_customer']) ? (int) $params['id_customer'] : 0;
|
||||
$paymentMethod = isset($params['payment_method']) ? pSQL($params['payment_method']) : '';
|
||||
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(
|
||||
'SELECT op.`id_order_payment`, op.`date_add`, o.`id_order`, o.`id_customer`,
|
||||
op.`order_reference` AS reference,
|
||||
CONCAT(c.`firstname`, " ", c.`lastname`) AS customer_name,
|
||||
op.`payment_method`, op.`payment_type`, op.`amount`, op.`conversion_rate`,
|
||||
op.`transaction_id`, op.`id_currency`, cur.`iso_code` AS currency_iso, cur.`sign` AS currency_sign
|
||||
FROM `'._DB_PREFIX_.'order_payment` op
|
||||
INNER JOIN `'._DB_PREFIX_.'orders` o ON (o.`reference` = op.`order_reference` AND o.`valid` = 1)
|
||||
INNER JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = o.`id_customer`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'currency` cur ON (cur.`id_currency` = op.`id_currency`)
|
||||
INNER JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
ON (hbd.`id_order` = o.`id_order` AND hbd.`is_cancelled` = 0)
|
||||
WHERE op.`date_add` BETWEEN "'.$dateFrom.' 00:00:00" AND "'.$dateTo.' 23:59:59"'
|
||||
.($idOrder ? ' AND o.`id_order` = '.$idOrder : '')
|
||||
.($idCustomer ? ' AND o.`id_customer` = '.$idCustomer : '')
|
||||
.($paymentMethod ? ' AND op.`payment_method` = "'.$paymentMethod.'"' : '')
|
||||
.HotelBranchInformation::addHotelRestriction($idHotel, 'hbd').'
|
||||
GROUP BY op.`id_order_payment`
|
||||
ORDER BY op.`date_add` DESC'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Distinct payment methods used in hotel orders.
|
||||
*
|
||||
* @param int|false $idHotel
|
||||
* @return array rows: payment_method
|
||||
*/
|
||||
public static function getDistinctPaymentMethods($idHotel = false)
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(
|
||||
'SELECT DISTINCT op.`payment_method`
|
||||
FROM `'._DB_PREFIX_.'order_payment` op
|
||||
INNER JOIN `'._DB_PREFIX_.'orders` o
|
||||
ON (o.`reference` = op.`order_reference` AND o.`valid` = 1)
|
||||
INNER JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
ON (hbd.`id_order` = o.`id_order` AND hbd.`is_cancelled` = 0)
|
||||
WHERE op.`payment_method` IS NOT NULL AND op.`payment_method` != ""'
|
||||
.HotelBranchInformation::addHotelRestriction($idHotel, 'hbd').'
|
||||
ORDER BY op.`payment_method`'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1370,15 +1370,16 @@ class AdminStatsControllerCore extends AdminStatsTabController
|
||||
);
|
||||
}
|
||||
|
||||
public static function getTotalRooms($idHotel = null, $active = null)
|
||||
public static function getTotalRooms($idHotel = null, $active = null, $idProduct = null)
|
||||
{
|
||||
$sql = 'SELECT COUNT(hri.`id`)
|
||||
FROM `'._DB_PREFIX_.'htl_room_information` hri
|
||||
INNER JOIN `'._DB_PREFIX_.'product` p
|
||||
ON (p.`id_product` = hri.`id_product`)
|
||||
WHERE p.`booking_product` = 1 '.
|
||||
(!is_null($active) ? ' AND p.`active` ='.(int) $active : ' ').
|
||||
(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hri') : '');
|
||||
(!is_null($active) ? ' AND p.`active` = '.(int) $active : '').
|
||||
(!is_null($idProduct) ? ' AND hri.`id_product` = '.(int) $idProduct : '').
|
||||
(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hri') : '');
|
||||
|
||||
return Db::getInstance()->getValue($sql);
|
||||
}
|
||||
|
||||
@@ -104,6 +104,7 @@ abstract class AdminStatsTabControllerCore extends AdminPreferencesControllerCor
|
||||
$action .= ($module ? '&module='.Tools::safeOutput($module) : '');
|
||||
$action .= (($id_product = Tools::getValue('id_product')) ? '&id_product='.Tools::safeOutput($id_product) : '');
|
||||
$action .= (($id_hotel = Tools::getValue('id_hotel')) ? '&id_hotel='.Tools::safeOutput($id_hotel) : '');
|
||||
$action .= (($tab = Tools::getValue('tab')) ? '&tab='.Tools::safeOutput($tab) : '');
|
||||
$tpl->assign(array(
|
||||
'current' => self::$currentIndex,
|
||||
'token' => $token,
|
||||
@@ -150,34 +151,74 @@ abstract class AdminStatsTabControllerCore extends AdminPreferencesControllerCor
|
||||
$tpl = $this->createTemplate('menu.tpl');
|
||||
|
||||
$modules = $this->getModules();
|
||||
$module_instance = array();
|
||||
foreach ($modules as $m => $module) {
|
||||
if ($module_instance[$module['name']] = Module::getInstanceByName($module['name'])) {
|
||||
$modules[$m]['displayName'] = $module_instance[$module['name']]->displayName;
|
||||
} else {
|
||||
unset($module_instance[$module['name']]);
|
||||
unset($modules[$m]);
|
||||
|
||||
$statsTabs = array();
|
||||
foreach ($modules as $module) {
|
||||
if ($moduleObj = Module::getInstanceByName($module['name'])) {
|
||||
$statsTabs[$module['name']] = array(
|
||||
'display_name' => $moduleObj->displayName,
|
||||
'position' => property_exists($moduleObj, 'stats_position') ? (int)$moduleObj->stats_position : null,
|
||||
);
|
||||
if (method_exists($moduleObj, 'getStatsTabs')) {
|
||||
$statsTabs[$module['name']]['tabs'] = $moduleObj->getStatsTabs();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uasort($modules, array($this, 'checkModulesNames'));
|
||||
$positionedModules = array_filter($statsTabs, fn($d) => $d['position'] !== null);
|
||||
$defaultModules = array_filter($statsTabs, fn($d) => $d['position'] === null);
|
||||
|
||||
$modulesBySlot = [];
|
||||
foreach ($positionedModules as $name => $data) {
|
||||
$modulesBySlot[$data['position']][$name] = $data;
|
||||
}
|
||||
ksort($modulesBySlot);
|
||||
|
||||
$defaultKeys = array_keys($defaultModules);
|
||||
$defaultCount = count($defaultKeys);
|
||||
$statsTabs = [];
|
||||
$defaultModulesIndex = 0;
|
||||
$positionedModulesCount = 0;
|
||||
|
||||
foreach ($modulesBySlot as $slot => $group) {
|
||||
$defaultsBefore = max(0, $slot - 1 - $positionedModulesCount);
|
||||
while ($defaultModulesIndex < $defaultsBefore && $defaultModulesIndex < $defaultCount) {
|
||||
$key = $defaultKeys[$defaultModulesIndex++];
|
||||
$statsTabs[$key] = $defaultModules[$key];
|
||||
}
|
||||
foreach ($group as $name => $data) {
|
||||
$statsTabs[$name] = $data;
|
||||
$positionedModulesCount++;
|
||||
}
|
||||
}
|
||||
|
||||
while ($defaultModulesIndex < $defaultCount) {
|
||||
$key = $defaultKeys[$defaultModulesIndex++];
|
||||
$statsTabs[$key] = $defaultModules[$key];
|
||||
}
|
||||
|
||||
Hook::exec('actionStatsTabsModifier', array(
|
||||
'stats_tabs' => &$statsTabs
|
||||
));
|
||||
|
||||
$currentModuleName = Tools::getValue('module') ?: array_key_first($statsTabs);
|
||||
$currentTab = Tools::getValue('tab', '');
|
||||
if (!$currentTab && isset($statsTabs[$currentModuleName]['tabs'])) {
|
||||
$firstTab = reset($statsTabs[$currentModuleName]['tabs']);
|
||||
$currentTab = $firstTab['key'];
|
||||
}
|
||||
|
||||
$tpl->assign(array(
|
||||
'current' => self::$currentIndex,
|
||||
'current_module_name' => Tools::getValue('module', 'statsforecast'),
|
||||
'current_module_name' => $currentModuleName,
|
||||
'current_tab' => $currentTab,
|
||||
'token' => $this->token,
|
||||
'modules' => $modules,
|
||||
'module_instance' => $module_instance
|
||||
'module_tabs' => $statsTabs,
|
||||
));
|
||||
|
||||
return $tpl->fetch();
|
||||
}
|
||||
|
||||
public function checkModulesNames($a, $b)
|
||||
{
|
||||
return ($a['displayName'] > $b['displayName']) ? 1 : 0;
|
||||
}
|
||||
|
||||
protected function getModules()
|
||||
{
|
||||
$sql = 'SELECT h.`name` AS hook, m.`name`
|
||||
@@ -191,12 +232,30 @@ abstract class AdminStatsTabControllerCore extends AdminPreferencesControllerCor
|
||||
return Db::getInstance()->executeS($sql);
|
||||
}
|
||||
|
||||
protected function getDefaultModuleName()
|
||||
{
|
||||
$modules = $this->getModules();
|
||||
if (empty($modules)) {
|
||||
return '';
|
||||
}
|
||||
$sorted = [];
|
||||
foreach ($modules as $mod) {
|
||||
$instance = Module::getInstanceByName($mod['name']);
|
||||
$pos = ($instance && property_exists($instance, 'stats_position'))
|
||||
? (int) $instance->stats_position
|
||||
: PHP_INT_MAX;
|
||||
$sorted[] = ['name' => $mod['name'], 'pos' => $pos];
|
||||
}
|
||||
usort($sorted, fn($a, $b) => $a['pos'] <=> $b['pos']);
|
||||
return $sorted[0]['name'];
|
||||
}
|
||||
|
||||
public function displayStats()
|
||||
{
|
||||
$tpl = $this->createTemplate('stats.tpl');
|
||||
|
||||
if ((!($module_name = Tools::getValue('module')) || !Validate::isModuleName($module_name)) && ($module_instance = Module::getInstanceByName('statsforecast')) && $module_instance->active) {
|
||||
$module_name = 'statsforecast';
|
||||
if (!($module_name = Tools::getValue('module')) || !Validate::isModuleName($module_name)) {
|
||||
$module_name = $this->getDefaultModuleName();
|
||||
}
|
||||
|
||||
if ($module_name) {
|
||||
@@ -311,4 +370,4 @@ abstract class AdminStatsTabControllerCore extends AdminPreferencesControllerCor
|
||||
$day = isset($this->context->cookie->stats_day) ? sprintf('%02d', $this->context->cookie->stats_day) : '%';
|
||||
return $year.'-'.$month.'-'.$day;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3888,6 +3888,788 @@ class HotelBookingDetail extends ObjectModel
|
||||
return parent::add($auto_date, $null_values);
|
||||
}
|
||||
|
||||
// ── REPORT METHODS ────────────────────────────────────────────────────────
|
||||
|
||||
/**
|
||||
/**
|
||||
* Per-day booking summary keyed by booking-creation date (date_add).
|
||||
* Returns room revenue, tax, rooms booked, and room nights for each day bookings were placed.
|
||||
*
|
||||
* @param array $params date_from, date_to, id_hotel, id_product, id_room, id_order, id_customer
|
||||
* @return array timestamp => ['total_price_tax_excl' => float, 'total_tax' => float, 'rooms_booked' => int, 'room_nights' => int]
|
||||
*/
|
||||
public static function getDatewiseSummary(array $params)
|
||||
{
|
||||
$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);
|
||||
$idProduct = isset($params['id_product']) ? (int) $params['id_product'] : 0;
|
||||
$idRoom = isset($params['id_room']) ? (int) $params['id_room'] : 0;
|
||||
$idOrder = isset($params['id_order']) ? (int) $params['id_order'] : 0;
|
||||
$idCustomer = isset($params['id_customer']) ? (int) $params['id_customer'] : 0;
|
||||
|
||||
$whereFilters = ($idProduct ? ' AND hbd.`id_product` = '.$idProduct : '')
|
||||
.($idRoom ? ' AND hbd.`id_room` = '.$idRoom : '')
|
||||
.($idOrder ? ' AND hbd.`id_order` = '.$idOrder : '')
|
||||
.($idCustomer ? ' AND hbd.`id_customer` = '.$idCustomer : '')
|
||||
.HotelBranchInformation::addHotelRestriction($idsHotel, 'hbd');
|
||||
|
||||
$rows = Db::getInstance()->executeS(
|
||||
'SELECT DATE(o.`date_add`) AS grp_date,
|
||||
IFNULL(SUM(hbd.`total_price_tax_excl` / o.`conversion_rate`), 0) AS total_price_tax_excl,
|
||||
IFNULL(SUM((hbd.`total_price_tax_incl` - hbd.`total_price_tax_excl`) / o.`conversion_rate`), 0) AS total_tax,
|
||||
SUM(CASE WHEN hbd.`is_refunded` = 0 AND hbd.`is_cancelled` = 0 THEN 1 ELSE 0 END) AS rooms_booked,
|
||||
SUM(CASE WHEN hbd.`is_refunded` = 0 AND hbd.`is_cancelled` = 0
|
||||
THEN DATEDIFF(hbd.`date_to`, hbd.`date_from`) ELSE 0 END) AS room_nights
|
||||
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = hbd.`id_product`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'orders` o ON (o.`id_order` = hbd.`id_order`)
|
||||
WHERE p.`active` = 1 AND o.`valid` = 1
|
||||
AND o.`date_add` BETWEEN "'.$dateFrom.' 00:00:00" AND "'.$dateTo.' 23:59:59"'
|
||||
.$whereFilters.'
|
||||
GROUP BY DATE(o.`date_add`)'
|
||||
);
|
||||
$result = array();
|
||||
foreach ($rows as $row) {
|
||||
$ts = strtotime($row['grp_date']);
|
||||
$result[$ts] = array(
|
||||
'total_price_tax_excl' => (float) $row['total_price_tax_excl'],
|
||||
'total_tax' => (float) $row['total_tax'],
|
||||
'rooms_booked' => (int) $row['rooms_booked'],
|
||||
'room_nights' => (int) $row['room_nights'],
|
||||
);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Daily room revenue + tax amount split keyed by occupancy date (pro-rated per night).
|
||||
*
|
||||
* @param array $params date_from, date_to, id_hotel, id_product, id_room, id_order, id_customer
|
||||
* @return array timestamp => ['total_price_tax_excl' => float, 'total_tax' => float]
|
||||
*/
|
||||
public static function getDatewiseRevenue(array $params)
|
||||
{
|
||||
$dateFrom = $params['date_from'];
|
||||
$dateTo = 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);
|
||||
$idProduct = isset($params['id_product']) ? (int) $params['id_product'] : 0;
|
||||
$idRoom = isset($params['id_room']) ? (int) $params['id_room'] : 0;
|
||||
$idOrder = isset($params['id_order']) ? (int) $params['id_order'] : 0;
|
||||
$idCustomer = isset($params['id_customer']) ? (int) $params['id_customer'] : 0;
|
||||
|
||||
$result = array();
|
||||
$current = $dateFrom;
|
||||
|
||||
$whereFilters = ($idProduct ? ' AND hbd.`id_product` = '.$idProduct : '')
|
||||
.($idRoom ? ' AND hbd.`id_room` = '.$idRoom : '')
|
||||
.($idOrder ? ' AND hbd.`id_order` = '.$idOrder : '')
|
||||
.($idCustomer ? ' AND hbd.`id_customer` = '.$idCustomer : '')
|
||||
.HotelBranchInformation::addHotelRestriction($idsHotel, 'hbd');
|
||||
|
||||
while ($current <= $dateTo) {
|
||||
$nextDay = date('Y-m-d', strtotime('+1 day', strtotime($current)));
|
||||
$ts = strtotime($current);
|
||||
$row = Db::getInstance()->getRow(
|
||||
'SELECT IFNULL(SUM(
|
||||
ROUND(hbd.`total_price_tax_excl` / NULLIF(DATEDIFF(hbd.`date_to`, hbd.`date_from`), 0), 6)
|
||||
/ o.`conversion_rate`
|
||||
), 0) AS total_price_tax_excl,
|
||||
IFNULL(SUM(
|
||||
ROUND((hbd.`total_price_tax_incl` - hbd.`total_price_tax_excl`) / NULLIF(DATEDIFF(hbd.`date_to`, hbd.`date_from`), 0), 6)
|
||||
/ o.`conversion_rate`
|
||||
), 0) AS total_tax
|
||||
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = hbd.`id_product`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'orders` o ON (o.`id_order` = hbd.`id_order`)
|
||||
WHERE p.`active` = 1 AND o.`valid` = 1 AND hbd.`is_refunded` = 0
|
||||
AND hbd.`is_cancelled` = 0
|
||||
AND hbd.`date_from` < "'.pSQL($nextDay).' 00:00:00"
|
||||
AND hbd.`date_to` > "'.pSQL($current).' 00:00:00"'
|
||||
.$whereFilters
|
||||
);
|
||||
$result[$ts] = array(
|
||||
'total_price_tax_excl' => (float) $row['total_price_tax_excl'],
|
||||
'total_tax' => (float) $row['total_tax'],
|
||||
);
|
||||
$current = $nextDay;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Arrival counts per day across a date range.
|
||||
*
|
||||
* @param array $params date_from, date_to, id_hotel, id_product, id_room, id_customer
|
||||
* @return array timestamp => int
|
||||
*/
|
||||
public static function getDatewiseArrivals(array $params)
|
||||
{
|
||||
$dateFrom = $params['date_from'];
|
||||
$dateTo = 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);
|
||||
$idProduct = isset($params['id_product']) ? (int) $params['id_product'] : 0;
|
||||
$idRoom = isset($params['id_room']) ? (int) $params['id_room'] : 0;
|
||||
$idCustomer = isset($params['id_customer']) ? (int) $params['id_customer'] : 0;
|
||||
|
||||
$result = array();
|
||||
$current = $dateFrom;
|
||||
|
||||
while ($current <= $dateTo) {
|
||||
$result[strtotime($current)] = (int) Db::getInstance()->getValue(
|
||||
'SELECT COUNT(hbd.`id_room`)
|
||||
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
WHERE hbd.`is_refunded` = 0
|
||||
AND hbd.`is_cancelled` = 0
|
||||
AND hbd.`is_back_order` = 0
|
||||
AND hbd.`date_from` BETWEEN "'.pSQL($current).' 00:00:00" AND "'.pSQL($current).' 23:59:59"'
|
||||
.($idProduct ? ' AND hbd.`id_product` = '.$idProduct : '')
|
||||
.($idRoom ? ' AND hbd.`id_room` = '.$idRoom : '')
|
||||
.($idCustomer ? ' AND hbd.`id_customer` = '.$idCustomer : '')
|
||||
.HotelBranchInformation::addHotelRestriction($idsHotel, 'hbd')
|
||||
);
|
||||
$current = date('Y-m-d', strtotime('+1 day', strtotime($current)));
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Departure counts per day across a date range.
|
||||
*
|
||||
* @param array $params date_from, date_to, id_hotel, id_product, id_room, id_customer
|
||||
* @return array timestamp => int
|
||||
*/
|
||||
public static function getDatewiseDepartures(array $params)
|
||||
{
|
||||
$dateFrom = $params['date_from'];
|
||||
$dateTo = 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);
|
||||
$idProduct = isset($params['id_product']) ? (int) $params['id_product'] : 0;
|
||||
$idRoom = isset($params['id_room']) ? (int) $params['id_room'] : 0;
|
||||
$idCustomer = isset($params['id_customer']) ? (int) $params['id_customer'] : 0;
|
||||
|
||||
$result = array();
|
||||
$current = $dateFrom;
|
||||
|
||||
while ($current <= $dateTo) {
|
||||
$result[strtotime($current)] = (int) Db::getInstance()->getValue(
|
||||
'SELECT COUNT(hbd.`id_room`)
|
||||
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
WHERE hbd.`is_refunded` = 0
|
||||
AND hbd.`is_cancelled` = 0
|
||||
AND hbd.`date_to` BETWEEN "'.pSQL($current).' 00:00:00" AND "'.pSQL($current).' 23:59:59"
|
||||
AND (hbd.`id_status` = '.(int) self::STATUS_CHECKED_IN
|
||||
.' OR (hbd.`check_in` != "0000-00-00 00:00:00" AND hbd.`check_out` != "0000-00-00 00:00:00"))'
|
||||
.($idProduct ? ' AND hbd.`id_product` = '.$idProduct : '')
|
||||
.($idRoom ? ' AND hbd.`id_room` = '.$idRoom : '')
|
||||
.($idCustomer ? ' AND hbd.`id_customer` = '.$idCustomer : '')
|
||||
.HotelBranchInformation::addHotelRestriction($idsHotel, 'hbd')
|
||||
);
|
||||
$current = date('Y-m-d', strtotime('+1 day', strtotime($current)));
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Arrival rows for a date range.
|
||||
* AdminStatsController::getArrivalsInfoByDate() is single-date only; this covers ranges.
|
||||
*
|
||||
* @param array $params date_from, date_to, id_hotel, id_product, id_room, id_customer, id_status, all_statuses
|
||||
* @return array
|
||||
*/
|
||||
public static function getArrivalsInfo(array $params)
|
||||
{
|
||||
$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);
|
||||
$idProduct = isset($params['id_product']) ? (int) $params['id_product'] : 0;
|
||||
$idRoom = isset($params['id_room']) ? (int) $params['id_room'] : 0;
|
||||
$idCustomer = isset($params['id_customer']) ? (int) $params['id_customer'] : 0;
|
||||
$idStatus = isset($params['id_status']) ? (int) $params['id_status'] : 0;
|
||||
$allStatuses = !empty($params['all_statuses']);
|
||||
|
||||
$statusFilter = $allStatuses
|
||||
? ''
|
||||
: ($idStatus
|
||||
? ' AND hbd.`id_status` = '.$idStatus
|
||||
: ' AND hbd.`id_status` != '.(int) self::STATUS_CHECKED_IN.
|
||||
' AND hbd.`id_status` != '.(int) self::STATUS_CHECKED_OUT);
|
||||
|
||||
return Db::getInstance()->executeS(
|
||||
'SELECT hbd.*, o.`with_occupancy`, o.`id_currency`, o.`conversion_rate`,
|
||||
CONCAT(c.`firstname`, " ", c.`lastname`) AS customer_name,
|
||||
DATEDIFF(hbd.`date_to`, hbd.`date_from`) AS los,
|
||||
IF(hbd.`check_in` > "0000-00-00 00:00:00", hbd.`check_in`, CONCAT(DATE(hbd.`date_from`), " ", hbd.`check_in_time`)) AS actual_checkin,
|
||||
IF(hbd.`check_out` > "0000-00-00 00:00:00", hbd.`check_out`, CONCAT(DATE(hbd.`date_to`), " ", hbd.`check_out_time`)) AS actual_checkout
|
||||
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
LEFT JOIN `'._DB_PREFIX_.'orders` o ON (o.`id_order` = hbd.`id_order`)
|
||||
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` BETWEEN "'.$dateFrom.' 00:00:00" AND "'.$dateTo.' 23:59:59"'
|
||||
.$statusFilter
|
||||
.($idProduct ? ' AND hbd.`id_product` = '.$idProduct : '')
|
||||
.($idRoom ? ' AND hbd.`id_room` = '.$idRoom : '')
|
||||
.($idCustomer ? ' AND hbd.`id_customer` = '.$idCustomer : '')
|
||||
.HotelBranchInformation::addHotelRestriction($idsHotel, 'hbd')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Departure rows for a date range.
|
||||
* AdminStatsController::getDeparturesInfoByDate() is single-date only; this covers ranges.
|
||||
*
|
||||
* @param array $params date_from, date_to, id_hotel, id_product, id_room, id_customer, id_status, all_statuses
|
||||
* @return array
|
||||
*/
|
||||
public static function getDeparturesInfo(array $params)
|
||||
{
|
||||
$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);
|
||||
$idProduct = isset($params['id_product']) ? (int) $params['id_product'] : 0;
|
||||
$idRoom = isset($params['id_room']) ? (int) $params['id_room'] : 0;
|
||||
$idCustomer = isset($params['id_customer']) ? (int) $params['id_customer'] : 0;
|
||||
$idStatus = isset($params['id_status']) ? (int) $params['id_status'] : (int) self::STATUS_CHECKED_IN;
|
||||
$allStatuses = !empty($params['all_statuses']);
|
||||
|
||||
return Db::getInstance()->executeS(
|
||||
'SELECT hbd.*, o.`with_occupancy`, o.`id_currency`, o.`conversion_rate`,
|
||||
CONCAT(c.`firstname`, " ", c.`lastname`) AS customer_name,
|
||||
DATEDIFF(hbd.`date_to`, hbd.`date_from`) AS los,
|
||||
IF(hbd.`check_in` > "0000-00-00 00:00:00", hbd.`check_in`, CONCAT(DATE(hbd.`date_from`), " ", hbd.`check_in_time`)) AS actual_checkin,
|
||||
IF(hbd.`check_out` > "0000-00-00 00:00:00", hbd.`check_out`, CONCAT(DATE(hbd.`date_to`), " ", hbd.`check_out_time`)) AS actual_checkout
|
||||
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
LEFT JOIN `'._DB_PREFIX_.'orders` o ON (o.`id_order` = hbd.`id_order`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = hbd.`id_customer`)
|
||||
WHERE hbd.`is_refunded` = 0
|
||||
AND hbd.`date_to` BETWEEN "'.$dateFrom.' 00:00:00" AND "'.$dateTo.' 23:59:59"'
|
||||
.($allStatuses ? '' : ' AND hbd.`id_status` = '.$idStatus)
|
||||
.($idProduct ? ' AND hbd.`id_product` = '.$idProduct : '')
|
||||
.($idRoom ? ' AND hbd.`id_room` = '.$idRoom : '')
|
||||
.($idCustomer ? ' AND hbd.`id_customer` = '.$idCustomer : '')
|
||||
.HotelBranchInformation::addHotelRestriction($idsHotel, 'hbd')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* In-house guests for a date range (overlap with [date_from, date_to]).
|
||||
* AdminStatsController::getInHousesInfo() has no date params; this covers ranges.
|
||||
*
|
||||
* @param array $params date_from, date_to, id_hotel, id_product, id_room, id_customer
|
||||
* @return array
|
||||
*/
|
||||
public static function getInHouseInfo(array $params)
|
||||
{
|
||||
$today = pSQL(date('Y-m-d'));
|
||||
$dateFrom = isset($params['date_from']) ? pSQL($params['date_from']) : $today;
|
||||
$dateTo = isset($params['date_to']) ? pSQL($params['date_to']) : $today;
|
||||
$idsHotel = isset($params['ids_hotel']) ? $params['ids_hotel'] : (isset($params['id_hotel']) ? $params['id_hotel'] : false);
|
||||
$idProduct = isset($params['id_product']) ? (int) $params['id_product'] : 0;
|
||||
$idRoom = isset($params['id_room']) ? (int) $params['id_room'] : 0;
|
||||
$idCustomer = isset($params['id_customer']) ? (int) $params['id_customer']: 0;
|
||||
|
||||
return Db::getInstance()->executeS(
|
||||
'SELECT hbd.*, o.`with_occupancy`, o.`id_currency`, o.`conversion_rate`,
|
||||
CONCAT(c.`firstname`, " ", c.`lastname`) AS customer_name,
|
||||
DATEDIFF(hbd.`date_to`, hbd.`date_from`) AS los,
|
||||
IF(hbd.`check_in` > "0000-00-00 00:00:00", hbd.`check_in`, CONCAT(DATE(hbd.`date_from`), " ", hbd.`check_in_time`)) AS actual_checkin,
|
||||
IF(hbd.`check_out` > "0000-00-00 00:00:00", hbd.`check_out`, CONCAT(DATE(hbd.`date_to`), " ", hbd.`check_out_time`)) AS actual_checkout
|
||||
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
LEFT JOIN `'._DB_PREFIX_.'orders` o ON (o.`id_order` = hbd.`id_order`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = hbd.`id_customer`)
|
||||
WHERE hbd.`is_refunded` = 0
|
||||
AND hbd.`id_status` IN ('.(int) self::STATUS_CHECKED_IN.', '.(int) self::STATUS_CHECKED_OUT.')
|
||||
AND hbd.`date_from` < "'.$dateTo.' 23:59:59"
|
||||
AND hbd.`date_to` > "'.$dateFrom.' 00:00:00"'
|
||||
.($idProduct ? ' AND hbd.`id_product` = '.$idProduct : '')
|
||||
.($idRoom ? ' AND hbd.`id_room` = '.$idRoom : '')
|
||||
.($idCustomer ? ' AND hbd.`id_customer` = '.$idCustomer : '')
|
||||
.HotelBranchInformation::addHotelRestriction($idsHotel, 'hbd')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Per-room booking lines for a date range, one row per booked room.
|
||||
* Used by reservation report — returns full per-line detail.
|
||||
*
|
||||
* @param array $params date_from, date_to, id_hotel, id_customer, id_product, id_status, booking_type, id_order_state
|
||||
* @return array
|
||||
*/
|
||||
public static function getBookingsInfo(array $params)
|
||||
{
|
||||
$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);
|
||||
$idCustomer = isset($params['id_customer']) ? (int) $params['id_customer'] : 0;
|
||||
$idProduct = isset($params['id_product']) ? (int) $params['id_product'] : 0;
|
||||
$idStatus = isset($params['id_status']) ? (int) $params['id_status'] : 0;
|
||||
$bookingType = isset($params['booking_type']) ? (int) $params['booking_type'] : 0;
|
||||
$idOrderState = isset($params['id_order_state']) ? (int) $params['id_order_state'] : 0;
|
||||
|
||||
return Db::getInstance()->executeS(
|
||||
'SELECT hbd.`id`, hbd.`id_order`, hbd.`id_customer`,
|
||||
CONCAT(c.`firstname`, " ", c.`lastname`) AS customer_name,
|
||||
c.`phone`, hbd.`id_hotel`, hbd.`hotel_name`,
|
||||
hbd.`id_product`, hbd.`room_type_name`, hbd.`id_room`, hbd.`room_num`,
|
||||
hbd.`date_from`, hbd.`date_to`,
|
||||
DATEDIFF(hbd.`date_to`, hbd.`date_from`) AS nights,
|
||||
CONCAT(DATE(hbd.`date_from`), " ", hbd.`check_in_time`) AS hotel_check_in,
|
||||
CONCAT(DATE(hbd.`date_to`), " ", hbd.`check_out_time`) AS hotel_check_out,
|
||||
hbd.`adults`, hbd.`children`,
|
||||
ROUND(hbd.`total_price_tax_excl` / NULLIF(DATEDIFF(hbd.`date_to`, hbd.`date_from`), 0), 6) AS unit_price_tax_excl,
|
||||
(hbd.`total_price_tax_excl` + COALESCE(svc.`svc_excl`, 0)) AS total_price_tax_excl,
|
||||
((hbd.`total_price_tax_incl` + COALESCE(svc.`svc_incl`, 0))
|
||||
- (hbd.`total_price_tax_excl` + COALESCE(svc.`svc_excl`, 0))) AS tax_amount,
|
||||
(hbd.`total_price_tax_incl` + COALESCE(svc.`svc_incl`, 0)) AS total_price_tax_incl,
|
||||
o.`total_paid_tax_incl` AS order_total,
|
||||
o.`total_paid_real` AS order_paid,
|
||||
(o.`total_paid_tax_incl` - o.`total_paid_real`) AS balance_due,
|
||||
o.`id_currency`, o.`conversion_rate`,
|
||||
hbd.`id_status`, hbd.`booking_type`, hbd.`date_add`,
|
||||
IFNULL(NULLIF(o.`source`, \'\'), \'(direct)\') AS order_source,
|
||||
(SELECT CONCAT(e.`firstname`, " ", e.`lastname`)
|
||||
FROM `'._DB_PREFIX_.'order_history` oh
|
||||
INNER JOIN `'._DB_PREFIX_.'employee` e ON (e.`id_employee` = oh.`id_employee`)
|
||||
WHERE oh.`id_order` = hbd.`id_order`
|
||||
ORDER BY oh.`id_order_history` ASC LIMIT 1) AS created_by
|
||||
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
LEFT JOIN `'._DB_PREFIX_.'orders` o ON (o.`id_order` = hbd.`id_order`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = hbd.`id_customer`)
|
||||
LEFT JOIN (
|
||||
SELECT `id_htl_booking_detail`,
|
||||
COALESCE(SUM(`total_price_tax_excl`), 0) AS svc_excl,
|
||||
COALESCE(SUM(`total_price_tax_incl`), 0) AS svc_incl
|
||||
FROM `'._DB_PREFIX_.'service_product_order_detail`
|
||||
WHERE `is_cancelled` = 0
|
||||
GROUP BY `id_htl_booking_detail`
|
||||
) svc ON (svc.`id_htl_booking_detail` = hbd.`id`)
|
||||
WHERE hbd.`date_add` BETWEEN "'.$dateFrom.' 00:00:00" AND "'.$dateTo.' 23:59:59"'
|
||||
.($idCustomer ? ' AND hbd.`id_customer` = '.$idCustomer : '')
|
||||
.($idProduct ? ' AND hbd.`id_product` = '.$idProduct : '')
|
||||
.($idStatus ? ' AND hbd.`id_status` = '.$idStatus : '')
|
||||
.($bookingType ? ' AND hbd.`booking_type` = '.$bookingType : '')
|
||||
.($idOrderState ? ' AND o.`current_state` = '.$idOrderState : '')
|
||||
.HotelBranchInformation::addHotelRestriction($idsHotel, 'hbd').'
|
||||
ORDER BY hbd.`date_add` DESC'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Booking channel performance stats for a date range, one row per booking_type.
|
||||
*
|
||||
* @param array $params date_from, date_to, id_hotel, id_customer, booking_type
|
||||
* @return array
|
||||
*/
|
||||
public static function getChannelStats(array $params)
|
||||
{
|
||||
$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);
|
||||
$idCustomer = isset($params['id_customer']) ? (int) $params['id_customer'] : 0;
|
||||
$bookingSource = isset($params['booking_source']) ? pSQL($params['booking_source']) : '';
|
||||
$hotelRestriction = HotelBranchInformation::addHotelRestriction($idsHotel, 'hbd');
|
||||
|
||||
$dateToNext = pSQL(date('Y-m-d', strtotime('+1 day', strtotime($dateTo))));
|
||||
|
||||
$sourceFilter = $bookingSource
|
||||
? ' WHERE per_order.`order_source` = \''.$bookingSource.'\''
|
||||
: '';
|
||||
|
||||
$rows = Db::getInstance()->executeS(
|
||||
'SELECT
|
||||
per_order.`order_source`,
|
||||
COUNT(*) AS bookings,
|
||||
SUM(per_order.`rooms_booked`) AS rooms_booked,
|
||||
SUM(per_order.`room_nights`) AS room_nights,
|
||||
SUM(per_order.`revenue_excl`) AS revenue_excl,
|
||||
SUM(per_order.`revenue_incl`) AS revenue_incl,
|
||||
SUM(per_order.`discount_amount`) AS discount_amount,
|
||||
SUM(per_order.`refund_amount`) AS refund_amount,
|
||||
SUM(per_order.`total_rooms`) AS total_rooms,
|
||||
SUM(per_order.`cancelled_rooms`) AS cancellations
|
||||
FROM (
|
||||
SELECT
|
||||
hbd.`id_order`,
|
||||
IFNULL(NULLIF(o.`source`, \'\'), \'(direct)\') AS order_source,
|
||||
SUM(CASE WHEN hbd.`is_cancelled` = 0 AND hbd.`is_refunded` = 0 THEN 1 ELSE 0 END) AS rooms_booked,
|
||||
SUM(CASE WHEN hbd.`is_cancelled` = 0 AND hbd.`is_refunded` = 0
|
||||
THEN DATEDIFF(hbd.`date_to`, hbd.`date_from`) ELSE 0 END) AS room_nights,
|
||||
SUM(CASE WHEN hbd.`is_cancelled` = 0 AND hbd.`is_refunded` = 0
|
||||
THEN hbd.`total_price_tax_excl` / o.`conversion_rate` ELSE 0 END) AS revenue_excl,
|
||||
SUM(CASE WHEN hbd.`is_cancelled` = 0 AND hbd.`is_refunded` = 0
|
||||
THEN hbd.`total_price_tax_incl` / o.`conversion_rate` ELSE 0 END) AS revenue_incl,
|
||||
MAX(o.`total_discounts_tax_excl` / o.`conversion_rate`) AS discount_amount,
|
||||
IFNULL(MAX(ord_ref.`refunded_total`), 0) AS refund_amount,
|
||||
COUNT(*) AS total_rooms,
|
||||
SUM(CASE WHEN hbd.`is_refunded` = 1 THEN 1 ELSE 0 END) AS cancelled_rooms
|
||||
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
INNER JOIN `'._DB_PREFIX_.'orders` o ON (o.`id_order` = hbd.`id_order` AND o.`valid` = 1)
|
||||
LEFT JOIN (
|
||||
SELECT `id_order`, SUM(`refunded_amount`) AS refunded_total
|
||||
FROM `'._DB_PREFIX_.'order_return`
|
||||
GROUP BY `id_order`
|
||||
) ord_ref ON (ord_ref.`id_order` = hbd.`id_order`)
|
||||
WHERE hbd.`date_from` < "'.$dateToNext.'"
|
||||
AND hbd.`date_to` > "'.$dateFrom.'"'
|
||||
.($idCustomer ? ' AND hbd.`id_customer` = '.$idCustomer : '')
|
||||
.$hotelRestriction.'
|
||||
GROUP BY hbd.`id_order`
|
||||
) AS per_order'
|
||||
.$sourceFilter.'
|
||||
GROUP BY per_order.`order_source`
|
||||
ORDER BY revenue_incl DESC'
|
||||
);
|
||||
|
||||
$totalRevExcl = array_sum(array_column($rows, 'revenue_excl'));
|
||||
foreach ($rows as &$row) {
|
||||
$row['channel_label'] = $row['order_source'];
|
||||
$row['tax_amount'] = (float) $row['revenue_incl'] - (float) $row['revenue_excl'];
|
||||
$row['net_revenue'] = (float) $row['revenue_excl'] - (float) $row['discount_amount'];
|
||||
$row['adr'] = (float) $row['room_nights'] > 0
|
||||
? (float) $row['revenue_excl'] / (float) $row['room_nights'] : 0.0;
|
||||
$row['contribution_pct'] = $totalRevExcl > 0
|
||||
? round((float) $row['revenue_excl'] / $totalRevExcl * 100, 1) : 0.0;
|
||||
$row['cancel_rate_pct'] = (int) $row['total_rooms'] > 0
|
||||
? round((float) $row['cancellations'] / (int) $row['total_rooms'] * 100, 1) : 0.0;
|
||||
}
|
||||
unset($row);
|
||||
return $rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Payment method performance stats for a date range, one row per payment method.
|
||||
*
|
||||
* @param array $params date_from, date_to, id_hotel, id_customer, booking_type
|
||||
* @return array
|
||||
*/
|
||||
public static function getPaymentMethodStats(array $params)
|
||||
{
|
||||
$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);
|
||||
$idCustomer = isset($params['id_customer']) ? (int) $params['id_customer'] : 0;
|
||||
$bookingType = isset($params['booking_type']) ? (int) $params['booking_type'] : 0;
|
||||
|
||||
return Db::getInstance()->executeS(
|
||||
'SELECT o.`payment` AS payment_method, o.`module`,
|
||||
COUNT(DISTINCT hbd.`id_order`) AS bookings,
|
||||
IFNULL(SUM(hbd.`total_price_tax_excl` / o.`conversion_rate`), 0) AS revenue_excl,
|
||||
IFNULL(SUM(hbd.`total_price_tax_incl` / o.`conversion_rate`), 0) AS revenue_incl
|
||||
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.`is_cancelled` = 0
|
||||
AND hbd.`is_refunded` = 0
|
||||
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 : '')
|
||||
.HotelBranchInformation::addHotelRestriction($idsHotel, 'hbd').'
|
||||
GROUP BY o.`payment`, o.`module`
|
||||
ORDER BY revenue_incl DESC'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tax breakdown per booking line for the Tax Report.
|
||||
* Delegates to ServiceProductOrderDetail::getTaxBreakdown() for service revenue.
|
||||
*
|
||||
* @param array $params date_from, date_to, id_hotel, id_product, id_tax, revenue_source ('room'|'service'|'all'), id_lang
|
||||
* @return array
|
||||
*/
|
||||
public static function getTaxBreakdown(array $params)
|
||||
{
|
||||
$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);
|
||||
$idProduct = isset($params['id_product']) ? (int) $params['id_product'] : 0;
|
||||
$idTax = isset($params['id_tax']) ? (int) $params['id_tax'] : 0;
|
||||
$revenueSource = isset($params['revenue_source']) ? $params['revenue_source'] : 'all';
|
||||
$idLang = isset($params['id_lang']) ? (int) $params['id_lang'] : 0;
|
||||
if (!$idLang) {
|
||||
$idLang = Context::getContext()->language->id;
|
||||
}
|
||||
|
||||
$roomQuery =
|
||||
'SELECT hbd.`id_order`, o.`reference`, hbd.`id_customer`, hbd.`id_product`,
|
||||
CONCAT(c.`firstname`, " ", c.`lastname`) AS customer_name,
|
||||
hbd.`room_type_name`, hbd.`room_num`, hbd.`date_add`,
|
||||
hbd.`total_price_tax_excl` / o.`conversion_rate` AS taxable_amount,
|
||||
tl.`name` AS tax_name, t.`rate` AS tax_rate,
|
||||
odt.`total_amount` / o.`conversion_rate` AS tax_amount,
|
||||
"room" AS revenue_source
|
||||
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
INNER JOIN `'._DB_PREFIX_.'orders` o ON (o.`id_order` = hbd.`id_order` AND o.`valid` = 1)
|
||||
INNER JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = hbd.`id_customer`)
|
||||
INNER JOIN `'._DB_PREFIX_.'order_detail` od ON (od.`id_order_detail` = hbd.`id_order_detail`)
|
||||
INNER JOIN `'._DB_PREFIX_.'order_detail_tax` odt ON (odt.`id_order_detail` = od.`id_order_detail`)
|
||||
INNER JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = odt.`id_tax`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_lang` tl ON (tl.`id_tax` = t.`id_tax` AND tl.`id_lang` = '.(int) $idLang.')
|
||||
WHERE hbd.`date_add` BETWEEN "'.$dateFrom.' 00:00:00" AND "'.$dateTo.' 23:59:59"'
|
||||
.($idProduct ? ' AND hbd.`id_product` = '.$idProduct : '')
|
||||
.($idTax ? ' AND t.`id_tax` = '.$idTax : '')
|
||||
.HotelBranchInformation::addHotelRestriction($idsHotel, 'hbd');
|
||||
|
||||
if ($revenueSource === 'service') {
|
||||
return ServiceProductOrderDetail::getTaxBreakdown($params);
|
||||
}
|
||||
|
||||
$roomRows = Db::getInstance()->executeS($roomQuery . ' ORDER BY hbd.`id_order` ASC, tl.`name` ASC');
|
||||
|
||||
if ($revenueSource === 'all') {
|
||||
$serviceRows = ServiceProductOrderDetail::getTaxBreakdown($params);
|
||||
$merged = array_merge($roomRows, $serviceRows);
|
||||
usort($merged, function ($a, $b) {
|
||||
return $a['id_order'] == $b['id_order'] ? 0 : ($a['id_order'] < $b['id_order'] ? -1 : 1);
|
||||
});
|
||||
return $merged;
|
||||
}
|
||||
|
||||
return $roomRows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Refunded booking rows in a date range, one row per booking (requires ORDER RETURN record).
|
||||
* QloApps sets is_refunded=1 on all freed/refunded rooms; is_cancelled is not reliably set.
|
||||
* Refund report filters this further to refunded_amount > 0 in the caller; Cancellation report shows all rows.
|
||||
*
|
||||
* @param array $params date_from, date_to, id_hotel, id_customer, id_product, detailed_info
|
||||
* @return array
|
||||
*/
|
||||
public static function getCancellations(array $params)
|
||||
{
|
||||
$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);
|
||||
$idCustomer = isset($params['id_customer']) ? (int) $params['id_customer'] : 0;
|
||||
$idProduct = isset($params['id_product']) ? (int) $params['id_product'] : 0;
|
||||
$idLang = Context::getContext()->language->id;
|
||||
$detailedInfo = !empty($params['detailed_info']);
|
||||
|
||||
$extraSelect = $detailedInfo
|
||||
? ', orr.`question` AS cancellation_reason, orr.`refunded_amount`,
|
||||
COALESCE(NULLIF(orr.`payment_mode`, ""), IF(os.`id_order_slip` IS NOT NULL, "Credit Slip", NULL)) AS refund_method,
|
||||
orr.`date_add` AS cancellation_date, orr.`date_upd` AS processed_date,
|
||||
hbd.`date_add` AS booking_date,
|
||||
orsl.`name` AS refund_status, hbd.`total_price_tax_incl`, o.`id_currency`,
|
||||
(SELECT CONCAT(e.`firstname`, " ", e.`lastname`)
|
||||
FROM `'._DB_PREFIX_.'order_history` oh
|
||||
INNER JOIN `'._DB_PREFIX_.'employee` e ON (e.`id_employee` = oh.`id_employee`)
|
||||
WHERE oh.`id_order` = hbd.`id_order` AND oh.`id_employee` > 0
|
||||
ORDER BY oh.`date_add` DESC LIMIT 1) AS processed_by'
|
||||
: '';
|
||||
|
||||
return Db::getInstance()->executeS(
|
||||
'SELECT orr.`id_order_return`, hbd.`id_customer`, hbd.`room_num`, hbd.`id_product`,
|
||||
hbd.`room_type_name`, o.`with_occupancy`, CONCAT(c.`firstname`, " ", c.`lastname`) AS customer_name,
|
||||
hbd.`id_hotel`, hbd.`hotel_name`, SUM(hbd.`adults` + hbd.`children`) AS total_guests,
|
||||
hbd.`date_from`, hbd.`date_to`, hbd.`id_order`,
|
||||
CONCAT(DATE(hbd.`date_from`), " ", hbd.`check_in_time`) AS hotel_check_in,
|
||||
CONCAT(DATE(hbd.`date_to`), " ", hbd.`check_out_time`) AS hotel_check_out,
|
||||
o.`current_state`, osl.`name` AS state_name'
|
||||
. $extraSelect .'
|
||||
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
INNER JOIN `'._DB_PREFIX_.'order_return_detail` ord
|
||||
ON (ord.`id_htl_booking` = hbd.`id`)
|
||||
INNER JOIN `'._DB_PREFIX_.'order_return` orr
|
||||
ON (orr.`id_order_return` = ord.`id_order_return`)
|
||||
INNER JOIN `'._DB_PREFIX_.'orders` o ON (o.`id_order` = hbd.`id_order`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl
|
||||
ON (osl.`id_order_state` = o.`current_state` AND osl.`id_lang` = '.(int) $idLang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_return_state_lang` orsl
|
||||
ON (orsl.`id_order_return_state` = orr.`state` AND orsl.`id_lang` = '.(int) $idLang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = hbd.`id_customer`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_slip` os ON (os.`id_order` = orr.`id_order`)
|
||||
WHERE hbd.`is_refunded` = 1
|
||||
AND orr.`date_add` BETWEEN "'.$dateFrom.' 00:00:00" AND "'.$dateTo.' 23:59:59"'
|
||||
. ($idCustomer ? ' AND hbd.`id_customer` = '.$idCustomer : '')
|
||||
. ($idProduct ? ' AND hbd.`id_product` = '.$idProduct : '')
|
||||
. HotelBranchInformation::addHotelRestriction($idsHotel, 'hbd').'
|
||||
GROUP BY ord.`id_htl_booking`, orr.`id_order_return`
|
||||
ORDER BY orr.`date_add` DESC'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Total cancellation count for a date range.
|
||||
*
|
||||
* @param array $params date_from, date_to, id_hotel, id_product, id_customer
|
||||
* @return int
|
||||
*/
|
||||
public static function getTotalCancellations(array $params)
|
||||
{
|
||||
return count(self::getCancellations($params));
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancellation counts per day across a date range.
|
||||
*
|
||||
* @param array $params date_from, date_to, id_hotel, id_product, id_customer
|
||||
* @return array timestamp => int
|
||||
*/
|
||||
public static function getDatewiseCancellations(array $params)
|
||||
{
|
||||
$result = array();
|
||||
$rows = self::getCancellations(array_merge($params, array('detailed_info' => true)));
|
||||
foreach ($rows as $row) {
|
||||
$ts = strtotime(date('Y-m-d', strtotime($row['cancellation_date'])));
|
||||
$result[$ts] = isset($result[$ts]) ? $result[$ts] + 1 : 1;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Count of distinct orders (new bookings) created in a date range.
|
||||
*
|
||||
* @param array $params date_from, date_to, id_hotel, id_product, id_customer
|
||||
* @return int
|
||||
*/
|
||||
public static function getTotalBookings(array $params)
|
||||
{
|
||||
$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);
|
||||
$idProduct = isset($params['id_product']) ? (int) $params['id_product'] : 0;
|
||||
$idCustomer = isset($params['id_customer']) ? (int) $params['id_customer']: 0;
|
||||
|
||||
$countExpr = (isset($params['count_rows']) && $params['count_rows'])
|
||||
? 'hbd.`id`'
|
||||
: 'DISTINCT hbd.`id_order`';
|
||||
|
||||
return (int) Db::getInstance()->getValue(
|
||||
'SELECT COUNT('.$countExpr.')
|
||||
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
WHERE hbd.`date_add` BETWEEN "'.$dateFrom.' 00:00:00" AND "'.$dateTo.' 23:59:59"'
|
||||
.($idProduct ? ' AND hbd.`id_product` = '.$idProduct : '')
|
||||
.($idCustomer ? ' AND hbd.`id_customer` = '.$idCustomer : '')
|
||||
.HotelBranchInformation::addHotelRestriction($idsHotel, 'hbd')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Total room-nights sold (SUM of DATEDIFF per booking row) for a date range.
|
||||
*
|
||||
* @param array $params date_from, date_to, id_hotel, id_product
|
||||
* @return int
|
||||
*/
|
||||
public static function getTotalRoomNights(array $params)
|
||||
{
|
||||
$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);
|
||||
$idProduct = isset($params['id_product']) ? (int) $params['id_product'] : 0;
|
||||
$idRoom = isset($params['id_room']) ? (int) $params['id_room'] : 0;
|
||||
|
||||
return (int) Db::getInstance()->getValue(
|
||||
'SELECT IFNULL(SUM(DATEDIFF(hbd.`date_to`, hbd.`date_from`)), 0)
|
||||
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = hbd.`id_product`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'orders` o ON (o.`id_order` = hbd.`id_order`)
|
||||
WHERE p.`active` = 1
|
||||
AND o.`valid` = 1
|
||||
AND hbd.`is_refunded` = 0
|
||||
AND hbd.`is_cancelled` = 0
|
||||
AND o.`invoice_date` BETWEEN "'.$dateFrom.' 00:00:00" AND "'.$dateTo.' 23:59:59"'
|
||||
.($idProduct ? ' AND hbd.`id_product` = '.$idProduct : '')
|
||||
.($idRoom ? ' AND hbd.`id_room` = '.$idRoom : '')
|
||||
.HotelBranchInformation::addHotelRestriction($idsHotel, 'hbd')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* New booking counts per day across a date range.
|
||||
*
|
||||
* @param array $params date_from, date_to, id_hotel, id_product, id_customer
|
||||
* @return array timestamp => int
|
||||
*/
|
||||
public static function getDatewiseBookings(array $params)
|
||||
{
|
||||
$dateFrom = $params['date_from'];
|
||||
$dateTo = 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);
|
||||
$idProduct = isset($params['id_product']) ? (int) $params['id_product'] : 0;
|
||||
$idCustomer = isset($params['id_customer']) ? (int) $params['id_customer'] : 0;
|
||||
|
||||
$result = array();
|
||||
$current = $dateFrom;
|
||||
|
||||
while ($current <= $dateTo) {
|
||||
$result[strtotime($current)] = (int) Db::getInstance()->getValue(
|
||||
'SELECT COUNT(DISTINCT hbd.`id_order`)
|
||||
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
WHERE hbd.`date_add` BETWEEN "'.pSQL($current).' 00:00:00" AND "'.pSQL($current).' 23:59:59"'
|
||||
.($idProduct ? ' AND hbd.`id_product` = '.$idProduct : '')
|
||||
.($idCustomer ? ' AND hbd.`id_customer` = '.$idCustomer : '')
|
||||
.HotelBranchInformation::addHotelRestriction($idsHotel, 'hbd')
|
||||
);
|
||||
$current = date('Y-m-d', strtotime('+1 day', strtotime($current)));
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Per-day occupied room count. With id_status: own query; without: delegates to AdminStatsController.
|
||||
*
|
||||
* @param array $params date_from, date_to, id_hotel, id_status (optional)
|
||||
* @return array [$timestamp => int]
|
||||
*/
|
||||
public static function getDatewiseOccupiedRooms(array $params)
|
||||
{
|
||||
$dateFrom = $params['date_from'];
|
||||
$dateTo = 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);
|
||||
$idStatus = isset($params['id_status']) ? (int) $params['id_status'] : null;
|
||||
$idProduct = isset($params['id_product']) ? (int) $params['id_product'] : 0;
|
||||
|
||||
$hotelFilter = HotelBranchInformation::addHotelRestriction($idsHotel, 'hbd');
|
||||
$statusFilter = $idStatus !== null ? ' AND hbd.`id_status` = '.$idStatus : '';
|
||||
$productFilter = $idProduct ? ' AND hri.`id_product` = '.$idProduct : '';
|
||||
$result = array();
|
||||
$dateTemp = $dateFrom;
|
||||
while ($dateTemp <= $dateTo) {
|
||||
$dateNext = date('Y-m-d', strtotime('+1 day', strtotime($dateTemp)));
|
||||
$result[strtotime($dateTemp)] = (int) Db::getInstance()->getValue(
|
||||
'SELECT COUNT(DISTINCT hbd.`id_room`)
|
||||
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
INNER JOIN `'._DB_PREFIX_.'htl_room_information` hri ON (hri.`id` = hbd.`id_room`)
|
||||
INNER JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = hri.`id_product`)
|
||||
WHERE p.`active` = 1
|
||||
AND hbd.`is_cancelled` = 0
|
||||
AND hbd.`date_from` < "'.pSQL($dateNext).' 00:00:00"
|
||||
AND hbd.`date_to` > "'.pSQL($dateTemp).' 00:00:00"'
|
||||
.$statusFilter
|
||||
.$productFilter
|
||||
.$hotelFilter
|
||||
);
|
||||
$dateTemp = $dateNext;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Per-day refunded amount grouped by cancellation date.
|
||||
*
|
||||
* @param array $params date_from, date_to, id_hotel, id_product
|
||||
* @return array [$timestamp => float]
|
||||
*/
|
||||
public static function getDatewiseRefunds(array $params)
|
||||
{
|
||||
$rows = self::getCancellations(array_merge($params, array('detailed_info' => true)));
|
||||
$result = array();
|
||||
foreach ($rows as $row) {
|
||||
$refunded = (float) $row['refunded_amount'];
|
||||
if (!$refunded || empty($row['cancellation_date'])) {
|
||||
continue;
|
||||
}
|
||||
$ts = strtotime(date('Y-m-d', strtotime($row['cancellation_date'])));
|
||||
$result[$ts] = isset($result[$ts]) ? $result[$ts] + $refunded : $refunded;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all Guest Registration Card sections and their fields.
|
||||
* Modules may add, remove, or reorder sections/fields via the hook.
|
||||
|
||||
@@ -926,33 +926,37 @@ class HotelBranchInformation extends ObjectModel
|
||||
|
||||
public static function addHotelRestriction($idsHotel, $alias = null, $identifier = 'id_hotel', $idProfile = null)
|
||||
{
|
||||
if (!$idProfile) {
|
||||
$idProfile = Context::getContext()->employee->id_profile;
|
||||
}
|
||||
|
||||
$accessedIds = self::getProfileAccessedHotels($idProfile, 1, 1);
|
||||
if (!$idsHotel) {
|
||||
$idsHotel = $accessedIds;
|
||||
} else {
|
||||
if (!is_array($idsHotel)) {
|
||||
$idsHotel = array($idsHotel);
|
||||
}
|
||||
// check if passed hotel id's are available for current employee
|
||||
$idsHotel = array_filter($idsHotel, function ($idHotel) use($accessedIds) {
|
||||
return in_array($idHotel, $accessedIds);
|
||||
});
|
||||
}
|
||||
|
||||
$restriction = ' AND ';
|
||||
if (count($idsHotel)) {
|
||||
if ($alias) {
|
||||
$alias .= '.';
|
||||
$restriction = '';
|
||||
if (defined('_PS_ADMIN_DIR_')) {
|
||||
if (!$idProfile) {
|
||||
$idProfile = Context::getContext()->employee->id_profile;
|
||||
}
|
||||
|
||||
$identifier = "`$identifier`";
|
||||
$restriction .= $alias.$identifier.' IN ('.implode(', ', $idsHotel).') ';
|
||||
} else {
|
||||
$restriction .= 0;
|
||||
$accessedIds = self::getProfileAccessedHotels($idProfile, 1, 1);
|
||||
if (!$idsHotel) {
|
||||
$idsHotel = $accessedIds;
|
||||
} else {
|
||||
if (!is_array($idsHotel)) {
|
||||
$idsHotel = array($idsHotel);
|
||||
}
|
||||
// check if passed hotel id's are available for current employee
|
||||
$idsHotel = array_filter($idsHotel, function ($idHotel) use($accessedIds) {
|
||||
return in_array($idHotel, $accessedIds);
|
||||
});
|
||||
}
|
||||
|
||||
$restriction .= ' AND ';
|
||||
if (count($idsHotel)) {
|
||||
if ($alias) {
|
||||
$alias .= '.';
|
||||
}
|
||||
$identifier = "`$identifier`";
|
||||
$restriction .= $alias.$identifier.' IN ('.implode(', ', $idsHotel).') ';
|
||||
} else {
|
||||
$restriction .= 0;
|
||||
}
|
||||
} elseif ($ids = array_filter(array_map('intval', is_array($idsHotel) ? $idsHotel : array($idsHotel)))) {
|
||||
$restriction .= ' AND `'.bqSQL($alias).'`.`id_hotel` IN ('.implode(',', $ids).')';
|
||||
}
|
||||
|
||||
return $restriction;
|
||||
|
||||
@@ -136,4 +136,67 @@ class HotelRoomDisableDates extends ObjectModel
|
||||
return Db::getInstance()->delete('htl_room_disable_dates', '`id_room_type`='.(int)$idRoomType);
|
||||
}
|
||||
|
||||
// ── REPORT METHODS ────────────────────────────────────────────────────────
|
||||
|
||||
/**
|
||||
* Disabled/maintenance room rows for the out-of-order report.
|
||||
* Returns both scheduled disable-date entries AND permanently inactive rooms (STATUS_INACTIVE).
|
||||
*
|
||||
* @param array $params date_from, date_to, id_hotel, id_product, floor, id_lang
|
||||
* @return array
|
||||
*/
|
||||
public static function getDisabledRooms(array $params)
|
||||
{
|
||||
$dateFrom = pSQL($params['date_from']);
|
||||
$dateTo = pSQL(isset($params['date_to']) ? $params['date_to'] : $params['date_from']);
|
||||
$idHotel = isset($params['id_hotel']) ? $params['id_hotel'] : false;
|
||||
$idProduct = isset($params['id_product']) ? (int) $params['id_product'] : 0;
|
||||
$idLang = isset($params['id_lang']) ? (int) $params['id_lang'] : 0;
|
||||
$floor = isset($params['floor']) ? pSQL($params['floor']) : '';
|
||||
if (!$idLang) {
|
||||
$idLang = Context::getContext()->language->id;
|
||||
}
|
||||
|
||||
$hotelRestriction = HotelBranchInformation::addHotelRestriction($idHotel, 'hri');
|
||||
$floorFilter = $floor ? ' AND hri.`floor` = "'.$floor.'"' : '';
|
||||
$productFilter = $idProduct ? ' AND hri.`id_product` = '.$idProduct : '';
|
||||
$sharedJoins =
|
||||
'INNER JOIN `'._DB_PREFIX_.'product` p
|
||||
ON (p.`id_product` = hri.`id_product` AND p.`active` = 1 AND p.`booking_product` = 1)
|
||||
INNER JOIN `'._DB_PREFIX_.'product_lang` pl
|
||||
ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int) $idLang.')
|
||||
INNER JOIN `'._DB_PREFIX_.'htl_branch_info` hbi ON (hbi.`id` = hri.`id_hotel`)
|
||||
INNER JOIN `'._DB_PREFIX_.'htl_branch_info_lang` hbil
|
||||
ON (hbil.`id` = hri.`id_hotel` AND hbil.`id_lang` = '.(int) $idLang.')';
|
||||
|
||||
return Db::getInstance()->executeS(
|
||||
'SELECT hrdd.`id`, hrdd.`id_room`, hrdd.`id_room_type`,
|
||||
hrdd.`date_from` AS disabled_from, hrdd.`date_to` AS disabled_to,
|
||||
DATEDIFF(hrdd.`date_to`, hrdd.`date_from`) AS disabled_days,
|
||||
hrdd.`reason`,
|
||||
hri.`room_num`, hri.`floor`, hri.`id_hotel`, hri.`id_status`,
|
||||
pl.`name` AS room_type_name, hbil.`hotel_name`
|
||||
FROM `'._DB_PREFIX_.'htl_room_disable_dates` hrdd
|
||||
INNER JOIN `'._DB_PREFIX_.'htl_room_information` hri ON (hri.`id` = hrdd.`id_room`)
|
||||
'.$sharedJoins.'
|
||||
WHERE hrdd.`date_from` < "'.$dateTo.' 23:59:59"
|
||||
AND hrdd.`date_to` > "'.$dateFrom.' 00:00:00"'
|
||||
.$floorFilter.$productFilter.$hotelRestriction.'
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT NULL AS id, hri.`id` AS id_room, hri.`id_product` AS id_room_type,
|
||||
NULL AS disabled_from, NULL AS disabled_to,
|
||||
NULL AS disabled_days,
|
||||
NULL AS reason,
|
||||
hri.`room_num`, hri.`floor`, hri.`id_hotel`, hri.`id_status`,
|
||||
pl.`name` AS room_type_name, hbil.`hotel_name`
|
||||
FROM `'._DB_PREFIX_.'htl_room_information` hri
|
||||
'.$sharedJoins.'
|
||||
WHERE hri.`id_status` = '.(int) HotelRoomInformation::STATUS_INACTIVE
|
||||
.$floorFilter.$productFilter.$hotelRestriction.'
|
||||
|
||||
ORDER BY `hotel_name`, `room_type_name`, `room_num`, `disabled_from` ASC'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -329,4 +329,181 @@ class HotelRoomInformation extends ObjectModel
|
||||
{
|
||||
return $this->delete();
|
||||
}
|
||||
|
||||
// ── REPORT METHODS ────────────────────────────────────────────────────────
|
||||
|
||||
/**
|
||||
* Room-type × date grid showing total / booked / available / OOO per row.
|
||||
* Used by availability report tab.
|
||||
*
|
||||
* @param array $params date_from, date_to, id_hotel, id_product, id_lang
|
||||
* @return array rows: date, id_product, room_type_name, total_rooms, rooms_booked, out_of_order, available, occupancy_pct
|
||||
*/
|
||||
public static function getAvailabilityReport(array $params)
|
||||
{
|
||||
$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);
|
||||
$idProduct = isset($params['id_product']) ? (int) $params['id_product'] : 0;
|
||||
$idLang = isset($params['id_lang']) ? (int) $params['id_lang'] : 0;
|
||||
if (!$idLang) {
|
||||
$idLang = Context::getContext()->language->id;
|
||||
}
|
||||
|
||||
$roomTypes = Db::getInstance()->executeS(
|
||||
'SELECT hri.`id_product`, pl.`name` AS room_type_name,
|
||||
COUNT(hri.`id`) AS total_rooms,
|
||||
SUM(CASE WHEN hri.`id_status` IN ('.(int) self::STATUS_INACTIVE.','.(int) self::STATUS_TEMPORARY_INACTIVE.') THEN 1 ELSE 0 END) AS ooo_rooms
|
||||
FROM `'._DB_PREFIX_.'htl_room_information` hri
|
||||
INNER JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = hri.`id_product` AND p.`active` = 1)
|
||||
INNER JOIN `'._DB_PREFIX_.'product_lang` pl
|
||||
ON (pl.`id_product` = hri.`id_product` AND pl.`id_lang` = '.(int) $idLang.')
|
||||
WHERE 1'
|
||||
.HotelBranchInformation::addHotelRestriction($idsHotel, 'hri')
|
||||
.($idProduct ? ' AND hri.`id_product` = '.$idProduct : '').'
|
||||
GROUP BY hri.`id_product`'
|
||||
);
|
||||
|
||||
if (!$roomTypes) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$dateToNext = pSQL(date('Y-m-d', strtotime('+1 day', strtotime($dateTo))));
|
||||
$bookingsRaw = Db::getInstance()->executeS(
|
||||
'SELECT hbd.`id_product`, hbd.`id_room`, hbd.`date_from`, hbd.`date_to`
|
||||
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.`is_refunded` = 0 AND hbd.`is_cancelled` = 0
|
||||
AND hbd.`date_from` < "'.$dateToNext.'" AND hbd.`date_to` > "'.$dateFrom.'"'
|
||||
.HotelBranchInformation::addHotelRestriction($idsHotel, 'hbd')
|
||||
.($idProduct ? ' AND hbd.`id_product` = '.$idProduct : '')
|
||||
);
|
||||
|
||||
$bookingsByProduct = array();
|
||||
foreach ($bookingsRaw as $b) {
|
||||
$bookingsByProduct[$b['id_product']][] = $b;
|
||||
}
|
||||
|
||||
$result = array();
|
||||
$current = $dateFrom;
|
||||
while ($current <= $dateTo) {
|
||||
$next = date('Y-m-d', strtotime('+1 day', strtotime($current)));
|
||||
foreach ($roomTypes as $rt) {
|
||||
$idProd = $rt['id_product'];
|
||||
$bookedRooms = array();
|
||||
if (isset($bookingsByProduct[$idProd])) {
|
||||
foreach ($bookingsByProduct[$idProd] as $b) {
|
||||
if ($b['date_from'] < $next && $b['date_to'] > $current) {
|
||||
$bookedRooms[$b['id_room']] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
$booked = count($bookedRooms);
|
||||
$total = (int) $rt['total_rooms'];
|
||||
$ooo = (int) $rt['ooo_rooms'];
|
||||
$available = max(0, $total - $booked - $ooo);
|
||||
$result[] = array(
|
||||
'date' => $current,
|
||||
'id_product' => $idProd,
|
||||
'room_type_name' => $rt['room_type_name'],
|
||||
'total_rooms' => $total,
|
||||
'rooms_booked' => $booked,
|
||||
'out_of_order' => $ooo,
|
||||
'available' => $available,
|
||||
'occupancy_pct' => $total ? round($booked / $total * 100, 1) : 0.0,
|
||||
);
|
||||
}
|
||||
$current = $next;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Per-room status with current guest info for room-status report tab.
|
||||
*
|
||||
* @param array $params date_from, date_to, id_hotel, id_product, id_lang, housekeeping_installed
|
||||
* @return array
|
||||
*/
|
||||
public static function getRoomStatus(array $params)
|
||||
{
|
||||
$dateFrom = pSQL($params['date_from']);
|
||||
$dateTo = pSQL(isset($params['date_to']) ? $params['date_to'] : $params['date_from']);
|
||||
$dateToNext = pSQL(date('Y-m-d', strtotime('+1 day', strtotime($dateTo))));
|
||||
$idsHotel = isset($params['ids_hotel']) ? $params['ids_hotel'] : (isset($params['id_hotel']) ? $params['id_hotel'] : false);
|
||||
$idProduct = isset($params['id_product']) ? (int) $params['id_product'] : 0;
|
||||
$idLang = isset($params['id_lang']) ? (int) $params['id_lang'] : 0;
|
||||
$housekeepingInstalled = !empty($params['housekeeping_installed']);
|
||||
if (!$idLang) {
|
||||
$idLang = Context::getContext()->language->id;
|
||||
}
|
||||
|
||||
return Db::getInstance()->executeS(
|
||||
'SELECT hri.`id` AS id_room, hri.`room_num`, hri.`floor`,
|
||||
CASE WHEN hri.`id_status` = '.(int) self::STATUS_TEMPORARY_INACTIVE.' AND hrdd.`id_room` IS NULL
|
||||
THEN '.(int) self::STATUS_ACTIVE.'
|
||||
ELSE hri.`id_status`
|
||||
END AS id_status,
|
||||
hri.`id_product`, hri.`id_hotel`,
|
||||
pl.`name` AS room_type_name, hbil.`hotel_name`,
|
||||
bkgs.`id_order`, bkgs.`date_from`, bkgs.`date_to`,
|
||||
bkgs.`id_status` AS booking_status,
|
||||
c.`id_customer`,
|
||||
CONCAT(c.`firstname`, " ", c.`lastname`) AS guest_name'
|
||||
.($housekeepingInstalled ? ', hri.`id_housekeeping_status`' : '').'
|
||||
FROM `'._DB_PREFIX_.'htl_room_information` hri
|
||||
INNER JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = hri.`id_product`)
|
||||
INNER JOIN `'._DB_PREFIX_.'product_lang` pl
|
||||
ON (pl.`id_product` = hri.`id_product` AND pl.`id_lang` = '.(int) $idLang.')
|
||||
INNER JOIN `'._DB_PREFIX_.'htl_branch_info` hbi ON (hbi.`id` = hri.`id_hotel`)
|
||||
INNER JOIN `'._DB_PREFIX_.'htl_branch_info_lang` hbil
|
||||
ON (hbil.`id` = hri.`id_hotel` AND hbil.`id_lang` = '.(int) $idLang.')
|
||||
LEFT JOIN (
|
||||
SELECT `id_room`
|
||||
FROM `'._DB_PREFIX_.'htl_room_disable_dates`
|
||||
WHERE `date_from` < "'.$dateToNext.'" AND `date_to` > "'.$dateFrom.'"
|
||||
GROUP BY `id_room`
|
||||
) hrdd ON (hrdd.`id_room` = hri.`id`)
|
||||
LEFT JOIN (
|
||||
SELECT hbd.`id_room`,
|
||||
MIN(hbd.`id_order`) AS `id_order`,
|
||||
MIN(hbd.`date_from`) AS `date_from`,
|
||||
MAX(hbd.`date_to`) AS `date_to`,
|
||||
MIN(hbd.`id_status`) AS `id_status`,
|
||||
MIN(hbd.`id_customer`) AS `id_customer`
|
||||
FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
WHERE hbd.`is_refunded` = 0
|
||||
AND hbd.`date_from` < "'.$dateToNext.'" AND hbd.`date_to` > "'.$dateFrom.'"
|
||||
GROUP BY hbd.`id_room`
|
||||
) bkgs ON (bkgs.`id_room` = hri.`id`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = bkgs.`id_customer`)
|
||||
WHERE p.`active` = 1 AND p.`booking_product` = 1'
|
||||
.($idProduct ? ' AND hri.`id_product` = '.$idProduct : '')
|
||||
.HotelBranchInformation::addHotelRestriction($idsHotel, 'hri').'
|
||||
ORDER BY hbil.`hotel_name`, pl.`name`, hri.`room_num`'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Floor list for filter dropdown in reports.
|
||||
*
|
||||
* @param array $params id_hotel, id_product
|
||||
* @return array rows: floor
|
||||
*/
|
||||
public static function getDistinctFloors(array $params = array())
|
||||
{
|
||||
$idsHotel = isset($params['ids_hotel']) ? $params['ids_hotel'] : (isset($params['id_hotel']) ? $params['id_hotel'] : false);
|
||||
$idProduct = isset($params['id_product']) ? (int) $params['id_product'] : 0;
|
||||
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(
|
||||
'SELECT DISTINCT hri.`floor`
|
||||
FROM `'._DB_PREFIX_.'htl_room_information` hri
|
||||
INNER JOIN `'._DB_PREFIX_.'product` p
|
||||
ON (p.`id_product` = hri.`id_product` AND p.`active` = 1 AND p.`booking_product` = 1)
|
||||
WHERE hri.`floor` != "" AND hri.`floor` IS NOT NULL'
|
||||
.($idProduct ? ' AND hri.`id_product` = '.$idProduct : '')
|
||||
.HotelBranchInformation::addHotelRestriction($idsHotel, 'hri').'
|
||||
ORDER BY hri.`floor`'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -456,4 +456,101 @@ class HotelRoomType extends ObjectModel
|
||||
return parent::validateFields($die, $error_return);
|
||||
}
|
||||
|
||||
// ── REPORT METHODS ────────────────────────────────────────────────────────
|
||||
|
||||
/**
|
||||
* Performance metrics per room type: revenue, ADR, RevPAR, occupancy, LOS.
|
||||
* Used by room-type performance report tab.
|
||||
*
|
||||
* @param array $params date_from, date_to, id_hotel, id_product, id_lang
|
||||
* @return array
|
||||
*/
|
||||
|
||||
/**
|
||||
* Room type list for filter dropdowns in reports.
|
||||
*
|
||||
* @param array $params id_hotel, id_lang
|
||||
* @return array rows: id_product, room_type_name
|
||||
*/
|
||||
public static function getRoomTypes(array $params)
|
||||
{
|
||||
$idsHotel = isset($params['ids_hotel']) ? $params['ids_hotel'] : (isset($params['id_hotel']) ? $params['id_hotel'] : false);
|
||||
$idLang = !empty($params['id_lang']) ? (int) $params['id_lang'] : (int) Context::getContext()->language->id;
|
||||
|
||||
return Db::getInstance()->executeS(
|
||||
'SELECT hrt.`id_product`, pl.`name` AS room_type_name
|
||||
FROM `'._DB_PREFIX_.'htl_room_type` hrt
|
||||
INNER JOIN `'._DB_PREFIX_.'product` p
|
||||
ON (p.`id_product` = hrt.`id_product` AND p.`active` = 1 AND p.`booking_product` = 1)
|
||||
INNER JOIN `'._DB_PREFIX_.'product_lang` pl
|
||||
ON (pl.`id_product` = hrt.`id_product` AND pl.`id_lang` = '.$idLang.')'
|
||||
. HotelBranchInformation::addHotelRestriction($idsHotel, 'hrt')
|
||||
. ' ORDER BY pl.`name`'
|
||||
);
|
||||
}
|
||||
|
||||
public static function getRoomTypePerformance(array $params)
|
||||
{
|
||||
$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);
|
||||
$idProduct = isset($params['id_product']) ? (int) $params['id_product'] : 0;
|
||||
$idLang = isset($params['id_lang']) ? (int) $params['id_lang'] : 0;
|
||||
if (!$idLang) {
|
||||
$idLang = Context::getContext()->language->id;
|
||||
}
|
||||
|
||||
$numNights = max(1, (int)(new DateTime($dateTo))->diff(new DateTime($dateFrom))->days);
|
||||
|
||||
$rows = Db::getInstance()->executeS(
|
||||
'SELECT hrt.`id_product`, hrt.`id_hotel`,
|
||||
pl.`name` AS room_type_name, hbil.`hotel_name`,
|
||||
(
|
||||
SELECT COUNT(r.`id`)
|
||||
FROM `'._DB_PREFIX_.'htl_room_information` r
|
||||
WHERE r.`id_product` = hrt.`id_product` AND r.`id_hotel` = hrt.`id_hotel`
|
||||
) AS total_rooms,
|
||||
COUNT(CASE WHEN hbd.`is_cancelled` = 0 AND hbd.`is_refunded` = 0 THEN hbd.`id` END) AS bookings,
|
||||
IFNULL(SUM(CASE WHEN hbd.`is_cancelled` = 0 AND hbd.`is_refunded` = 0 THEN DATEDIFF(hbd.`date_to`, hbd.`date_from`) ELSE 0 END), 0) AS room_nights,
|
||||
IFNULL(SUM(CASE WHEN hbd.`is_cancelled` = 0 AND hbd.`is_refunded` = 0 THEN hbd.`total_price_tax_excl` / o.`conversion_rate` ELSE 0 END), 0) AS room_revenue,
|
||||
IFNULL(SUM(CASE WHEN hbd.`is_cancelled` = 0 AND hbd.`is_refunded` = 0 THEN (hbd.`total_price_tax_incl` - hbd.`total_price_tax_excl`) / o.`conversion_rate` ELSE 0 END), 0) AS tax_amount,
|
||||
COUNT(CASE WHEN hbd.`is_refunded` = 1 THEN hbd.`id` END) AS cancel_count
|
||||
FROM `'._DB_PREFIX_.'htl_room_type` hrt
|
||||
INNER JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = hrt.`id_product`)
|
||||
INNER JOIN `'._DB_PREFIX_.'product_lang` pl
|
||||
ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int) $idLang.')
|
||||
INNER JOIN `'._DB_PREFIX_.'htl_branch_info_lang` hbil
|
||||
ON (hbil.`id` = hrt.`id_hotel` AND hbil.`id_lang` = '.(int) $idLang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
ON (hbd.`id_product` = hrt.`id_product`
|
||||
AND hbd.`date_from` < "'.$dateTo.' 23:59:59"
|
||||
AND hbd.`date_to` > "'.$dateFrom.' 00:00:00")
|
||||
LEFT JOIN `'._DB_PREFIX_.'orders` o
|
||||
ON (o.`id_order` = hbd.`id_order` AND o.`valid` = 1)
|
||||
WHERE p.`active` = 1 AND p.`booking_product` = 1'
|
||||
.HotelBranchInformation::addHotelRestriction($idsHotel, 'hrt')
|
||||
.($idProduct ? ' AND hrt.`id_product` = '.$idProduct : '').'
|
||||
GROUP BY hrt.`id_product`, hrt.`id_hotel`
|
||||
ORDER BY room_revenue DESC'
|
||||
);
|
||||
|
||||
foreach ($rows as &$row) {
|
||||
$roomNights = (int) $row['room_nights'];
|
||||
$totalRooms = (int) $row['total_rooms'];
|
||||
$roomRevenue = (float) $row['room_revenue'];
|
||||
$taxAmount = (float) $row['tax_amount'];
|
||||
$row['total_revenue'] = $roomRevenue + $taxAmount;
|
||||
$row['total_nights_available'] = $totalRooms * $numNights;
|
||||
$row['adr'] = $roomNights ? round($roomRevenue / $roomNights, 2) : 0.0;
|
||||
$row['revpar'] = ($totalRooms && $numNights)
|
||||
? round($roomRevenue / ($totalRooms * $numNights), 2) : 0.0;
|
||||
$row['occupancy_pct'] = ($totalRooms && $numNights)
|
||||
? round(($roomNights / ($totalRooms * $numNights)) * 100, 1) : 0.0;
|
||||
$row['avg_los'] = (int) $row['bookings'] > 0
|
||||
? round($roomNights / (int) $row['bookings'], 1) : 0.0;
|
||||
}
|
||||
unset($row);
|
||||
|
||||
return $rows;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -619,4 +619,273 @@ class ServiceProductOrderDetail extends ObjectModel
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// ── REPORT METHODS ────────────────────────────────────────────────────────
|
||||
|
||||
/**
|
||||
* Total service revenue (tax excl) for a date range, filtered by invoice_date.
|
||||
*
|
||||
* @param array $params date_from, date_to, id_hotel, id_product, id_room, id_order,
|
||||
* id_customer, id_category, id_service_product, id_lang
|
||||
* @return float
|
||||
*/
|
||||
public static function getTotalRevenue(array $params)
|
||||
{
|
||||
$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);
|
||||
$idProduct = isset($params['id_product']) ? (int) $params['id_product'] : 0;
|
||||
$idRoom = isset($params['id_room']) ? (int) $params['id_room'] : 0;
|
||||
$idOrder = isset($params['id_order']) ? (int) $params['id_order'] : 0;
|
||||
$idCustomer = isset($params['id_customer']) ? (int) $params['id_customer'] : 0;
|
||||
$idCategory = isset($params['id_category']) ? (int) $params['id_category'] : 0;
|
||||
$idServiceProduct = isset($params['id_service_product']) ? (int) $params['id_service_product'] : 0;
|
||||
$idLang = isset($params['id_lang']) ? (int) $params['id_lang'] : 0;
|
||||
if (!$idLang) {
|
||||
$idLang = Context::getContext()->language->id;
|
||||
}
|
||||
|
||||
$baseFrom =
|
||||
'FROM `'._DB_PREFIX_.'service_product_order_detail` spod
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
ON (spod.`id_htl_booking_detail` = hbd.`id`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p
|
||||
ON (p.`id_product` = hbd.`id_product`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'orders` o
|
||||
ON (o.`id_order` = hbd.`id_order`)';
|
||||
|
||||
$baseWhere =
|
||||
'WHERE p.`active` = 1
|
||||
AND o.`valid` = 1
|
||||
AND hbd.`is_refunded` = 0
|
||||
AND spod.`is_cancelled` = 0
|
||||
AND o.`invoice_date` BETWEEN "'.$dateFrom.' 00:00:00" AND "'.$dateTo.' 23:59:59"'
|
||||
.($idProduct ? ' AND hbd.`id_product` = '.$idProduct : '')
|
||||
.($idRoom ? ' AND hbd.`id_room` = '.$idRoom : '')
|
||||
.($idOrder ? ' AND hbd.`id_order` = '.$idOrder : '')
|
||||
.($idCustomer ? ' AND hbd.`id_customer` = '.$idCustomer : '')
|
||||
.($idServiceProduct ? ' AND spod.`id_product` = '.$idServiceProduct : '')
|
||||
.($idCategory ? ' AND spod.`id_product` IN (SELECT `id_product` FROM `'._DB_PREFIX_.'product` WHERE `id_category_default` = '.$idCategory.')' : '')
|
||||
.HotelBranchInformation::addHotelRestriction($idsHotel, 'hbd');
|
||||
|
||||
return (float) Db::getInstance()->getValue(
|
||||
'SELECT IFNULL(SUM(spod.`total_price_tax_excl` / o.`conversion_rate`), 0)
|
||||
'.$baseFrom.' '.$baseWhere
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Per-service-line rows for a date range, one row per service order line.
|
||||
* Used by services report tab.
|
||||
*
|
||||
* @param array $params date_from, date_to, id_hotel, id_product, id_room, id_order,
|
||||
* id_customer, id_category, id_service_product, id_lang
|
||||
* @return array
|
||||
*/
|
||||
public static function getServicesInfo(array $params)
|
||||
{
|
||||
$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);
|
||||
$idProduct = isset($params['id_product']) ? (int) $params['id_product'] : 0;
|
||||
$idRoom = isset($params['id_room']) ? (int) $params['id_room'] : 0;
|
||||
$idOrder = isset($params['id_order']) ? (int) $params['id_order'] : 0;
|
||||
$idCustomer = isset($params['id_customer']) ? (int) $params['id_customer'] : 0;
|
||||
$idCategory = isset($params['id_category']) ? (int) $params['id_category'] : 0;
|
||||
$idServiceProduct = isset($params['id_service_product']) ? (int) $params['id_service_product'] : 0;
|
||||
$idLang = isset($params['id_lang']) ? (int) $params['id_lang'] : 0;
|
||||
if (!$idLang) {
|
||||
$idLang = Context::getContext()->language->id;
|
||||
}
|
||||
|
||||
$baseFrom =
|
||||
'FROM `'._DB_PREFIX_.'service_product_order_detail` spod
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
ON (spod.`id_htl_booking_detail` = hbd.`id`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p
|
||||
ON (p.`id_product` = hbd.`id_product`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'orders` o
|
||||
ON (o.`id_order` = hbd.`id_order`)';
|
||||
|
||||
$baseWhere =
|
||||
'WHERE p.`active` = 1
|
||||
AND o.`valid` = 1
|
||||
AND hbd.`is_refunded` = 0
|
||||
AND spod.`is_cancelled` = 0
|
||||
AND o.`invoice_date` BETWEEN "'.$dateFrom.' 00:00:00" AND "'.$dateTo.' 23:59:59"'
|
||||
.($idProduct ? ' AND hbd.`id_product` = '.$idProduct : '')
|
||||
.($idRoom ? ' AND hbd.`id_room` = '.$idRoom : '')
|
||||
.($idOrder ? ' AND hbd.`id_order` = '.$idOrder : '')
|
||||
.($idCustomer ? ' AND hbd.`id_customer` = '.$idCustomer : '')
|
||||
.($idServiceProduct ? ' AND spod.`id_product` = '.$idServiceProduct : '')
|
||||
.($idCategory ? ' AND spod.`id_product` IN (SELECT `id_product` FROM `'._DB_PREFIX_.'product` WHERE `id_category_default` = '.$idCategory.')' : '')
|
||||
.HotelBranchInformation::addHotelRestriction($idsHotel, 'hbd');
|
||||
|
||||
return Db::getInstance()->executeS(
|
||||
'SELECT spod.`id_service_product_order_detail`, spod.`date_add`,
|
||||
o.`id_order`, o.`reference`, o.`id_customer`,
|
||||
CONCAT(c.`firstname`, " ", c.`lastname`) AS customer_name,
|
||||
spod.`name` AS service_name,
|
||||
IFNULL(cl.`name`, "") AS service_category,
|
||||
spod.`quantity`, sp.`allow_multiple_quantity`,
|
||||
(spod.`unit_price_tax_excl` / o.`conversion_rate`) AS unit_price,
|
||||
spod.`hotel_name`, hbd.`room_num`, hbd.`room_type_name`,
|
||||
hbd.`date_from`, hbd.`date_to`,
|
||||
(spod.`total_price_tax_excl` / o.`conversion_rate`) AS total_price_tax_excl,
|
||||
((spod.`total_price_tax_incl` - spod.`total_price_tax_excl`) / o.`conversion_rate`) AS tax_amount,
|
||||
(spod.`total_price_tax_incl` / o.`conversion_rate`) AS total_price_tax_incl
|
||||
'.$baseFrom.'
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = o.`id_customer`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` sp ON (sp.`id_product` = spod.`id_product`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl
|
||||
ON (cl.`id_category` = sp.`id_category_default` AND cl.`id_lang` = '.(int) $idLang.')
|
||||
'.$baseWhere.'
|
||||
ORDER BY o.`invoice_date` DESC, spod.`id_service_product_order_detail` ASC'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Daily service revenue + tax amount split, keyed by Unix timestamp.
|
||||
* Used by revenue report daily table.
|
||||
*
|
||||
* @param array $params date_from, date_to, id_hotel, id_product, id_room, id_order, id_customer
|
||||
* @return array timestamp => ['service_revenue' => float, 'total_tax' => float]
|
||||
*/
|
||||
public static function getDatewiseRevenue(array $params)
|
||||
{
|
||||
$dateFrom = $params['date_from'];
|
||||
$dateTo = 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);
|
||||
$idProduct = isset($params['id_product']) ? (int) $params['id_product'] : 0;
|
||||
$idRoom = isset($params['id_room']) ? (int) $params['id_room'] : 0;
|
||||
$idOrder = isset($params['id_order']) ? (int) $params['id_order'] : 0;
|
||||
$idCustomer = isset($params['id_customer']) ? (int) $params['id_customer'] : 0;
|
||||
|
||||
$result = array();
|
||||
|
||||
$whereFilters =
|
||||
($idProduct ? ' AND hbd.`id_product` = '.$idProduct : '')
|
||||
.($idRoom ? ' AND hbd.`id_room` = '.$idRoom : '')
|
||||
.($idOrder ? ' AND hbd.`id_order` = '.$idOrder : '')
|
||||
.($idCustomer ? ' AND hbd.`id_customer` = '.$idCustomer : '')
|
||||
.HotelBranchInformation::addHotelRestriction($idsHotel, 'hbd');
|
||||
|
||||
$joins =
|
||||
'FROM `'._DB_PREFIX_.'service_product_order_detail` spod
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
ON (spod.`id_htl_booking_detail` = hbd.`id`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = hbd.`id_product`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'orders` o ON (o.`id_order` = hbd.`id_order`)';
|
||||
|
||||
$rows = Db::getInstance()->executeS(
|
||||
'SELECT DATE(o.`date_add`) AS grp_date,
|
||||
IFNULL(SUM(spod.`total_price_tax_excl` / o.`conversion_rate`), 0) AS service_revenue,
|
||||
IFNULL(SUM((spod.`total_price_tax_incl` - spod.`total_price_tax_excl`) / o.`conversion_rate`), 0) AS total_tax
|
||||
'.$joins.'
|
||||
WHERE p.`active` = 1 AND o.`valid` = 1
|
||||
AND spod.`is_cancelled` = 0
|
||||
AND o.`date_add` BETWEEN "'.pSQL($dateFrom).' 00:00:00" AND "'.pSQL($dateTo).' 23:59:59"'
|
||||
.$whereFilters.'
|
||||
GROUP BY DATE(o.`date_add`)'
|
||||
);
|
||||
foreach ($rows as $row) {
|
||||
$ts = strtotime($row['grp_date']);
|
||||
$result[$ts] = array(
|
||||
'service_revenue' => (float) $row['service_revenue'],
|
||||
'total_tax' => (float) $row['total_tax'],
|
||||
);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Distinct service categories with at least one active service product.
|
||||
*
|
||||
* @param int $idLang
|
||||
* @return array rows: id_category, name
|
||||
*/
|
||||
public static function getServiceCategories($idLang = 0)
|
||||
{
|
||||
if (!$idLang) {
|
||||
$idLang = Context::getContext()->language->id;
|
||||
}
|
||||
return Db::getInstance()->executeS(
|
||||
'SELECT DISTINCT c.`id_category`, cl.`name`
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
INNER JOIN `'._DB_PREFIX_.'category` c ON (c.`id_category` = p.`id_category_default`)
|
||||
INNER JOIN `'._DB_PREFIX_.'category_lang` cl
|
||||
ON (cl.`id_category` = c.`id_category` AND cl.`id_lang` = '.(int) $idLang.')
|
||||
WHERE p.`booking_product` = 0 AND p.`active` = 1
|
||||
ORDER BY cl.`name` ASC'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Active service products, optionally filtered by category.
|
||||
*
|
||||
* @param int $idLang
|
||||
* @param int $idCategory 0 = all categories
|
||||
* @return array rows: id_product, name
|
||||
*/
|
||||
public static function getServiceProducts($idLang = 0, $idCategory = 0)
|
||||
{
|
||||
if (!$idLang) {
|
||||
$idLang = Context::getContext()->language->id;
|
||||
}
|
||||
return Db::getInstance()->executeS(
|
||||
'SELECT p.`id_product`, pl.`name`
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
INNER JOIN `'._DB_PREFIX_.'product_lang` pl
|
||||
ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int) $idLang.')
|
||||
WHERE p.`booking_product` = 0 AND p.`active` = 1'
|
||||
.($idCategory ? ' AND p.`id_category_default` = '.(int) $idCategory : '').'
|
||||
ORDER BY pl.`name` ASC'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tax breakdown for service order lines in a date range.
|
||||
* Called by HotelBookingDetail::getTaxBreakdown() when revenue_source is 'service' or 'all'.
|
||||
*
|
||||
* @param array $params date_from, date_to, id_hotel, id_tax, id_lang
|
||||
* @return array
|
||||
*/
|
||||
public static function getTaxBreakdown(array $params)
|
||||
{
|
||||
$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);
|
||||
$idTax = isset($params['id_tax']) ? (int) $params['id_tax'] : 0;
|
||||
$idLang = isset($params['id_lang']) ? (int) $params['id_lang'] : 0;
|
||||
if (!$idLang) {
|
||||
$idLang = Context::getContext()->language->id;
|
||||
}
|
||||
|
||||
return Db::getInstance()->executeS(
|
||||
'SELECT hbd.`id_order`, o.`reference`, hbd.`id_customer`, spod.`id_product`,
|
||||
CONCAT(c.`firstname`, " ", c.`lastname`) AS customer_name,
|
||||
spod.`name` AS room_type_name, hbd.`room_num`, spod.`date_add`,
|
||||
spod.`total_price_tax_excl` / o.`conversion_rate` AS taxable_amount,
|
||||
MAX(tl.`name`) AS tax_name,
|
||||
MAX(t.`rate`) AS tax_rate,
|
||||
(spod.`total_price_tax_incl` - spod.`total_price_tax_excl`) / o.`conversion_rate` AS tax_amount,
|
||||
"service" AS revenue_source
|
||||
FROM `'._DB_PREFIX_.'service_product_order_detail` spod
|
||||
INNER JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd ON (hbd.`id` = spod.`id_htl_booking_detail`)
|
||||
INNER JOIN `'._DB_PREFIX_.'orders` o ON (o.`id_order` = hbd.`id_order` AND o.`valid` = 1)
|
||||
INNER JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = hbd.`id_customer`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (tr.`id_tax_rules_group` = spod.`id_tax_rules_group`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_lang` tl ON (tl.`id_tax` = t.`id_tax` AND tl.`id_lang` = '.(int) $idLang.')
|
||||
WHERE spod.`is_cancelled` = 0
|
||||
AND hbd.`is_refunded` = 0
|
||||
AND (spod.`total_price_tax_incl` - spod.`total_price_tax_excl`) > 0
|
||||
AND spod.`date_add` BETWEEN "'.$dateFrom.' 00:00:00" AND "'.$dateTo.' 23:59:59"'
|
||||
.($idTax ? ' AND t.`id_tax` = '.$idTax : '')
|
||||
.HotelBranchInformation::addHotelRestriction($idsHotel, 'hbd').'
|
||||
GROUP BY spod.`id_service_product_order_detail`
|
||||
ORDER BY spod.`date_add` ASC'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
32
modules/qlohotelreports/index.php
Normal file
32
modules/qlohotelreports/index.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 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/licenses/afl-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/licenses/afl-3.0.php Academic Free License 3.0
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../../../');
|
||||
exit;
|
||||
BIN
modules/qlohotelreports/logo.gif
Normal file
BIN
modules/qlohotelreports/logo.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 617 B |
BIN
modules/qlohotelreports/logo.png
Normal file
BIN
modules/qlohotelreports/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.8 KiB |
1889
modules/qlohotelreports/qlohotelreports.php
Normal file
1889
modules/qlohotelreports/qlohotelreports.php
Normal file
File diff suppressed because it is too large
Load Diff
32
modules/qlohotelreports/views/css/index.php
Normal file
32
modules/qlohotelreports/views/css/index.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 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/licenses/afl-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/licenses/afl-3.0.php Academic Free License 3.0
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../../../');
|
||||
exit;
|
||||
160
modules/qlohotelreports/views/css/qlohotelreports.css
Normal file
160
modules/qlohotelreports/views/css/qlohotelreports.css
Normal file
@@ -0,0 +1,160 @@
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
||||
/* Report page heading */
|
||||
.qlo-report-heading {
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
color: #333;
|
||||
margin: 0 0 16px 0;
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 2px solid #25b9d7;
|
||||
}
|
||||
|
||||
/* Gap above the filter form */
|
||||
form.form-horizontal.list_action_wrapper {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
/* Cancel Bootstrap's label margin-bottom inside filter bar */
|
||||
form.list_action_wrapper .list_filters label {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Admin theme overrides <th> to font-weight:normal and only restores bold via
|
||||
* span.title_box.active. We re-apply bold for all report table headers here.
|
||||
* white-space:nowrap prevents column compression so the table overflows its
|
||||
* table-responsive wrapper and horizontal scrolling kicks in.
|
||||
*/
|
||||
.table > thead > tr > th {
|
||||
font-weight: bold !important;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* Ensure table-responsive always enables horizontal scroll */
|
||||
.table-responsive {
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
/* Totals footer */
|
||||
.qlo-report-totals td {
|
||||
background: #f0f8f0;
|
||||
border-top: 2px solid #ccc;
|
||||
}
|
||||
|
||||
/* KPI summary cards (used in room-status sub-report) */
|
||||
.qlo-kpi-row {
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-ms-flex-wrap: wrap;
|
||||
flex-wrap: wrap;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.qlo-kpi-row > [class*="col-"] {
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.qlo-kpi-card {
|
||||
background: #fff;
|
||||
border: 1px solid #e0e0e0;
|
||||
border-radius: 4px;
|
||||
padding: 14px 12px;
|
||||
margin-bottom: 12px;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-box-direction: normal;
|
||||
-ms-flex-direction: column;
|
||||
flex-direction: column;
|
||||
-webkit-box-pack: center;
|
||||
-ms-flex-pack: center;
|
||||
justify-content: center;
|
||||
min-height: 80px;
|
||||
}
|
||||
|
||||
.qlo-kpi-card--success { border-color: #5cb85c; background: #f0fff0; }
|
||||
.qlo-kpi-card--danger { border-color: #d9534f; background: #fff5f5; }
|
||||
.qlo-kpi-card--warning { border-color: #f0ad4e; background: #fffbf0; }
|
||||
|
||||
.qlo-kpi-card .qlo-kpi-label {
|
||||
font-size: 10px;
|
||||
text-transform: uppercase;
|
||||
color: #888;
|
||||
margin-bottom: 5px;
|
||||
letter-spacing: 0.5px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.qlo-kpi-card .qlo-kpi-value {
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
color: #333;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.qlo-kpi-card--success .qlo-kpi-value { color: #5cb85c; }
|
||||
.qlo-kpi-card--danger .qlo-kpi-value { color: #d9534f; }
|
||||
.qlo-kpi-card--warning .qlo-kpi-value { color: #e67e22; }
|
||||
|
||||
.qlo-section-heading {
|
||||
margin: 20px 0 10px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #555;
|
||||
border-bottom: 1px solid #eee;
|
||||
padding-bottom: 6px;
|
||||
}
|
||||
|
||||
.qlo-text-danger {
|
||||
color: #c0392b;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.export-csv {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
/* Housekeeping status badge */
|
||||
.qlo-hk-badge {
|
||||
display: inline-block;
|
||||
padding: 2px 8px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
/* Pagination row below room-status table */
|
||||
.qlo-pagination-wrap {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.qlo-pagination-wrap .pagination {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
32
modules/qlohotelreports/views/index.php
Normal file
32
modules/qlohotelreports/views/index.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 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/licenses/afl-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/licenses/afl-3.0.php Academic Free License 3.0
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../../../');
|
||||
exit;
|
||||
32
modules/qlohotelreports/views/js/index.php
Normal file
32
modules/qlohotelreports/views/js/index.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 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/licenses/afl-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/licenses/afl-3.0.php Academic Free License 3.0
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../../../');
|
||||
exit;
|
||||
41
modules/qlohotelreports/views/js/qlohotelreports.js
Normal file
41
modules/qlohotelreports/views/js/qlohotelreports.js
Normal file
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* 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 () {
|
||||
function getParam(name) {
|
||||
var match = window.location.search.match(new RegExp('[?&]' + name + '=([^&]*)'));
|
||||
return match ? match[1] : null;
|
||||
}
|
||||
|
||||
var reportGroup = getParam('report_group') || 'bookings';
|
||||
var report = getParam('report');
|
||||
|
||||
$('form[action*="AdminStats"]').each(function () {
|
||||
var $form = $(this);
|
||||
if (!$form.find('input[name="report_group"]').length) {
|
||||
$form.append($('<input>').attr({ type: 'hidden', name: 'report_group', value: reportGroup }));
|
||||
}
|
||||
if (report && !$form.find('input[name="report"]').length) {
|
||||
$form.append($('<input>').attr({ type: 'hidden', name: 'report', value: report }));
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,38 @@
|
||||
{**
|
||||
* 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
|
||||
*}
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
{if isset($smarty.get.tab) && $smarty.get.tab}
|
||||
var form = document.getElementById('calendar_form');
|
||||
if (form && form.action.indexOf('&tab=') === -1) {
|
||||
form.action += '&tab=' + encodeURIComponent('{$smarty.get.tab|escape:'html':'UTF-8'}');
|
||||
}
|
||||
{/if}
|
||||
|
||||
$(document).on('change', '.qlo-report-filters select[name="id_hotel"]', function() {
|
||||
$(this).closest('form').submit();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
{include file=$group_tpl_path}
|
||||
467
modules/qlohotelreports/views/templates/hook/group-bookings.tpl
Normal file
467
modules/qlohotelreports/views/templates/hook/group-bookings.tpl
Normal file
@@ -0,0 +1,467 @@
|
||||
{**
|
||||
* 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
|
||||
*}
|
||||
|
||||
<div class="qlo-report-group-bookings">
|
||||
|
||||
<h3 class="qlo-report-heading">{$report_label|escape:'html':'UTF-8'}</h3>
|
||||
|
||||
{* ── Filter bar ──────────────────────────────────────────────────── *}
|
||||
<form method="get" action="{$filter_base_url|escape:'html':'UTF-8'}" class="form-horizontal clearfix list_action_wrapper">
|
||||
<input type="hidden" name="controller" value="AdminStats">
|
||||
<input type="hidden" name="module" value="qlohotelreports">
|
||||
<input type="hidden" name="tab" value="{$active_report|escape:'html':'UTF-8'}">
|
||||
{if isset($smarty.get.token)}<input type="hidden" name="token" value="{$smarty.get.token|escape:'html':'UTF-8'}">{/if}
|
||||
<div class="list_filters">
|
||||
<div class="row">
|
||||
<label class="col-xs-3">{l s='Hotel' mod='qlohotelreports'}</label>
|
||||
<div class="col-xs-9">
|
||||
<select name="id_hotel" class="form-control">
|
||||
<option value="0"{if !$id_hotel} selected="selected"{/if}>{l s='All Hotels' mod='qlohotelreports'}</option>
|
||||
{foreach $hotels as $hotel}
|
||||
<option value="{$hotel.id|intval}"{if $id_hotel == $hotel.id} selected="selected"{/if}>{$hotel.hotel_name|escape:'html':'UTF-8'}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label class="col-xs-3">{l s='Room Type' mod='qlohotelreports'}</label>
|
||||
<div class="col-xs-9">
|
||||
<select name="id_product" class="form-control">
|
||||
<option value="0">{l s='All' mod='qlohotelreports'}</option>
|
||||
{foreach $room_types as $roomType}
|
||||
<option value="{$roomType.id_product|intval}"{if $filter_id_product == $roomType.id_product}selected="selected"{/if}>
|
||||
{$roomType.room_type_name|escape:'html':'UTF-8'}
|
||||
</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{if $active_report == 'reservation'}
|
||||
<div class="row">
|
||||
<label class="col-xs-3">{l s='Status' mod='qlohotelreports'}</label>
|
||||
<div class="col-xs-9">
|
||||
<select name="booking_status" class="form-control">
|
||||
<option value="0">{l s='All' mod='qlohotelreports'}</option>
|
||||
{foreach $booking_statuses as $statusId => $statusLabel}
|
||||
<option value="{$statusId|intval}"{if $filter_booking_status == $statusId}selected="selected"{/if}>{$statusLabel}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label class="col-xs-3">{l s='Source' mod='qlohotelreports'}</label>
|
||||
<div class="col-xs-9">
|
||||
<select name="booking_type" class="form-control">
|
||||
<option value="0">{l s='All' mod='qlohotelreports'}</option>
|
||||
{foreach $booking_sources as $sourceId => $sourceLabel}
|
||||
<option value="{$sourceId|intval}"{if $filter_booking_type == $sourceId}selected="selected"{/if}>{$sourceLabel}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label class="col-xs-3">{l s='Order Status' mod='qlohotelreports'}</label>
|
||||
<div class="col-xs-9">
|
||||
<select name="id_order_state" class="form-control">
|
||||
<option value="0">{l s='All' mod='qlohotelreports'}</option>
|
||||
{foreach $order_states as $state}
|
||||
<option value="{$state.id_order_state|intval}"{if $filter_id_order_state == $state.id_order_state}selected="selected"{/if}>
|
||||
{$state.name|escape:'html':'UTF-8'}
|
||||
</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="actions">
|
||||
<hr>
|
||||
<span class="pull-right">
|
||||
<button type="submit" class="btn btn-default btn-sm">
|
||||
<i class="icon-filter"></i> {l s='Apply' mod='qlohotelreports'}
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{* ── Reservation Report ──────────────────────────────────────────── *}
|
||||
{if $active_report == 'reservation'}
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{l s='Room Type' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Room No.' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Check-in Date' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Check-out Date' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Order ID' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Guest Name' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Guest Contact' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Nights' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Adults' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Children' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Room Rate Per Night' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Booking Source' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Booking Status' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Total (excl. Tax)' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Tax Amount' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Grand Total' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Created By' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Booking Date' mod='qlohotelreports'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{if $reservations}
|
||||
{foreach $reservations as $reservation}
|
||||
<tr>
|
||||
<td><a href="{$room_type_link}&id_product={$reservation.id_product|intval}&updateproduct" target="_blank">{$reservation.room_type_name|escape:'html':'UTF-8'}</a></td>
|
||||
<td>{$reservation.room_num|escape:'html':'UTF-8'}</td>
|
||||
<td>{$reservation.hotel_check_in|escape:'html':'UTF-8'}</td>
|
||||
<td>{$reservation.hotel_check_out|escape:'html':'UTF-8'}</td>
|
||||
<td><a href="{$order_link}&id_order={$reservation.id_order|intval}&vieworder" target="_blank">{$reservation.id_order|intval}</a></td>
|
||||
<td><a href="{$customer_link}&id_customer={$reservation.id_customer|intval}&updatecustomer" target="_blank">{$reservation.customer_name|escape:'html':'UTF-8'}</a></td>
|
||||
<td>{if $reservation.phone}{$reservation.phone|escape:'html':'UTF-8'}{else}<span class="text-muted">—</span>{/if}</td>
|
||||
<td class="text-right">{$reservation.nights|intval}</td>
|
||||
<td class="text-right">{$reservation.adults|intval}</td>
|
||||
<td class="text-right">{$reservation.children|intval}</td>
|
||||
<td class="text-right">{displayPrice price=$reservation.unit_price_tax_excl currency=$reservation.id_currency}</td>
|
||||
<td>
|
||||
{$reservation.order_source|escape:'html':'UTF-8'}
|
||||
</td>
|
||||
<td>
|
||||
{if isset($booking_statuses[$reservation.id_status])}{$booking_statuses[$reservation.id_status]|escape:'html':'UTF-8'}{else}{$reservation.id_status|intval}{/if}
|
||||
</td>
|
||||
<td class="text-right">{displayPrice price=$reservation.total_price_tax_excl currency=$reservation.id_currency}</td>
|
||||
<td class="text-right">{displayPrice price=$reservation.tax_amount currency=$reservation.id_currency}</td>
|
||||
<td class="text-right">{displayPrice price=$reservation.total_price_tax_incl currency=$reservation.id_currency}</td>
|
||||
<td>{if $reservation.created_by}{$reservation.created_by|escape:'html':'UTF-8'}{else}<span class="text-muted">—</span>{/if}</td>
|
||||
<td>{$reservation.date_add|escape:'html':'UTF-8'}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{else}
|
||||
<tr>
|
||||
<td class="list-empty" colspan="18">
|
||||
<div class="list-empty-msg">
|
||||
<i class="icon-warning-sign list-empty-icon"></i>
|
||||
{l s='No reservations found for the selected date range and filters.' mod='qlohotelreports'}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
</tbody>
|
||||
{if $reservations}
|
||||
<tfoot>
|
||||
<tr class="qlo-report-totals">
|
||||
<td colspan="7"><strong>{l s='Totals' mod='qlohotelreports'}</strong></td>
|
||||
<td class="text-right"><strong>{$reservation_totals.nights}</strong></td>
|
||||
<td class="text-right"><strong>{$reservation_totals.adults}</strong></td>
|
||||
<td class="text-right"><strong>{$reservation_totals.children}</strong></td>
|
||||
<td></td>
|
||||
<td colspan="2"></td>
|
||||
<td class="text-right"><strong>{displayPrice price=$reservation_totals.total_price_tax_excl currency=$id_currency}</strong></td>
|
||||
<td class="text-right"><strong>{displayPrice price=$reservation_totals.tax_amount currency=$id_currency}</strong></td>
|
||||
<td class="text-right"><strong>{displayPrice price=$reservation_totals.total_price_tax_incl currency=$id_currency}</strong></td>
|
||||
<td colspan="3"></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
{/if}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{* ── Cancellation Report ─────────────────────────────────────────── *}
|
||||
{if $active_report == 'cancellation'}
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{l s='Room Type' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Room No.' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Check-in Date' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Order ID' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Guest Name' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Cancellation Date' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Cancellation Reason' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Refund Amount' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Refund Status' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Booking Date' mod='qlohotelreports'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{if $cancellations}
|
||||
{foreach $cancellations as $cancellation}
|
||||
<tr>
|
||||
<td><a href="{$room_type_link}&id_product={$cancellation.id_product|intval}&updateproduct" target="_blank">{$cancellation.room_type_name|escape:'html':'UTF-8'}</a></td>
|
||||
<td>{$cancellation.room_num|escape:'html':'UTF-8'}</td>
|
||||
<td>{$cancellation.hotel_check_in|escape:'html':'UTF-8'}</td>
|
||||
<td><a href="{$order_link}&id_order={$cancellation.id_order|intval}&vieworder" target="_blank">{$cancellation.id_order|intval}</a></td>
|
||||
<td><a href="{$customer_link}&id_customer={$cancellation.id_customer|intval}&updatecustomer" target="_blank">{$cancellation.customer_name|escape:'html':'UTF-8'}</a></td>
|
||||
<td>{if $cancellation.cancellation_date}{$cancellation.cancellation_date|date_format:'%d-%m-%Y'}{else}<span class="text-muted">—</span>{/if}</td>
|
||||
<td>{if $cancellation.cancellation_reason}{$cancellation.cancellation_reason|escape:'html':'UTF-8'}{else}<span class="text-muted">—</span>{/if}</td>
|
||||
<td class="text-right">{displayPrice price=$cancellation.refunded_amount currency=$cancellation.id_currency}</td>
|
||||
<td>{if $cancellation.refund_status}{$cancellation.refund_status|escape:'html':'UTF-8'}{else}<span class="text-muted">—</span>{/if}</td>
|
||||
<td>{if $cancellation.booking_date}{$cancellation.booking_date|escape:'html':'UTF-8'}{else}<span class="text-muted">—</span>{/if}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{else}
|
||||
<tr>
|
||||
<td class="list-empty" colspan="10">
|
||||
<div class="list-empty-msg">
|
||||
<i class="icon-warning-sign list-empty-icon"></i>
|
||||
{l s='No cancellations found for the selected date range.' mod='qlohotelreports'}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
</tbody>
|
||||
{if $cancellations}
|
||||
<tfoot>
|
||||
<tr class="qlo-report-totals">
|
||||
<td colspan="8"><strong>{l s='Totals' mod='qlohotelreports'}</strong></td>
|
||||
<td class="text-right"><strong>{displayPrice price=$total_refunded currency=$id_currency}</strong></td>
|
||||
<td colspan="2"></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
{/if}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{* ── Arrivals Report ─────────────────────────────────────────────── *}
|
||||
{if $active_report == 'arrivals'}
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{l s='Room Type' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Room No.' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Check-in' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Check-out' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Order ID' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Guest Name' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Hotel' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Nights' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Adults' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Children' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Total (incl. Tax)' mod='qlohotelreports'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{if $arrivals}
|
||||
{foreach $arrivals as $arrival}
|
||||
<tr>
|
||||
<td><a href="{$room_type_link}&id_product={$arrival.id_product|intval}&updateproduct" target="_blank">{$arrival.room_type_name|escape:'html':'UTF-8'}</a></td>
|
||||
<td>{$arrival.room_num|escape:'html':'UTF-8'}</td>
|
||||
<td>{$arrival.actual_checkin|escape:'html':'UTF-8'}</td>
|
||||
<td>{$arrival.actual_checkout|escape:'html':'UTF-8'}</td>
|
||||
<td><a href="{$order_link}&id_order={$arrival.id_order|intval}&vieworder" target="_blank">{$arrival.id_order|intval}</a></td>
|
||||
<td><a href="{$customer_link}&id_customer={$arrival.id_customer|intval}&updatecustomer" target="_blank">{$arrival.customer_name|escape:'html':'UTF-8'}</a></td>
|
||||
<td><a href="{$hotel_link}&id={$arrival.id_hotel|intval}&updatehtl_branch_info" target="_blank">{$arrival.hotel_name|escape:'html':'UTF-8'}</a></td>
|
||||
<td class="text-right">{$arrival.los|intval}</td>
|
||||
<td class="text-right">{$arrival.adults|intval}</td>
|
||||
<td class="text-right">{$arrival.children|intval}</td>
|
||||
<td class="text-right">{displayPrice price=$arrival.total_price_tax_incl currency=$arrival.id_currency}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{else}
|
||||
<tr>
|
||||
<td class="list-empty" colspan="11">
|
||||
<div class="list-empty-msg">
|
||||
<i class="icon-warning-sign list-empty-icon"></i>
|
||||
{l s='No arrivals found for the selected date range.' mod='qlohotelreports'}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
</tbody>
|
||||
{if $arrivals}
|
||||
<tfoot>
|
||||
<tr class="qlo-report-totals">
|
||||
<td colspan="7"><strong>{l s='Totals' mod='qlohotelreports'}</strong></td>
|
||||
<td class="text-right"><strong>{$arrival_totals.los}</strong></td>
|
||||
<td class="text-right"><strong>{$arrival_totals.adults}</strong></td>
|
||||
<td class="text-right"><strong>{$arrival_totals.children}</strong></td>
|
||||
<td class="text-right"><strong>{displayPrice price=$arrival_totals.total_price_tax_incl currency=$id_currency}</strong></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
{/if}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{* ── Departures Report ───────────────────────────────────────────── *}
|
||||
{if $active_report == 'departures'}
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{l s='Room Type' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Room No.' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Check-in' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Check-out' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Order ID' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Guest Name' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Hotel' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Nights' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Adults' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Children' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Total (incl. Tax)' mod='qlohotelreports'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{if $departures}
|
||||
{foreach $departures as $departure}
|
||||
<tr>
|
||||
<td><a href="{$room_type_link}&id_product={$departure.id_product|intval}&updateproduct" target="_blank">{$departure.room_type_name|escape:'html':'UTF-8'}</a></td>
|
||||
<td>{$departure.room_num|escape:'html':'UTF-8'}</td>
|
||||
<td>{$departure.actual_checkin|escape:'html':'UTF-8'}</td>
|
||||
<td>{$departure.actual_checkout|escape:'html':'UTF-8'}</td>
|
||||
<td><a href="{$order_link}&id_order={$departure.id_order|intval}&vieworder" target="_blank">{$departure.id_order|intval}</a></td>
|
||||
<td><a href="{$customer_link}&id_customer={$departure.id_customer|intval}&updatecustomer" target="_blank">{$departure.customer_name|escape:'html':'UTF-8'}</a></td>
|
||||
<td><a href="{$hotel_link}&id={$departure.id_hotel|intval}&updatehtl_branch_info" target="_blank">{$departure.hotel_name|escape:'html':'UTF-8'}</a></td>
|
||||
<td class="text-right">{$departure.los|intval}</td>
|
||||
<td class="text-right">{$departure.adults|intval}</td>
|
||||
<td class="text-right">{$departure.children|intval}</td>
|
||||
<td class="text-right">{displayPrice price=$departure.total_price_tax_incl currency=$departure.id_currency}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{else}
|
||||
<tr>
|
||||
<td class="list-empty" colspan="11">
|
||||
<div class="list-empty-msg">
|
||||
<i class="icon-warning-sign list-empty-icon"></i>
|
||||
{l s='No departures found for the selected date range.' mod='qlohotelreports'}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
</tbody>
|
||||
{if $departures}
|
||||
<tfoot>
|
||||
<tr class="qlo-report-totals">
|
||||
<td colspan="7"><strong>{l s='Totals' mod='qlohotelreports'}</strong></td>
|
||||
<td class="text-right"><strong>{$departure_totals.los}</strong></td>
|
||||
<td class="text-right"><strong>{$departure_totals.adults}</strong></td>
|
||||
<td class="text-right"><strong>{$departure_totals.children}</strong></td>
|
||||
<td class="text-right"><strong>{displayPrice price=$departure_totals.total_price_tax_incl currency=$id_currency}</strong></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
{/if}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{* ── In-House Report ─────────────────────────────────────────────── *}
|
||||
{if $active_report == 'in-house'}
|
||||
<div class="alert alert-info">
|
||||
{l s='Showing guests who were in-house at any point during the selected date range.' mod='qlohotelreports'}
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{l s='Room Type' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Room No.' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Check-in' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Check-out' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Order ID' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Guest Name' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Hotel' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Nights' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Adults' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Children' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Total (incl. Tax)' mod='qlohotelreports'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{if $in_house}
|
||||
{foreach $in_house as $inHouseGuest}
|
||||
<tr>
|
||||
<td><a href="{$room_type_link}&id_product={$inHouseGuest.id_product|intval}&updateproduct" target="_blank">{$inHouseGuest.room_type_name|escape:'html':'UTF-8'}</a></td>
|
||||
<td>{$inHouseGuest.room_num|escape:'html':'UTF-8'}</td>
|
||||
<td>{$inHouseGuest.actual_checkin|escape:'html':'UTF-8'}</td>
|
||||
<td>{$inHouseGuest.actual_checkout|escape:'html':'UTF-8'}</td>
|
||||
<td><a href="{$order_link}&id_order={$inHouseGuest.id_order|intval}&vieworder" target="_blank">{$inHouseGuest.id_order|intval}</a></td>
|
||||
<td><a href="{$customer_link}&id_customer={$inHouseGuest.id_customer|intval}&updatecustomer" target="_blank">{$inHouseGuest.customer_name|escape:'html':'UTF-8'}</a></td>
|
||||
<td><a href="{$hotel_link}&id={$inHouseGuest.id_hotel|intval}&updatehtl_branch_info" target="_blank">{$inHouseGuest.hotel_name|escape:'html':'UTF-8'}</a></td>
|
||||
<td class="text-right">{$inHouseGuest.los|intval}</td>
|
||||
<td class="text-right">{$inHouseGuest.adults|intval}</td>
|
||||
<td class="text-right">{$inHouseGuest.children|intval}</td>
|
||||
<td class="text-right">{displayPrice price=$inHouseGuest.total_price_tax_incl currency=$inHouseGuest.id_currency}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{else}
|
||||
<tr>
|
||||
<td class="list-empty" colspan="11">
|
||||
<div class="list-empty-msg">
|
||||
<i class="icon-warning-sign list-empty-icon"></i>
|
||||
{l s='No guests currently in-house.' mod='qlohotelreports'}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
</tbody>
|
||||
{if $in_house}
|
||||
<tfoot>
|
||||
<tr class="qlo-report-totals">
|
||||
<td colspan="7"><strong>{l s='Totals' mod='qlohotelreports'}</strong></td>
|
||||
<td class="text-right"><strong>{$in_house_totals.los}</strong></td>
|
||||
<td class="text-right"><strong>{$in_house_totals.adults}</strong></td>
|
||||
<td class="text-right"><strong>{$in_house_totals.children}</strong></td>
|
||||
<td class="text-right"><strong>{displayPrice price=$in_house_totals.total_price_tax_incl currency=$id_currency}</strong></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
{/if}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{if $in_house}
|
||||
<p class="text-muted small">
|
||||
{l s='%d room(s) currently in-house.' sprintf=[$in_house|count] mod='qlohotelreports'}
|
||||
</p>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
<a class="btn btn-default export-csv" href="{$export_url|escape:'html':'UTF-8'}">
|
||||
<i class="icon-cloud-download"></i> {l s='CSV Export' mod='qlohotelreports'}
|
||||
</a>
|
||||
|
||||
</div>
|
||||
200
modules/qlohotelreports/views/templates/hook/group-channels.tpl
Normal file
200
modules/qlohotelreports/views/templates/hook/group-channels.tpl
Normal file
@@ -0,0 +1,200 @@
|
||||
{**
|
||||
* 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
|
||||
*}
|
||||
|
||||
<h3 class="qlo-report-heading">{$report_label|escape:'html':'UTF-8'}</h3>
|
||||
|
||||
{* ── Filters ─────────────────────────────────────────────────────────────── *}
|
||||
<form method="get" action="{$filter_base_url|escape:'html':'UTF-8'}" class="form-horizontal clearfix list_action_wrapper">
|
||||
<input type="hidden" name="controller" value="AdminStats">
|
||||
<input type="hidden" name="module" value="qlohotelreports">
|
||||
<input type="hidden" name="tab" value="{$active_report|escape:'html':'UTF-8'}">
|
||||
{if isset($smarty.get.token)}<input type="hidden" name="token" value="{$smarty.get.token|escape:'html':'UTF-8'}">{/if}
|
||||
<div class="list_filters">
|
||||
<div class="row">
|
||||
<label class="col-xs-3">{l s='Hotel' mod='qlohotelreports'}</label>
|
||||
<div class="col-xs-9">
|
||||
<select name="id_hotel" class="form-control">
|
||||
<option value="0"{if !$id_hotel} selected="selected"{/if}>{l s='All Hotels' mod='qlohotelreports'}</option>
|
||||
{foreach $hotels as $hotel}
|
||||
<option value="{$hotel.id|intval}"{if $id_hotel == $hotel.id} selected="selected"{/if}>{$hotel.hotel_name|escape:'html':'UTF-8'}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label class="col-xs-3">{l s='Booking Source' mod='qlohotelreports'}</label>
|
||||
<div class="col-xs-9">
|
||||
<input type="text" name="booking_source" class="form-control"
|
||||
value="{$filter_booking_source|escape:'html':'UTF-8'}"
|
||||
placeholder="{l s='All sources' mod='qlohotelreports'}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<hr>
|
||||
<span class="pull-right">
|
||||
<button type="submit" class="btn btn-sm btn-default">
|
||||
<i class="icon-filter"></i> {l s='Apply' mod='qlohotelreports'}
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{* ═══════════════════════════════════════════════════════════════════════════
|
||||
BOOKING SOURCE
|
||||
═══════════════════════════════════════════════════════════════════════════ *}
|
||||
{if $active_report == 'source'}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{l s='Booking Source' mod='qlohotelreports'}</th>
|
||||
<th class="text-center">{l s='Total Orders' mod='qlohotelreports'}</th>
|
||||
<th class="text-center">{l s='Rooms Booked' mod='qlohotelreports'}</th>
|
||||
<th class="text-center">{l s='Nights Sold' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Room Revenue (excl. Tax)' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Discount Amount' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Refund Amount' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Tax Amount' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Total Collection' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Net Revenue' mod='qlohotelreports'}</th>
|
||||
<th class="text-center">{l s='Cancellations' mod='qlohotelreports'}</th>
|
||||
<th class="text-center">{l s='Cancel Rate %' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='ADR (Avg. Daily Rate)' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Contribution %' mod='qlohotelreports'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{if $source_rows}
|
||||
{foreach $source_rows as $sourceRow}
|
||||
<tr>
|
||||
<td>{$sourceRow.channel_label|escape:'html':'UTF-8'}</td>
|
||||
<td class="text-center">{$sourceRow.bookings|intval}</td>
|
||||
<td class="text-center">{$sourceRow.rooms_booked|intval}</td>
|
||||
<td class="text-center">{$sourceRow.room_nights|intval}</td>
|
||||
<td class="text-right">{displayPrice price=$sourceRow.revenue_excl currency=$id_currency}</td>
|
||||
<td class="text-right">{displayPrice price=$sourceRow.discount_amount currency=$id_currency}</td>
|
||||
<td class="text-right">{displayPrice price=$sourceRow.refund_amount currency=$id_currency}</td>
|
||||
<td class="text-right">{displayPrice price=$sourceRow.tax_amount currency=$id_currency}</td>
|
||||
<td class="text-right">{displayPrice price=$sourceRow.revenue_incl currency=$id_currency}</td>
|
||||
<td class="text-right">{displayPrice price=$sourceRow.net_revenue currency=$id_currency}</td>
|
||||
<td class="text-center">{$sourceRow.cancellations|intval}</td>
|
||||
<td class="text-center">{$sourceRow.cancel_rate_pct|string_format:'%.1f'}%</td>
|
||||
<td class="text-right">{displayPrice price=$sourceRow.adr currency=$id_currency}</td>
|
||||
<td class="text-right">{$sourceRow.contribution_pct|string_format:'%.1f'}%</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{else}
|
||||
<tr>
|
||||
<td class="list-empty" colspan="14">
|
||||
<div class="list-empty-msg">
|
||||
<i class="icon-warning-sign list-empty-icon"></i>
|
||||
{l s='No bookings found for the selected period.' mod='qlohotelreports'}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
</tbody>
|
||||
{if $source_rows}
|
||||
<tfoot class="qlo-report-totals">
|
||||
<tr>
|
||||
<td><strong>{l s='Total' mod='qlohotelreports'}</strong></td>
|
||||
<td class="text-center"><strong>{$source_totals.bookings|intval}</strong></td>
|
||||
<td class="text-center"><strong>{$source_totals.rooms_booked|intval}</strong></td>
|
||||
<td class="text-center"><strong>{$source_totals.room_nights|intval}</strong></td>
|
||||
<td class="text-right"><strong>{displayPrice price=$source_totals.revenue_excl currency=$id_currency}</strong></td>
|
||||
<td class="text-right"><strong>{displayPrice price=$source_totals.discount_amount currency=$id_currency}</strong></td>
|
||||
<td class="text-right"><strong>{displayPrice price=$source_totals.refund_amount currency=$id_currency}</strong></td>
|
||||
<td class="text-right"><strong>{displayPrice price=$source_totals.tax_amount currency=$id_currency}</strong></td>
|
||||
<td class="text-right"><strong>{displayPrice price=$source_totals.revenue_incl currency=$id_currency}</strong></td>
|
||||
<td class="text-right"><strong>{displayPrice price=$source_totals.net_revenue currency=$id_currency}</strong></td>
|
||||
<td class="text-center"><strong>{$source_totals.cancellations|intval}</strong></td>
|
||||
<td colspan="3"></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
{/if}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{* ═══════════════════════════════════════════════════════════════════════════
|
||||
PAYMENT METHODS
|
||||
═══════════════════════════════════════════════════════════════════════════ *}
|
||||
{elseif $active_report == 'payment-method'}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{l s='Payment Method' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Module' mod='qlohotelreports'}</th>
|
||||
<th class="text-center">{l s='Bookings' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Revenue (excl. Tax)' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Revenue (incl. Tax)' mod='qlohotelreports'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{if $payment_rows}
|
||||
{foreach $payment_rows as $paymentMethodRow}
|
||||
<tr>
|
||||
<td>{$paymentMethodRow.payment_method|escape:'html':'UTF-8'}</td>
|
||||
<td>{$paymentMethodRow.module|escape:'html':'UTF-8'}</td>
|
||||
<td class="text-center">{$paymentMethodRow.bookings|intval}</td>
|
||||
<td class="text-right">{displayPrice price=$paymentMethodRow.revenue_excl currency=$id_currency}</td>
|
||||
<td class="text-right">{displayPrice price=$paymentMethodRow.revenue_incl currency=$id_currency}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{else}
|
||||
<tr>
|
||||
<td class="list-empty" colspan="5">
|
||||
<div class="list-empty-msg">
|
||||
<i class="icon-warning-sign list-empty-icon"></i>
|
||||
{l s='No payment data found for the selected period.' mod='qlohotelreports'}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
</tbody>
|
||||
{if $payment_rows}
|
||||
<tfoot class="qlo-report-totals">
|
||||
<tr>
|
||||
<td colspan="3"><strong>{l s='Total' mod='qlohotelreports'}</strong></td>
|
||||
<td colspan="2" class="text-right"><strong>{displayPrice price=$total_revenue currency=$id_currency}</strong></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
{/if}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/if}
|
||||
|
||||
<a class="btn btn-default export-csv" href="{$export_url|escape:'html':'UTF-8'}">
|
||||
<i class="icon-cloud-download"></i> {l s='CSV Export' mod='qlohotelreports'}
|
||||
</a>
|
||||
234
modules/qlohotelreports/views/templates/hook/group-guests.tpl
Normal file
234
modules/qlohotelreports/views/templates/hook/group-guests.tpl
Normal file
@@ -0,0 +1,234 @@
|
||||
{**
|
||||
* 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
|
||||
*}
|
||||
|
||||
<h3 class="qlo-report-heading">{$report_label|escape:'html':'UTF-8'}</h3>
|
||||
|
||||
{* ── Filters ─────────────────────────────────────────────────────────────── *}
|
||||
<form method="get" action="{$filter_base_url|escape:'html':'UTF-8'}" class="form-horizontal clearfix list_action_wrapper">
|
||||
<input type="hidden" name="controller" value="AdminStats">
|
||||
<input type="hidden" name="module" value="qlohotelreports">
|
||||
<input type="hidden" name="tab" value="{$active_report|escape:'html':'UTF-8'}">
|
||||
{if isset($smarty.get.token)}<input type="hidden" name="token" value="{$smarty.get.token|escape:'html':'UTF-8'}">{/if}
|
||||
<div class="list_filters">
|
||||
<div class="row">
|
||||
<label class="col-xs-3">{l s='Hotel' mod='qlohotelreports'}</label>
|
||||
<div class="col-xs-9">
|
||||
<select name="id_hotel" class="form-control">
|
||||
<option value="0"{if !$id_hotel} selected="selected"{/if}>{l s='All Hotels' mod='qlohotelreports'}</option>
|
||||
{foreach $hotels as $hotel}
|
||||
<option value="{$hotel.id|intval}"{if $id_hotel == $hotel.id} selected="selected"{/if}>{$hotel.hotel_name|escape:'html':'UTF-8'}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{if $active_report == 'guest-directory'}
|
||||
<div class="row">
|
||||
<label class="col-xs-3">{l s='Guest Type' mod='qlohotelreports'}</label>
|
||||
<div class="col-xs-9">
|
||||
<select name="guest_type" class="form-control">
|
||||
<option value=""{if !$filter_guest_type} selected="selected"{/if}>{l s='All Guests' mod='qlohotelreports'}</option>
|
||||
<option value="new"{if $filter_guest_type == 'new'} selected="selected"{/if}>{l s='New Guests' mod='qlohotelreports'}</option>
|
||||
<option value="returning"{if $filter_guest_type == 'returning'} selected="selected"{/if}>{l s='Returning Guests' mod='qlohotelreports'}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{if $active_report == 'services'}
|
||||
<div class="row">
|
||||
<label class="col-xs-3">{l s='Service Category' mod='qlohotelreports'}</label>
|
||||
<div class="col-xs-9">
|
||||
<select name="id_category" class="form-control">
|
||||
<option value="0"{if !$filter_id_category} selected="selected"{/if}>{l s='All Categories' mod='qlohotelreports'}</option>
|
||||
{foreach $service_categories as $cat}
|
||||
<option value="{$cat.id_category|intval}"{if $filter_id_category == $cat.id_category} selected="selected"{/if}>
|
||||
{$cat.name|escape:'html':'UTF-8'}
|
||||
</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label class="col-xs-3">{l s='Service Name' mod='qlohotelreports'}</label>
|
||||
<div class="col-xs-9">
|
||||
<select name="id_service_product" class="form-control">
|
||||
<option value="0"{if !$filter_id_service} selected="selected"{/if}>{l s='All Services' mod='qlohotelreports'}</option>
|
||||
{foreach $service_products as $svc}
|
||||
<option value="{$svc.id_product|intval}"{if $filter_id_service == $svc.id_product} selected="selected"{/if}>
|
||||
{$svc.name|escape:'html':'UTF-8'}
|
||||
</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="actions">
|
||||
<hr>
|
||||
<span class="pull-right">
|
||||
<button type="submit" class="btn btn-sm btn-default">
|
||||
<i class="icon-filter"></i> {l s='Apply' mod='qlohotelreports'}
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{* ═══════════════════════════════════════════════════════════════════════════
|
||||
SERVICES
|
||||
═══════════════════════════════════════════════════════════════════════════ *}
|
||||
{if $active_report == 'services'}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{l s='Date' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Booking Ref. No.' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Guest Name' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Room No.' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Service Name' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Service Category' mod='qlohotelreports'}</th>
|
||||
<th class="text-center">{l s='Quantity' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Unit Price' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Total Price (excl. Tax)' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Tax Amount' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Grand Total' mod='qlohotelreports'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{if $service_rows}
|
||||
{foreach $service_rows as $serviceRow}
|
||||
<tr>
|
||||
<td>{$serviceRow.date_add|date_format:'%Y-%m-%d'}</td>
|
||||
<td>{$serviceRow.reference|escape:'html':'UTF-8'}</td>
|
||||
<td><a href="{$customer_link}&id_customer={$serviceRow.id_customer|intval}&updatecustomer" target="_blank">{$serviceRow.customer_name|escape:'html':'UTF-8'}</a></td>
|
||||
<td>{$serviceRow.room_num|escape:'html':'UTF-8'}</td>
|
||||
<td>{$serviceRow.service_name|escape:'html':'UTF-8'}</td>
|
||||
<td>{if $serviceRow.service_category}{$serviceRow.service_category|escape:'html':'UTF-8'}{else}—{/if}</td>
|
||||
<td class="text-center">{if $serviceRow.allow_multiple_quantity}{$serviceRow.quantity|intval}{else}<span class="text-muted">—</span>{/if}</td>
|
||||
<td class="text-right">{displayPrice price=$serviceRow.unit_price currency=$id_currency}</td>
|
||||
<td class="text-right">{displayPrice price=$serviceRow.total_price_tax_excl currency=$id_currency}</td>
|
||||
<td class="text-right">{displayPrice price=$serviceRow.tax_amount currency=$id_currency}</td>
|
||||
<td class="text-right">{displayPrice price=$serviceRow.total_price_tax_incl currency=$id_currency}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{else}
|
||||
<tr>
|
||||
<td class="list-empty" colspan="11">
|
||||
<div class="list-empty-msg">
|
||||
<i class="icon-warning-sign list-empty-icon"></i>
|
||||
{l s='No service transactions for the selected period.' mod='qlohotelreports'}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
</tbody>
|
||||
{if $service_rows}
|
||||
<tfoot class="qlo-report-totals">
|
||||
<tr>
|
||||
<td colspan="8"><strong>{l s='Total' mod='qlohotelreports'}</strong></td>
|
||||
<td class="text-right"><strong>{displayPrice price=$service_totals.total_excl currency=$id_currency}</strong></td>
|
||||
<td class="text-right"><strong>{displayPrice price=$service_totals.total_tax currency=$id_currency}</strong></td>
|
||||
<td class="text-right"><strong>{displayPrice price=$service_totals.total_incl currency=$id_currency}</strong></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
{/if}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{* ═══════════════════════════════════════════════════════════════════════════
|
||||
GUEST DIRECTORY
|
||||
═══════════════════════════════════════════════════════════════════════════ *}
|
||||
{elseif $active_report == 'guest-directory'}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{l s='Guest ID' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Guest Name' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Email' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Phone' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Country' mod='qlohotelreports'}</th>
|
||||
<th>{l s='State' mod='qlohotelreports'}</th>
|
||||
<th>{l s='City' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Company' mod='qlohotelreports'}</th>
|
||||
<th>{l s='VAT Number' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Address' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Postcode' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Guest Type' mod='qlohotelreports'}</th>
|
||||
<th class="text-center">{l s='Total Stays' mod='qlohotelreports'}</th>
|
||||
<th class="text-center">{l s='Total Nights' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Last Stay Date' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Lifetime Revenue' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Avg Spend Per Stay' mod='qlohotelreports'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{if $guests}
|
||||
{foreach $guests as $guest}
|
||||
<tr>
|
||||
<td>{$guest.id_customer|intval}</td>
|
||||
<td><a href="{$customer_link}&id_customer={$guest.id_customer|intval}&updatecustomer" target="_blank">{$guest.customer_name|escape:'html':'UTF-8'}</a></td>
|
||||
<td>{$guest.email|escape:'html':'UTF-8'}</td>
|
||||
<td>{if $guest.phone}{$guest.phone|escape:'html':'UTF-8'}{else}<span class="text-muted">—</span>{/if}</td>
|
||||
<td>{if $guest.country}{$guest.country|escape:'html':'UTF-8'}{else}<span class="text-muted">—</span>{/if}</td>
|
||||
<td>{if $guest.state}{$guest.state|escape:'html':'UTF-8'}{else}<span class="text-muted">—</span>{/if}</td>
|
||||
<td>{if $guest.city}{$guest.city|escape:'html':'UTF-8'}{else}<span class="text-muted">—</span>{/if}</td>
|
||||
<td>{if $guest.company}{$guest.company|escape:'html':'UTF-8'}{else}<span class="text-muted">—</span>{/if}</td>
|
||||
<td>{if $guest.vat_number}{$guest.vat_number|escape:'html':'UTF-8'}{else}<span class="text-muted">—</span>{/if}</td>
|
||||
<td>{if $guest.address1}{$guest.address1|escape:'html':'UTF-8'}{if $guest.address2}, {$guest.address2|escape:'html':'UTF-8'}{/if}{else}<span class="text-muted">—</span>{/if}</td>
|
||||
<td>{if $guest.postcode}{$guest.postcode|escape:'html':'UTF-8'}{else}<span class="text-muted">—</span>{/if}</td>
|
||||
<td>{if $guest.total_stays == 1}{l s='New' mod='qlohotelreports'}{else}{l s='Returning' mod='qlohotelreports'}{/if}</td>
|
||||
<td class="text-center">{$guest.total_stays|intval}</td>
|
||||
<td class="text-center">{$guest.total_nights|intval}</td>
|
||||
<td>{if $guest.last_stay}{$guest.last_stay|escape:'html':'UTF-8'}{else}<span class="text-muted">—</span>{/if}</td>
|
||||
<td class="text-right">{displayPrice price=$guest.lifetime_revenue currency=$id_currency}</td>
|
||||
<td class="text-right">{displayPrice price=$guest.avg_spend_per_stay currency=$id_currency}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{else}
|
||||
<tr>
|
||||
<td class="list-empty" colspan="17">
|
||||
<div class="list-empty-msg">
|
||||
<i class="icon-warning-sign list-empty-icon"></i>
|
||||
{l s='No guests found for the selected period.' mod='qlohotelreports'}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/if}
|
||||
|
||||
<a class="btn btn-default export-csv" href="{$export_url|escape:'html':'UTF-8'}">
|
||||
<i class="icon-cloud-download"></i> {l s='CSV Export' mod='qlohotelreports'}
|
||||
</a>
|
||||
452
modules/qlohotelreports/views/templates/hook/group-occupancy.tpl
Normal file
452
modules/qlohotelreports/views/templates/hook/group-occupancy.tpl
Normal file
@@ -0,0 +1,452 @@
|
||||
{**
|
||||
* 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
|
||||
*}
|
||||
|
||||
<h3 class="qlo-report-heading">{$report_label|escape:'html':'UTF-8'}</h3>
|
||||
|
||||
{* ── Filters ─────────────────────────────────────────────────────────────── *}
|
||||
<form method="get" action="{$filter_base_url|escape:'html':'UTF-8'}" class="form-horizontal clearfix list_action_wrapper">
|
||||
<input type="hidden" name="controller" value="AdminStats">
|
||||
<input type="hidden" name="module" value="qlohotelreports">
|
||||
<input type="hidden" name="tab" value="{$active_report|escape:'html':'UTF-8'}">
|
||||
{if isset($smarty.get.token)}<input type="hidden" name="token" value="{$smarty.get.token|escape:'html':'UTF-8'}">{/if}
|
||||
<div class="list_filters">
|
||||
<div class="row">
|
||||
<label class="col-xs-3">{l s='Hotel' mod='qlohotelreports'}</label>
|
||||
<div class="col-xs-9">
|
||||
<select name="id_hotel" class="form-control">
|
||||
<option value="0"{if !$id_hotel} selected="selected"{/if}>{l s='All Hotels' mod='qlohotelreports'}</option>
|
||||
{foreach $hotels as $hotel}
|
||||
<option value="{$hotel.id|intval}"{if $id_hotel == $hotel.id} selected="selected"{/if}>{$hotel.hotel_name|escape:'html':'UTF-8'}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label class="col-xs-3">{l s='Room Type' mod='qlohotelreports'}</label>
|
||||
<div class="col-xs-9">
|
||||
<select name="id_product" class="form-control">
|
||||
<option value="0">{l s='All' mod='qlohotelreports'}</option>
|
||||
{foreach $room_types as $roomType}
|
||||
<option value="{$roomType.id_product|intval}"{if $filter_id_product == $roomType.id_product} selected="selected"{/if}>
|
||||
{$roomType.room_type_name|escape:'html':'UTF-8'}
|
||||
</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<hr>
|
||||
<span class="pull-right">
|
||||
<button type="submit" class="btn btn-sm btn-default">
|
||||
<i class="icon-filter"></i> {l s='Apply' mod='qlohotelreports'}
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{* ═══════════════════════════════════════════════════════════════════════════
|
||||
OCCUPANCY
|
||||
═══════════════════════════════════════════════════════════════════════════ *}
|
||||
{if $active_report == 'occupancy'}
|
||||
|
||||
{* Daily table *}
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{l s='Date' mod='qlohotelreports'}</th>
|
||||
<th class="text-center">{l s='Total Rooms (Inventory)' mod='qlohotelreports'}</th>
|
||||
<th class="text-center">{l s='Available Rooms' mod='qlohotelreports'}</th>
|
||||
<th class="text-center">{l s='Rooms Booked' mod='qlohotelreports'}</th>
|
||||
<th class="text-center">{l s='Rooms Occupied' mod='qlohotelreports'}</th>
|
||||
<th class="text-center">{l s='Out of Order' mod='qlohotelreports'}</th>
|
||||
<th class="text-center">{l s='Occupancy Rate %' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='ADR (Avg. Daily Rate)' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='RevPAR (Rev. Per Avail. Room)' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Total Room Revenue' mod='qlohotelreports'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{if $daily_rows}
|
||||
{foreach $daily_rows as $occupancyRow}
|
||||
<tr>
|
||||
<td>{$occupancyRow.date|escape:'html':'UTF-8'}</td>
|
||||
<td class="text-center">{$occupancyRow.total|intval}</td>
|
||||
<td class="text-center">{$occupancyRow.available|intval}</td>
|
||||
<td class="text-center">{$occupancyRow.rooms_booked|intval}</td>
|
||||
<td class="text-center">{$occupancyRow.rooms_occupied|intval}</td>
|
||||
<td class="text-center">{$occupancyRow.out_of_order|intval}</td>
|
||||
<td class="text-center">{$occupancyRow.occupancy_pct|string_format:'%.1f'}%</td>
|
||||
<td class="text-right">{displayPrice price=$occupancyRow.adr currency=$id_currency}</td>
|
||||
<td class="text-right">{displayPrice price=$occupancyRow.revpar currency=$id_currency}</td>
|
||||
<td class="text-right">{displayPrice price=$occupancyRow.total_room_revenue currency=$id_currency}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{else}
|
||||
<tr>
|
||||
<td class="list-empty" colspan="10">
|
||||
<div class="list-empty-msg">
|
||||
<i class="icon-warning-sign list-empty-icon"></i>
|
||||
{l s='No data for the selected period.' mod='qlohotelreports'}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{* ═══════════════════════════════════════════════════════════════════════════
|
||||
AVAILABILITY
|
||||
═══════════════════════════════════════════════════════════════════════════ *}
|
||||
{elseif $active_report == 'availability'}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{l s='Date' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Room Type' mod='qlohotelreports'}</th>
|
||||
<th class="text-center">{l s='Total Rooms (Inventory)' mod='qlohotelreports'}</th>
|
||||
<th class="text-center">{l s='Rooms Booked' mod='qlohotelreports'}</th>
|
||||
<th class="text-center">{l s='Out of Order / Maintenance' mod='qlohotelreports'}</th>
|
||||
<th class="text-center">{l s='Rooms Available' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Rate' mod='qlohotelreports'}</th>
|
||||
<th class="text-center">{l s='Occupancy %' mod='qlohotelreports'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{if $availability_rows}
|
||||
{assign var="prev_date" value=''}
|
||||
{assign var="date_total" value=0}
|
||||
{assign var="date_booked" value=0}
|
||||
{assign var="date_ooo" value=0}
|
||||
{assign var="date_avail" value=0}
|
||||
{foreach $availability_rows as $availabilityRow}
|
||||
{if $prev_date != '' && $prev_date != $availabilityRow.date}
|
||||
<tr class="qlo-subtotal-row">
|
||||
<td><strong>{$prev_date|escape:'html':'UTF-8'} {l s='Total' mod='qlohotelreports'}</strong></td>
|
||||
<td class="text-center">—</td>
|
||||
<td class="text-center"><strong>{$date_total|intval}</strong></td>
|
||||
<td class="text-center"><strong>{$date_booked|intval}</strong></td>
|
||||
<td class="text-center"><strong>{$date_ooo|intval}</strong></td>
|
||||
<td class="text-center"><strong>{$date_avail|intval}</strong></td>
|
||||
<td class="text-center">—</td>
|
||||
<td class="text-center">—</td>
|
||||
</tr>
|
||||
<tr><td colspan="8" style="height:14px;font-size:0;line-height:0;padding:0;border-top:0 !important;border-bottom:0 !important;background:#f4f6f9;"> </td></tr>
|
||||
{assign var="date_total" value=0}
|
||||
{assign var="date_booked" value=0}
|
||||
{assign var="date_ooo" value=0}
|
||||
{assign var="date_avail" value=0}
|
||||
{/if}
|
||||
{assign var="prev_date" value=$availabilityRow.date}
|
||||
{assign var="date_total" value=$date_total+$availabilityRow.total_rooms}
|
||||
{assign var="date_booked" value=$date_booked+$availabilityRow.rooms_booked}
|
||||
{assign var="date_ooo" value=$date_ooo+$availabilityRow.out_of_order}
|
||||
{assign var="date_avail" value=$date_avail+$availabilityRow.available}
|
||||
<tr>
|
||||
<td>{$availabilityRow.date|escape:'html':'UTF-8'}</td>
|
||||
<td><a href="{$room_type_link}&id_product={$availabilityRow.id_product|intval}&updateproduct" target="_blank">{$availabilityRow.room_type_name|escape:'html':'UTF-8'}</a></td>
|
||||
<td class="text-center">{$availabilityRow.total_rooms|intval}</td>
|
||||
<td class="text-center">{$availabilityRow.rooms_booked|intval}</td>
|
||||
<td class="text-center">{$availabilityRow.out_of_order|intval}</td>
|
||||
<td class="text-center">{$availabilityRow.available|intval}</td>
|
||||
<td class="text-center">—</td>
|
||||
<td class="text-center">{$availabilityRow.occupancy_pct|string_format:'%.1f'}%</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{if $prev_date != ''}
|
||||
<tr class="qlo-subtotal-row">
|
||||
<td><strong>{$prev_date|escape:'html':'UTF-8'} {l s='Total' mod='qlohotelreports'}</strong></td>
|
||||
<td>—</td>
|
||||
<td class="text-center"><strong>{$date_total|intval}</strong></td>
|
||||
<td class="text-center"><strong>{$date_booked|intval}</strong></td>
|
||||
<td class="text-center"><strong>{$date_ooo|intval}</strong></td>
|
||||
<td class="text-center"><strong>{$date_avail|intval}</strong></td>
|
||||
<td>—</td>
|
||||
<td>—</td>
|
||||
</tr>
|
||||
{/if}
|
||||
{else}
|
||||
<tr>
|
||||
<td class="list-empty" colspan="8">
|
||||
<div class="list-empty-msg">
|
||||
<i class="icon-warning-sign list-empty-icon"></i>
|
||||
{l s='No data for the selected period.' mod='qlohotelreports'}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{* ═══════════════════════════════════════════════════════════════════════════
|
||||
ROOM STATUS
|
||||
═══════════════════════════════════════════════════════════════════════════ *}
|
||||
{elseif $active_report == 'room-status'}
|
||||
|
||||
<div class="alert alert-info">
|
||||
{l s='Showing room status as of the filter start date.' mod='qlohotelreports'}
|
||||
</div>
|
||||
|
||||
{if $kpi_total}
|
||||
<div class="row qlo-kpi-row">
|
||||
<div class="col-md-3 col-sm-6">
|
||||
<div class="qlo-kpi-card">
|
||||
<div class="qlo-kpi-label">{l s='Total Rooms' mod='qlohotelreports'}</div>
|
||||
<div class="qlo-kpi-value">{$kpi_total|intval}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 col-sm-6">
|
||||
<div class="qlo-kpi-card qlo-kpi-card--success">
|
||||
<div class="qlo-kpi-label">{l s='Available' mod='qlohotelreports'}</div>
|
||||
<div class="qlo-kpi-value">{$kpi_available|intval}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 col-sm-6">
|
||||
<div class="qlo-kpi-card qlo-kpi-card--danger">
|
||||
<div class="qlo-kpi-label">{l s='Occupied' mod='qlohotelreports'}</div>
|
||||
<div class="qlo-kpi-value">{$kpi_occupied|intval}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 col-sm-6">
|
||||
<div class="qlo-kpi-card qlo-kpi-card--warning">
|
||||
<div class="qlo-kpi-label">{l s='Out of Order' mod='qlohotelreports'}</div>
|
||||
<div class="qlo-kpi-value">{$kpi_out_of_order|intval}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{l s='Room No.' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Room Type' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Floor' mod='qlohotelreports'}</th>
|
||||
<th class="text-center">{l s='Status' mod='qlohotelreports'}</th>
|
||||
{if $show_housekeeping}<th class="text-center">{l s='Housekeeping Status' mod='qlohotelreports'}</th>{/if}
|
||||
<th>{l s='Current Guest' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Check-out Date' mod='qlohotelreports'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{if $rooms}
|
||||
{foreach $rooms as $room}
|
||||
<tr>
|
||||
<td>{$room.room_num|escape:'html':'UTF-8'}</td>
|
||||
<td><a href="{$room_type_link}&id_product={$room.id_product|intval}&updateproduct" target="_blank">{$room.room_type_name|escape:'html':'UTF-8'}</a></td>
|
||||
<td>{if $room.floor}{$room.floor|escape:'html':'UTF-8'}{else}—{/if}</td>
|
||||
<td class="text-center">
|
||||
{if $room.id_order}
|
||||
<span class="label label-danger">{l s='Occupied' mod='qlohotelreports'}</span>
|
||||
{elseif isset($room_statuses[$room.id_status])}
|
||||
<span class="label {$room_statuses[$room.id_status].class|escape:'html':'UTF-8'}">{$room_statuses[$room.id_status].label|escape:'html':'UTF-8'}</span>
|
||||
{else}
|
||||
<span class="label label-success">{l s='Vacant' mod='qlohotelreports'}</span>
|
||||
{/if}
|
||||
</td>
|
||||
{if $show_housekeeping}
|
||||
<td class="text-center">
|
||||
{assign var="hk_id" value=$room.id_housekeeping_status|intval}
|
||||
{if isset($housekeeping_statuses[$hk_id])}
|
||||
{assign var="hk" value=$housekeeping_statuses[$hk_id]}
|
||||
<span class="qlo-hk-badge" style="background-color:{$hk.bg_color|escape:'html':'UTF-8'};color:{$hk.text_color|escape:'html':'UTF-8'}">{$hk.name|escape:'html':'UTF-8'}</span>
|
||||
{else}
|
||||
—
|
||||
{/if}
|
||||
</td>
|
||||
{/if}
|
||||
<td>{if $room.guest_name}<a href="{$customer_link}&id_customer={$room.id_customer|intval}&updatecustomer" target="_blank">{$room.guest_name|escape:'html':'UTF-8'}</a>{else}—{/if}</td>
|
||||
<td>{if $room.date_to}{$room.date_to|escape:'html':'UTF-8'}{else}—{/if}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{else}
|
||||
<tr>
|
||||
<td class="list-empty" colspan="{if $show_housekeeping}7{else}6{/if}">
|
||||
<div class="list-empty-msg">
|
||||
<i class="icon-warning-sign list-empty-icon"></i>
|
||||
{l s='No rooms found.' mod='qlohotelreports'}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{if $rooms_total_pages > 1}
|
||||
<div class="row qlo-pagination-wrap">
|
||||
<div class="col-lg-12 text-center">
|
||||
<ul class="pagination pagination-sm">
|
||||
<li {if $rooms_page <= 1}class="disabled"{/if}>
|
||||
<a href="{$rooms_page_base_url|escape:'html':'UTF-8'}1"><i class="icon-double-angle-left"></i></a>
|
||||
</li>
|
||||
<li {if $rooms_page <= 1}class="disabled"{/if}>
|
||||
<a href="{$rooms_page_base_url|escape:'html':'UTF-8'}{if $rooms_page > 1}{$rooms_page-1}{else}1{/if}"><i class="icon-angle-left"></i></a>
|
||||
</li>
|
||||
{assign var="p" value=0}
|
||||
{while $p++ < $rooms_total_pages}
|
||||
{if $p < $rooms_page-2}
|
||||
<li class="disabled"><a href="#">…</a></li>
|
||||
{assign var="p" value=$rooms_page-3}
|
||||
{elseif $p > $rooms_page+2}
|
||||
<li class="disabled"><a href="#">…</a></li>
|
||||
{assign var="p" value=$rooms_total_pages}
|
||||
{else}
|
||||
<li {if $p == $rooms_page}class="active"{/if}>
|
||||
<a href="{$rooms_page_base_url|escape:'html':'UTF-8'}{$p|intval}">{$p|intval}</a>
|
||||
</li>
|
||||
{/if}
|
||||
{/while}
|
||||
<li {if $rooms_page >= $rooms_total_pages}class="disabled"{/if}>
|
||||
<a href="{$rooms_page_base_url|escape:'html':'UTF-8'}{if $rooms_page < $rooms_total_pages}{$rooms_page+1}{else}{$rooms_total_pages}{/if}"><i class="icon-angle-right"></i></a>
|
||||
</li>
|
||||
<li {if $rooms_page >= $rooms_total_pages}class="disabled"{/if}>
|
||||
<a href="{$rooms_page_base_url|escape:'html':'UTF-8'}{$rooms_total_pages|intval}"><i class="icon-double-angle-right"></i></a>
|
||||
</li>
|
||||
</ul>
|
||||
<p class="text-muted small">
|
||||
{l s='Showing' mod='qlohotelreports'}
|
||||
{$rooms_offset_start|intval}–{$rooms_offset_end|intval}
|
||||
{l s='of' mod='qlohotelreports'} {$rooms_total|intval} {l s='rooms' mod='qlohotelreports'}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{* ═══════════════════════════════════════════════════════════════════════════
|
||||
ROOM TYPE PERFORMANCE
|
||||
═══════════════════════════════════════════════════════════════════════════ *}
|
||||
{elseif $active_report == 'room-perf'}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{l s='Room Type' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Hotel' mod='qlohotelreports'}</th>
|
||||
<th class="text-center">{l s='Total Rooms' mod='qlohotelreports'}</th>
|
||||
<th class="text-center">{l s='Total Room Nights Available' mod='qlohotelreports'}</th>
|
||||
<th class="text-center">{l s='Total Room Nights Sold' mod='qlohotelreports'}</th>
|
||||
<th class="text-center">{l s='Occupancy Rate %' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Total Price (excl. Tax)' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Tax Amount' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Total Revenue' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='ADR (Avg. Daily Rate)' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='RevPAR (Rev. Per Avail. Room)' mod='qlohotelreports'}</th>
|
||||
<th class="text-center">{l s='Cancellation Count' mod='qlohotelreports'}</th>
|
||||
<th class="text-center">{l s='Avg. Length of Stay' mod='qlohotelreports'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{if $roomTypePerformance_rows}
|
||||
{foreach $roomTypePerformance_rows as $perfRow}
|
||||
<tr>
|
||||
<td><a href="{$room_type_link}&id_product={$perfRow.id_product|intval}&updateproduct" target="_blank">{$perfRow.room_type_name|escape:'html':'UTF-8'}</a></td>
|
||||
<td><a href="{$hotel_link}&id={$perfRow.id_hotel|intval}&updatehtl_branch_info" target="_blank">{$perfRow.hotel_name|escape:'html':'UTF-8'}</a></td>
|
||||
<td class="text-center">{$perfRow.total_rooms|intval}</td>
|
||||
<td class="text-center">{$perfRow.total_nights_available|intval}</td>
|
||||
<td class="text-center">{$perfRow.room_nights|intval}</td>
|
||||
<td class="text-center">{$perfRow.occupancy_pct|string_format:'%.1f'}%</td>
|
||||
<td class="text-right">{displayPrice price=$perfRow.room_revenue currency=$id_currency}</td>
|
||||
<td class="text-right">{displayPrice price=$perfRow.tax_amount currency=$id_currency}</td>
|
||||
<td class="text-right">{displayPrice price=$perfRow.total_revenue currency=$id_currency}</td>
|
||||
<td class="text-right">{displayPrice price=$perfRow.adr currency=$id_currency}</td>
|
||||
<td class="text-right">{displayPrice price=$perfRow.revpar currency=$id_currency}</td>
|
||||
<td class="text-center">{$perfRow.cancel_count|intval}</td>
|
||||
<td class="text-center">{$perfRow.avg_los|string_format:'%.1f'}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{else}
|
||||
<tr>
|
||||
<td class="list-empty" colspan="13">
|
||||
<div class="list-empty-msg">
|
||||
<i class="icon-warning-sign list-empty-icon"></i>
|
||||
{l s='No data for the selected period.' mod='qlohotelreports'}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
</tbody>
|
||||
{if $roomTypePerformance_rows}
|
||||
<tfoot class="qlo-report-totals">
|
||||
{assign var="tot_rooms" value=0}
|
||||
{assign var="tot_nights_avail" value=0}
|
||||
{assign var="tot_nights_sold" value=0}
|
||||
{assign var="tot_price_excl" value=0}
|
||||
{assign var="tot_tax" value=0}
|
||||
{assign var="tot_total_rev" value=0}
|
||||
{assign var="tot_cancels" value=0}
|
||||
{foreach $roomTypePerformance_rows as $perfRow}
|
||||
{assign var="tot_rooms" value=$tot_rooms+$perfRow.total_rooms}
|
||||
{assign var="tot_nights_avail" value=$tot_nights_avail+$perfRow.total_nights_available}
|
||||
{assign var="tot_nights_sold" value=$tot_nights_sold+$perfRow.room_nights}
|
||||
{assign var="tot_price_excl" value=$tot_price_excl+$perfRow.room_revenue}
|
||||
{assign var="tot_tax" value=$tot_tax+$perfRow.tax_amount}
|
||||
{assign var="tot_total_rev" value=$tot_total_rev+$perfRow.total_revenue}
|
||||
{assign var="tot_cancels" value=$tot_cancels+$perfRow.cancel_count}
|
||||
{/foreach}
|
||||
<tr>
|
||||
<td colspan="2"><strong>{l s='Total' mod='qlohotelreports'}</strong></td>
|
||||
<td class="text-center"><strong>{$tot_rooms|intval}</strong></td>
|
||||
<td class="text-center"><strong>{$tot_nights_avail|intval}</strong></td>
|
||||
<td class="text-center"><strong>{$tot_nights_sold|intval}</strong></td>
|
||||
<td class="text-center">—</td>
|
||||
<td class="text-right"><strong>{displayPrice price=$tot_price_excl currency=$id_currency}</strong></td>
|
||||
<td class="text-right"><strong>{displayPrice price=$tot_tax currency=$id_currency}</strong></td>
|
||||
<td class="text-right"><strong>{displayPrice price=$tot_total_rev currency=$id_currency}</strong></td>
|
||||
<td class="text-right">—</td>
|
||||
<td class="text-right">—</td>
|
||||
<td class="text-center"><strong>{$tot_cancels|intval}</strong></td>
|
||||
<td class="text-center">—</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
{/if}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/if}
|
||||
|
||||
<a class="btn btn-default export-csv" href="{$export_url|escape:'html':'UTF-8'}">
|
||||
<i class="icon-cloud-download"></i> {l s='CSV Export' mod='qlohotelreports'}
|
||||
</a>
|
||||
272
modules/qlohotelreports/views/templates/hook/group-property.tpl
Normal file
272
modules/qlohotelreports/views/templates/hook/group-property.tpl
Normal file
@@ -0,0 +1,272 @@
|
||||
{**
|
||||
* 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
|
||||
*}
|
||||
|
||||
<h3 class="qlo-report-heading">{$report_label|escape:'html':'UTF-8'}</h3>
|
||||
|
||||
{* ── Filters ─────────────────────────────────────────────────────────────── *}
|
||||
<form method="get" action="{$filter_base_url|escape:'html':'UTF-8'}" class="form-horizontal clearfix list_action_wrapper">
|
||||
<input type="hidden" name="controller" value="AdminStats">
|
||||
<input type="hidden" name="module" value="qlohotelreports">
|
||||
<input type="hidden" name="tab" value="{$active_report|escape:'html':'UTF-8'}">
|
||||
{if isset($smarty.get.token)}<input type="hidden" name="token" value="{$smarty.get.token|escape:'html':'UTF-8'}">{/if}
|
||||
<div class="list_filters">
|
||||
{if $active_report != 'hotel-comparison'}
|
||||
<div class="row">
|
||||
<label class="col-xs-3">{l s='Hotel' mod='qlohotelreports'}</label>
|
||||
<div class="col-xs-9">
|
||||
<select name="id_hotel" class="form-control">
|
||||
<option value="0"{if !$id_hotel} selected="selected"{/if}>{l s='All Hotels' mod='qlohotelreports'}</option>
|
||||
{foreach $hotels as $hotel}
|
||||
<option value="{$hotel.id|intval}"{if $id_hotel == $hotel.id} selected="selected"{/if}>{$hotel.hotel_name|escape:'html':'UTF-8'}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{if $active_report == 'out-of-order'}
|
||||
<div class="row">
|
||||
<label class="col-xs-3">{l s='Room Type' mod='qlohotelreports'}</label>
|
||||
<div class="col-xs-9">
|
||||
<select name="id_product" class="form-control">
|
||||
<option value="0"{if !$filter_id_product} selected="selected"{/if}>{l s='All' mod='qlohotelreports'}</option>
|
||||
{foreach $room_types as $roomType}
|
||||
<option value="{$roomType.id_product|intval}"{if $filter_id_product == $roomType.id_product} selected="selected"{/if}>
|
||||
{$roomType.room_type_name|escape:'html':'UTF-8'}
|
||||
</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label class="col-xs-3">{l s='Floor' mod='qlohotelreports'}</label>
|
||||
<div class="col-xs-9">
|
||||
<select name="floor" class="form-control">
|
||||
<option value=""{if !$filter_floor} selected="selected"{/if}>{l s='All Floors' mod='qlohotelreports'}</option>
|
||||
{foreach $available_floors as $fl}
|
||||
<option value="{$fl.floor|escape:'html':'UTF-8'}"{if $filter_floor == $fl.floor} selected="selected"{/if}>{$fl.floor|escape:'html':'UTF-8'}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{if $active_report != 'hotel-comparison'}
|
||||
<div class="actions">
|
||||
<hr>
|
||||
<span class="pull-right">
|
||||
<button type="submit" class="btn btn-sm btn-default">
|
||||
<i class="icon-filter"></i> {l s='Apply' mod='qlohotelreports'}
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{* ═══════════════════════════════════════════════════════════════════════════
|
||||
DAILY SUMMARY
|
||||
═══════════════════════════════════════════════════════════════════════════ *}
|
||||
{if $active_report == 'daily-summary'}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{l s='Date' mod='qlohotelreports'}</th>
|
||||
<th class="text-center">{l s='Total Rooms' mod='qlohotelreports'}</th>
|
||||
<th class="text-center">{l s='Rooms Sold' mod='qlohotelreports'}</th>
|
||||
<th class="text-center">{l s='Occupancy %' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='ADR (Avg. Daily Rate)' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='RevPAR (Rev. Per Avail. Room)' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Total Revenue' mod='qlohotelreports'}</th>
|
||||
<th class="text-center">{l s='Arrivals' mod='qlohotelreports'}</th>
|
||||
<th class="text-center">{l s='Departures' mod='qlohotelreports'}</th>
|
||||
<th class="text-center">{l s='In-house Guests' mod='qlohotelreports'}</th>
|
||||
<th class="text-center">{l s='Cancellations' mod='qlohotelreports'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{if $daily_rows}
|
||||
{foreach $daily_rows as $dailySummaryRow}
|
||||
<tr>
|
||||
<td>{$dailySummaryRow.date|escape:'html':'UTF-8'}</td>
|
||||
<td class="text-center">{$dailySummaryRow.total_rooms|intval}</td>
|
||||
<td class="text-center">{$dailySummaryRow.rooms_sold|intval}</td>
|
||||
<td class="text-center">{$dailySummaryRow.occupancy|string_format:'%.1f'}%</td>
|
||||
<td class="text-right">{displayPrice price=$dailySummaryRow.adr currency=$id_currency}</td>
|
||||
<td class="text-right">{displayPrice price=$dailySummaryRow.revpar currency=$id_currency}</td>
|
||||
<td class="text-right">{displayPrice price=$dailySummaryRow.revenue currency=$id_currency}</td>
|
||||
<td class="text-center">{$dailySummaryRow.arrivals|intval}</td>
|
||||
<td class="text-center">{$dailySummaryRow.departures|intval}</td>
|
||||
<td class="text-center">{$dailySummaryRow.inhouse_guests|intval}</td>
|
||||
<td class="text-center">{$dailySummaryRow.cancels|intval}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{else}
|
||||
<tr>
|
||||
<td class="list-empty" colspan="11">
|
||||
<div class="list-empty-msg">
|
||||
<i class="icon-warning-sign list-empty-icon"></i>
|
||||
{l s='No data for the selected period.' mod='qlohotelreports'}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{* ═══════════════════════════════════════════════════════════════════════════
|
||||
HOTEL COMPARISON
|
||||
═══════════════════════════════════════════════════════════════════════════ *}
|
||||
{elseif $active_report == 'hotel-comparison'}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{l s='Hotel Name' mod='qlohotelreports'}</th>
|
||||
<th class="text-center">{l s='Total Rooms' mod='qlohotelreports'}</th>
|
||||
<th class="text-center">{l s='Rooms Sold' mod='qlohotelreports'}</th>
|
||||
<th class="text-center">{l s='Occupancy %' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Room Revenue' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Extra Service Revenue' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Gross Revenue' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='ADR (Avg. Daily Rate)' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='RevPAR (Rev. Per Avail. Room)' mod='qlohotelreports'}</th>
|
||||
<th class="text-center">{l s='Total Room Bookings' mod='qlohotelreports'}</th>
|
||||
<th class="text-center">{l s='Total Cancellations' mod='qlohotelreports'}</th>
|
||||
<th class="text-center">{l s='Cancel Rate %' mod='qlohotelreports'}</th>
|
||||
<th class="text-center">{l s='Avg LOS' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Due Amount' mod='qlohotelreports'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{if $hotel_rows}
|
||||
{foreach $hotel_rows as $hotelRow}
|
||||
<tr>
|
||||
<td><a href="{$hotel_link}&id={$hotelRow.id_hotel|intval}&updatehtl_branch_info" target="_blank">{$hotelRow.hotel_name|escape:'html':'UTF-8'}</a></td>
|
||||
<td class="text-center">{$hotelRow.total_rooms|intval}</td>
|
||||
<td class="text-center">{$hotelRow.rooms_sold|intval}</td>
|
||||
<td class="text-center">{$hotelRow.occupancy|string_format:'%.1f'}%</td>
|
||||
<td class="text-right">{displayPrice price=$hotelRow.room_revenue currency=$id_currency}</td>
|
||||
<td class="text-right">{displayPrice price=$hotelRow.extra_service_rev currency=$id_currency}</td>
|
||||
<td class="text-right">{displayPrice price=$hotelRow.gross_revenue currency=$id_currency}</td>
|
||||
<td class="text-right">{displayPrice price=$hotelRow.adr currency=$id_currency}</td>
|
||||
<td class="text-right">{displayPrice price=$hotelRow.revpar currency=$id_currency}</td>
|
||||
<td class="text-center">{$hotelRow.bookings|intval}</td>
|
||||
<td class="text-center">{$hotelRow.cancellations|intval}</td>
|
||||
<td class="text-center">{$hotelRow.cancel_rate_pct|string_format:'%.1f'}%</td>
|
||||
<td class="text-center">{$hotelRow.avg_los|string_format:'%.1f'}</td>
|
||||
<td class="text-right">{displayPrice price=$hotelRow.outstanding_balance currency=$id_currency}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{else}
|
||||
<tr>
|
||||
<td class="list-empty" colspan="14">
|
||||
<div class="list-empty-msg">
|
||||
<i class="icon-warning-sign list-empty-icon"></i>
|
||||
{l s='No hotels found.' mod='qlohotelreports'}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{* ═══════════════════════════════════════════════════════════════════════════
|
||||
OUT OF ORDER ROOMS
|
||||
═══════════════════════════════════════════════════════════════════════════ *}
|
||||
{elseif $active_report == 'out-of-order'}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{l s='Room No.' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Floor' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Room Type' mod='qlohotelreports'}</th>
|
||||
<th class="text-center">{l s='OOO Status' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Reason' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Start Date' mod='qlohotelreports'}</th>
|
||||
<th>{l s='End Date' mod='qlohotelreports'}</th>
|
||||
<th class="text-center">{l s='Duration (Days)' mod='qlohotelreports'}</th>
|
||||
<th class="text-center">{l s='Current Status' mod='qlohotelreports'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{if $outOfOrder_rows}
|
||||
{assign var="today" value=$smarty.now|date_format:'%Y-%m-%d'}
|
||||
{foreach $outOfOrder_rows as $outOfOrderRow}
|
||||
<tr>
|
||||
<td>{$outOfOrderRow.room_num|escape:'html':'UTF-8'}</td>
|
||||
<td>{if $outOfOrderRow.floor}{$outOfOrderRow.floor|escape:'html':'UTF-8'}{else}—{/if}</td>
|
||||
<td><a href="{$room_type_link}&id_product={$outOfOrderRow.id_room_type|intval}&updateproduct" target="_blank">{$outOfOrderRow.room_type_name|escape:'html':'UTF-8'}</a></td>
|
||||
<td class="text-center">
|
||||
{if isset($room_statuses[$outOfOrderRow.id_status])}
|
||||
<span class="label {$room_statuses[$outOfOrderRow.id_status].class|escape:'html':'UTF-8'}">{$room_statuses[$outOfOrderRow.id_status].label|escape:'html':'UTF-8'}</span>
|
||||
{/if}
|
||||
</td>
|
||||
<td>{if $outOfOrderRow.reason}{$outOfOrderRow.reason|escape:'html':'UTF-8'}{else}—{/if}</td>
|
||||
<td>{if $outOfOrderRow.disabled_from}{$outOfOrderRow.disabled_from|escape:'html':'UTF-8'}{else}—{/if}</td>
|
||||
<td>{if $outOfOrderRow.disabled_to}{$outOfOrderRow.disabled_to|escape:'html':'UTF-8'}{else}—{/if}</td>
|
||||
<td class="text-center">{if $outOfOrderRow.disabled_days}{$outOfOrderRow.disabled_days|intval}{else}—{/if}</td>
|
||||
<td class="text-center">
|
||||
{if !$outOfOrderRow.disabled_to || $outOfOrderRow.disabled_to >= $today}
|
||||
<span class="label label-warning">{l s='Ongoing' mod='qlohotelreports'}</span>
|
||||
{else}
|
||||
<span class="label label-success">{l s='Resolved' mod='qlohotelreports'}</span>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{else}
|
||||
<tr>
|
||||
<td class="list-empty" colspan="9">
|
||||
<div class="list-empty-msg">
|
||||
<i class="icon-warning-sign list-empty-icon"></i>
|
||||
{l s='No out of order rooms for the selected period.' mod='qlohotelreports'}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/if}
|
||||
|
||||
<a class="btn btn-default export-csv" href="{$export_url|escape:'html':'UTF-8'}">
|
||||
<i class="icon-cloud-download"></i> {l s='CSV Export' mod='qlohotelreports'}
|
||||
</a>
|
||||
478
modules/qlohotelreports/views/templates/hook/group-revenue.tpl
Normal file
478
modules/qlohotelreports/views/templates/hook/group-revenue.tpl
Normal file
@@ -0,0 +1,478 @@
|
||||
{**
|
||||
* 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
|
||||
*}
|
||||
|
||||
<div class="qlo-report-group-revenue">
|
||||
|
||||
<h3 class="qlo-report-heading">{$report_label|escape:'html':'UTF-8'}</h3>
|
||||
|
||||
{* ── Filter bar ──────────────────────────────────────────────────── *}
|
||||
<form method="get" action="{$filter_base_url|escape:'html':'UTF-8'}" class="form-horizontal clearfix list_action_wrapper">
|
||||
<input type="hidden" name="controller" value="AdminStats">
|
||||
<input type="hidden" name="module" value="qlohotelreports">
|
||||
<input type="hidden" name="tab" value="{$active_report|escape:'html':'UTF-8'}">
|
||||
{if isset($smarty.get.token)}<input type="hidden" name="token" value="{$smarty.get.token|escape:'html':'UTF-8'}">{/if}
|
||||
<div class="list_filters">
|
||||
<div class="row">
|
||||
<label class="col-xs-3">{l s='Hotel' mod='qlohotelreports'}</label>
|
||||
<div class="col-xs-9">
|
||||
<select name="id_hotel" class="form-control">
|
||||
<option value="0"{if !$id_hotel} selected="selected"{/if}>{l s='All Hotels' mod='qlohotelreports'}</option>
|
||||
{foreach $hotels as $hotel}
|
||||
<option value="{$hotel.id|intval}"{if $id_hotel == $hotel.id} selected="selected"{/if}>{$hotel.hotel_name|escape:'html':'UTF-8'}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label class="col-xs-3">{l s='Room Type' mod='qlohotelreports'}</label>
|
||||
<div class="col-xs-9">
|
||||
<select name="id_product" class="form-control">
|
||||
<option value="0">{l s='All' mod='qlohotelreports'}</option>
|
||||
{foreach $room_types as $roomType}
|
||||
<option value="{$roomType.id_product|intval}"{if $filter_id_product == $roomType.id_product}selected="selected"{/if}>
|
||||
{$roomType.room_type_name|escape:'html':'UTF-8'}
|
||||
</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{if $active_report == 'refund'}
|
||||
<div class="row">
|
||||
<label class="col-xs-3">{l s='Refund Status' mod='qlohotelreports'}</label>
|
||||
<div class="col-xs-9">
|
||||
<select name="refund_status" class="form-control">
|
||||
<option value="0"{if !$filter_refund_status} selected="selected"{/if}>{l s='All' mod='qlohotelreports'}</option>
|
||||
{foreach $refund_states as $refundState}
|
||||
<option value="{$refundState.id_order_return_state|intval}"{if $filter_refund_status == $refundState.id_order_return_state} selected="selected"{/if}>
|
||||
{$refundState.name|escape:'html':'UTF-8'}
|
||||
</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{if $active_report == 'payment'}
|
||||
<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>
|
||||
{/if}
|
||||
{if $active_report == 'tax'}
|
||||
<div class="row">
|
||||
<label class="col-xs-3">{l s='Revenue Source' mod='qlohotelreports'}</label>
|
||||
<div class="col-xs-9">
|
||||
<select name="revenue_source" class="form-control">
|
||||
<option value="all"{if $filter_revenue_source == 'all'} selected="selected"{/if}>{l s='All' mod='qlohotelreports'}</option>
|
||||
<option value="room"{if $filter_revenue_source == 'room'} selected="selected"{/if}>{l s='Room Charges' mod='qlohotelreports'}</option>
|
||||
<option value="service"{if $filter_revenue_source == 'service'} selected="selected"{/if}>{l s='Service Charges' mod='qlohotelreports'}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label class="col-xs-3">{l s='Tax Name' mod='qlohotelreports'}</label>
|
||||
<div class="col-xs-9">
|
||||
<select name="id_tax" class="form-control">
|
||||
<option value="0"{if !$filter_id_tax} selected="selected"{/if}>{l s='All' mod='qlohotelreports'}</option>
|
||||
{foreach $tax_names as $tax}
|
||||
<option value="{$tax.id_tax|intval}"{if $filter_id_tax == $tax.id_tax} selected="selected"{/if}>
|
||||
{$tax.name|escape:'html':'UTF-8'}{if $tax.rate} ({$tax.rate|string_format:'%.2f'}%){/if}
|
||||
</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="actions">
|
||||
<hr>
|
||||
<span class="pull-right">
|
||||
<button type="submit" class="btn btn-default btn-sm">
|
||||
<i class="icon-filter"></i> {l s='Apply' mod='qlohotelreports'}
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{* ── Revenue Report ──────────────────────────────────────────────── *}
|
||||
{if $active_report == 'revenue'}
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{l s='Date / Period' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Rooms Booked' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Total Bookings' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Room Revenue (excl. Tax)' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Extra Services Revenue' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Tax Amount' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Refund Amount' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Total Collection' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Net Revenue' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='ADR (Avg. Daily Rate)' mod='qlohotelreports'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{if $daily_rows}
|
||||
{foreach $daily_rows as $revenueRow}
|
||||
<tr>
|
||||
<td>{$revenueRow.date|escape:'html':'UTF-8'}</td>
|
||||
<td class="text-right">{$revenueRow.rooms_sold|intval}</td>
|
||||
<td class="text-right">{$revenueRow.bookings|intval}</td>
|
||||
<td class="text-right">{displayPrice price=$revenueRow.room_revenue currency=$id_currency}</td>
|
||||
<td class="text-right">{displayPrice price=$revenueRow.service_revenue currency=$id_currency}</td>
|
||||
<td class="text-right">{displayPrice price=$revenueRow.tax_amount currency=$id_currency}</td>
|
||||
<td class="text-right">{displayPrice price=$revenueRow.refund_amount currency=$id_currency}</td>
|
||||
<td class="text-right">{displayPrice price=$revenueRow.total_collection currency=$id_currency}</td>
|
||||
<td class="text-right">{displayPrice price=$revenueRow.net_revenue currency=$id_currency}</td>
|
||||
<td class="text-right">{displayPrice price=$revenueRow.adr currency=$id_currency}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{else}
|
||||
<tr>
|
||||
<td class="list-empty" colspan="10">
|
||||
<div class="list-empty-msg">
|
||||
<i class="icon-warning-sign list-empty-icon"></i>
|
||||
{l s='No revenue data found for the selected date range.' mod='qlohotelreports'}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
</tbody>
|
||||
{if $daily_rows}
|
||||
<tfoot>
|
||||
<tr class="qlo-report-totals">
|
||||
<td><strong>{l s='Total' mod='qlohotelreports'}</strong></td>
|
||||
<td class="text-right"><strong>{$revenue_totals.rooms_sold}</strong></td>
|
||||
<td class="text-right"><strong>{$revenue_totals.bookings}</strong></td>
|
||||
<td class="text-right"><strong>{displayPrice price=$revenue_totals.room_revenue currency=$id_currency}</strong></td>
|
||||
<td class="text-right"><strong>{displayPrice price=$revenue_totals.service_revenue currency=$id_currency}</strong></td>
|
||||
<td class="text-right"><strong>{displayPrice price=$revenue_totals.tax_amount currency=$id_currency}</strong></td>
|
||||
<td class="text-right"><strong>{displayPrice price=$revenue_totals.refund_amount currency=$id_currency}</strong></td>
|
||||
<td class="text-right"><strong>{displayPrice price=$revenue_totals.total_collection currency=$id_currency}</strong></td>
|
||||
<td class="text-right"><strong>{displayPrice price=$revenue_totals.net_revenue currency=$id_currency}</strong></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
{/if}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{* ── Refund Report ───────────────────────────────────────────────── *}
|
||||
{if $active_report == 'refund'}
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{l s='Refund Date' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Refund ID' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Order ID' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Guest Name' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Original Booking Amount' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Refund Amount' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Refund Method' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Refund Status' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Refund Remark' mod='qlohotelreports'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{if $refunds}
|
||||
{foreach $refunds as $refund}
|
||||
<tr>
|
||||
<td>{if $refund.cancellation_date}{$refund.cancellation_date|date_format:'%d-%m-%Y'}{else}<span class="text-muted">—</span>{/if}</td>
|
||||
<td>{$refund.id_order_return|intval}</td>
|
||||
<td><a href="{$order_link}&id_order={$refund.id_order|intval}&vieworder" target="_blank">{$refund.id_order|intval}</a></td>
|
||||
<td><a href="{$customer_link}&id_customer={$refund.id_customer|intval}&updatecustomer" target="_blank">{$refund.customer_name|escape:'html':'UTF-8'}</a></td>
|
||||
<td class="text-right">{displayPrice price=$refund.total_price_tax_incl currency=$refund.id_currency}</td>
|
||||
<td class="text-right">{displayPrice price=$refund.refunded_amount currency=$refund.id_currency}</td>
|
||||
<td>{if $refund.refund_method}{$refund.refund_method|escape:'html':'UTF-8'}{else}<span class="text-muted">—</span>{/if}</td>
|
||||
<td>{if $refund.refund_status}{$refund.refund_status|escape:'html':'UTF-8'}{else}<span class="text-muted">—</span>{/if}</td>
|
||||
<td>{if $refund.cancellation_reason}{$refund.cancellation_reason|escape:'html':'UTF-8'}{else}<span class="text-muted">—</span>{/if}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{else}
|
||||
<tr>
|
||||
<td class="list-empty" colspan="9">
|
||||
<div class="list-empty-msg">
|
||||
<i class="icon-warning-sign list-empty-icon"></i>
|
||||
{l s='No refunds found for the selected date range.' mod='qlohotelreports'}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
</tbody>
|
||||
{if $refunds}
|
||||
<tfoot>
|
||||
<tr class="qlo-report-totals">
|
||||
<td colspan="5"><strong>{l s='Total Refunded' mod='qlohotelreports'}</strong></td>
|
||||
<td class="text-right"><strong>{displayPrice price=$total_refunded currency=$id_currency}</strong></td>
|
||||
<td colspan="3"></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
{/if}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{* ── Payment / Collection Report ────────────────────────────────── *}
|
||||
{if $active_report == 'payment'}
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{l s='Payment Date' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Payment ID' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Order ID' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Booking Ref.' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Guest Name' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Payment Method' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Payment Type' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Amount' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Payment Status' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Transaction Reference' mod='qlohotelreports'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{if $payments}
|
||||
{foreach $payments as $payment}
|
||||
<tr>
|
||||
<td>{$payment.date_add|escape:'html':'UTF-8'}</td>
|
||||
<td>{$payment.id_order_payment|intval}</td>
|
||||
<td><a href="{$order_link}&id_order={$payment.id_order|intval}&vieworder" target="_blank">{$payment.id_order|intval}</a></td>
|
||||
<td>{$payment.reference|escape:'html':'UTF-8'}</td>
|
||||
<td><a href="{$customer_link}&id_customer={$payment.id_customer|intval}&updatecustomer" target="_blank">{$payment.customer_name|escape:'html':'UTF-8'}</a></td>
|
||||
<td>{$payment.payment_method|escape:'html':'UTF-8'}</td>
|
||||
<td>
|
||||
{if isset($payment_types[$payment.payment_type])}{$payment_types[$payment.payment_type]|escape:'html':'UTF-8'}{else}<span class="text-muted">—</span>{/if}
|
||||
</td>
|
||||
<td class="text-right">{displayPrice price=$payment.amount currency=$payment.id_currency}</td>
|
||||
<td>{l s='Success' mod='qlohotelreports'}</td>
|
||||
<td>{if $payment.transaction_id}{$payment.transaction_id|escape:'html':'UTF-8'}{else}<span class="text-muted">—</span>{/if}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{else}
|
||||
<tr>
|
||||
<td class="list-empty" colspan="10">
|
||||
<div class="list-empty-msg">
|
||||
<i class="icon-warning-sign list-empty-icon"></i>
|
||||
{l s='No payments found for the selected date range.' mod='qlohotelreports'}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
</tbody>
|
||||
{if $payments}
|
||||
<tfoot>
|
||||
<tr class="qlo-report-totals">
|
||||
<td colspan="7"><strong>{l s='Total Collected' mod='qlohotelreports'}</strong></td>
|
||||
<td class="text-right"><strong>{displayPrice price=$total_payments currency=$id_currency}</strong></td>
|
||||
<td colspan="2"></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
{/if}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{* ── Tax Report ──────────────────────────────────────────────────── *}
|
||||
{if $active_report == 'tax'}
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{l s='Booking Date' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Booking Ref.' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Guest Name' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Revenue Source' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Room Type' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Taxable Amount' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Tax Name' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Tax Rate %' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Tax Amount' mod='qlohotelreports'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{if $tax_rows}
|
||||
{foreach $tax_rows as $taxRow}
|
||||
<tr>
|
||||
<td>{$taxRow.date_add|date_format:'%d-%m-%Y'}</td>
|
||||
<td>{$taxRow.reference|escape:'html':'UTF-8'}</td>
|
||||
<td><a href="{$customer_link}&id_customer={$taxRow.id_customer|intval}&updatecustomer" target="_blank">{$taxRow.customer_name|escape:'html':'UTF-8'}</a></td>
|
||||
<td>{if $taxRow.revenue_source == 'service'}{l s='Service Charge' mod='qlohotelreports'}{else}{l s='Room Charge' mod='qlohotelreports'}{/if}</td>
|
||||
<td><a href="{if $taxRow.revenue_source == 'service'}{$service_link}{else}{$room_type_link}{/if}&id_product={$taxRow.id_product|intval}&updateproduct" target="_blank">{$taxRow.room_type_name|escape:'html':'UTF-8'}</a></td>
|
||||
<td class="text-right">{displayPrice price=$taxRow.taxable_amount currency=$id_currency}</td>
|
||||
<td>{if $taxRow.tax_name}{$taxRow.tax_name|escape:'html':'UTF-8'}{else}<span class="text-muted">—</span>{/if}</td>
|
||||
<td class="text-right">{$taxRow.tax_rate|string_format:"%.2f"}%</td>
|
||||
<td class="text-right">{displayPrice price=$taxRow.tax_amount currency=$id_currency}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{else}
|
||||
<tr>
|
||||
<td class="list-empty" colspan="9">
|
||||
<div class="list-empty-msg">
|
||||
<i class="icon-warning-sign list-empty-icon"></i>
|
||||
{l s='No tax data found for the selected date range.' mod='qlohotelreports'}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
</tbody>
|
||||
{if $tax_rows}
|
||||
<tfoot>
|
||||
<tr class="qlo-report-totals">
|
||||
<td colspan="5"><strong>{l s='Totals' mod='qlohotelreports'}</strong></td>
|
||||
<td class="text-right"><strong>{displayPrice price=$tax_totals.taxable_amount currency=$id_currency}</strong></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td class="text-right"><strong>{displayPrice price=$tax_totals.tax_amount currency=$id_currency}</strong></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
{/if}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{if $tax_by_name}
|
||||
<h4 class="qlo-section-heading">{l s='Tax Summary by Type' mod='qlohotelreports'}</h4>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{l s='Tax Name' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Tax Rate %' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Total Taxable Amount' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Total Tax Collected' mod='qlohotelreports'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach $tax_by_name as $taxSummary}
|
||||
<tr>
|
||||
<td>{$taxSummary.tax_name|escape:'html':'UTF-8'}</td>
|
||||
<td class="text-right">{$taxSummary.tax_rate|string_format:"%.2f"}%</td>
|
||||
<td class="text-right">{displayPrice price=$taxSummary.taxable_amount currency=$id_currency}</td>
|
||||
<td class="text-right">{displayPrice price=$taxSummary.tax_amount currency=$id_currency}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr class="qlo-report-totals">
|
||||
<td colspan="2"><strong>{l s='Grand Total' mod='qlohotelreports'}</strong></td>
|
||||
<td class="text-right"><strong>{displayPrice price=$tax_totals.taxable_amount currency=$id_currency}</strong></td>
|
||||
<td class="text-right"><strong>{displayPrice price=$tax_totals.tax_amount currency=$id_currency}</strong></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{* ── Outstanding / Balance Due Report ───────────────────────────── *}
|
||||
{if $active_report == 'outstanding'}
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{l s='Order ID' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Guest Name' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Guest Email' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Guest Phone' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Total Charges' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Total Paid' mod='qlohotelreports'}</th>
|
||||
<th class="text-right">{l s='Outstanding Balance' mod='qlohotelreports'}</th>
|
||||
<th>{l s='Last Payment Date' mod='qlohotelreports'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{if $outstanding}
|
||||
{foreach $outstanding as $outstandingRow}
|
||||
<tr>
|
||||
<td><a href="{$order_link}&id_order={$outstandingRow.id_order|intval}&vieworder" target="_blank">{$outstandingRow.id_order|intval}</a></td>
|
||||
<td><a href="{$customer_link}&id_customer={$outstandingRow.id_customer|intval}&updatecustomer" target="_blank">{$outstandingRow.customer_name|escape:'html':'UTF-8'}</a></td>
|
||||
<td>{if $outstandingRow.email}{$outstandingRow.email|escape:'html':'UTF-8'}{else}<span class="text-muted">—</span>{/if}</td>
|
||||
<td>{if $outstandingRow.phone}{$outstandingRow.phone|escape:'html':'UTF-8'}{else}<span class="text-muted">—</span>{/if}</td>
|
||||
<td class="text-right">{displayPrice price=$outstandingRow.total_charges currency=$id_currency}</td>
|
||||
<td class="text-right">{displayPrice price=$outstandingRow.total_paid currency=$id_currency}</td>
|
||||
<td class="text-right qlo-text-danger">{displayPrice price=$outstandingRow.balance_due currency=$id_currency}</td>
|
||||
<td>{if $outstandingRow.last_payment_date}{$outstandingRow.last_payment_date|date_format:'%d-%m-%Y'}{else}<span class="text-muted">—</span>{/if}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{else}
|
||||
<tr>
|
||||
<td class="list-empty" colspan="8">
|
||||
<div class="list-empty-msg">
|
||||
<i class="icon-warning-sign list-empty-icon"></i>
|
||||
{l s='No outstanding balances found for the selected date range.' mod='qlohotelreports'}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
</tbody>
|
||||
{if $outstanding}
|
||||
<tfoot>
|
||||
<tr class="qlo-report-totals">
|
||||
<td colspan="6"><strong>{l s='Total Outstanding' mod='qlohotelreports'}</strong></td>
|
||||
<td class="text-right qlo-text-danger"><strong>{displayPrice price=$total_outstanding currency=$id_currency}</strong></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
{/if}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<a class="btn btn-default export-csv" href="{$export_url|escape:'html':'UTF-8'}">
|
||||
<i class="icon-cloud-download"></i> {l s='CSV Export' mod='qlohotelreports'}
|
||||
</a>
|
||||
|
||||
</div>
|
||||
32
modules/qlohotelreports/views/templates/hook/index.php
Normal file
32
modules/qlohotelreports/views/templates/hook/index.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 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/licenses/afl-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/licenses/afl-3.0.php Academic Free License 3.0
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../../../');
|
||||
exit;
|
||||
32
modules/qlohotelreports/views/templates/index.php
Normal file
32
modules/qlohotelreports/views/templates/index.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 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/licenses/afl-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/licenses/afl-3.0.php Academic Free License 3.0
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../../../');
|
||||
exit;
|
||||
@@ -106,6 +106,9 @@ class StatsForecast extends Module
|
||||
$to2 = min(date('Y-m-d H:i:s', strtotime('+1 day')), $to);
|
||||
$interval = HotelHelper::getNumberOfDays($from, $to);
|
||||
$interval2 = HotelHelper::getNumberOfDays($from, $to2);
|
||||
if (!$interval2) {
|
||||
return;
|
||||
}
|
||||
$prop30 = $interval / $interval2;
|
||||
$to = strtotime($to);
|
||||
$to2 = strtotime($to2);
|
||||
|
||||
Reference in New Issue
Block a user