class Sunnyside::CashReceipt
Attributes
post_date[R]
type_of_entry[R]
Public Class Methods
new(type_of_entry)
click to toggle source
# File lib/sunnyside/cash_receipts/cash_receipt.rb, line 23 def initialize(type_of_entry) print "Enter in post date (YYYY-MM-DD): " @post_date = Date.parse(gets.chomp) @type_of_entry = type_of_entry end
Public Instance Methods
collate()
click to toggle source
# File lib/sunnyside/cash_receipts/cash_receipt.rb, line 29 def collate case type_of_entry when :electronic Sunnyside.check_prompt { |payment_id| EdiPayment.new(payment_id, post_date).collate } when :manual manual_invoices else exit end end
invoice_selection()
click to toggle source
# File lib/sunnyside/cash_receipts/cash_receipt.rb, line 40 def invoice_selection puts "Enter in the invoices, each separated by a space. If any invoice has a denial, 'flag' it by typing '-d' after the invoice number.\n" invoices = gets.chomp.split print "You have typed out #{invoices.length} number of invoices. Do you wish to add more to the same check? (Y or N): " if gets.chomp.upcase == 'Y' more_invoices = gets.chomp.split return (more_invoices + invoices).uniq else return invoices.uniq end end
invoices_exist?(invoices)
click to toggle source
# File lib/sunnyside/cash_receipts/cash_receipt.rb, line 70 def invoices_exist?(invoices) invoices.map { |invoice| invoice.gsub(/-d/, '') }.all? { |invoice| !Invoice[invoice].nil? } end
manual_invoices()
click to toggle source
# File lib/sunnyside/cash_receipts/cash_receipt.rb, line 52 def manual_invoices print "# of checks to enter for the post date of #{post_date}? " num = gets.chomp.to_i num.times do prov = provider print "Enter in the check number: " check = gets.chomp invoices = invoice_selection if invoices_exist?(invoices) manual = ManualPayment.new(invoices, post_date, prov, check) manual.seed_claims_and_services manual.create_csv else manual_invoices end end end
provider()
click to toggle source
# File lib/sunnyside/cash_receipts/cash_receipt.rb, line 74 def provider Provider.all.each { |prov| puts "#{prov.id}: #{prov.name}"} print "Type in the Provider ID: " return Provider[gets.chomp] || '' end