From e013deb655ea14caaf0fb0465a747905e8bcdc2c Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Thu, 28 Nov 2024 17:52:16 +0100 Subject: [PATCH] Added Admin Customer Statistics --- Layout/default/Admin/CustomerStatistics.php | 48 +++++++++++++++++++++ Layout/default/Admin/Index.php | 15 ++++++- application/Admin/AdminController.php | 40 ++++++++++++++++- 3 files changed, 100 insertions(+), 3 deletions(-) create mode 100644 Layout/default/Admin/CustomerStatistics.php diff --git a/Layout/default/Admin/CustomerStatistics.php b/Layout/default/Admin/CustomerStatistics.php new file mode 100644 index 000000000..8bc820e1e --- /dev/null +++ b/Layout/default/Admin/CustomerStatistics.php @@ -0,0 +1,48 @@ + + + +
+
+
+
+ +
+

Kundenstatistiken

+
+
+
+ + +
+
+
+
+
+ + + + + + + + + + + + + +
Xinon Kunden gesamt:
Xinon Kunden Business:
Xinon Kunden Privat:
+
+
+
+
+
+ + + + + \ No newline at end of file diff --git a/Layout/default/Admin/Index.php b/Layout/default/Admin/Index.php index ec2ada089..829079d3b 100644 --- a/Layout/default/Admin/Index.php +++ b/Layout/default/Admin/Index.php @@ -14,7 +14,20 @@ - + + +
+
+
Backoffice
+
+ +
+
+
diff --git a/application/Admin/AdminController.php b/application/Admin/AdminController.php index 65cac0c1b..2bd1176a6 100644 --- a/application/Admin/AdminController.php +++ b/application/Admin/AdminController.php @@ -19,7 +19,36 @@ class AdminController extends mfBaseController { } - + protected function customerStatisticsAction() { + $this->layout()->setTemplate("Admin/CustomerStatistics"); + + $bc_sql = "SELECT COUNT(Contract.id) as contract_count, Address.* FROM `Address` + LEFT JOIN Contract ON (Contract.owner_id = Address.id) + WHERE customer_number > 0 AND company <> '' + AND (Contract.cancel_date IS NULL OR Contract.cancel_date > UNIX_TIMESTAMP()) + GROUP BY Address.id HAVING contract_count > 0"; + $bc_res = $this->db()->query($bc_sql); + + $xinon_active_customers_business = $this->db()->num_rows($bc_res); + $this->layout()->set("xinon_active_customers_business", $xinon_active_customers_business); + + $pc_sql = "SELECT COUNT(Contract.id) as contract_count, Address.* FROM `Address` + LEFT JOIN Contract ON (Contract.owner_id = Address.id) + WHERE customer_number > 0 AND (company = '' OR company IS NULL) + AND (Contract.cancel_date IS NULL OR Contract.cancel_date > UNIX_TIMESTAMP()) + GROUP BY Address.id HAVING contract_count > 0"; + + $pc_res = $this->db()->query($pc_sql); + + $xinon_active_customers_private = $this->db()->num_rows($pc_res); + $this->layout()->set("xinon_active_customers_private", $xinon_active_customers_private); + + $xinon_active_customers_total = $xinon_active_customers_business + $xinon_active_customers_private; + $this->layout()->set("xinon_active_customers_total", $xinon_active_customers_total); + + + } + protected function createNetworkAddressForNetowner() { $i = 0; foreach(NetworkModel::getAll() as $network) { @@ -80,6 +109,8 @@ class AdminController extends mfBaseController { } protected function saveIvtImportMatchProducts() { + $this->layout()->setFlash("disabled", "error"); + $this->redirect("Admin"); $r = $this->request; //var_dump($r);exit; @@ -151,7 +182,9 @@ class AdminController extends mfBaseController { } protected function ivtContractImportAction() { - //exit; + $this->layout()->setFlash("disabled", "error"); + $this->redirect("Admin"); + $doit = false; if($this->request->doit == 1) { $doit = true; @@ -174,6 +207,9 @@ class AdminController extends mfBaseController { } protected function ivtCreditImportAction() { + $this->layout()->setFlash("disabled", "error"); + $this->redirect("Admin"); + $doit = false; if($this->request->doit == 1) { $doit = true;