From 9bcdac8f30ee74796d434aca615c3273e8fcc3dc Mon Sep 17 00:00:00 2001 From: Ahmed Ejaz Date: Wed, 13 Nov 2024 20:00:11 +0500 Subject: [PATCH] 12776: rename vat to tax --- config/locales/en.yml | 6 +++--- lib/reporting/reports/suppliers/base.rb | 12 ++++++------ .../reports/suppliers/helpers/columns_helper.rb | 14 +++++++------- .../suppliers/pay_your_suppliers_report_spec.rb | 12 ++++++------ 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index 7bff667b07..44834a3d6f 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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 diff --git a/lib/reporting/reports/suppliers/base.rb b/lib/reporting/reports/suppliers/base.rb index 972ab2e6df..f6723ffdc8 100644 --- a/lib/reporting/reports/suppliers/base.rb +++ b/lib/reporting/reports/suppliers/base.rb @@ -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 diff --git a/lib/reporting/reports/suppliers/helpers/columns_helper.rb b/lib/reporting/reports/suppliers/helpers/columns_helper.rb index 8a0d5c19d0..abac2f67b1 100644 --- a/lib/reporting/reports/suppliers/helpers/columns_helper.rb +++ b/lib/reporting/reports/suppliers/helpers/columns_helper.rb @@ -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 diff --git a/spec/lib/reports/suppliers/pay_your_suppliers_report_spec.rb b/spec/lib/reports/suppliers/pay_your_suppliers_report_spec.rb index ad597d8e02..29fab7ea7e 100644 --- a/spec/lib/reports/suppliers/pay_your_suppliers_report_spec.rb +++ b/spec/lib/reports/suppliers/pay_your_suppliers_report_spec.rb @@ -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