Show the financial transaction type if there are more than one type #367

This commit is contained in:
Patrick Gansterer 2017-03-04 14:15:39 +01:00
parent e7657b987f
commit 924f346b4c
9 changed files with 98 additions and 15 deletions

View file

@ -6,15 +6,19 @@
%tr
%th= sort_link_helper heading_helper(Ordergroup, :name), "name", :per_page => @per_page
%th= heading_helper Ordergroup, :contact
%th.numeric= sort_link_helper heading_helper(Ordergroup, :account_balance), "account_balance", :per_page => @per_page
- FinancialTransactionClass.sorted.each do |c|
- name = FinancialTransactionClass.has_multiple_classes ? c.display : heading_helper(Ordergroup, :account_balance)
%th.numeric= sort_link_helper name, "sum_of_class_#{c.id}"
%th
%tbody
- for ordergroup in @ordergroups
%tr
%td= ordergroup.name
%td= ordergroup.contact
%td.numeric= number_to_currency(ordergroup.account_balance)
- 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
= 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'