class Sunnyside::EdiPayment
Attributes
payment[R]
post_date[R]
Public Class Methods
new(payment, post_date)
click to toggle source
# File lib/sunnyside/cash_receipts/cash_receipt.rb, line 87 def initialize(payment, post_date) @payment, @post_date = payment, post_date end
Public Instance Methods
collate()
click to toggle source
# File lib/sunnyside/cash_receipts/cash_receipt.rb, line 99 def collate puts "Total Amount Paid for this check is: #{total}\nProcessing..." populated_data.each do |clm| if !not_fully_paid?(clm) self.receivable_csv(clm, payment, post_date) else print "#{clm.invoice_id} was not added to the spreadsheet because the invoice was already fully paid for.\n" print "Please consider this $#{clm.paid} as an interest payment.\n" end end puts "----------------------------------------------------------------------------------------------------------" puts "------------------------------Check added to #{DRIVE}/EDI-citywide-import.csv-----------------------------" puts "-------------Please note that there are #{denied_services} service days with possible denials-------------" puts "----------------------------------------------------------------------------------------------------------" end
denied_services()
click to toggle source
# File lib/sunnyside/cash_receipts/cash_receipt.rb, line 121 def denied_services Service.where(payment_id: payment.id).exclude(denial_reason: nil).count end
not_fully_paid?(clm)
click to toggle source
# File lib/sunnyside/cash_receipts/cash_receipt.rb, line 117 def not_fully_paid?(clm) Claim.where(invoice_id: clm.invoice_id).sum(:paid).round(2) < clm.paid end
populated_data()
click to toggle source
# File lib/sunnyside/cash_receipts/cash_receipt.rb, line 91 def populated_data Claim.where(payment_id: payment.id).all.select { |clm| clm.paid > 0.0 } end
total()
click to toggle source
# File lib/sunnyside/cash_receipts/cash_receipt.rb, line 95 def total populated_data.map { |clm| clm.paid }.inject { |x, y| x + y }.round(2) end