Module: SpreeCmCommissioner::Billing::MonthlyOrdersHelper

Included in:
Spree::Billing::ReportsController
Defined in:
app/helpers/spree_cm_commissioner/billing/monthly_orders_helper.rb

Instance Method Summary collapse

Instance Method Details

#initialize_monthly_order_hashesObject



4
5
6
7
8
9
10
11
12
13
14
# File 'app/helpers/spree_cm_commissioner/billing/monthly_orders_helper.rb', line 4

def initialize_monthly_order_hashes
  {
    orders: Hash.new(0),
    total: Hash.new(0),
    paid: Hash.new(0),
    balance_due: Hash.new(0),
    voided: Hash.new(0),
    previous_month_carried_forward: Hash.new(0),
    current_month_total: Hash.new(0)
  }
end

#load_orders_by_month(search, year) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'app/helpers/spree_cm_commissioner/billing/monthly_orders_helper.rb', line 16

def load_orders_by_month(search, year)
  hashes = initialize_monthly_order_hashes

  (1..12).each do |month|
    load_monthly_orders(search, hashes, month, year)
  end

  hashes
end