Class: Sunnyside::Ledger
- Inherits:
-
Object
- Object
- Sunnyside::Ledger
- Includes:
- Sunnyside
- Defined in:
- lib/sunnyside/ledger/ledger.rb
Constant Summary
Constants included from Sunnyside
DB, DRIVE, PRIVATE_CLIENTS, VERSION
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#pages ⇒ Object
readonly
Returns the value of attribute pages.
-
#post_date ⇒ Object
readonly
Returns the value of attribute post_date.
Instance Method Summary collapse
- #export_to_csv ⇒ Object
-
#initialize(file) ⇒ Ledger
constructor
when Ledger gets initialized, the page variable filters out the VNS clients and then proceeds to pass the page date onto the PageData class.
- #process_file ⇒ Object
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
#file ⇒ Object (readonly)
Returns the value of attribute file.
42 43 44 |
# File 'lib/sunnyside/ledger/ledger.rb', line 42 def file @file end |
#pages ⇒ Object (readonly)
Returns the value of attribute pages.
42 43 44 |
# File 'lib/sunnyside/ledger/ledger.rb', line 42 def pages @pages end |
#post_date ⇒ Object (readonly)
Returns the value of attribute post_date.
42 43 44 |
# File 'lib/sunnyside/ledger/ledger.rb', line 42 def post_date @post_date end |
Instance Method Details
#export_to_csv ⇒ Object
60 61 62 63 |
# 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 ⇒ Object
52 53 54 |
# File 'lib/sunnyside/ledger/ledger.rb', line 52 def process_file pages.each { |page| PageData.new(page.raw_content, post_date).invoice_data } end |