Class: Sunnyside::Ledger

Inherits:
Object
  • Object
show all
Includes:
Sunnyside
Defined in:
lib/sunnyside/ledger/ledger.rb

Constant Summary

Constants included from Sunnyside

DB, DRIVE, PRIVATE_CLIENTS, VERSION

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Sunnyside

access_ftp, add_denial_data, add_provider_to_ftp, add_providers, advanced_opts, cash_receipt, check_prompt, create_folders, create_tables, determine_browser, edi_parser, expiring_auth, ledger_file, parse_pdf, #payable_csv, private_clients, process_private, query, rails_server, #receivable_csv, run_mco_mltc, run_report

Constructor Details

#initialize(file) ⇒ Ledger

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



47
48
49
50
# 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

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file.



42
43
44
# File 'lib/sunnyside/ledger/ledger.rb', line 42

def file
  @file
end

#pagesObject (readonly)

Returns the value of attribute pages.



42
43
44
# File 'lib/sunnyside/ledger/ledger.rb', line 42

def pages
  @pages
end

#post_dateObject (readonly)

Returns the value of attribute post_date.



42
43
44
# File 'lib/sunnyside/ledger/ledger.rb', line 42

def 
  @post_date
end

Instance Method Details

#export_to_csvObject



60
61
62
63
# File 'lib/sunnyside/ledger/ledger.rb', line 60

def export_to_csv
  CSV.open("#{DRIVE}/sunnyside-files/new-ledger/#{}-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: ).all.each { |inv| self.payable_csv(inv, ) }
end

#process_fileObject



52
53
54
# File 'lib/sunnyside/ledger/ledger.rb', line 52

def process_file
  pages.each { |page| PageData.new(page.raw_content, ).invoice_data }
end