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 =
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



10
11
12
# File 'app/services/report/balance_sheet/balance_sheet_command.rb', line 10

def self.company_options
  Company.select_options_sales_companies
end

.yearsObject



31
32
33
# File 'app/services/report/balance_sheet/balance_sheet_command.rb', line 31

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

Instance Method Details

#executeObject

validates_presence_of :balance_period



16
17
18
19
# File 'app/services/report/balance_sheet/balance_sheet_command.rb', line 16

def execute
  return unless valid?
  @result = Report::BalanceSheet::BalanceSheet.result_report(attributes)
end