$this->lang->line('reports_customer')), 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'), array('total' => $this->lang->line('reports_total'), 'sorter' => 'number_sorter'), array('cost' => $this->lang->line('reports_cost'), 'sorter' => 'number_sorter'), array('profit' => $this->lang->line('reports_profit'), 'sorter' => 'number_sorter')); } protected function _select(array $inputs) { parent::_select($inputs); $this->db->select(' CONCAT(customer_p.first_name, " ", customer_p.last_name) AS customer, SUM(sales_items.quantity_purchased) AS quantity_purchased '); } protected function _from() { parent::_from(); $this->db->join('people AS customer_p', 'sales.customer_id = customer_p.person_id'); } protected function _group_order() { $this->db->group_by('sales.customer_id'); $this->db->order_by('customer_p.last_name'); } } ?>