class Sunnyside::ReportMCO

Attributes

clients[R]
post_date[R]
provider[R]

Public Class Methods

new(provider, post_date) click to toggle source

attr_accessor :mco_total, :mltc_total

# File lib/sunnyside/reports/mco_mltc.rb, line 14
def initialize(provider, post_date)
  @provider   = provider
  @post_date  = post_date 
  @clients    = Client.where(provider: provider)
  # @mco_total  = 0.0
  # @mltc_total = 0.0
end

Public Instance Methods

invoices() click to toggle source
# File lib/sunnyside/reports/mco_mltc.rb, line 35
def invoices
  Invoice.where(provider: provider, post_date: post_date).all.map { |invoice| 
    { :type  => Client.where(med_id: invoice.service_number).exclude(type: nil).get(:type),
      :hours => invoice.hours }
  }
end
run() click to toggle source
# 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