sunnyside 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,18 +1,24 @@
1
1
  module Sunnyside
2
2
 
3
3
  def payment_type
4
- puts 'Type of Payment? (EDI or MANUAL)'
5
- return gets.chomp.upcase == 'EDI' ? EdiPayment.new : ManualPayment.new
4
+ puts "1.) EDI PAYMENT"
5
+ puts "2.) MANUAL PAYMENT"
6
+ return gets.chomp.upcase == '1' ? EdiPayment.new : ManualPayment.new
6
7
  end
7
8
 
8
- def check_number_and_date
9
- puts 'Enter in check number followed by the post date (separated by a space - ex: 235345 10/12/2013): '
10
- return gets.chomp.split(' ')
9
+ def check_date_abbre
10
+ puts 'Enter in check number, post date and then followed by the provider abbreviation (separated by a space - ex: 235345 10/12/2013 WEL): '
11
+ ans = gets.chomp.split
12
+ if ans.size == 3
13
+ return ans
14
+ else
15
+ raise 'You need to enter in the specified fields.'
16
+ end
11
17
  end
12
18
 
13
19
  def invoice_numbers
14
20
  puts 'Enter in invoices, each separated by a space. If an invoice contains any denials, flag it by typing in a "-d" right after the last number. '
15
- return gets.chomp.split(' ')
21
+ return gets.chomp.split
16
22
  end
17
23
 
18
24
  class CashReceipt
@@ -29,10 +35,10 @@ module Sunnyside
29
35
 
30
36
  class EdiPayment
31
37
  include Sunnyside
32
- attr_reader :check_number, :post_date
38
+ attr_reader :check_number, :post_date, :prov
33
39
 
34
40
  def initialize
35
- @check_number, @post_date = self.check_number_and_date
41
+ @check_number, @post_date, @prov = self.check_date_abbre
36
42
  end
37
43
 
38
44
  def invoices
@@ -64,23 +70,27 @@ module Sunnyside
64
70
  end
65
71
 
66
72
  class ManualPayment < CashReceipt
67
- attr_reader :check, :invoices, :post_date
73
+ attr_reader :check, :manual_invs, :post_date, :prov
68
74
 
69
75
  def initialize
70
- @check, @post_date = self.check_number_and_date
71
- @invoices = self.invoice_numbers
76
+ @check, @post_date, @prov = self.check_date_abbre
77
+ @manual_invs = self.invoice_numbers
78
+ end
79
+
80
+ def provider
81
+ Provider.where(abbreviation: prov).first
72
82
  end
73
83
 
74
84
  def payment_id
75
85
  if check_exists?
76
- Payment.where(check_number: check).get(:id)
86
+ Payment.where(check_number: check, post_date: post_date, provider_id: provider.id).get(:id)
77
87
  else
78
- Payment.insert(check_number: check)
88
+ Payment.insert(check_number: check, post_date: post_date, provider_id: provider.id)
79
89
  end
80
90
  end
81
91
 
82
92
  def check_exists?
83
- Payment.where(check_number: check).count > 0
93
+ Payment.where(check_number: check, post_date: post_date, provider_id: provider.id).count > 0
84
94
  end
85
95
 
86
96
  def date
@@ -88,13 +98,12 @@ module Sunnyside
88
98
  end
89
99
 
90
100
  def collate
91
- invoices.each { |inv|
92
- invoice_data(inv) { |invoice|
93
- claim_id = create_claim(invoice)
94
- create_services(invoice, claim_id)
95
- edit_services(inv) if denial_present?(inv)
96
- self.receivable_csv(invoice, payment_id, check, post_date)
97
- }
101
+ manual_invs.each { |inv|
102
+ invoice = Invoice[inv.gsub(/-d/, '')]
103
+ claim_id = create_claim(invoice)
104
+ create_services(invoice, claim_id)
105
+ edit_services(claim_id) if denial_present?(inv)
106
+ self.receivable_csv(invoice, payment_id, check, post_date)
98
107
  }
99
108
  end
100
109
 
@@ -105,12 +114,11 @@ module Sunnyside
105
114
 
106
115
  def create_claim(invoice)
107
116
  Claim.insert(
108
- :invoice_id => invoice.invoice_number,
117
+ :invoice_id => invoice.id,
109
118
  :client_id => invoice.client_id,
110
119
  :billed => invoice.amount,
111
120
  :paid => 0.0,
112
121
  :payment_id => payment_id,
113
- :check_number => check,
114
122
  :provider_id => invoice.provider_id
115
123
  )
116
124
  end
@@ -126,6 +134,7 @@ module Sunnyside
126
134
  :billed => visit.amount,
127
135
  :dos => visit.dos,
128
136
  :units => visit.units
137
+ :client_id => Claim[claim_id].client_id
129
138
  )
