Class: Report::SalesProfit::SalesProfitCommand
- Inherits:
-
BaseCommand
- Object
- BaseCommand
- Report::SalesProfit::SalesProfitCommand
- Defined in:
- app/services/report/sales_profit/sales_profit_command.rb
Overview
Command pattern to encapsulate parameters necessary to run a presence report
Constant Summary collapse
- SALES_OPTIONS =
Available sales options.
[%w[SO SO], %w[MO MO], %w[TO TO], %w[CI CI]].freeze
- GRANULARITY_OPTIONS =
Available granularity options.
[['Product Line > Category > Sku', 1], ['Channel > Product Line > Customer', 2], ['State/Province > Channel > Product Line', 3], ['Channel > Product Line > Subcategory', 4]].freeze
- ORDER_BY_OPTIONS =
Available order by options.
[['Profit', 1], ['Total Sales', 2], ['COGS', 3], ['Variable Costs', 4], ['Sales Taxes', 5], ['Sales Commissions', 6], ['Credit Card and Paypal Commissions', 7], ['Shipping', 8], ['Bad Credit', 9], ['Returns', 10]].freeze
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.company_options ⇒ Object
14 15 16 |
# File 'app/services/report/sales_profit/sales_profit_command.rb', line 14 def self. Company. end |
Instance Method Details
#execute ⇒ Object
36 37 38 39 40 |
# File 'app/services/report/sales_profit/sales_profit_command.rb', line 36 def execute return unless valid? @result = Report::SalesProfit::SalesProfit.result_report(attributes) end |
#success? ⇒ Boolean
42 43 44 |
# File 'app/services/report/sales_profit/sales_profit_command.rb', line 42 def success? valid? && @result.success? end |