Class: OrderCsv

Inherits:
RenderCsv show all
Includes:
ApplicationHelper, ArticlesHelper, OrdersHelper
Defined in:
lib/order_csv.rb

Instance Method Summary collapse

Methods included from OrdersHelper

#article_version_change_hint, #format_units_to_order, #options_for_suppliers_to_select, #order_article_class, #order_pdf, #ordered_quantities_different_from_group_orders?, #ordergroup_count, #pkg_helper, #pkg_helper_icon, #ratio_quantity_data, #receive_button, #receive_input_field, #supplier_link, #units_history_line, #update_articles_link

Methods included from ArticlesHelper

#field_with_preset_value_and_errors, #format_billing_unit, #format_billing_unit_with_ratios, #format_group_order_unit, #format_group_order_unit_with_ratios, #format_price_unit, #format_supplier_order_unit, #format_supplier_order_unit_with_ratios, #highlight_new, #row_classes

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_number, #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
# File 'lib/order_csv.rb', line 19

def data
  @object.order_articles.ordered.includes(:article_version).all.map do |oa|
    yield [
      oa.article_version.order_number,
      format_units_to_order(oa, strip_insignificant_zeros: true),
      format_supplier_order_unit_with_ratios(oa.article_version),
      oa.article_version.name,
      number_to_currency(oa.article_version.price),
      number_to_currency(oa.total_price)
    ]
  end
end

#headerObject



8
9
10
11
12
13
14
15
16
17
# File 'lib/order_csv.rb', line 8

def header
  [
    Article.human_attribute_name(:order_number),
    OrderArticle.human_attribute_name(:units_to_order),
    Article.human_attribute_name(:unit),
    Article.human_attribute_name(:name),
    ArticleVersion.human_attribute_name(:price),
    OrderArticle.human_attribute_name(:total_price)
  ]
end