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 =
[%w[SO SO], %w[MO MO], %w[TO TO], %w[CI CI]]
- GRANULARITY_OPTIONS =
[['Product Line > Category > Sku', 1], ['Channel > Product Line > Customer', 2], ['State/Province > Channel > Product Line', 3], ['Channel > Product Line > Subcategory', 4]]
- 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]]
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.company_options ⇒ Object
13 14 15 |
# File 'app/services/report/sales_profit/sales_profit_command.rb', line 13 def self. Company. end |
Instance Method Details
#execute ⇒ Object
32 33 34 35 36 |
# File 'app/services/report/sales_profit/sales_profit_command.rb', line 32 def execute return unless valid? @result = Report::SalesProfit::SalesProfit.result_report(attributes) end |
#success? ⇒ Boolean
38 39 40 |
# File 'app/services/report/sales_profit/sales_profit_command.rb', line 38 def success? valid? && @result.success? end |