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 =
[['January',1],['February',2],['March',3],['April',4],['May',5],['June',6],['July',7],['August',8],['September',9],['October',10],['November',11],['December',12]]

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.yearsObject



27
28
29
# File 'app/services/report/profit_loss/profit_loss_command.rb', line 27

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

Instance Method Details

#executeObject

validates_presence_of :balance_period



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

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