Class: Report::BalanceSheet::BalanceSheetCommand

Inherits:
Report::BaseCommand
  • Object
show all
Defined in:
app/services/report/balance_sheet/balance_sheet_command.rb

Overview

Command pattern to encapsulate parameters necessary to run a presence report

Constant Summary collapse

MONTHS_OPTIONS =

Available months options.

Date::MONTHNAMES.compact.each_with_index.map { |name, i| [name, i + 1] }.freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.company_optionsObject

Company options.

Returns:

  • (Object)


13
14
15
# File 'app/services/report/balance_sheet/balance_sheet_command.rb', line 13

def self.company_options
  Company.select_options_sales_companies
end

.yearsArray<Integer>

Years.

Returns:

  • (Array<Integer>)


40
41
42
# File 'app/services/report/balance_sheet/balance_sheet_command.rb', line 40

def self.years
  (2012..Date.current.year).to_a
end

Instance Method Details

#executeObject

validates_presence_of :balance_period



18
19
20
21
22
# File 'app/services/report/balance_sheet/balance_sheet_command.rb', line 18

def execute
  return unless valid?

  @result = Report::BalanceSheet::BalanceSheet.result_report(attributes)
end