Class: Sunnyside::ReportMCO

Inherits:
Object
  • Object
show all
Defined in:
lib/sunnyside/reports/mco_mltc.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(provider, post_date) ⇒ ReportMCO

attr_accessor :mco_total, :mltc_total



14
15
16
17
18
19
20
# File 'lib/sunnyside/reports/mco_mltc.rb', line 14

def initialize(provider, )
  @provider   = provider
  @post_date  =  
  @clients    = Client.where(provider: provider)
  # @mco_total  = 0.0
  # @mltc_total = 0.0
end

Instance Attribute Details

#clientsObject (readonly)

Returns the value of attribute clients.



11
12
13
# File 'lib/sunnyside/reports/mco_mltc.rb', line 11

def clients
  @clients
end

#post_dateObject (readonly)

Returns the value of attribute post_date.



11
12
13
# File 'lib/sunnyside/reports/mco_mltc.rb', line 11

def 
  @post_date
end

#providerObject (readonly)

Returns the value of attribute provider.



11
12
13
# File 'lib/sunnyside/reports/mco_mltc.rb', line 11

def provider
  @provider
end

Instance Method Details

#invoicesObject



35
36
37
38
39
40
# File 'lib/sunnyside/reports/mco_mltc.rb', line 35

def invoices
  Invoice.where(provider: provider, post_date: ).all.map { |invoice| 
    { :type  => Client.where(med_id: invoice.service_number).exclude(type: nil).get(:type),
      :hours => invoice.hours }
  }
end

#runObject



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/sunnyside/reports/mco_mltc.rb', line 22

def run
  mco_total  = 0.0
  mltc_total = 0.0
  invoices.each do |inv|
    if inv[:type] == 'MCO'
      mco_total += inv[:hours]
    elsif inv[:type] == 'MLTC'  
      mltc_total += inv[:hours]
    end
  end
  puts "#{provider}: MCO => #{mco_total} MLTC => #{mltc_total}"
end