From bb12283ff829318fa9a889b477a7b32865651adc Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Fri, 22 Mar 2024 15:45:39 +0530 Subject: [PATCH] updated table data and licenes --- install/models/install.php | 2 +- modules/gridhtml/gridhtml.php | 2 +- modules/qlostatsserviceproducts/CHANGELOG.txt | 4 + modules/qlostatsserviceproducts/index.php | 29 ++++ .../logo.gif | Bin .../logo.png | Bin .../qlostatsserviceproducts.php} | 127 ++++++++++-------- .../qlostatsserviceproducts/views/index.php | 29 ++++ .../views/templates/hook/index.php | 29 ++++ .../templates/hook/services_content_block.tpl | 36 +++++ .../views/templates/index.php | 29 ++++ modules/statsserviceproducts/CHANGELOG.txt | 0 modules/statsserviceproducts/index.php | 29 ---- modules/statsserviceproducts/views/index.php | 29 ---- .../views/templates/hook/index.php | 29 ---- .../templates/hook/services_content_block.tpl | 36 ----- .../views/templates/index.php | 29 ---- 17 files changed, 228 insertions(+), 211 deletions(-) create mode 100644 modules/qlostatsserviceproducts/CHANGELOG.txt create mode 100644 modules/qlostatsserviceproducts/index.php rename modules/{statsserviceproducts => qlostatsserviceproducts}/logo.gif (100%) rename modules/{statsserviceproducts => qlostatsserviceproducts}/logo.png (100%) rename modules/{statsserviceproducts/statsserviceproducts.php => qlostatsserviceproducts/qlostatsserviceproducts.php} (75%) create mode 100644 modules/qlostatsserviceproducts/views/index.php create mode 100644 modules/qlostatsserviceproducts/views/templates/hook/index.php create mode 100644 modules/qlostatsserviceproducts/views/templates/hook/services_content_block.tpl create mode 100644 modules/qlostatsserviceproducts/views/templates/index.php delete mode 100644 modules/statsserviceproducts/CHANGELOG.txt delete mode 100644 modules/statsserviceproducts/index.php delete mode 100644 modules/statsserviceproducts/views/index.php delete mode 100644 modules/statsserviceproducts/views/templates/hook/index.php delete mode 100644 modules/statsserviceproducts/views/templates/hook/services_content_block.tpl delete mode 100644 modules/statsserviceproducts/views/templates/index.php diff --git a/install/models/install.php b/install/models/install.php index 0ebf9679b..e692b0815 100644 --- a/install/models/install.php +++ b/install/models/install.php @@ -698,7 +698,7 @@ class InstallModelInstall extends InstallAbstractModel 'statsbestvouchers', 'statsbestcustomers', 'statsequipment', - 'statsserviceproducts', + 'qlostatsserviceproducts', 'blockcart', 'blockuserinfo', 'qlochannelmanagerconnector', diff --git a/modules/gridhtml/gridhtml.php b/modules/gridhtml/gridhtml.php index 1e1ccad4a..dbbe49459 100644 --- a/modules/gridhtml/gridhtml.php +++ b/modules/gridhtml/gridhtml.php @@ -77,7 +77,7 @@ class GridHtml extends ModuleGridEngine '; foreach ($params['columns'] as $column) - $html .= ''.$column['header'].''; + $html .= ''.$column['header'].''; $html .= ' diff --git a/modules/qlostatsserviceproducts/CHANGELOG.txt b/modules/qlostatsserviceproducts/CHANGELOG.txt new file mode 100644 index 000000000..5932aa450 --- /dev/null +++ b/modules/qlostatsserviceproducts/CHANGELOG.txt @@ -0,0 +1,4 @@ +Changelog + +v1.0.0 +- first release \ No newline at end of file diff --git a/modules/qlostatsserviceproducts/index.php b/modules/qlostatsserviceproducts/index.php new file mode 100644 index 000000000..73108e1bc --- /dev/null +++ b/modules/qlostatsserviceproducts/index.php @@ -0,0 +1,29 @@ + +* @copyright Since 2010 Webkul IN +* @license https://store.webkul.com/license.html +*/ + +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; diff --git a/modules/statsserviceproducts/logo.gif b/modules/qlostatsserviceproducts/logo.gif similarity index 100% rename from modules/statsserviceproducts/logo.gif rename to modules/qlostatsserviceproducts/logo.gif diff --git a/modules/statsserviceproducts/logo.png b/modules/qlostatsserviceproducts/logo.png similarity index 100% rename from modules/statsserviceproducts/logo.png rename to modules/qlostatsserviceproducts/logo.png diff --git a/modules/statsserviceproducts/statsserviceproducts.php b/modules/qlostatsserviceproducts/qlostatsserviceproducts.php similarity index 75% rename from modules/statsserviceproducts/statsserviceproducts.php rename to modules/qlostatsserviceproducts/qlostatsserviceproducts.php index b1d6cd8c2..eee2d2538 100644 --- a/modules/statsserviceproducts/statsserviceproducts.php +++ b/modules/qlostatsserviceproducts/qlostatsserviceproducts.php @@ -1,28 +1,28 @@ +* @copyright Since 2010 Webkul IN +* @license https://store.webkul.com/license.html +*/ if (!defined('_PS_VERSION_')) { exit; } -class statsServiceProducts extends ModuleGrid +class QloStatsServiceProducts extends ModuleGrid { private $query = null; private $columns = null; @@ -31,7 +31,7 @@ class statsServiceProducts extends ModuleGrid public function __construct() { - $this->name = 'statsserviceproducts'; + $this->name = 'qlostatsserviceproducts'; $this->tab = 'analytics_stats'; $this->version = '1.0.0'; $this->author = 'Webkul'; @@ -53,21 +53,21 @@ class statsServiceProducts extends ModuleGrid public function hookAdminStatsModules($params) { - $engine_params_services = $this->getServicesParams(); - $engine_params_facilities = $this->getFacilitiesParams(); + $engineParamsServices = $this->getServicesParams(); + $engineParamsFacilities = $this->getFacilitiesParams(); if (Tools::getValue('export')) { if (Tools::getValue('option') == 'services') { - $this->csvExport($engine_params_services); + $this->csvExport($engineParamsServices); } else if (Tools::getValue('option') == 'facilities') { - $this->csvExport($engine_params_facilities); + $this->csvExport($engineParamsFacilities); } } $this->context->smarty->assign(array( 'module_name' => $this->displayName, - 'grid_table_services' => $this->engine($engine_params_services), - 'grid_table_facilities' => $this->engine($engine_params_facilities), + 'grid_table_services' => $this->engine($engineParamsServices), + 'grid_table_facilities' => $this->engine($engineParamsFacilities), 'export_link_services' => Tools::safeOutput($_SERVER['REQUEST_URI']).'&export=1&option=services', 'export_link_facilities' => Tools::safeOutput($_SERVER['REQUEST_URI']).'&export=1&option=facilities', )); @@ -90,31 +90,31 @@ class statsServiceProducts extends ModuleGrid 'id' => 'auto_add_to_cart', 'header' => $this->l('Auto add to cart'), 'dataIndex' => 'auto_add_to_cart', - 'align' => 'center' + 'align' => 'left' ), array( 'id' => 'totalQuantitySold', 'header' => $this->l('Quantity sold'), 'dataIndex' => 'totalQuantitySold', - 'align' => 'center' + 'align' => 'left' ), array( 'id' => 'avgPriceSold', 'header' => $this->l('Average Price'), 'dataIndex' => 'avgPriceSold', - 'align' => 'center' + 'align' => 'left' ), array( 'id' => 'totalPriceSold', 'header' => $this->l('Sales'), 'dataIndex' => 'totalPriceSold', - 'align' => 'center' + 'align' => 'left' ), array( 'id' => 'active', - 'header' => $this->l('Active'), + 'header' => $this->l('Status'), 'dataIndex' => 'active', - 'align' => 'center' + 'align' => 'left' ) ), 'defaultSortColumn' => 'totalPriceSold', @@ -139,19 +139,19 @@ class statsServiceProducts extends ModuleGrid 'id' => 'totalQuantitySold', 'header' => $this->l('Quantity sold'), 'dataIndex' => 'totalQuantitySold', - 'align' => 'center' + 'align' => 'left' ), array( 'id' => 'avgPriceSold', 'header' => $this->l('Average Price'), 'dataIndex' => 'avgPriceSold', - 'align' => 'center' + 'align' => 'left' ), array( 'id' => 'totalPriceSold', 'header' => $this->l('Sales'), 'dataIndex' => 'totalPriceSold', - 'align' => 'center' + 'align' => 'left' ), ), 'defaultSortColumn' => 'totalPriceSold', @@ -163,36 +163,46 @@ class statsServiceProducts extends ModuleGrid public function setOption($option) { - $date_between = $this->getDate(); + $dateBetween = $this->getDate(); switch($option) { case 'services' : - $this->setQueryForServices($date_between); + $this->setQueryForServices($dateBetween); break; case 'facilities' : - $this->setQueryForFacilities($date_between); + $this->setQueryForFacilities($dateBetween); break; } } - public function setQueryForServices($date_between) + public function setQueryForServices($dateBetween) { - $this->query = '(SELECT IFNULL(pl.`name`, od.`product_name`) as `display_name`, p.`active`, p.`auto_add_to_cart`, - ROUND(IFNULL(SUM(spod.`total_price_tax_excl` / o.`conversion_rate`), 0), 2) / SUM(spod.`quantity`) AS avgPriceSold, - IFNULL(SUM(spod.`quantity`), 0) AS totalQuantitySold, + $this->query = '(SELECT IFNULL(pl.`name`, od.`product_name`) as `display_name`, p.`active`, od.`product_auto_add` as auto_add_to_cart, od.`product_price_addition_type` as price_addition_type, + ROUND(IFNULL(SUM(spod.`total_price_tax_excl` / o.`conversion_rate`), 0), 2) / SUM( + IF(od.`product_price_calculation_method` = '.(int)Product::PRICE_CALCULATION_METHOD_PER_DAY.', + DATEDIFF(hbd.`date_to`, hbd.`date_from`) * spod.`quantity`, + spod.`quantity` + ) + ) AS avgPriceSold, + IFNULL(SUM( + IF(od.`product_price_calculation_method` = '.(int)Product::PRICE_CALCULATION_METHOD_PER_DAY.', + DATEDIFF(hbd.`date_to`, hbd.`date_from`) * spod.`quantity`, + spod.`quantity` + ) + ), 0) AS totalQuantitySold, ROUND(IFNULL(SUM(spod.`total_price_tax_excl` / o.`conversion_rate`), 0), 2) AS totalPriceSold FROM '._DB_PREFIX_.'htl_room_type_service_product_order_detail spod LEFT JOIN '._DB_PREFIX_.'product p ON (spod.`id_product` = p.`id_product`) LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (p.id_product = pl.id_product AND pl.id_lang = '.(int)$this->getLang().') INNER JOIN '._DB_PREFIX_.'orders o ON (spod.id_order = o.id_order) - INNER JOIN '._DB_PREFIX_.'order_detail od ON (od.id_order = o.id_order) + INNER JOIN '._DB_PREFIX_.'order_detail od ON (spod.`id_product` = od.`product_id` AND od.id_order = o.id_order) INNER JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd ON (spod.`id_htl_booking_detail` = hbd.`id`) - WHERE o.valid = 1 AND o.invoice_date BETWEEN '.$date_between.' + WHERE o.valid = 1 AND o.invoice_date BETWEEN '.$dateBetween.' '.HotelBranchInformation::addHotelRestriction(false, 'hbd').' AND od.`is_booking_product` = 0 - GROUP BY spod.id_product) + GROUP BY spod.id_product, od.product_auto_add) UNION - (SELECT pl.`name` as `display_name`, p.`active`, p.`auto_add_to_cart`, + (SELECT pl.`name` as `display_name`, p.`active`, p.`auto_add_to_cart`, p.`price_addition_type`, 0 AS avgPriceSold, 0 AS totalQuantitySold, 0 AS totalPriceSold @@ -205,7 +215,7 @@ class statsServiceProducts extends ModuleGrid INNER JOIN '._DB_PREFIX_.'orders o ON (spod.id_order = o.id_order) INNER JOIN '._DB_PREFIX_.'order_detail od ON (od.id_order = o.id_order) INNER JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd ON (spod.`id_htl_booking_detail` = hbd.`id`) - WHERE o.valid = 1 AND o.invoice_date BETWEEN '.$date_between.' + WHERE o.valid = 1 AND o.invoice_date BETWEEN '.$dateBetween.' '.HotelBranchInformation::addHotelRestriction(false, 'hbd').' AND od.`is_booking_product` = 0 ) @@ -218,7 +228,7 @@ class statsServiceProducts extends ModuleGrid $this->option = 'services'; } - public function setQueryForFacilities($date_between) + public function setQueryForFacilities($dateBetween) { $this->query = '(SELECT bd.`name` as `display_name`, ROUND(IFNULL(SUM(bd.`total_price_tax_excl` / o.`conversion_rate`), 0), 2) / COUNT(bd.`id_booking_demand`) as avgPriceSold, @@ -227,7 +237,7 @@ class statsServiceProducts extends ModuleGrid FROM '._DB_PREFIX_.'htl_booking_demands bd INNER JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd ON (bd.`id_htl_booking` = hbd.`id`) INNER JOIN '._DB_PREFIX_.'orders o ON (hbd.id_order = o.id_order) - WHERE o.valid = 1 AND o.invoice_date BETWEEN '.$date_between.' + WHERE o.valid = 1 AND o.invoice_date BETWEEN '.$dateBetween.' '.HotelBranchInformation::addHotelRestriction(false, 'hbd').' GROUP BY bd.`name`) UNION @@ -247,7 +257,7 @@ class statsServiceProducts extends ModuleGrid HAVING `display_name` NOT IN (SELECT bd.`name` FROM '._DB_PREFIX_.'htl_booking_demands bd INNER JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd ON (bd.`id_htl_booking` = hbd.`id`) INNER JOIN '._DB_PREFIX_.'orders o ON (hbd.id_order = o.id_order) - WHERE o.valid = 1 AND o.invoice_date BETWEEN '.$date_between.' + WHERE o.valid = 1 AND o.invoice_date BETWEEN '.$dateBetween.' '.HotelBranchInformation::addHotelRestriction(false, 'hbd').' ))'; $this->_totalCount = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue( @@ -278,17 +288,20 @@ class statsServiceProducts extends ModuleGrid if (is_null($value['active'])) { $value['active'] = ''.$this->l('Deleted').''; } else if (!$value['active']) { - $value['active'] = ''.$this->l('No').''; + $value['active'] = ''.$this->l('Inactive').''; } else { - $value['active'] = ''.$this->l('Yes').''; + $value['active'] = ''.$this->l('Active').''; } - if (is_null($value['auto_add_to_cart'])) { - $value['auto_add_to_cart'] = ''.$this->l('Deleted').''; - } else if (!$value['auto_add_to_cart']) { - $value['auto_add_to_cart'] = ''.$this->l('No').''; + if ($value['auto_add_to_cart']) { + $value['auto_add_to_cart'] = ''.$this->l('Yes'); + $value['auto_add_to_cart'] .= ''; + if ($value['price_addition_type'] == ProductCore::PRICE_ADDITION_TYPE_WITH_ROOM) { + $value['auto_add_to_cart'] .= ' '.$this->l('Auto added').''; + } else { + $value['auto_add_to_cart'] .= ' '.$this->l('Convenience fee').''; + } } else { - - $value['auto_add_to_cart'] = ''.$this->l('Yes').''; + $value['auto_add_to_cart'] = ''.$this->l('No').''; } } $value['avgPriceSold'] = Tools::displayPrice($value['avgPriceSold'], $currency); diff --git a/modules/qlostatsserviceproducts/views/index.php b/modules/qlostatsserviceproducts/views/index.php new file mode 100644 index 000000000..73108e1bc --- /dev/null +++ b/modules/qlostatsserviceproducts/views/index.php @@ -0,0 +1,29 @@ + +* @copyright Since 2010 Webkul IN +* @license https://store.webkul.com/license.html +*/ + +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; diff --git a/modules/qlostatsserviceproducts/views/templates/hook/index.php b/modules/qlostatsserviceproducts/views/templates/hook/index.php new file mode 100644 index 000000000..73108e1bc --- /dev/null +++ b/modules/qlostatsserviceproducts/views/templates/hook/index.php @@ -0,0 +1,29 @@ + +* @copyright Since 2010 Webkul IN +* @license https://store.webkul.com/license.html +*/ + +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; diff --git a/modules/qlostatsserviceproducts/views/templates/hook/services_content_block.tpl b/modules/qlostatsserviceproducts/views/templates/hook/services_content_block.tpl new file mode 100644 index 000000000..d0bff4f30 --- /dev/null +++ b/modules/qlostatsserviceproducts/views/templates/hook/services_content_block.tpl @@ -0,0 +1,36 @@ +{** +* Since 2010 Webkul. +* +* NOTICE OF LICENSE +* +* All right is reserved, +* Please go through this link for complete license : https://store.webkul.com/license.html +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade this module to 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 IN +* @license https://store.webkul.com/license.html +*} + +
+ {l s='Services' mod='qlostatsserviceproducts'} +
+ {$grid_table_services} + + {l s='CSV Export' mod='qlostatsserviceproducts'} + + +
+
+ {l s='Facilities' mod='qlostatsserviceproducts'} +
+ + {$grid_table_facilities} + + {l s='CSV Export' mod='qlostatsserviceproducts'} + \ No newline at end of file diff --git a/modules/qlostatsserviceproducts/views/templates/index.php b/modules/qlostatsserviceproducts/views/templates/index.php new file mode 100644 index 000000000..73108e1bc --- /dev/null +++ b/modules/qlostatsserviceproducts/views/templates/index.php @@ -0,0 +1,29 @@ + +* @copyright Since 2010 Webkul IN +* @license https://store.webkul.com/license.html +*/ + +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; diff --git a/modules/statsserviceproducts/CHANGELOG.txt b/modules/statsserviceproducts/CHANGELOG.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/modules/statsserviceproducts/index.php b/modules/statsserviceproducts/index.php deleted file mode 100644 index 7a7f9721e..000000000 --- a/modules/statsserviceproducts/index.php +++ /dev/null @@ -1,29 +0,0 @@ - - {l s='Services' mod='statsserviceproducts'} -
- {$grid_table_services} - - {l s='CSV Export' mod='statsserviceproducts'} - - -
-
- {l s='Facilities' mod='statsserviceproducts'} -
- - {$grid_table_facilities} - - {l s='CSV Export' mod='statsserviceproducts'} - \ No newline at end of file diff --git a/modules/statsserviceproducts/views/templates/index.php b/modules/statsserviceproducts/views/templates/index.php deleted file mode 100644 index 7a7f9721e..000000000 --- a/modules/statsserviceproducts/views/templates/index.php +++ /dev/null @@ -1,29 +0,0 @@ -