Class: Sunnyside::ReportMCO
- Inherits:
-
Object
- Object
- Sunnyside::ReportMCO
- Defined in:
- lib/sunnyside/reports/mco_mltc.rb
Instance Attribute Summary collapse
-
#clients ⇒ Object
readonly
Returns the value of attribute clients.
-
#post_date ⇒ Object
readonly
Returns the value of attribute post_date.
-
#provider ⇒ Object
readonly
Returns the value of attribute provider.
Instance Method Summary collapse
-
#initialize(provider, post_date) ⇒ ReportMCO
constructor
attr_accessor :mco_total, :mltc_total.
- #invoices ⇒ Object
- #run ⇒ Object
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, post_date) @provider = provider @post_date = post_date @clients = Client.where(provider: provider) # @mco_total = 0.0 # @mltc_total = 0.0 end |
Instance Attribute Details
#clients ⇒ Object (readonly)
Returns the value of attribute clients.
11 12 13 |
# File 'lib/sunnyside/reports/mco_mltc.rb', line 11 def clients @clients end |
#post_date ⇒ Object (readonly)
Returns the value of attribute post_date.
11 12 13 |
# File 'lib/sunnyside/reports/mco_mltc.rb', line 11 def post_date @post_date end |
#provider ⇒ Object (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
#invoices ⇒ Object
35 36 37 38 39 40 |
# 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 ⇒ Object
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 |