12776: rename vat to tax

This commit is contained in:
Ahmed Ejaz
2024-11-13 20:00:11 +05:00
committed by Rachel Arnould
parent e2d999da8d
commit 9bcdac8f30
4 changed files with 22 additions and 22 deletions

View File

@@ -3332,11 +3332,11 @@ See the %{link} to find out more about %{sitename}'s features and to start using
report_header_total_units: Total Units
report_header_sum_max_total: "Sum Max Total"
report_header_total_excl_vat: "Total excl. tax (%{currency_symbol})"
report_header_total_fees_excl_vat: "Total fees excl. tax (%{currency_symbol})"
report_header_total_vat_on_fees: "Total tax on fees (%{currency_symbol})"
report_header_total_fees_excl_tax: "Total fees excl. tax (%{currency_symbol})"
report_header_total_tax_on_fees: "Total tax on fees (%{currency_symbol})"
report_header_total: "Total (%{currency_symbol})"
report_header_total_incl_vat: "Total incl. tax (%{currency_symbol})"
report_header_total_excl_vat_and_fees: "Total excl. fees and tax (%{currency_symbol})"
report_header_total_excl_fees_and_tax: "Total excl. fees and tax (%{currency_symbol})"
report_header_temp_controlled: TempControlled?
report_header_is_producer: Producer?
report_header_not_confirmed: Not Confirmed

View File

@@ -40,10 +40,10 @@ module Reporting
product:,
variant_unit_name:,
quantity:,
total_excl_vat_and_fees:,
total_excl_fees_and_tax:,
total_excl_vat:,
total_fees_excl_vat:,
total_vat_on_fees:,
total_fees_excl_tax:,
total_tax_on_fees:,
total_tax:,
total:,
}
@@ -58,10 +58,10 @@ module Reporting
summary_hash = Hash.new(0)
line_items.each do |line_item|
summary_hash[:total_excl_vat_and_fees] += total_excl_vat_and_fees.call(line_item)
summary_hash[:total_excl_fees_and_tax] += total_excl_fees_and_tax.call(line_item)
summary_hash[:total_excl_vat] += total_excl_vat.call(line_item)
summary_hash[:total_fees_excl_vat] += total_fees_excl_vat.call(line_item)
summary_hash[:total_vat_on_fees] += total_vat_on_fees.call(line_item)
summary_hash[:total_fees_excl_tax] += total_fees_excl_tax.call(line_item)
summary_hash[:total_tax_on_fees] += total_tax_on_fees.call(line_item)
summary_hash[:total_tax] += total_tax.call(line_item)
summary_hash[:total] += total.call(line_item)
end

View File

@@ -71,7 +71,7 @@ module Reporting
proc { |line_item| line_item.quantity }
end
def total_excl_vat_and_fees
def total_excl_fees_and_tax
proc do |line_item|
included_tax = adjustments_by_type(line_item, :tax, included: true)
line_item.amount - included_tax
@@ -81,18 +81,18 @@ module Reporting
def total_excl_vat
proc do |line_item|
total_fees = adjustments_by_type(line_item, :fees)
total_excl_vat_and_fees.call(line_item) + total_fees
total_excl_fees_and_tax.call(line_item) + total_fees
end
end
def total_fees_excl_vat
def total_fees_excl_tax
proc do |line_item|
included_tax = tax_on_fees(line_item, included: true)
adjustments_by_type(line_item, :fees) - included_tax
end
end
def total_vat_on_fees
def total_tax_on_fees
proc { |line_item| tax_on_fees(line_item) }
end
@@ -107,9 +107,9 @@ module Reporting
def total
proc do |line_item|
total_price = total_excl_vat_and_fees.call(line_item)
total_fees = total_fees_excl_vat.call(line_item)
total_fees_tax = total_vat_on_fees.call(line_item)
total_price = total_excl_fees_and_tax.call(line_item)
total_fees = total_fees_excl_tax.call(line_item)
total_fees_tax = total_tax_on_fees.call(line_item)
tax = total_tax.call(line_item)
total_price + total_fees + total_fees_tax + tax

View File

@@ -38,10 +38,10 @@ RSpec.describe "Pay Your Suppliers Report" do
expect(table_row.product).to eq(product.name)
expect(table_row.variant_unit_name).to eq(variant.full_name)
expect(table_row.quantity).to eq(1)
expect(table_row.total_excl_vat_and_fees.to_f).to eq(10.0)
expect(table_row.total_excl_fees_and_tax.to_f).to eq(10.0)
expect(table_row.total_excl_vat.to_f).to eq(10.0)
expect(table_row.total_fees_excl_vat.to_f).to eq(0.0)
expect(table_row.total_vat_on_fees.to_f).to eq(0.0)
expect(table_row.total_fees_excl_tax.to_f).to eq(0.0)
expect(table_row.total_tax_on_fees.to_f).to eq(0.0)
expect(table_row.total_tax.to_f).to eq(0.0)
expect(table_row.total.to_f).to eq(10.0)
end
@@ -88,10 +88,10 @@ RSpec.describe "Pay Your Suppliers Report" do
expect(report_table_rows.length).to eq(1)
table_row = report_table_rows.first
expect(table_row.total_excl_vat_and_fees.to_f).to eq(10.0)
expect(table_row.total_excl_fees_and_tax.to_f).to eq(10.0)
expect(table_row.total_excl_vat.to_f).to eq(10.1)
expect(table_row.total_fees_excl_vat.to_f).to eq(0.1)
expect(table_row.total_vat_on_fees.to_f).to eq(0.01)
expect(table_row.total_fees_excl_tax.to_f).to eq(0.1)
expect(table_row.total_tax_on_fees.to_f).to eq(0.01)
expect(table_row.total_tax.to_f).to eq(0.1)
expect(table_row.total.to_f).to eq(10.21)
end