module LucaBook::Accumulator

Public Instance Methods

credit_amount(code, start_year = nil, start_month = nil, end_year = nil, end_month = nil, recursive: true) click to toggle source
# File lib/luca_book/accumulator.rb, line 178
def credit_amount(code, start_year = nil, start_month = nil, end_year = nil, end_month = nil, recursive: true)
  gross_amount(code, start_year, start_month, end_year, end_month, recursive: recursive)[1]
end
credit_count(code, start_year = nil, start_month = nil, end_year = nil, end_month = nil, recursive: true) click to toggle source
# File lib/luca_book/accumulator.rb, line 195
def credit_count(code, start_year = nil, start_month = nil, end_year = nil, end_month = nil, recursive: true)
  gross_count(code, start_year, start_month, end_year, end_month, recursive: recursive)[1]
end
debit_amount(code, start_year = nil, start_month = nil, end_year = nil, end_month = nil, recursive: true) click to toggle source
# File lib/luca_book/accumulator.rb, line 174
def debit_amount(code, start_year = nil, start_month = nil, end_year = nil, end_month = nil, recursive: true)
  gross_amount(code, start_year, start_month, end_year, end_month, recursive: recursive)[0]
end
debit_count(code, start_year = nil, start_month = nil, end_year = nil, end_month = nil, recursive: true) click to toggle source
# File lib/luca_book/accumulator.rb, line 191
def debit_count(code, start_year = nil, start_month = nil, end_year = nil, end_month = nil, recursive: true)
  gross_count(code, start_year, start_month, end_year, end_month, recursive: recursive)[0]
end
each_month() { || ... } click to toggle source
# File lib/luca_book/accumulator.rb, line 208
def each_month
  yield
end
gross_amount(code, start_year = nil, start_month = nil, end_year = nil, end_month = nil, recursive: true) click to toggle source
# File lib/luca_book/accumulator.rb, line 182
def gross_amount(code, start_year = nil, start_month = nil, end_year = nil, end_month = nil, recursive: true)
  start_year ||= @cursor_start&.year || @start_date.year
  start_month ||= @cursor_start&.month || @start_date.month
  end_year ||= @cursor_end&.year || @end_date.year
  end_month ||= @cursor_end&.month || @end_date.month
  g = self.class.gross(start_year, start_month, end_year, end_month, code: code, recursive: recursive)
  [g[:debit][code], g[:credit][code]]
end
gross_count(code, start_year = nil, start_month = nil, end_year = nil, end_month = nil, recursive: true) click to toggle source
# File lib/luca_book/accumulator.rb, line 199
def gross_count(code, start_year = nil, start_month = nil, end_year = nil, end_month = nil, recursive: true)
  start_year ||= @cursor_start&.year || @start_date.year
  start_month ||= @cursor_start&.month || @start_date.month
  end_year ||= @cursor_end&.year || @end_date.year
  end_month ||= @cursor_end&.month || @end_date.month
  g = self.class.gross(start_year, start_month, end_year, end_month, code: code, recursive: recursive)
  [g[:debit_count][code], g[:credit_count][code]]
end
net_amount(code, start_year = nil, start_month = nil, end_year = nil, end_month = nil, recursive: true) click to toggle source
# File lib/luca_book/accumulator.rb, line 166
def net_amount(code, start_year = nil, start_month = nil, end_year = nil, end_month = nil, recursive: true)
  start_year ||= @cursor_start&.year || @start_date.year
  start_month ||= @cursor_start&.month || @start_date.month
  end_year ||= @cursor_end&.year || @end_date.year
  end_month ||= @cursor_end&.month || @end_date.month
  self.class.net(start_year, start_month, end_year, end_month, code: code, recursive: recursive)[0][code]
end