Show the financial transaction type if there are more than one type #367
This commit is contained in:
parent
e7657b987f
commit
924f346b4c
9 changed files with 98 additions and 15 deletions
|
|
@ -16,8 +16,12 @@
|
|||
- if with_ordergroup
|
||||
%th= heading_helper FinancialTransaction, :ordergroup
|
||||
%th= heading_helper FinancialTransaction, :user
|
||||
- if FinancialTransactionType.has_multiple_types
|
||||
%th= heading_helper FinancialTransaction, :financial_transaction_type
|
||||
%th= sort_link_helper heading_helper(FinancialTransaction, :note), "note"
|
||||
%th= sort_link_helper heading_helper(FinancialTransaction, :amount), "amount"
|
||||
- FinancialTransactionClass.sorted.each do |c|
|
||||
%th
|
||||
= sort_link_helper c.display, "amount"
|
||||
%tbody
|
||||
- @financial_transactions.each do |t|
|
||||
%tr
|
||||
|
|
@ -29,5 +33,10 @@
|
|||
- if with_ordergroup
|
||||
%td= h link_to t.ordergroup.name, finance_ordergroup_transactions_path(t.ordergroup)
|
||||
%td= h show_user(t.user)
|
||||
- if FinancialTransactionType.has_multiple_types
|
||||
%td= h t.financial_transaction_type.name
|
||||
%td= h t.note
|
||||
%td.currency{:style => "color:#{t.amount < 0 ? 'red' : 'black'}; width:5em"}= number_to_currency(t.amount)
|
||||
- FinancialTransactionClass.sorted.each do |c|
|
||||
%td.currency{:style => "color:#{t.amount < 0 ? 'red' : 'black'}; width:5em"}
|
||||
- if t.financial_transaction_type.financial_transaction_class == c
|
||||
= number_to_currency(t.amount)
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
|
||||
|
|
|
|||
|
|
@ -67,15 +67,24 @@
|
|||
%tr
|
||||
%th= heading_helper FinancialTransaction, :created_on
|
||||
%th= heading_helper FinancialTransaction, :user
|
||||
- if FinancialTransactionType.has_multiple_types
|
||||
%th= heading_helper FinancialTransaction, :financial_transaction_type
|
||||
%th= heading_helper FinancialTransaction, :note
|
||||
%th= heading_helper FinancialTransaction, :amount
|
||||
- FinancialTransactionClass.sorted.each do |fc|
|
||||
%th
|
||||
= fc.display
|
||||
- for ft in current_user.ordergroup.financial_transactions.limit(5).order('created_on DESC')
|
||||
%tr
|
||||
%td= format_time(ft.created_on)
|
||||
%td= h(show_user(ft.user))
|
||||
- if FinancialTransactionType.has_multiple_types
|
||||
%td= h(ft.financial_transaction_type.name)
|
||||
%td= h(ft.note)
|
||||
- color = ft.amount < 0 ? 'red' : 'black'
|
||||
%td{:style => "color:#{color}; width:5em", :class => "currency"}= number_to_currency(ft.amount)
|
||||
- FinancialTransactionClass.sorted.each do |fc|
|
||||
%td{:style => "color:#{color}; width:5em", :class => "currency"}
|
||||
- if ft.financial_transaction_type.financial_transaction_class == fc
|
||||
= number_to_currency(ft.amount)
|
||||
|
||||
-# placeholder deface to add content using erb[silent]:contains()
|
||||
- '<dashboard_bottom_mark>'
|
||||
|
|
|
|||
|
|
@ -13,6 +13,11 @@
|
|||
%p
|
||||
%b= heading_helper(Ordergroup, :available_funds) + ':'
|
||||
= number_to_currency(@ordergroup.get_available_funds())
|
||||
- if FinancialTransactionClass.has_multiple_classes
|
||||
- FinancialTransactionClass.sorted.each do |c|
|
||||
%p
|
||||
%b= c.display + ':'
|
||||
= number_to_currency(@ordergroup["sum_of_class_#{c.id}"])
|
||||
%p
|
||||
%b= heading_helper(Ordergroup, :user_tokens) + ':'
|
||||
= @ordergroup.memberships.map{|m| show_user m.user}.join(', ')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue