Add expected_amount to Invoice

expected_amount returns the sum of all associated orders together with
the transport costs.
This commit is contained in:
Patrick Gansterer 2022-02-18 13:03:34 +01:00
parent 093313f0f3
commit 052d297bff
4 changed files with 31 additions and 2 deletions

View file

@ -29,10 +29,14 @@
%dd><
- @invoice.orders.order(:ends).each_with_index do |order, index|
- sum = order.sum
- total += sum
- transport = order.transport || 0
- total += sum + transport
= ', ' if index > 0
= link_to format_date(order.ends), new_finance_order_path(order_id: order)
= ' (' + number_to_currency(sum) + ')'
= ' (' + number_to_currency(sum)
- if transport != 0
= ' + ' + number_to_currency(transport)
= ')'
%dt= heading_helper(Invoice, :number) + ':'
%dd= @invoice.number