From 7a875723cacd00f2d974f8942811f36f8bba65ed Mon Sep 17 00:00:00 2001 From: Mohamed ABDELLANI Date: Fri, 9 Jun 2023 08:44:14 +0100 Subject: [PATCH] fix order_cycle summary row. the summary row has to only include the line items coming from the supplier used in the grouping key --- .../enterprise_fees_with_tax_report_by_producer.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/reporting/reports/enterprise_fee_summary/enterprise_fees_with_tax_report_by_producer.rb b/lib/reporting/reports/enterprise_fee_summary/enterprise_fees_with_tax_report_by_producer.rb index 95fb6aca29..f474d72805 100644 --- a/lib/reporting/reports/enterprise_fee_summary/enterprise_fees_with_tax_report_by_producer.rb +++ b/lib/reporting/reports/enterprise_fee_summary/enterprise_fees_with_tax_report_by_producer.rb @@ -219,8 +219,12 @@ module Reporting def order_cycle_totals_row proc do |_key, items, _rows| + supplier_id = items.first.first[2] # supplier id used in the grouped line items order_ids = items.flat_map(&:second).map(&:id).uniq line_items = items.flat_map(&:second).uniq.map(&:line_items).flatten + .filter do |line_item| + line_item.supplier_id == supplier_id + end total_excl_tax = total_fees_excl_tax(order_ids) + line_items_excl_tax(line_items) tax = tax_for_order_ids(order_ids) + tax_for_line_items(line_items)