add tax_adjustment total to the invoice

This commit is contained in:
Mohamed ABDELLANI
2023-10-30 22:09:22 +01:00
parent e16df2777a
commit 23a56d35a0
3 changed files with 11 additions and 0 deletions

View File

@@ -105,6 +105,10 @@ class Invoice
I18n.l(invoice_date.to_date, format: :long)
end
def display_tax_adjustment_total
Spree::Money.new(all_tax_adjustments.map(&:amount).sum, currency:)
end
def tax_adjustment_totals
all_tax_adjustments.each_with_object(Hash.new(0)) do |adjustment, totals|
totals[adjustment.originator.id] += adjustment.amount

View File

@@ -73,6 +73,12 @@
= t(:tax_total, rate: tax[:percentage])
%td{:align => "right", :colspan => "2"}
= tax[:amount]
%tr
%td{:align => "right", :colspan => "5"}
= t(:total_all_tax)
%td{:align => "right", :colspan => "2"}
= @order.display_tax_adjustment_total
%tr
%td{:align => "right", :colspan => "5"}
%strong= t(:total_incl_tax)

View File

@@ -1888,6 +1888,7 @@ en:
invoice_shipping_type: "Type:"
total_excl_tax: "Total (Excl. tax):"
total_incl_tax: "Total (Incl. tax):"
total_all_tax: "Total tax:"
abn: "ABN:"
acn: "ACN:"
invoice_issued_on: "Invoice issued on:"