mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-12 23:27:48 +00:00
add tax_adjustment total to the invoice
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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:"
|
||||
|
||||
Reference in New Issue
Block a user