Add format helper for currency

This commit is contained in:
Patrick Gansterer 2018-09-16 12:05:39 +02:00
parent 5408c08b58
commit 6cc02cb563
7 changed files with 21 additions and 9 deletions

View file

@ -17,7 +17,7 @@
= format_date item[:date]
%td= item[:type]
%td= item[:description]
%td.currency{:style => "color:#{item[:amount] < 0 ? 'red' : 'black'}; width:5em"}= number_to_currency(item[:amount])
%td.numeric{style: 'width:5em'}= format_currency item[:amount]
%p
= @financial_link.note

View file

@ -37,6 +37,6 @@
%td= h t.financial_transaction_type.name
%td= h t.note
- FinancialTransactionClass.sorted.each do |c|
%td.currency{:style => "color:#{t.amount < 0 ? 'red' : 'black'}; width:5em"}
%td.numeric{style: 'width:5em'}
- if t.financial_transaction_type.financial_transaction_class == c
= number_to_currency(t.amount)
= format_currency t.amount

View file

@ -36,7 +36,7 @@
%td= format_date(ft.created_on)
%td= ft.ordergroup.name
%td= ft.note
%td.numeric{:style => "color:#{ft.amount < 0 ? 'red' : 'black'}"}= number_to_currency(ft.amount)
%td.numeric= format_currency ft.amount
.span6
%h2
= t('.open_transactions')

View file

@ -17,8 +17,8 @@
%td= ordergroup.contact
- FinancialTransactionClass.sorted.each do |c|
- amount = ordergroup["sum_of_class_#{c.id}"]
%td.numeric{:style => "color:#{amount < 0 ? 'red' : 'black'}"}
= number_to_currency amount
%td.numeric
= format_currency amount
%td
= link_to t('.new_transaction'), new_finance_ordergroup_transaction_path(ordergroup), class: 'btn btn-mini'
= link_to t('.account_statement'), finance_ordergroup_transactions_path(ordergroup), class: 'btn btn-mini'