diff --git a/app/models/spree/adjustment.rb b/app/models/spree/adjustment.rb index e53f08db77..8c8bfb848e 100644 --- a/app/models/spree/adjustment.rb +++ b/app/models/spree/adjustment.rb @@ -70,7 +70,6 @@ module Spree scope :credit, -> { where('amount < 0') } scope :return_authorization, -> { where(originator_type: "Spree::ReturnAuthorization") } scope :voucher, -> { where(originator_type: "Voucher") } - scope :voucher_tax, -> { where(originator_type: "Voucher").where("label LIKE 'Tax%'") } scope :non_voucher, -> { where.not(originator_type: "Voucher") } scope :inclusive, -> { where(included: true) } scope :additional, -> { where(included: false) } diff --git a/lib/reporting/reports/sales_tax/sales_tax_totals_by_order.rb b/lib/reporting/reports/sales_tax/sales_tax_totals_by_order.rb index 61a66b7360..7e3d7cc01d 100644 --- a/lib/reporting/reports/sales_tax/sales_tax_totals_by_order.rb +++ b/lib/reporting/reports/sales_tax/sales_tax_totals_by_order.rb @@ -159,10 +159,8 @@ module Reporting end def voucher_tax_adjustment(order) - included_tax_voucher_adjustment = order.voucher_adjustments.first&.included_tax || 0 - excluded_tax_voucher_adjustment = order.all_adjustments.voucher_tax.first&.amount || 0 - - included_tax_voucher_adjustment + excluded_tax_voucher_adjustment + VoucherAdjustmentsService.new(order).voucher_included_tax + + VoucherAdjustmentsService.new(order).voucher_excluded_tax end def first_name(query_result_row)