erp_invoicing 3.0.4 → 3.0.5
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.
- data/app/controllers/erp_invoicing/erp_app/organizer/bill_pay/accounts_controller.rb +23 -17
- data/app/controllers/erp_invoicing/erp_app/shared/files_controller.rb +5 -5
- data/app/controllers/erp_invoicing/erp_app/shared/invoices_controller.rb +2 -2
- data/app/controllers/erp_invoicing/sms_controller.rb +1 -1
- data/app/models/billing_account.rb +6 -5
- data/app/models/recurring_payment.rb +1 -1
- data/db/migrate/20111121000000_invoicing_services.rb +6 -6
- data/lib/erp_invoicing/version.rb +1 -1
- data/public/javascripts/erp_app/shared/billing_accounts_grid_panel.js +2 -4
- data/public/javascripts/erp_app/shared/invoices_grid_panel.js +0 -2
- metadata +10 -10
@@ -66,7 +66,7 @@ module ErpInvoicing
|
|
66
66
|
@total_payment = params[:total_payment]
|
67
67
|
|
68
68
|
money = Money.create(
|
69
|
-
:amount => @total_payment.
|
69
|
+
:amount => @total_payment.to_d,
|
70
70
|
:description => "Online Payment",
|
71
71
|
:currency => Currency.usd
|
72
72
|
)
|
@@ -79,40 +79,46 @@ module ErpInvoicing
|
|
79
79
|
financial_txn.save
|
80
80
|
|
81
81
|
@billing_account_payment_amts.each do |hash|
|
82
|
-
amount = hash[:amount].
|
82
|
+
amount = hash[:amount].to_d rescue 0
|
83
83
|
if amount > 0
|
84
84
|
comment = (params[:short_payment_comment] and hash[:short_payment]) ? params[:short_payment_comment] : nil
|
85
85
|
PaymentApplication.create(
|
86
86
|
:financial_txn => financial_txn,
|
87
87
|
:payment_applied_to => hash[:billing_account],
|
88
|
-
:money => Money.create(:amount =>
|
88
|
+
:money => Money.create(:amount => amount),
|
89
89
|
:comment => comment
|
90
90
|
)
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
94
|
-
if financial_txn.apply_date == Date.today
|
95
|
-
|
94
|
+
#if financial_txn.apply_date == Date.today
|
95
|
+
case @payment_account.class.to_s
|
96
96
|
when "BankAccount"
|
97
97
|
financial_txn.txn_type = BizTxnType.ach_sale
|
98
98
|
financial_txn.save
|
99
|
-
|
100
|
-
if
|
101
|
-
|
102
|
-
|
103
|
-
|
99
|
+
|
100
|
+
if financial_txn.apply_date == Date.today
|
101
|
+
result = @payment_account.purchase(financial_txn, ErpCommerce::Config.active_merchant_gateway_wrapper)
|
102
|
+
if !result[:payment].nil? and result[:payment].success
|
103
|
+
@authorization_code = result[:payment].authorization_code
|
104
|
+
else
|
105
|
+
@message = result[:message]
|
106
|
+
end
|
104
107
|
end
|
105
108
|
when "CreditCardAccount"
|
106
109
|
financial_txn.txn_type = BizTxnType.cc_sale
|
107
110
|
financial_txn.save
|
108
|
-
|
109
|
-
if
|
110
|
-
|
111
|
-
|
112
|
-
|
111
|
+
|
112
|
+
if financial_txn.apply_date == Date.today
|
113
|
+
result = @payment_account.purchase(financial_txn, params[:cvv], ErpCommerce::Config.active_merchant_gateway_wrapper)
|
114
|
+
if !result[:payment].nil? and result[:payment].success
|
115
|
+
@authorization_code = result[:payment].authorization_code
|
116
|
+
else
|
117
|
+
@message = result[:message]
|
118
|
+
end
|
113
119
|
end
|
114
|
-
end
|
115
120
|
end
|
121
|
+
|
116
122
|
|
117
123
|
if @message.nil?
|
118
124
|
render :json => {:success => true, :message => "Payment Successful!" }
|
@@ -145,7 +151,7 @@ module ErpInvoicing
|
|
145
151
|
billing_account_payment_amts = []
|
146
152
|
billing_account = BillingAccount.find(params["billing_account_id"])
|
147
153
|
amount = params[:total_payment]
|
148
|
-
billing_account_payment_amts << {:billing_account => billing_account, :amount => amount, :short_payment => (amount.
|
154
|
+
billing_account_payment_amts << {:billing_account => billing_account, :amount => amount, :short_payment => (amount.to_d < billing_account.balance)}
|
149
155
|
|
150
156
|
billing_account_payment_amts
|
151
157
|
end
|
@@ -12,16 +12,16 @@ module ErpInvoicing
|
|
12
12
|
clear_files
|
13
13
|
|
14
14
|
result = {}
|
15
|
-
upload_path =
|
16
|
-
name =
|
17
|
-
data = request.
|
15
|
+
upload_path = params[:directory]
|
16
|
+
name = params[:name]
|
17
|
+
data = request.raw_post
|
18
18
|
|
19
19
|
begin
|
20
20
|
@invoice.add_file(data, File.join(base_path, name))
|
21
21
|
result = {:success => true}
|
22
22
|
rescue Exception=>ex
|
23
|
-
logger.error ex.message
|
24
|
-
logger.error ex.backtrace.join("\n")
|
23
|
+
Rails.logger.error ex.message
|
24
|
+
Rails.logger.error ex.backtrace.join("\n")
|
25
25
|
result = {:success => false, :error => "Error uploading file."}
|
26
26
|
end
|
27
27
|
|
@@ -129,7 +129,7 @@ module ErpInvoicing
|
|
129
129
|
def create_invoice_item
|
130
130
|
data = params[:data]
|
131
131
|
invoice = Invoice.find(params[:invoice_id])
|
132
|
-
invoice_item = InvoiceItem.create(:amount => data[:amount].
|
132
|
+
invoice_item = InvoiceItem.create(:amount => data[:amount].to_d, :quantity => data[:quantity], :item_description => data[:item_description])
|
133
133
|
invoice.items << invoice_item
|
134
134
|
|
135
135
|
{:success => true,
|
@@ -146,7 +146,7 @@ module ErpInvoicing
|
|
146
146
|
def update_invoice_item
|
147
147
|
data = params[:data]
|
148
148
|
invoice_item = InvoiceItem.find(data[:id])
|
149
|
-
invoice_item.amount = data[:amount].
|
149
|
+
invoice_item.amount = data[:amount].to_d
|
150
150
|
invoice_item.quantity = data[:quantity]
|
151
151
|
invoice_item.item_description = data[:item_description]
|
152
152
|
invoice_item.save
|
@@ -1,5 +1,4 @@
|
|
1
1
|
class BillingAccount < ActiveRecord::Base
|
2
|
-
has_relational_dynamic_attributes
|
3
2
|
acts_as_financial_txn_account
|
4
3
|
|
5
4
|
belongs_to :calculate_balance_strategy_type
|
@@ -62,12 +61,13 @@ class BillingAccount < ActiveRecord::Base
|
|
62
61
|
when 'invoices_and_payments'
|
63
62
|
(self.invoices.balance.amount - self.total_payments)
|
64
63
|
when 'payments'
|
65
|
-
(self.balance - self.total_payments)
|
64
|
+
balance_amt = (self.balance - self.total_payments)
|
65
|
+
balance_amt == 0 ? 0 : balance_amt.round(2)
|
66
66
|
else
|
67
|
-
self.balance
|
67
|
+
self.balance == 0 ? 0 : self.balance.round(2)
|
68
68
|
end
|
69
69
|
else
|
70
|
-
self.balance
|
70
|
+
self.balance == 0 ? 0 : self.balance.round(2)
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
@@ -76,7 +76,8 @@ class BillingAccount < ActiveRecord::Base
|
|
76
76
|
end
|
77
77
|
|
78
78
|
def outstanding_balance
|
79
|
-
|
79
|
+
outstanding_balance_amt = (calculate_balance - total_pending_payments)
|
80
|
+
outstanding_balance_amt == 0 ? 0 : outstanding_balance_amt.round(2)
|
80
81
|
end
|
81
82
|
|
82
83
|
def total_pending_payments
|
@@ -75,9 +75,9 @@ class InvoicingServices < ActiveRecord::Migration
|
|
75
75
|
#non-key columns
|
76
76
|
t.integer :item_seq_id
|
77
77
|
t.string :item_description
|
78
|
-
t.
|
79
|
-
t.
|
80
|
-
t.
|
78
|
+
t.decimal :sales_tax, :precision => 8, :scale => 2
|
79
|
+
t.decimal :quantity, :precision => 8, :scale => 2
|
80
|
+
t.decimal :amount, :precision => 8, :scale => 2
|
81
81
|
|
82
82
|
t.timestamps
|
83
83
|
end
|
@@ -151,8 +151,8 @@ class InvoicingServices < ActiveRecord::Migration
|
|
151
151
|
create_table :recurring_payments do |t|
|
152
152
|
t.references :payment_account, :polymorphic => true
|
153
153
|
t.references :billing_account
|
154
|
-
t.
|
155
|
-
t.
|
154
|
+
t.decimal :pay_up_to_amount, :precision => 8, :scale => 2
|
155
|
+
t.decimal :payment_amount, :precision => 8, :scale => 2
|
156
156
|
t.integer :payment_day
|
157
157
|
t.date :from_date
|
158
158
|
t.date :thru_date
|
@@ -217,7 +217,7 @@ class InvoicingServices < ActiveRecord::Migration
|
|
217
217
|
#non-key columns
|
218
218
|
t.string :description
|
219
219
|
t.date :pay_by
|
220
|
-
t.
|
220
|
+
t.decimal :amount, :precision => 8, :scale => 2
|
221
221
|
|
222
222
|
t.timestamps
|
223
223
|
end
|
@@ -42,8 +42,6 @@ Ext.define("Compass.ErpApp.Shared.BillingAccountsGridPanel",{
|
|
42
42
|
addDocument : function(rec){
|
43
43
|
var uploadWindow = new Compass.ErpApp.Shared.UploadWindow({
|
44
44
|
standardUploadUrl:'/erp_invoicing/erp_app/shared/billing_accounts/'+rec.get('id')+'/upload_file',
|
45
|
-
flashUploadUrl:'/erp_invoicing/erp_app/shared/billing_accounts/'+rec.get('id')+'/upload_file',
|
46
|
-
xhrUploadUrl:'/erp_invoicing/erp_app/shared/billing_accounts/'+rec.get('id')+'/upload_file',
|
47
45
|
extraPostData:{}
|
48
46
|
});
|
49
47
|
uploadWindow.show();
|
@@ -262,7 +260,7 @@ Ext.define("Compass.ErpApp.Shared.BillingAccountsGridPanel",{
|
|
262
260
|
width:100,
|
263
261
|
dataIndex: 'payment_due',
|
264
262
|
renderer:function(v){
|
265
|
-
return v.toFixed(2);
|
263
|
+
return parseFloat(v).toFixed(2);
|
266
264
|
},
|
267
265
|
editor:{
|
268
266
|
xtype:'numberfield'
|
@@ -273,7 +271,7 @@ Ext.define("Compass.ErpApp.Shared.BillingAccountsGridPanel",{
|
|
273
271
|
width:100,
|
274
272
|
dataIndex: 'balance',
|
275
273
|
renderer:function(v){
|
276
|
-
return v.toFixed(2);
|
274
|
+
return parseFloat(v).toFixed(2);
|
277
275
|
},
|
278
276
|
editor:{
|
279
277
|
xtype:'numberfield'
|
@@ -5,8 +5,6 @@ Ext.define("Compass.ErpApp.Shared.InvoicesGridPanel",{
|
|
5
5
|
addDocument : function(rec){
|
6
6
|
var uploadWindow = new Compass.ErpApp.Shared.UploadWindow({
|
7
7
|
standardUploadUrl:'/erp_invoicing/erp_app/shared/invoices/files/'+rec.get('id')+'/upload_file',
|
8
|
-
flashUploadUrl:'/erp_invoicing/erp_app/shared/invoices/files/'+rec.get('id')+'/upload_file',
|
9
|
-
xhrUploadUrl:'/erp_invoicing/erp_app/shared/invoices/files/'+rec.get('id')+'/upload_file',
|
10
8
|
extraPostData:{}
|
11
9
|
});
|
12
10
|
uploadWindow.show();
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: erp_invoicing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-09-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: erp_inventory
|
16
|
-
requirement: &
|
16
|
+
requirement: &70232070628880 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '3.0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70232070628880
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: erp_work_effort
|
27
|
-
requirement: &
|
27
|
+
requirement: &70232070628360 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '3.0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70232070628360
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: erp_commerce
|
38
|
-
requirement: &
|
38
|
+
requirement: &70232070627820 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '3.0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70232070627820
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: erp_dev_svcs
|
49
|
-
requirement: &
|
49
|
+
requirement: &70232070627200 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '3.0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70232070627200
|
58
58
|
description: ErpInvoicing adds models and services to the CompassAE core to handle
|
59
59
|
invoicing and billing functions. It includes extensions to the core ERP classes
|
60
60
|
for accounts and things that are 'billable' (products, work efforts), and additional
|