Fix Reports and few other minor things

This commit is contained in:
FrancescoUK
2017-12-12 20:58:36 +00:00
parent 323738210b
commit c96c2a69a6
15 changed files with 269 additions and 216 deletions

View File

@@ -484,7 +484,7 @@ class Item extends CI_Model
{
$suggestions = array();
$this->db->select($this->get_search_suggestion_format('item_id,name'));
$this->db->select($this->get_search_suggestion_format('item_id, name'));
$this->db->from('items');
$this->db->where('deleted', $filters['is_deleted']);
$this->db->where("item_type = " . ITEM); // standard, exclude kit items since kits will be picked up later
@@ -495,7 +495,7 @@ class Item extends CI_Model
$suggestions[] = array('value' => $row->item_id, 'label' => $this->get_search_suggestion_label($row));
}
$this->db->select($this->get_search_suggestion_format('item_id,item_number'));
$this->db->select($this->get_search_suggestion_format('item_id, item_number'));
$this->db->from('items');
$this->db->where('deleted', $filters['is_deleted']);
$this->db->where("item_type = " . ITEM); // standard, exclude kit items since kits will be picked up later
@@ -576,7 +576,6 @@ class Item extends CI_Model
}
}
//only return $limit suggestions
if(count($suggestions > $limit))
{
@@ -687,7 +686,6 @@ class Item extends CI_Model
}
}
//only return $limit suggestions
if(count($suggestions > $limit))
{

View File

@@ -1183,6 +1183,7 @@ class Sale extends CI_Model
MAX(CONCAT(employee.first_name, " ", employee.last_name)) AS employee_name,
items.item_id AS item_id,
MAX(items.name) AS name,
MAX(items.item_number) AS item_number,
MAX(items.category) AS category,
MAX(items.supplier_id) AS supplier_id,
MAX(sales_items.quantity_purchased) AS quantity_purchased,

View File

@@ -25,7 +25,7 @@ class Detailed_sales extends Report
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'),
array('payment_type' => $this->lang->line('sales_amount_tendered')),
array('payment_type' => $this->lang->line('reports_payment_type')),
array('comment' => $this->lang->line('reports_comments'))),
'details' => array(
$this->lang->line('reports_name'),
@@ -50,14 +50,14 @@ class Detailed_sales extends Report
$this->db->select('sale_id,
sale_date,
SUM(quantity_purchased) AS items_purchased,
employee_name,
customer_name,
MAX(employee_name) AS employee_name,
MAX(customer_name) AS customer_name,
SUM(subtotal) AS subtotal,
SUM(tax) AS tax,
SUM(total) AS total,
SUM(cost) AS cost,
SUM(profit) AS profit,
payment_type,
MAX(payment_type) AS payment_type,
comment');
$this->db->from('sales_items_temp');
$this->db->where('sale_id', $sale_id);

View File

@@ -55,6 +55,7 @@ class Specific_customer extends Report
WHEN sale_status = ' . CANCELED . ' THEN \'' . $this->lang->line('reports_code_canceled') . '\'
ELSE \'\'
END) AS type_code,
MAX(sale_status) as sale_status,
MAX(sale_date) AS sale_date,
SUM(quantity_purchased) AS items_purchased,
MAX(employee_name) AS employee_name,

View File

@@ -18,10 +18,12 @@ class Specific_discount extends Report
array('type_code' => $this->lang->line('reports_code_type')),
array('sale_date' => $this->lang->line('reports_date')),
array('quantity' => $this->lang->line('reports_quantity')),
array('employee_name' => $this->lang->line('reports_sold_by')),
array('customer_name' => $this->lang->line('reports_sold_to')),
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'),
array('payment_type' => $this->lang->line('reports_payment_type')),
array('comment' => $this->lang->line('reports_comments'))),
@@ -53,8 +55,10 @@ class Specific_discount extends Report
WHEN sale_status = ' . CANCELED . ' THEN \'' . $this->lang->line('reports_code_canceled') . '\'
ELSE \'\'
END) AS type_code,
MAX(sale_status) as sale_status,
MAX(sale_date) AS sale_date,
SUM(quantity_purchased) AS items_purchased,
MAX(employee_name) AS employee_name,
MAX(customer_name) AS customer_name,
SUM(subtotal) AS subtotal,
SUM(tax) AS tax,

View File

@@ -55,6 +55,7 @@ class Specific_employee extends Report
WHEN sale_status = ' . CANCELED . ' THEN \'' . $this->lang->line('reports_code_canceled') . '\'
ELSE \'\'
END) AS type_code,
MAX(sale_status) as sale_status,
MAX(sale_date) AS sale_date,
SUM(quantity_purchased) AS items_purchased,
MAX(customer_name) AS customer_name,