Class: Sunnyside::Reporter
- Inherits:
-
Object
- Object
- Sunnyside::Reporter
- Includes:
- Sunnyside
- Defined in:
- lib/sunnyside/reports/pdf_report.rb
Direct Known Subclasses
Constant Summary
Constants included from Sunnyside
DB, DRIVE, PRIVATE_CLIENTS, VERSION
Instance Attribute Summary collapse
-
#claims ⇒ Object
readonly
Returns the value of attribute claims.
-
#payment ⇒ Object
readonly
Returns the value of attribute payment.
-
#pdf ⇒ Object
readonly
Returns the value of attribute pdf.
-
#post_date ⇒ Object
readonly
Returns the value of attribute post_date.
-
#provider ⇒ Object
readonly
Returns the value of attribute provider.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Instance Method Summary collapse
- #check_header ⇒ Object
- #denied_claims ⇒ Object
-
#initialize(payment, post_date, provider) ⇒ Reporter
constructor
A new instance of Reporter.
- #page_numbering ⇒ Object
- #paid_claims ⇒ Object
- #takeback_claims ⇒ 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(payment, post_date, provider) ⇒ Reporter
Returns a new instance of Reporter.
19 20 21 22 23 24 25 26 |
# File 'lib/sunnyside/reports/pdf_report.rb', line 19 def initialize(payment, post_date, provider) @provider = provider @payment = payment @post_date = post_date @claims = Claim.where(payment_id: payment.id) @pdf = Prawn::Document.new(:page_layout => :landscape) # generate("#{DRIVE}/sunnyside-files/pdf-reports/#{provider.name}-#{payment.check_number}.PDF", :page_layout => :landscape) @total = Money.new(payment.check_total * 100, 'USD').format end |
Instance Attribute Details
#claims ⇒ Object (readonly)
Returns the value of attribute claims.
17 18 19 |
# File 'lib/sunnyside/reports/pdf_report.rb', line 17 def claims @claims end |
#payment ⇒ Object (readonly)
Returns the value of attribute payment.
17 18 19 |
# File 'lib/sunnyside/reports/pdf_report.rb', line 17 def payment @payment end |
#pdf ⇒ Object (readonly)
Returns the value of attribute pdf.
17 18 19 |
# File 'lib/sunnyside/reports/pdf_report.rb', line 17 def pdf @pdf end |
#post_date ⇒ Object (readonly)
Returns the value of attribute post_date.
17 18 19 |
# File 'lib/sunnyside/reports/pdf_report.rb', line 17 def post_date @post_date end |
#provider ⇒ Object (readonly)
Returns the value of attribute provider.
17 18 19 |
# File 'lib/sunnyside/reports/pdf_report.rb', line 17 def provider @provider end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
17 18 19 |
# File 'lib/sunnyside/reports/pdf_report.rb', line 17 def total @total end |
Instance Method Details
#check_header ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/sunnyside/reports/pdf_report.rb', line 28 def check_header puts "creating report for #{provider.name} - Check Number: #{payment.check_number} - posted on: #{post_date}" pdf.text "CLAIMS FOR #{provider.name} - CHECK NUMBER: #{payment.check_number} - CHECK TOTAL: #{total}" pdf.move_down 50 pdf.text "Claims with payments." paid_claims do |clm| pdf.move_down 10 claim = ClaimEOP.new(clm, post_date, pdf, clm.paid, clm.billed) claim.create_block end if claims.where(status: '4').count > 0 pdf.start_new_page pdf.text "Claims with denials." denied_claims do |clm| pdf.move_down 10 claim = ClaimEOP.new(clm, post_date, pdf, clm.paid, clm.billed) claim.create_block end end if claims.where(status: '22').count > 0 pdf.start_new_page pdf.text "Claims with takebacks." takeback_claims do |clm| pdf.move_down 10 claim = ClaimEOP.new(clm, post_date, pdf, clm.paid, clm.billed) claim.create_block end end page_numbering pdf.render_file("#{DRIVE}/sunnyside-files/pdf-reports/#{provider.name.gsub(/[\.\/]/, '')}-#{payment.check_number}.PDF") end |
#denied_claims ⇒ Object
72 73 74 |
# File 'lib/sunnyside/reports/pdf_report.rb', line 72 def denied_claims claims.where(status: '4').order(:invoice_id).all.each { |claim| yield claim if !claim.nil?} end |
#page_numbering ⇒ Object
68 69 70 |
# File 'lib/sunnyside/reports/pdf_report.rb', line 68 def page_numbering pdf.number_pages('Page <page> of <total>', { :at => [pdf.bounds.right - 150, - 10], :width => 150, :align => :center, :start_count_at => 1 } ) end |
#paid_claims ⇒ Object
76 77 78 |
# File 'lib/sunnyside/reports/pdf_report.rb', line 76 def paid_claims claims.where(status: '1').order(:invoice_id).all.each { |claim| yield claim if !claim.nil?} end |
#takeback_claims ⇒ Object
80 81 82 |
# File 'lib/sunnyside/reports/pdf_report.rb', line 80 def takeback_claims claims.where(status: '22').order(:invoice_id).all.each { |claim| yield claim if !claim.nil?} end |