erp_invoicing 3.0.5 → 3.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -22,7 +22,8 @@ class BillingAccount < ActiveRecord::Base
22
22
  has_one :recurring_payment, :dependent => :destroy
23
23
 
24
24
  def self.find_by_account_number(account_number)
25
- self.includes(:financial_txn_account).where(:financial_txn_accounts => {:account_number => account_number.to_s}).first
25
+ #self.includes(:financial_txn_account).where(:financial_txn_accounts => {:account_number => account_number.to_s}).first
26
+ self.where(:account_number => account_number.to_s).first
26
27
  end
27
28
 
28
29
  def has_recurring_payment_enabled?
@@ -59,7 +60,7 @@ class BillingAccount < ActiveRecord::Base
59
60
  unless self.calculate_balance_strategy_type.nil?
60
61
  case self.calculate_balance_strategy_type.internal_identifier
61
62
  when 'invoices_and_payments'
62
- (self.invoices.balance.amount - self.total_payments)
63
+ (self.invoices.all.sum(&:calculate_balance) - self.total_payments)
63
64
  when 'payments'
64
65
  balance_amt = (self.balance - self.total_payments)
65
66
  balance_amt == 0 ? 0 : balance_amt.round(2)
@@ -59,6 +59,8 @@ class Invoice < ActiveRecord::Base
59
59
  case self.calculate_balance_strategy_type.internal_identifier
60
60
  when 'invoice_items_and_payments'
61
61
  (self.items.all.sum(&:total_amount) - self.total_payments)
62
+ when 'payable_balances_and_payments'
63
+ (self.payable_balances.all.sum(&:balance).amount - self.total_payments)
62
64
  when 'payments'
63
65
  (self.balance - self.total_payments)
64
66
  else
@@ -6,17 +6,15 @@ class AddBillpayWidget
6
6
  app = Application.find_by_internal_identifier('crm')
7
7
 
8
8
  billpay = Widget.create(
9
- :description => 'Bill Pay',
10
- :internal_identifier => 'billpay',
11
- :icon => 'icon-grid',
12
- :xtype => 'billpay'
13
- )
9
+ :description => 'Bill Pay',
10
+ :internal_identifier => 'billpay',
11
+ :icon => 'icon-grid',
12
+ :xtype => 'billpay'
13
+ )
14
14
 
15
15
  app.widgets << billpay
16
16
  app.save
17
17
 
18
- billpay.roles << Role.find_by_internal_identifier('admin')
19
- billpay.save
20
18
  end
21
19
  end
22
20
 
@@ -6,10 +6,8 @@ module ErpInvoicing
6
6
  app.middleware.insert_before Rack::Lock, ::ActionDispatch::Static, "#{root}/public"
7
7
  end
8
8
 
9
- engine = self
10
- config.to_prepare do
11
- ErpBaseErpSvcs.register_compass_ae_engine(engine)
12
- ::ErpApp::Widgets::Loader.load_compass_ae_widgets(engine)
13
- end
9
+ ErpBaseErpSvcs.register_as_compass_ae_engine(config, self)
10
+ ::ErpApp::Widgets::Loader.load_compass_ae_widgets(config, self)
11
+
14
12
  end
15
13
  end
@@ -2,7 +2,7 @@ module ErpInvoicing
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 3
4
4
  MINOR = 0
5
- TINY = 5
5
+ TINY = 6
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].compact.join('.')
8
8
  end
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.5
4
+ version: 3.0.6
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-09-24 00:00:00.000000000 Z
12
+ date: 2013-01-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: erp_inventory
16
- requirement: &70232070628880 !ruby/object:Gem::Requirement
16
+ requirement: &70149467252040 !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: *70232070628880
24
+ version_requirements: *70149467252040
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: erp_work_effort
27
- requirement: &70232070628360 !ruby/object:Gem::Requirement
27
+ requirement: &70149467251380 !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: *70232070628360
35
+ version_requirements: *70149467251380
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: erp_commerce
38
- requirement: &70232070627820 !ruby/object:Gem::Requirement
38
+ requirement: &70149467250920 !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: *70232070627820
46
+ version_requirements: *70149467250920
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: erp_dev_svcs
49
- requirement: &70232070627200 !ruby/object:Gem::Requirement
49
+ requirement: &70149467250460 !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: *70232070627200
57
+ version_requirements: *70149467250460
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