From fec5c92b15a1184645c77b0d7bec6d7fe8e80fc8 Mon Sep 17 00:00:00 2001 From: chunter2 Date: Fri, 29 Apr 2022 14:33:21 -0400 Subject: [PATCH] Porting over e4ca111 --- app/Controllers/Reports.php | 1 + app/Models/Reports/Summary_items.php | 2 ++ 2 files changed, 3 insertions(+) diff --git a/app/Controllers/Reports.php b/app/Controllers/Reports.php index 768190f7a..688f68aab 100644 --- a/app/Controllers/Reports.php +++ b/app/Controllers/Reports.php @@ -351,6 +351,7 @@ class Reports extends Secure_Controller $tabular_data[] = [ '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']), diff --git a/app/Models/Reports/Summary_items.php b/app/Models/Reports/Summary_items.php index a0ceb85f4..e3225206e 100644 --- a/app/Models/Reports/Summary_items.php +++ b/app/Models/Reports/Summary_items.php @@ -9,6 +9,7 @@ class Summary_items extends Summary_report return [ ['item_name' => lang('Reports.item')], ['category' => lang('Reports.category')], + ['cost_price' => lang('Reports.cost_price'), 'sorter' => 'number_sorter'], ['unit_price' => lang('Reports.unit_price'), 'sorter' => 'number_sorter'], ['quantity' => lang('Reports.quantity'), 'sorter' => 'number_sorter'], ['subtotal' => lang('Reports.subtotal'), 'sorter' => 'number_sorter'], @@ -26,6 +27,7 @@ class Summary_items extends Summary_report $builder->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 ');