130
139
  }
131
140
  end
@@ -134,27 +143,15 @@ module Sunnyside
134
143
  Visit.where(invoice_id: invoice.invoice_number).all
135
144
  end
136
145
 
137
-
138
-
139
146
  def services(inv)
140
147
  Service.where(payment_id: payment_id, invoice_id: inv)
141
148
  end
142
149
 
143
150
  def edit_services(inv)
144
- invoice = inv.gsub(/-d/, '').to_i
145
- print "Select the day you wish to edit by the corresponding number followed by the adjusted amount\n"
146
- print "When you are finished, type 'done'."
147
- print "(e.g. 3451 23.50) Enter in the number now: "
151
+ service = EditServices.new(inv, payment_id)
148
152
  loop do
149
- services(invoice).all.each { |svc| puts "#{svc.id} #{svc.dos} #{svc.service_code} #{svc.modifier} #{svc.paid}" }
150
- id, adjusted_amt = gets.chomp.split
151
- if !id.nil?
152
- print "Type in the denial reason now: "
153
- denial_reason = gets.chomp
154
- Service[id].update(paid: adjusted_amt, denial_reason: denial_reason)
155
- else
156
- break
157
- end
153
+ service.show_all
154
+ service.adjust
158
155
  end
159
156
  end
160
157
 
@@ -165,5 +162,32 @@ module Sunnyside
165
162
  def visits(invoice)
166
163
  Visit.where(invoice_id: invoice.invoice_number).all
167
164
  end
165
+
166
+ class EditServices < ManualPayment::CashReceipt
167
+ attr_reader :claim
168
+
169
+ def initialize(claim_id)
170
+ @claim = Claim[claim_id]
171
+ @services = Service.where(claim_id: claim_id).all
172
+ end
173
+
174
+ def show_all
175
+ services.each { |svc| puts "ID: #{svc.id} #{svc.dos} #{svc.amount}" }
176
+ end
177
+
178
+ def adjust
179
+ print "Type in the Service ID # to change the amount: "
180
+ id = gets.chomp
181
+ print "You selected #{id} - Type in the adjusted amount: "
182
+ amt = gets.chomp
183
+ print "And now type in the denial reason: "
184
+ reason = gets.chomp
185
+ adjust_service(id, amt, reason)
186
+ end
187
+
188
+ def adjust_service
189
+ Service[id].update(paid: amt, denial_reason: reason)
190
+ end
191
+ end
168
192
  end
169
193
  end
@@ -16,7 +16,7 @@ module Sunnyside
16
16
  attr_reader :client_line, :visits
17
17
 
18
18
  def initialize(entry)
19
- @client_line = entry.split(/\n/).select { |line| line =~ /(NY|\s+)\s+001/ }
19
+ @client_line = entry.split(/\n/).select { |line| line =~ /\s+001\s+/ }
20
20
  @visits = entry.split(/\n/).select { |line| line =~ /^\d{6}/ }
21
21
  end
22
22
 
@@ -45,33 +45,7 @@ module Sunnyside
45
45
 
46
46
  # only the invoices lines and the client info line gets selected and passed onto the next object level
47
47
  end
48
- class ClientData < ParseInvoice
49
- attr_reader :client_id, :service_id, :recipient_id, :authorization
50
-
51
- def initialize(client)
52
- @client_id, @service_id, @recipient_id, @authorization = client.map { |line| line.strip }
53
- end
54
48
 
55
- def show_me
56
- puts "#{client_id} #{service_id} #{recipient_id} #{authorization}"
57
- end
58
-
59
- def client_number
60
- if client_exists?
61
- client_id
62
- else
63
- insert_client
64
- end
65
- end
66
-
67
- def client_exists?
68
- Client.where(client_number: client_id).count > 0
69
- end
70
-
71
- def insert_client
72
- Client.insert(client_number: client_id)
73
- end
74
- end
75
49
 
