From 20d78224a4429f430d239a1cfa785da41b3c26a1 Mon Sep 17 00:00:00 2001 From: Carl Hunter Date: Sat, 14 Nov 2020 19:12:53 -0500 Subject: [PATCH] Added Transactions column to Employees Summary Report and Transactions Summary Report --- application/controllers/Reports.php | 2 ++ application/models/reports/Summary_employees.php | 4 +++- application/models/reports/Summary_sales.php | 4 +++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/application/controllers/Reports.php b/application/controllers/Reports.php index d303f0ed6..805b3705c 100644 --- a/application/controllers/Reports.php +++ b/application/controllers/Reports.php @@ -51,6 +51,7 @@ class Reports extends Secure_Controller { $tabular_data[] = $this->xss_clean(array( 'sale_date' => to_date(strtotime($row['sale_date'])), + 'sales' => to_quantity_decimals($row['sales']), 'quantity' => to_quantity_decimals($row['quantity_purchased']), 'subtotal' => to_currency($row['subtotal']), 'tax' => to_currency_tax($row['tax']), @@ -265,6 +266,7 @@ class Reports extends Secure_Controller { $tabular_data[] = $this->xss_clean(array( 'employee_name' => $row['employee'], + 'sales' => to_quantity_decimals($row['sales']), 'quantity' => to_quantity_decimals($row['quantity_purchased']), 'subtotal' => to_currency($row['subtotal']), 'tax' => to_currency_tax($row['tax']), diff --git a/application/models/reports/Summary_employees.php b/application/models/reports/Summary_employees.php index 3f9723361..80496adc0 100644 --- a/application/models/reports/Summary_employees.php +++ b/application/models/reports/Summary_employees.php @@ -8,6 +8,7 @@ class Summary_employees extends Summary_report { return array( array('employee_name' => $this->lang->line('reports_employee')), + array('sales' => $this->lang->line('reports_sales'), 'sorter' => 'number_sorter'), array('quantity' => $this->lang->line('reports_quantity')), array('subtotal' => $this->lang->line('reports_subtotal'), 'sorter' => 'number_sorter'), array('tax' => $this->lang->line('reports_tax'), 'sorter' => 'number_sorter'), @@ -22,7 +23,8 @@ class Summary_employees extends Summary_report $this->db->select(' MAX(CONCAT(employee_p.first_name, " ", employee_p.last_name)) AS employee, - SUM(sales_items.quantity_purchased) AS quantity_purchased + SUM(sales_items.quantity_purchased) AS quantity_purchased, + COUNT(DISTINCT sales.sale_id) AS sales '); } diff --git a/application/models/reports/Summary_sales.php b/application/models/reports/Summary_sales.php index a6bff913b..6c57432d3 100644 --- a/application/models/reports/Summary_sales.php +++ b/application/models/reports/Summary_sales.php @@ -8,6 +8,7 @@ class Summary_sales extends Summary_report { return array( array('sale_date' => $this->lang->line('reports_date'), 'sortable' => FALSE), + array('sales' => $this->lang->line('reports_sales'), 'sorter' => 'number_sorter'), array('quantity' => $this->lang->line('reports_quantity')), array('subtotal' => $this->lang->line('reports_subtotal'), 'sorter' => 'number_sorter'), array('tax' => $this->lang->line('reports_tax'), 'sorter' => 'number_sorter'), @@ -22,7 +23,8 @@ class Summary_sales extends Summary_report $this->db->select(' DATE(sales.sale_time) AS sale_date, - SUM(sales_items.quantity_purchased) AS quantity_purchased + SUM(sales_items.quantity_purchased) AS quantity_purchased, + COUNT(DISTINCT sales.sale_id) AS sales '); }