Class: Report::ProfitLoss::ProfitLossCommand

Inherits:
BaseCommand
  • Object
show all
Defined in:
app/services/report/profit_loss/profit_loss_command.rb

Overview

Command pattern to encapsulate parameters necessary to run a presence report

Constant Summary collapse

MONTHS_OPTIONS =

Available months options.

[['January', 1], ['February', 2], ['March', 3], ['April', 4], ['May', 5], ['June', 6], ['July', 7], ['August', 8], ['September', 9], ['October', 10], ['November', 11], ['December', 12]].freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.yearsObject



29
30
31
# File 'app/services/report/profit_loss/profit_loss_command.rb', line 29

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

Instance Method Details

#executeObject

validates_presence_of :balance_period



13
14
15
16
17
# File 'app/services/report/profit_loss/profit_loss_command.rb', line 13

def execute
  return unless valid?

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