From d8656a36c67467db42700b9f7935c10693e0bf85 Mon Sep 17 00:00:00 2001 From: Rohan Mitchell Date: Wed, 25 Mar 2015 16:31:15 +1100 Subject: [PATCH] Consistency in tax calculations, remove some unneeded local vars --- app/models/spree/order_decorator.rb | 4 ++-- lib/open_food_network/sales_tax_report.rb | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/app/models/spree/order_decorator.rb b/app/models/spree/order_decorator.rb index eab5b00d72..c29d3f8165 100644 --- a/app/models/spree/order_decorator.rb +++ b/app/models/spree/order_decorator.rb @@ -199,11 +199,11 @@ Spree::Order.class_eval do end def shipping_tax - adjustments(:reload).shipping.first.andand.included_tax || 0 + adjustments(:reload).shipping.sum &:included_tax end def enterprise_fee_tax - adjustments(:reload).enterprise_fee.sum(&:included_tax) + adjustments(:reload).enterprise_fee.sum &:included_tax end def total_tax diff --git a/lib/open_food_network/sales_tax_report.rb b/lib/open_food_network/sales_tax_report.rb index d6d58d8c15..46e2cd234e 100644 --- a/lib/open_food_network/sales_tax_report.rb +++ b/lib/open_food_network/sales_tax_report.rb @@ -16,12 +16,9 @@ module OpenFoodNetwork @orders.map do |order| totals = totals_of order.line_items shipping_cost = shipping_cost_for order - shipping_tax = order.shipping_tax - enterprise_fee_tax = order.enterprise_fee_tax - total_tax = order.total_tax [order.number, order.created_at, totals[:items], totals[:items_total], - totals[:taxable_total], totals[:sales_tax], shipping_cost, shipping_tax, enterprise_fee_tax, total_tax, + totals[:taxable_total], totals[:sales_tax], shipping_cost, order.shipping_tax, order.enterprise_fee_tax, order.total_tax, order.bill_address.full_name, order.distributor.andand.name] end end