Merge branch 'develop' into gli-2941

This commit is contained in:
amit sharma
2026-09-07 12:36:40 +05:30
135 changed files with 1352 additions and 6506 deletions

View File

@@ -1909,7 +1909,7 @@ class AdminStatsControllerCore extends AdminStatsTabController
return $result;
}
// Calculate total services revenue (services and demands)
// Calculate total services revenue (services )
public static function getServicesRevenueForDiscreteDates($dateFrom, $dateTo = null, $idHotel = null, $useCache = true)
{
$dateTo = !$dateTo ? date('Y-m-d', strtotime('+1 day', strtotime($dateFrom))) : $dateTo;
@@ -1946,23 +1946,6 @@ class AdminStatsControllerCore extends AdminStatsTabController
$totalServicesRevenue += $servicesRevenue;
}
// Calculate demands revenue
$demandsRevenueSql = 'SELECT SUM((hdmd.`total_price_tax_excl` / o.`conversion_rate`) / DATEDIFF(hbd.`date_to`, hbd.`date_from`))
FROM `'._DB_PREFIX_.'htl_booking_demands` hdmd
LEFT JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd
ON (hdmd.`id_htl_booking` = 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`)
WHERE p.`active` = 1
AND o.`valid` = 1
AND hbd.`is_refunded` = 0
AND hbd.`date_from` < "'.pSQL($discreteDate['date_to']).' 00:00:00" AND hbd.`date_to` > "'.pSQL($discreteDate['date_from']).' 00:00:00"'.
(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : '');
if ($demandsRevenue = Db::getInstance()->getValue($demandsRevenueSql)) {
$totalServicesRevenue += $demandsRevenue;
}
$result[$discreteDate['timestamp_from']] = $totalServicesRevenue;
}