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
-
.company_options ⇒ Object
Company options.
Instance Method Summary collapse
-
#execute ⇒ Object
Run the report with the given filters and store the result.
-
#success? ⇒ Boolean
Whether the command validated and ran successfully.
Class Method Details
.company_options ⇒ Object
Company options.
16 17 18 |
# File 'app/services/report/sales_profit/sales_profit_command.rb', line 16 def self. Company. end |
Instance Method Details
#execute ⇒ Object
Run the report with the given filters and store the result.
40 41 42 43 44 |
# File 'app/services/report/sales_profit/sales_profit_command.rb', line 40 def execute return unless valid? @result = Report::SalesProfit::SalesProfit.result_report(attributes) end |
#success? ⇒ Boolean
Whether the command validated and ran successfully.
48 49 50 |
# File 'app/services/report/sales_profit/sales_profit_command.rb', line 48 def success? valid? && @result.success? end |