Class: Spree::PaymentMethodTransactionsReport

Inherits:
Report
  • Object
show all
Defined in:
app/reports/spree/payment_method_transactions_report.rb

Defined Under Namespace

Classes: PaymentMethodRevenueDistributionChart, Result

Constant Summary collapse

DEFAULT_SORTABLE_ATTRIBUTE =
:payment_method_name
HEADERS =
{ payment_method_name: :string, payment_amount: :integer }
SEARCH_ATTRIBUTES =
{ start_date: :payments_created_from, end_date: :payments_created_till }
SORTABLE_ATTRIBUTES =
[]

Constants inherited from Report

Report::TIME_SCALES

Instance Attribute Summary

Attributes inherited from Report

#current_page, #paginate, #records_per_page, #reporting_period, #search, #sortable_attribute, #sortable_type, #total_records

Instance Method Summary collapse

Methods inherited from Report

#active_record_sort, deeplink, #deeplink_properties, #generate, #get_results, #header_sorted?, #initialize, #name, #paginated?, #pagination_required?, #set_sortable_attributes, #time_scale_columns, #time_scale_columns_to_s, #time_scale_selects, #total_pages

Constructor Details

This class inherits a constructor from Spree::Report

Instance Method Details

#report_queryObject



37
38
39
40
41
42
43
44
45
46
47
# File 'app/reports/spree/payment_method_transactions_report.rb', line 37

def report_query
  Spree::Report::QueryFragments
    .from_subquery(payments)
    .group(*time_scale_columns_to_s, 'payment_method_name')
    .order(*time_scale_columns)
    .project(
      *time_scale_columns,
      'payment_method_name',
      'SUM(payment_amount) as payment_amount'
    )
end