foodsoft/app/views/finance/invoices/unpaid.html.haml
Patrick Gansterer 052d297bff Add expected_amount to Invoice
expected_amount returns the sum of all associated orders together with
the transport costs.
2022-02-18 13:12:27 +01:00

37 lines
1.2 KiB
Text

- title t('.title')
- for supplier in @suppliers
- invoices = supplier.invoices
- if invoices.any?
%h3= supplier.name
- invoices_sum = 0
- invoices_text = []
%p
- for invoice in invoices
- invoice_amount_diff = invoice.expected_amount - invoice.net_amount
- invoices_sum += invoice.amount
- invoices_text << invoice.number
= link_to finance_invoice_path(invoice) do
= format_date invoice.date
= ' ' + invoice.number
= ' ' + number_to_currency(invoice.amount)
- if invoice_amount_diff != 0
%span{style: "color:#{invoice_amount_diff < 0 ? 'red' : 'green'}"}
= invoice_amount_diff > 0 ? '+' : '-'
= number_to_currency(invoice_amount_diff.abs)
- if invoice.attachment_data?
= link_to finance_invoice_attachment_path(invoice) do
= glyph :download
- if invoice.note?
= '(' + invoice.note + ')'
%br/
%p
- if supplier.iban.present?
%b= heading_helper(Supplier, :iban) + ':'
= format_iban supplier.iban
%br/
%b= t('.invoices_text') + ':'
= invoices_text.join(', ')
%br/
%b= t('.invoices_sum') + ':'
= number_to_currency invoices_sum