class Sunnyside::Ledger

Attributes

file[R]
pages[R]
post_date[R]

Public Class Methods

new(file) click to toggle source

when Ledger gets initialized, the page variable filters out the VNS clients and then proceeds to pass the page date onto the PageData class

# File lib/sunnyside/ledger/ledger.rb, line 47
def initialize(file)
  @file      = File.basename(file)
  @pages     = PDF::Reader.new(file).pages.select { |page| !page.raw_content.include?('VISITING NURSE SERVICE') }
end

Public Instance Methods

export_to_csv() click to toggle source
# File lib/sunnyside/ledger/ledger.rb, line 60
def export_to_csv
  CSV.open("#{DRIVE}/sunnyside-files/new-ledger/#{post_date}-IMPORT-FUND-EZ-LEDGER.csv", "a+") { |row| row << ['Seq','inv','post_date','other id','prov','invoice','header memo','batch','doc date','detail memo','fund','account','cc1','cc2','cc3','debit','credit'] }
  Invoice.where(post_date: post_date).all.each { |inv| self.payable_csv(inv, post_date) }
end
process_file() click to toggle source
# File lib/sunnyside/ledger/ledger.rb, line 52
def process_file
  pages.each { |page| PageData.new(page.raw_content, post_date).invoice_data }
end