Add view for unpaid invoices

This commit is contained in:
Patrick Gansterer 2017-10-22 02:21:27 +02:00
parent 0de7fc0da5
commit 6989e2f4f7
6 changed files with 41 additions and 1 deletions

View file

@ -4,7 +4,7 @@
.span6
%h2
= t('.unpaid_invoices')
%small= link_to t('.show_all'), finance_invoices_path
%small= link_to t('.show_all'), unpaid_finance_invoices_path
%table.table.table-striped
%thead
%tr

View file

@ -0,0 +1,27 @@
- title t('.title')
- for supplier in @suppliers
- invoices = supplier.invoices.unpaid
- if invoices.any?
%h3= supplier.name
- invoices_sum = 0
- invoices_text = []
%p
- for invoice in invoices
- 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)
%br/
%p
- if supplier.iban.present?
%b= heading_helper(Supplier, :iban) + ':'
= supplier.iban
%br/
%b= t('.invoices_text') + ':'
= invoices_text.join(', ')
%br/
%b= t('.invoices_sum') + ':'
= number_to_currency invoices_sum