76
50
  class InvoiceDetail < ParseInvoice
77
51
  attr_reader :invoice, :service_code, :modifier, :dos, :units, :amount, :client
@@ -86,10 +60,6 @@ module Sunnyside
86
60
  @amount = invoice_line[:amount]
87
61
  end
88
62
 
89
- def show
90
- puts "#{invoice} #{service_code} #{modifier} #{dos} #{units} #{amount} #{client.show_me}"
91
- end
92
-
93
63
  def to_db
94
64
  Visit.insert(
95
65
  :client_id => client.client_number,
@@ -104,7 +74,31 @@ module Sunnyside
104
74
  end
105
75
 
106
76
  def update_invoice
107
- Invoice[invoice].update(:authorization => client.authorization, :recipient_id => client.recipient_id)
77
+ Invoice[invoice].update(:auth => client.auth, :recipient_id => client.recipient_id)
78
+ end
79
+ end
80
+
81
+ class ClientData < ParseInvoice
82
+ attr_reader :client_id, :service_id, :recipient_id, :authorization
83
+
84
+ def initialize(client)
85
+ @client_id, @service_id, @recipient_id, @authorization = client.map { |line| line.strip }
86
+ end
87
+
88
+ def client_number
89
+ if client_missing?
90
+ puts 'how the hell is it happening? ' + client_id
91
+ else
92
+ client_id
93
+ end
94
+ end
95
+
96
+ def auth
97
+ authorization
98
+ end
99
+
100
+ def client_missing?
101
+ Client[client_id].nil?
108
102
  end
109
103
  end
110
104
  end
@@ -3,13 +3,22 @@ module Sunnyside
3
3
  print "checking for new files...\n"
4
4
  Dir["#{LOCAL_FILES}/835/*.txt"].select { |file| Filelib.where(:filename => file).count == 0 }.each do |file|
5
5
  print "processing #{file}...\n"
6
- data = File.open(file).read.split(/~CLP\*/)
6
+ data = File.open(file).read
7
+
8
+ # Detect to see if the EDI file already has new lines inserted. If so, the newlines are removed before the file gets processed.
9
+
10
+ if data.include?(/\n/)
11
+ data.gsub!(/\n/, '')
12
+ end
13
+
14
+ data = data.split(/~CLP\*/)
7
15
  edi = Edi.new(data, file)
8
16
  edi.parse_claim_header
9
17
  Filelib.insert(filename: file, created_at: Time.now, purpose: 'EDI Import', file_type: '835 Remittance')
10
18
  edi.save_payment_to_db
11
19
  end
12
20
  end
21
+
13
22
  class Edi
14
23
  attr_reader :header, :claims, :file
15
24
  def initialize(data, file)
@@ -147,34 +156,60 @@ module Sunnyside
147
156
 
148
157
  def set_code(code)
149
158
  case code
150
- when '125' then return 'Submission/billing error(s). At least one Remark Code must be provided'
151
- when '140' then return 'Patient/Insured health identification number and name do not match.'
152
- when '31' then return 'INVALID MEMBER ID'
153
- when '62' then return 'PAID AUTHORIZED UNITS'
154
- when '96' then return 'NO AUTHORIZATION FOR DOS'
155
- when '146' then return 'DIAGNOSIS WAS INVALID FOR DATES LISTED'
156
- when '197' then return 'Precertification/authorization/notification absent'
157
- when '198' then return 'Precertification/authorization exceeded'
158
- when '199' then return 'Revenue code and Procedure code do not match'
159
- when '9' then return 'DIAGNOSIS ISSUE'
160
- when '15' then return 'AUTHORIZATION MISSING/INVALID'
161
- when '18' then return 'Exact Duplicate Claim/Service'
162
- when '19' then return 'Expenses incurred prior to coverage'
163
- when '27' then return 'Expenses incurred after coverage terminated'
164
- when '29' then return 'Timely Filing'
165
- when '39' then return 'Services denied at the time authorization/pre-certification was requested'
166
- when '45' then return 'Charge exceeds fee schedule/maximum allowable'
167
- when '16' then return 'Claim/service lacks information which is needed for adjudication'
168
- when '50' then return 'These are non-covered services because this is not deemed a medical necessity by the payer'
169
- when '192' then return 'Non standard adjustment code from paper remittance'
170
- when '181' then return 'Procedure code was invalid on the date of service'
171
- when '182' then return 'Procedure modifier was invalid on the date of service'
172
- when '204' then return 'This service/equipment/drug is not covered under the patients current benefit plan'
173
- when '151' then return '151 Payment adjusted because the payer deems the information submitted does not support this many/frequency of services'
174
- when '177' then return 'Patient has not met the required eligibility requirements'
175
- when '109' then return 'Claim/service not covered by this payer/contractor. You must send the claim/service to the correct payer/contractor.'
159
+ when '125'
160
+ 'Submission/billing error(s). At least one Remark Code must be provided'
161
+ when '140'
162
+ 'Patient/Insured health identification number and name do not match.'
163
+ when '31'
164
+ 'INVALID MEMBER ID'
165
+ when '62'
166
+ 'PAID AUTHORIZED UNITS'
167
+ when '96'
168
+ 'NO AUTHORIZATION FOR DOS'
169
+ when '146'
170
+ 'DIAGNOSIS WAS INVALID FOR DATES LISTED'
171
+ when '197'
172
+ 'Precertification/authorization/notification absent'
173
+ when '198'
174
+ 'Precertification/authorization exceeded'
175
+ when '199'
176
+ 'Revenue code and Procedure code do not match'
177
+ when '9'
178
+ 'DIAGNOSIS ISSUE'
179
+ when '15'
180
+ 'AUTHORIZATION MISSING/INVALID'
181
+ when '18'
182
+ 'Exact Duplicate Claim/Service'
183
+ when '19'
184
+ 'Expenses incurred prior to coverage'
185
+ when '27'
186
+ 'Expenses incurred after coverage terminated'
187
+ when '29'
188
+ 'Timely Filing'
189
+ when '39'
190
+ 'Services denied at the time authorization/pre-certification was requested'
191
+ when '45'
192
+ 'Charge exceeds fee schedule/maximum allowable'
193
+ when '16'
194
+ 'Claim/service lacks information which is needed for adjudication'
195
+ when '50'
196
+ 'These are non-covered services because this is not deemed a medical necessity by the payer'
197
+ when '192'
198
+ 'Non standard adjustment code from paper remittance'
199
+ when '181'
200
+ 'Procedure code was invalid on the date of service'
201
+ when '182'
202
+ 'Procedure modifier was invalid on the date of service'
203
+ when '204'
204
+ 'This service/equipment/drug is not covered under the patients current benefit plan'
205
+ when '151'
206
+ '151 Payment adjusted because the payer deems the information submitted does not support this many/frequency of services'
207
+ when '177'
208
+ 'Patient has not met the required eligibility requirements'
209
+ when '109'
210
+ 'Claim/service not covered by this payer/contractor. You must send the claim/service to the correct payer/contractor.'
176
211
  else
177
- return "#{code} is UNIDENTIFIED"
212
+ "#{code} is UNIDENTIFIED"
178
213
  end
179
214
  end
180
215
  end
@@ -40,7 +40,7 @@ module Sunnyside
40
40
  include Sunnyside
41
41
  attr_reader :page_data, :provider, :post_date
42
42
 
43
- def initialize(page_data, file, provider = nil)
43
+ def initialize(page_data, file)
44
44
  @provider = page_data[/CUSTOMER:\s+(.+)(?=\)')/, 1]
45
45
  @post_date = Date.parse(file[0..7])
46
46
  @page_data = page_data.split(/\n/).select { |line| line =~ /^\([0-9\/]+\s/ }
@@ -53,11 +53,11 @@ module Sunnyside
53
53
  if provider_missing?
54
54
  case provider
55
55
  when 'ELDERSERVEHEALTH'
56
- Provider.where(name: 'ELDERSERVE HEALTH').first
56
+ Provider[5]
57
57
  when 'AMERIGROUP'
58
- Provider.where(name: 'AMERIGROUP 2').first
58
+ Provider[1]
59
59
  else
60
- Provider.where(name: 'PRIVATE').first
60
+ Provider[16]
61
61
  end
62
62
  else
63
63
  Provider.where(name: provider).first
@@ -101,6 +101,7 @@ module Sunnyside
101
101
  def finalize
102
102
  if !client_missing?
103
103
  add_invoice
104
+ update_client if new_provider?
104
105
  else
105
106
  add_client
106
107
  finalize
@@ -111,8 +112,21 @@ module Sunnyside
111
112
  Client[client_id].nil?
112
113
  end
113
114
 
115
+ def new_provider?
116
+ Client[client_id].provider_id != provider.id
117
+ end
118
+
119
+ def update_client
120
+ Client[client_id].update(provider_id: provider.id, type: provider.type)
121
+ end
122
+
123
+ def fund_id
124
+ print "Enter in the FUND EZ ID for this client: #{client_name.strip} of #{provider.name}. "
125
+ return gets.chomp
126
+ end
127
+
114
128
  def add_client
115
- Client.insert(client_number: client_id, client_name: client_name)
129
+ Client.insert(client_number: client_id, client_name: client_name.strip, fund_id: fund_id, provider_id: provider.id, type: provider.type)
116
130
  end
117
131
 
118
132
  # rarely there may be an invoice line that contains an invoice number that already exists. This method accounts for it, by merely updating the amount.
@@ -127,15 +141,15 @@ module Sunnyside
127
141
  end
128
142
 
129
143
  def invoice_exist?
130
- Invoice.where(invoice_number: invoice).count > 0
144
+ !Invoice[invoice].nil?
131
145
  end
132
146
 
133
147
  def update_invoice
134
- Invoice.where(invoice_number: invoice).update(amount: amt.to_f)
148
+ Invoice[invoice].update(amount: amt.to_f)
135
149
  end
136
150
 
137
151
  def prev_amt
138
- Invoice.where(invoice_number: invoice).get(:amount)
152
+ Invoice[invoice].amount
139
153
  end
140
154
  end
141
155
  end
@@ -1,6 +1,14 @@
1
1
  module Sunnyside
2
2
  class << self
3
3
  def create_tables
4
+ DB.create_table :logins do
5
+ primary_key :id
6
+ String :site
7
+ String :username
8
+ String :password
9
+ String :provider
10
+ end
11
+
4
12
  DB.create_table :charges do
5
13
  primary_key :id
6
14
  foreign_key :invoice_id, :invoices
@@ -20,9 +28,11 @@ module Sunnyside
20
28
  foreign_key :client_id, :clients
21
29
  foreign_key :provider_id, :providers
22
30
  foreign_key :filelib_id, :filelibs
31
+ String :auth
23
32
  String :client_name
24
33
  Float :rate
25
34
  Float :hours
35
+ String :recipient_id
26
36
  end
27
37
 
28
38
  DB.create_table :payments do
@@ -30,6 +40,7 @@ module Sunnyside
30
40
  foreign_key :provider_id, :providers
31
41
  foreign_key :filelib_id, :filelibs
32
42
  Float :check_total
43
+ Date :post_date, :default=>Date.today
33
44
  String :status
34
45
  Integer :check_number
35
46
  end
@@ -68,6 +79,8 @@ module Sunnyside
68
79
  String :client_name
69
80
  String :fund_id
70
81
  String :recipient_id
82
+ foreign_key :provider_id, :providers
83
+ String :type, :default=>'MLTC'
71
84
  end
72
85
 
73
86
  DB.create_table :providers do
@@ -104,7 +117,29 @@ module Sunnyside
104
117
  primary_key :denial_code, :primary_key=>true
105
118
  String :denial_explanation
106
119
  end
120
+
121
+ DB.create_table :authorizations do
122
+ primary_key :id
123
+ String :auth
124
+ foreign_key :client_id, :clients
125
+ Integer :service_id
126
+ Date :start_date
127
+ Date :end_date
128
+ end
129
+ end
130
+
131
+ def add_clients
132
+ TT[:clients].all.each { |client|
133
+ if DB[:clients].where(client_number: client[:med_id]).count == 0
134
+ DB[:clients].insert(client_number: client[:med_id])
135
+ end
136
+ }
137
+ end
107
138
 
139
+ def add_ftp_data
140
+ end
141
+
142
+ def add_providers
108
143
  DB[:providers].insert(:credit_account=>1206, :fund=>500, :debit_account=>5005, :name=>"AMERIGROUP 2", :abbreviation=>"AMG", :type=>"MCO")
109
144
  DB[:providers].insert(:credit_account=>1207, :fund=>300, :debit_account=>5007, :name=>"CHILDREN'S AID SOCIETY", :abbreviation=>"CAS", :type=>"MLTC")
110
145
  DB[:providers].insert(:credit_account=>1226, :fund=>300, :debit_account=>5026, :name=>"COMPREHENSIVE CARE MANAGEMENT", :abbreviation=>"CCM", :type=>"MLTC")
@@ -129,7 +164,6 @@ module Sunnyside
129
164
  DB[:providers].insert(:credit_account=>1310, :fund=>300, :debit_account=>5030, :name=>"VILLAGE CARE MAX", :abbreviation=>"VIL", :type=>"MLTC")
130
165
  DB[:providers].insert(:credit_account=>1222, :fund=>500, :debit_account=>5022, :name=>"AFFINITY HEALTH PLUS", :abbreviation=>"AFF", :type=>"MCO")
131
166
  DB[:providers].insert(:credit_account=>1218, :fund=>500, :debit_account=>5018, :name=>"HEALTH PLUS PHSP,INC", :abbreviation=>"HFS", :type=>"MCO")
132
-
133
167
  end
134
168
  end
135
169
  end
@@ -20,12 +20,11 @@ module Sunnyside
20
20
  end
21
21
 
22
22
  def run
23
- mco_total = 0.0
23
+ mco_total = 0.0
24
24
  mltc_total = 0.0
25
25
  invoices.each do |inv|
26
26
  if inv[:type] == 'MCO'
27
27
  mco_total += inv[:hours]
28
- # mco_total += inv.hours
29
28
  elsif inv[:type] == 'MLTC'
30
29
  mltc_total += inv[:hours]
31
30
  end
@@ -22,26 +22,31 @@ module Sunnyside
22
22
  end
23
23
 
24
24
  def denials_present?
25
- claims.where('amount_charged > amount_paid').exclude(denial_reason: '22').count > 0
25
+ claims.where(denial_reason: '4').count > 0
26
26
  end
27
27
 
28
28
  def create_pdf
29
29
  Prawn::Document.generate("#{provider}_CHECK_#{check}.pdf", :page_layout => :landscape) do |pdf|
30
- report = ReportPDF.new(pdf, :claim_data => claims, :service_data => services, :provider => provider, :check => check)
30
+ report = ReportPDF.new(
31
+ pdf,
32
+ { :claim_data => claims,
33
+ :service_data => services,
34
+ :provider => provider,
35
+ :check => check
36
+ })
37
+
31
38
  report.create_check_header
39
+ report.claim_table
32
40
  if takeback_present?
33
41
  report.takeback_table
34
42
  elsif denials_present?
35
43
  report.denial_table
36
- else
37
- report.claim_table
38
44
  end
39
45
  end
40
46
  end
41
47
  end
42
48
  class ReportPDF
43
49
  attr_reader :pdf, :claims, :services, :provider, :check
44
-
45
50
  def initialize(pdf, data = {})
46
51
  @pdf = pdf
47
52
  @claims = data[:claim_data]
@@ -77,13 +82,24 @@ module Sunnyside
77
82
  end
78
83
 
79
84
  def denial_table
85
+ pdf.start_new_page
86
+ pdf.move_down 10
80
87
  pdf.text 'CLAIMS WITH DENIALS'
81
88
  pdf.move_down 10
89
+ claims.where(denial_reason: '4').all.each { |clm| claim_header(clm) }
82
90
  end
83
91
 
84
92
  def takeback_header
93
+ pdf.start_new_page
94
+ pdf.move_down 10
85
95
  pdf.text 'ADJUSTED CLAIMS'
86
96
  pdf.move_down 10
97
+ claims.where(denial_reason: '22').all.each { |clm| claim_header(clm) }
98
+ end
99
+
100
+ def table_create
101
+ pdf.text 'asdasds'
102
+ and_this_too_please
87
103
  end
88
104
 
89
105
  def client(inv)
@@ -91,37 +107,41 @@ module Sunnyside
91
107
  end
92
108
 
93
109
  def claim_header(claim)
110
+ puts claim.control_number
94
111
  pdf.move_down 10
95
112
  claim_data = [[claim.control_number, client(claim.invoice_number), claim.invoice_number, currency(claim.amount_charged), currency(claim.amount_paid), claim.denial_reason]]
96
- pdf.table(
97
- claim_data,
98
- :column_widths => [85, 75, 75, 75, 75, 150], :cell_style => {
99
- :align => :center,
100
- :overflow => :shrink_to_fit,
101
- :size => 12,
102
- :height => 30
103
- }) # SHOULD ONLY HAVE ONE CLAIM
113
+ pdf.table(claim_data, :column_widths => [85, 75, 75, 75, 75, 150], :cell_style => {
114
+ :align => :center,
115
+ :overflow => :shrink_to_fit,
116
+ :size => 12,
117
+ :height => 30
118
+ }) # SHOULD ONLY HAVE ONE CLAIM
104
119
  pdf.move_down 10
105
120
  create_service_table(claim.id)
106
121
  end
107
122
 
108
123
  def service_data(id)
109
- services.where(claim_id: id).map { |svc| ['', svc.dos, svc.service_code + svc.mod_1, svc.units, svc.amount_charged, svc.amount_paid, svc.denial_reason] }
124
+ services.where(claim_id: id).map { |svc| ['', svc.dos, svc_code(svc), svc.units, currency(svc.amount_charged), currency(svc.amount_paid), svc.denial_reason] }
125
+ end
126
+
127
+ def svc_code(svc)
128
+ if svc.mod_1
129
+ svc.service_code + ':' + svc.mod_1
130
+ else
131
+ svc.service_code
132
+ end
110
133
  end
111
134
 
112
135
  def create_service_table(id)
113
- pdf.table(service_data(id),
114
- :column_widths => [85, 75, 75, 75, 75, 150],
115
- :cell_style => {
116
- :align => :center,
117
- :overflow => :shrink_to_fit,
118
- :size => 12,
119
- :height => 30
120
- }) # SHOULD ONLY HAVE ONE CLAIM
136
+ pdf.table(service_data(id), :column_widths => [85, 75, 75, 75, 75, 150], :cell_style => {
137
+ :align => :center,
138
+ :overflow => :shrink_to_fit,
139
+ :size => 12,
140
+ :height => 30
141
+ }) # SHOULD ONLY HAVE ONE CLAIM
121
142
  end
122
143
 
123
144
  def claim_table
124
145
  claims.exclude(denial_reason: ['22', '4']).all.each { |clm| claim_header(clm) }
125
146
  end
126
- end
127
- end
147
+ end
@@ -1,3 +1,3 @@
1
1
  module Sunnyside
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/sunnyside.rb CHANGED
@@ -17,11 +17,19 @@ require 'sunnyside/menu'
17
17
  require 'sunnyside/expiring_auth'
18
18
 
19
19
  module Sunnyside
20
+ # doesn't work on some Windows machines
20
21
  LOCAL_FILES = ENV["HOME"] + "/sunnyside-files"
21
22
  DB = Sequel.connect("sqlite:/#{LOCAL_FILES}/db/sunnyside.db")
23
+
24
+ # Second database for copying old data
25
+
22
26
  if DB.tables.empty?
23
- require 'sunnyside/models/db_setup'
24
- Sunnyside.create_tables
27
+ require 'sunnyside/models/db_setup'
28
+ TT = Sequel.connect("sqlite:/#{LOCAL_FILES}/db/project.db")
29
+ Sunnyside.create_tables
30
+ Sunnyside.add_providers
31
+ Sunnyside.add_ftp_data
32
+ Sunnyside.add_clients
25
33
  end
26
34
  require 'sunnyside/models/sequel_classes'
27
35
  end
metadata CHANGED
@@ -1,32 +1,36 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sunnyside
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - wismer
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2013-12-19 00:00:00.000000000 Z
12
+ date: 2013-12-27 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: sqlite3
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
- - - '>='
19
+ - - ! '>='
18
20
  - !ruby/object:Gem::Version
19
21
  version: '0'
20
22
  type: :development
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
- - - '>='
27
+ - - ! '>='
25
28
  - !ruby/object:Gem::Version
26
29
  version: '0'
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: bundler
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
35
  - - ~>
32
36
  - !ruby/object:Gem::Version
@@ -34,6 +38,7 @@ dependencies:
34
38
  type: :development
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
43
  - - ~>
39
44
  - !ruby/object:Gem::Version
@@ -41,57 +46,65 @@ dependencies:
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: rake
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
- - - '>='
51
+ - - ! '>='
46
52
  - !ruby/object:Gem::Version
47
53
  version: '0'
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
- - - '>='
59
+ - - ! '>='
53
60
  - !ruby/object:Gem::Version
54
61
  version: '0'
55
62
  - !ruby/object:Gem::Dependency
56
63
  name: sequel
57
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
58
66
  requirements:
59
- - - '>='
67
+ - - ! '>='
60
68
  - !ruby/object:Gem::Version
61
69
  version: '0'
62
70
  type: :development
63
71
  prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
65
74
  requirements:
66
- - - '>='
75
+ - - ! '>='
67
76
  - !ruby/object:Gem::Version
68
77
  version: '0'
69
78
  - !ruby/object:Gem::Dependency
70
79
  name: money
71
80
  requirement: !ruby/object:Gem::Requirement
81
+ none: false
72
82
  requirements:
73
- - - '>='
83
+ - - ! '>='
74
84
  - !ruby/object:Gem::Version
75
85
  version: '0'
76
86
  type: :development
77
87
  prerelease: false
78
88
  version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
79
90
  requirements:
80
- - - '>='
91
+ - - ! '>='
81
92
  - !ruby/object:Gem::Version
82
93
  version: '0'
83
94
  - !ruby/object:Gem::Dependency
84
95
  name: prawn
85
96
  requirement: !ruby/object:Gem::Requirement
97
+ none: false
86
98
  requirements:
87
- - - '>='
99
+ - - ! '>='
88
100
  - !ruby/object:Gem::Version
89
101
  version: '0'
90
102
  type: :development
91
103
  prerelease: false
92
104
  version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
93
106
  requirements:
94
- - - '>='
107
+ - - ! '>='
95
108
  - !ruby/object:Gem::Version
96
109
  version: '0'
97
110
  description: gem for Sunnyside Citywide Home Care, Inc.
@@ -124,25 +137,26 @@ files:
124
137
  homepage: ''
125
138
  licenses:
126
139
  - MIT
127
- metadata: {}
128
140
  post_install_message:
129
141
  rdoc_options: []
130
142
  require_paths:
131
143
  - lib
132
144
  required_ruby_version: !ruby/object:Gem::Requirement
145
+ none: false
133
146
  requirements:
134
- - - '>='
147
+ - - ! '>='
135
148
  - !ruby/object:Gem::Version
136
149
  version: '0'
137
150
  required_rubygems_version: !ruby/object:Gem::Requirement
151
+ none: false
138
152
  requirements:
139
- - - '>='
153
+ - - ! '>='
140
154
  - !ruby/object:Gem::Version
141
155
  version: '0'
142
156
  requirements: []
143
157
  rubyforge_project:
144
- rubygems_version: 2.0.14
158
+ rubygems_version: 1.8.24
145
159
  signing_key:
146
- specification_version: 4
160
+ specification_version: 3
147
161
  summary: EDI/PDF parser, fiscal tools for accounting
148
162
  test_files: []
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 1cb352e0ac28b56b294e7736a05ea8c3862c41b0
4
- data.tar.gz: 8b00db12da4d56584417a1dc52e5b8cbb73226f8
5
- SHA512:
6
- metadata.gz: 5b8236a4f85643a031ecaed56c69d19bbc426c96443ce2d32624f85e32f27beb26b77a49866d2006d57b5e39ec65711d2ebe123a7c9fcf45d94c811f70c41c6f
7
- data.tar.gz: af009aeedc0ecffc3f462233e5c628dd269d455366d84d4b809ba326fb8c3a53bcece65738d18b05870fcf72bf8513b4bea5acb23469ffe61cb7a6c22e1ebf51