diff --git a/application/controllers/Reports.php b/application/controllers/Reports.php index 805b3705c..5dc7933c9 100644 --- a/application/controllers/Reports.php +++ b/application/controllers/Reports.php @@ -157,6 +157,7 @@ class Reports extends Secure_Controller { $tabular_data[] = $this->xss_clean(array( 'customer_name' => $row['customer'], + '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_customers.php b/application/models/reports/Summary_customers.php index a270c97bc..1b07697af 100644 --- a/application/models/reports/Summary_customers.php +++ b/application/models/reports/Summary_customers.php @@ -8,6 +8,7 @@ class Summary_customers extends Summary_report { return array( array('customer_name' => $this->lang->line('reports_customer')), + 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_customers extends Summary_report $this->db->select(' MAX(CONCAT(customer_p.first_name, " ", customer_p.last_name)) AS customer, - SUM(sales_items.quantity_purchased) AS quantity_purchased + SUM(sales_items.quantity_purchased) AS quantity_purchased, + COUNT(DISTINCT sales.sale_id) AS sales '); }