Add cost price column to item summary report (#3495)

This commit is contained in:
chunter2
2022-04-29 14:33:21 -04:00
committed by jekkos
parent 31944f491c
commit e4ca111977
2 changed files with 3 additions and 0 deletions

View File

@@ -231,6 +231,7 @@ class Reports extends Secure_Controller
$tabular_data[] = $this->xss_clean(array(
'item_name' => $row['name'],
'category' => $row['category'],
'cost_price' => $row['cost_price'],
'unit_price' => $row['unit_price'],
'quantity' => to_quantity_decimals($row['quantity_purchased']),
'subtotal' => to_currency($row['subtotal']),

View File

@@ -9,6 +9,7 @@ class Summary_items extends Summary_report
return array(
array('item_name' => $this->lang->line('reports_item')),
array('category' => $this->lang->line('reports_category')),
array('cost_price' => $this->lang->line('reports_cost_price'), 'sorter' => 'number_sorter'),
array('unit_price' => $this->lang->line('reports_unit_price'), 'sorter' => 'number_sorter'),
array('quantity' => $this->lang->line('reports_quantity'), 'sorter' => 'number_sorter'),
array('subtotal' => $this->lang->line('reports_subtotal'), 'sorter' => 'number_sorter'),
@@ -25,6 +26,7 @@ class Summary_items extends Summary_report
$this->db->select('
MAX(items.name) AS name,
MAX(items.category) AS category,
MAX(items.cost_price) AS cost_price,
MAX(items.unit_price) AS unit_price,
SUM(sales_items.quantity_purchased) AS quantity_purchased
');