add view for all transactions + csv
This commit is contained in:
parent
b5b4ccd922
commit
ef0888f38d
15 changed files with 111 additions and 19 deletions
29
lib/financial_transactions_csv.rb
Normal file
29
lib/financial_transactions_csv.rb
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
require 'csv'
|
||||
|
||||
class FinancialTransactionsCsv < RenderCSV
|
||||
include ApplicationHelper
|
||||
|
||||
def header
|
||||
[
|
||||
FinancialTransaction.human_attribute_name(:created_on),
|
||||
FinancialTransaction.human_attribute_name(:ordergroup),
|
||||
FinancialTransaction.human_attribute_name(:ordergroup),
|
||||
FinancialTransaction.human_attribute_name(:user),
|
||||
FinancialTransaction.human_attribute_name(:note),
|
||||
FinancialTransaction.human_attribute_name(:amount)
|
||||
]
|
||||
end
|
||||
|
||||
def data
|
||||
@object.includes(:user, :ordergroup).each do |t|
|
||||
yield [
|
||||
t.created_on,
|
||||
t.ordergroup_id,
|
||||
t.ordergroup.name,
|
||||
show_user(t.user),
|
||||
t.note,
|
||||
number_to_currency(t.amount)
|
||||
]
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue