2014-05-06 19:02:01 +02:00
|
|
|
require 'csv'
|
|
|
|
|
2023-01-06 16:55:40 +01:00
|
|
|
class FinancialTransactionsCsv < RenderCsv
|
2014-05-06 19:02:01 +02:00
|
|
|
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),
|
2018-12-18 15:13:57 +01:00
|
|
|
FinancialTransaction.human_attribute_name(:financial_transaction_class),
|
|
|
|
FinancialTransaction.human_attribute_name(:financial_transaction_type),
|
2014-05-06 19:02:01 +02:00
|
|
|
FinancialTransaction.human_attribute_name(:note),
|
|
|
|
FinancialTransaction.human_attribute_name(:amount)
|
|
|
|
]
|
|
|
|
end
|
|
|
|
|
|
|
|
def data
|
2018-12-18 15:13:57 +01:00
|
|
|
@object.includes(:user, :ordergroup, :financial_transaction_type).each do |t|
|
2014-05-06 19:02:01 +02:00
|
|
|
yield [
|
2021-03-01 15:27:26 +01:00
|
|
|
t.created_on,
|
|
|
|
t.ordergroup_id,
|
|
|
|
t.ordergroup_name,
|
|
|
|
show_user(t.user),
|
|
|
|
t.financial_transaction_type.financial_transaction_class.name,
|
|
|
|
t.financial_transaction_type.name,
|
|
|
|
t.note,
|
|
|
|
number_to_currency(t.amount)
|
|
|
|
]
|
2014-05-06 19:02:01 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|