Class: FinancialTransactionsCsv

Inherits:
RenderCsv show all
Includes:
ApplicationHelper
Defined in:
app/lib/financial_transactions_csv.rb

Instance Method Summary collapse

Methods included from ApplicationHelper

#base_errors, #bootstrap_flash_patched, #close_button, #expand, #foodcoop_css_path, #foodcoop_css_tag, #format_currency, #format_date, #format_datetime, #format_datetime_timespec, #format_iban, #format_roles, #format_time, #heading_helper, #icon, #items_per_page, #link_to_gmaps, #link_to_top, #pagination_links_remote, #remote_link_to, #show_title?, #show_user, #show_user_link, #sort_link_helper, #tab_is_active?, #title, #truncate, #weekday

Methods included from PathHelper

#finance_group_transactions_path

Methods inherited from RenderCsv

#initialize, #number_to_currency, #to_csv

Constructor Details

This class inherits a constructor from RenderCsv

Instance Method Details

#dataObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/lib/financial_transactions_csv.rb', line 19

def data
  @object.includes(:user, :ordergroup, :financial_transaction_type).each do |t|
    yield [
      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)
    ]
  end
end

#headerObject



6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/lib/financial_transactions_csv.rb', line 6

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(:financial_transaction_class),
    FinancialTransaction.human_attribute_name(:financial_transaction_type),
    FinancialTransaction.human_attribute_name(:note),
    FinancialTransaction.human_attribute_name(:amount)
  ]
end