erp_invoicing 3.0.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. data/app/controllers/erp_invoicing/erp_app/organizer/bill_pay/accounts_controller.rb +98 -46
  2. data/app/controllers/erp_invoicing/erp_app/organizer/bill_pay/base_controller.rb +1 -1
  3. data/app/controllers/erp_invoicing/erp_app/shared/billing_accounts_controller.rb +111 -0
  4. data/app/controllers/erp_invoicing/erp_app/shared/files_controller.rb +52 -0
  5. data/app/controllers/erp_invoicing/erp_app/shared/invoices_controller.rb +208 -0
  6. data/app/controllers/erp_invoicing/sms_controller.rb +156 -0
  7. data/app/models/billing_account.rb +204 -0
  8. data/app/models/extensions/document.rb +5 -0
  9. data/app/models/extensions/financial_txn.rb +5 -0
  10. data/app/models/extensions/party.rb +10 -0
  11. data/app/models/invoice.rb +100 -7
  12. data/app/models/invoice_item.rb +35 -2
  13. data/app/models/invoice_payment_strategy_type.rb +5 -0
  14. data/app/models/invoice_payment_term.rb +4 -0
  15. data/app/models/invoice_payment_term_set.rb +6 -0
  16. data/app/models/invoice_payment_term_type.rb +3 -0
  17. data/app/models/payment_application.rb +6 -1
  18. data/app/models/recurring_payment.rb +40 -0
  19. data/config/routes.rb +8 -1
  20. data/db/data_migrations/20111121153349_create_bill_pay_organizer_application.rb +1 -1
  21. data/db/data_migrations/20120118181839_create_invoice_management_desktop_application.rb +26 -0
  22. data/db/data_migrations/20120229174322_add_billpay_widget.rb +28 -0
  23. data/db/migrate/20111121000000_invoicing_services.rb +170 -103
  24. data/db/migrate/20120228184317_add_text_to_pay_to_recurring_payments.rb +13 -0
  25. data/db/migrate/20120301155722_add_billing_date_to_billing_account.rb +13 -0
  26. data/lib/erp_invoicing/engine.rb +5 -0
  27. data/lib/erp_invoicing/version.rb +7 -1
  28. data/lib/erp_invoicing.rb +1 -0
  29. data/public/javascripts/erp_app/desktop/applications/invoice_management/billing_accounts_panel.js +80 -0
  30. data/public/javascripts/erp_app/desktop/applications/invoice_management/invoices_panel.js +48 -0
  31. data/public/javascripts/erp_app/desktop/applications/invoice_management/module.js +36 -0
  32. data/public/javascripts/erp_app/organizer/applications/bill_pay/base.js +88 -76
  33. data/public/javascripts/erp_app/organizer/applications/bill_pay/extensions.js +6 -97
  34. data/public/javascripts/erp_app/organizer/applications/bill_pay/make_payment_window.js +19 -13
  35. data/public/javascripts/erp_app/organizer/applications/bill_pay/payment_accounts_grid_panel.js +2 -1
  36. data/public/javascripts/erp_app/shared/add_invoice_window.js +220 -0
  37. data/public/javascripts/erp_app/shared/billing_accounts_grid_panel.js +318 -0
  38. data/public/javascripts/erp_app/shared/invoice_items_grid_panel.js +152 -0
  39. data/public/javascripts/erp_app/shared/invoices_grid_panel.js +363 -0
  40. data/public/javascripts/erp_app/shared/payments_grid_panel.js +74 -0
  41. data/spec/dummy/Rakefile +7 -0
  42. data/spec/dummy/app/assets/javascripts/application.js +9 -0
  43. data/spec/dummy/app/assets/stylesheets/application.css +7 -0
  44. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  45. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  46. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  47. data/spec/dummy/config/application.rb +50 -0
  48. data/spec/dummy/config/boot.rb +10 -0
  49. data/spec/dummy/config/database.yml +8 -0
  50. data/spec/dummy/config/environment.rb +5 -0
  51. data/spec/dummy/config/environments/spec.rb +27 -0
  52. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  53. data/spec/dummy/config/initializers/inflections.rb +10 -0
  54. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  55. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  56. data/spec/dummy/config/initializers/session_store.rb +8 -0
  57. data/spec/dummy/config/initializers/wrap_parameters.rb +12 -0
  58. data/spec/dummy/config/locales/en.yml +5 -0
  59. data/spec/dummy/config/routes.rb +3 -0
  60. data/spec/dummy/config.ru +4 -0
  61. data/spec/dummy/public/404.html +26 -0
  62. data/spec/dummy/public/422.html +26 -0
  63. data/spec/dummy/public/500.html +26 -0
  64. data/spec/dummy/public/favicon.ico +0 -0
  65. data/spec/dummy/script/rails +6 -0
  66. data/spec/factories/basic.rb +9 -0
  67. data/spec/models/billing_account_spec.rb +78 -0
  68. data/spec/models/invoice_item_spec.rb +22 -0
  69. data/spec/models/invoice_spec.rb +58 -0
  70. data/spec/models/payment_application_spec.rb +17 -0
  71. data/spec/spec_helper.rb +60 -0
  72. metadata +148 -67
  73. data/app/widgets/bill_pay/base.rb +0 -230
  74. data/app/widgets/bill_pay/helpers/controller/bill_pay_controller_helper.rb +0 -3
  75. data/app/widgets/bill_pay/helpers/view/bill_pay_view_helper.rb +0 -3
  76. data/app/widgets/bill_pay/javascript/bill_pay.js +0 -11
  77. data/app/widgets/bill_pay/views/_menu.html.erb +0 -63
  78. data/app/widgets/bill_pay/views/_payment_history_table.html.erb +0 -115
  79. data/app/widgets/bill_pay/views/_statement_table.html.erb +0 -117
  80. data/app/widgets/bill_pay/views/account_home.html.erb +0 -10
  81. data/app/widgets/bill_pay/views/index.html.erb +0 -4
  82. data/app/widgets/bill_pay/views/make_payment.html.erb +0 -24
  83. data/app/widgets/bill_pay/views/payment_account_forms/bank_account.html.erb +0 -28
  84. data/app/widgets/bill_pay/views/payment_account_forms/credit_card.html.erb +0 -48
  85. data/app/widgets/bill_pay/views/payment_accounts.html.erb +0 -120
  86. data/app/widgets/bill_pay/views/payment_history.html.erb +0 -104
  87. data/app/widgets/bill_pay/views/pdf/layout.pdf.erb +0 -35
  88. data/app/widgets/bill_pay/views/statements.html.erb +0 -4
  89. data/public/javascripts/erp_app/organizer/applications/bill_pay/accounts_grid_panel.js +0 -182
@@ -0,0 +1,28 @@
1
+ class AddBillpayWidget
2
+
3
+ def self.up
4
+ #insert data here
5
+ if Widget.find_by_internal_identifier('billpay').nil?
6
+ app = Application.find_by_internal_identifier('crm')
7
+
8
+ billpay = Widget.create(
9
+ :description => 'Bill Pay',
10
+ :internal_identifier => 'billpay',
11
+ :icon => 'icon-grid',
12
+ :xtype => 'billpay'
13
+ )
14
+
15
+ app.widgets << billpay
16
+ app.save
17
+
18
+ billpay.roles << Role.find_by_internal_identifier('admin')
19
+ billpay.save
20
+ end
21
+ end
22
+
23
+ def self.down
24
+ #remove data here
25
+ Widget.find_by_internal_identifier('billpay').destroy
26
+ end
27
+
28
+ end
@@ -11,35 +11,54 @@ class InvoicingServices < ActiveRecord::Migration
11
11
  # Create invoices
12
12
  unless table_exists?(:invoices)
13
13
  create_table :invoices do |t|
14
-
15
- t.column :description, :string
16
- t.column :message, :string
17
- t.column :product_id, :integer
18
- t.column :invoice_date, :date
19
- t.column :external_identifier, :string
20
- t.column :external_id_source, :string
14
+ t.string :invoice_number
15
+ t.string :description
16
+ t.string :message
17
+ t.date :invoice_date
18
+ t.date :due_date
19
+ t.string :external_identifier
20
+ t.string :external_id_source
21
+ t.references :product
21
22
  t.references :invoice_type
23
+ t.references :billing_account
24
+ t.references :invoice_payment_strategy_type
22
25
 
23
26
  t.timestamps
24
27
  end
28
+
29
+ add_index :invoices, :product_id, :name => 'prod_type_idx'
30
+ add_index :invoices, :invoice_type_id, :name => 'invoice_type_idx'
31
+ add_index :invoices, :billing_account_id, :name => 'invoice_billing_acct_idx'
32
+ add_index :invoices, :invoice_payment_strategy_type_id, :name => 'invoice_payment_stragegy_idx'
25
33
  end
26
-
34
+
27
35
  # Create invoice types (not in silverston models - may be removed in future releases)
28
36
  unless table_exists?(:invoice_types)
29
-
37
+
30
38
  create_table :invoice_types do |t|
31
- t.column :parent_id, :integer
32
- t.column :lft, :integer
33
- t.column :rgt, :integer
34
-
35
- #custom columns go here
36
- t.column :description, :string
37
- t.column :comments, :string
38
- t.column :internal_identifier, :string
39
- t.column :external_identifier, :string
40
- t.column :external_id_source, :string
41
-
42
- t.timestamps
39
+ t.integer :parent_id
40
+ t.integer :lft
41
+ t.integer :rgt
42
+
43
+ #custom columns go here
44
+ t.string :description
45
+ t.string :comments
46
+ t.string :internal_identifier
47
+ t.string :external_identifier
48
+ t.string :external_id_source
49
+
50
+ t.timestamps
51
+ end
52
+ end
53
+
54
+ unless table_exists?(:invoice_payment_strategy_types)
55
+ create_table :invoice_payment_strategy_types do |t|
56
+ t.string :description
57
+ t.string :internal_identifier
58
+ t.string :external_identifier
59
+ t.string :external_id_source
60
+
61
+ t.timestamps
43
62
  end
44
63
  end
45
64
 
@@ -47,146 +66,194 @@ class InvoicingServices < ActiveRecord::Migration
47
66
  unless table_exists?(:invoice_items)
48
67
  create_table :invoice_items do |t|
49
68
  #foreign keys
50
- t.column :invoice_id, :integer
51
- t.column :invoice_item_type_id, :integer
69
+ t.references :invoice
70
+ t.references :invoice_item_type
52
71
 
53
72
  #these columns support the polymporphic relationship to invoice-able items
54
- t.column :invoiceable_item_type, :string
55
- t.column :invoiceable_item_id, :integer
73
+ t.references :invoiceable_item, :polymorphic => true
56
74
 
57
75
  #non-key columns
58
- t.column :item_seq_id, :integer
59
- t.column :item_description, :string
60
- t.column :taxable_flag, :integer
61
- t.column :quantity, :float
62
- t.column :amount, :float
76
+ t.integer :item_seq_id
77
+ t.string :item_description
78
+ t.float :sales_tax
79
+ t.float :quantity
80
+ t.float :amount
63
81
 
64
82
  t.timestamps
65
83
  end
84
+
85
+ add_index :invoice_items, [:invoiceable_item_id, :invoiceable_item_type], :name => 'invoiceable_item_idx'
86
+ add_index :invoice_items, :invoice_id, :name => 'invoice_id_idx'
87
+ add_index :invoice_items, :invoice_item_type_id, :name => 'invoice_item_type_id_idx'
66
88
  end
67
89
 
68
90
  # Create invoice item types
69
91
  unless table_exists?(:invoice_item_types)
70
92
  create_table :invoice_item_types do |t|
71
- t.column :parent_id, :integer
72
- t.column :lft, :integer
73
- t.column :rgt, :integer
74
-
75
- #custom columns go here
76
- t.column :description, :string
77
- t.column :comments, :string
78
- t.column :internal_identifier, :string
79
- t.column :external_identifier, :string
80
- t.column :external_id_source, :string
81
-
82
- t.timestamps
93
+ t.integer :parent_id
94
+ t.integer :lft
95
+ t.integer :rgt
96
+
97
+ #custom columns go here
98
+ t.string :description
99
+ t.string :comments
100
+ t.string :internal_identifier
101
+ t.string :external_identifier
102
+ t.string :external_id_source
103
+
104
+ t.timestamps
83
105
  end
84
106
  end
85
107
 
86
108
  # Create invoice_party_roles
87
109
  unless table_exists?(:invoice_party_roles)
88
110
  create_table :invoice_party_roles do |t|
89
- t.column :description, :string
90
- t.column :invoice_id, :integer
91
- t.column :party_id, :integer
92
- t.column :role_type_id, :integer
93
- t.column :external_identifier, :string
94
- t.column :external_id_source, :string
111
+ t.string :description
112
+ t.integer :role_type_id
113
+ t.string :external_identifier
114
+ t.string :external_id_source
115
+ t.references :invoice
116
+ t.references :party
95
117
 
96
118
  t.timestamps
97
119
  end
120
+
121
+ add_index :invoice_party_roles, :invoice_id, :name => 'invoice_party_invoice_id_idx'
122
+ add_index :invoice_party_roles, :party_id, :name => 'invoice_party_party_id_idx'
98
123
  end
99
124
 
100
- #*********************************************************************************************
101
- # This is a deferred specialization of FinancialTxnAccount - see rak or rh for details
102
- #*********************************************************************************************
103
- # # Create billing accounts
104
- # unless table_exists?(:billing_accounts)
105
- # create_table :billing_accounts do |t|
106
- # t.column :description, :string
107
- # t.column :from_date, :date
108
- # t.column :thru_date, :date
109
- #
110
- # t.timestamps
111
- # end
112
- # end
125
+
126
+ unless table_exists?(:billing_accounts)
127
+ create_table :billing_accounts do |t|
128
+ t.boolean :send_paper_bills, :default => false
129
+ t.boolean :payable_online, :default => false
130
+ t.date :billing_date
131
+
132
+ t.timestamps
133
+ end
134
+ end
113
135
 
114
136
  # Create billing contact mechanisms
115
137
  unless table_exists?(:billing_contact_mechanisms)
116
138
  create_table :billing_contact_mechanisms do |t|
117
- t.column :description, :string
139
+ t.string :description
118
140
  #these columns support a polymorphic relationship to the contact mechanism for an invoice and billing account
119
141
  #this allows for the use of email, postal addresses and other contact points to be used in billing
120
- t.column :contact_mechanism_type, :string
121
- t.column :contact_mechanism_id, :integer
142
+ t.references :contact_mechanism, :polymorphic => true
122
143
 
123
144
  t.timestamps
124
145
  end
146
+
147
+ add_index :billing_contact_mechanisms, [:contact_mechanism_id, :contact_mechanism_type], :name => 'billing_contact_mechanism_idx'
125
148
  end
126
149
 
127
- #*********************************************************************************************
128
- # This is a deferred extension of the base payments model in ecomm - see rak or rh for details
129
- #*********************************************************************************************
130
- # # Create payments
131
- # unless table_exists?(:payments)
132
- # create_table :payments do |t|
133
- #
134
- # t.column :effective_date, :date
135
- #
136
- # t.column :internal_identifier, :string
137
- # t.column :external_identifier, :string
138
- # t.column :external_id_source, :string
139
- #
140
- # #Payments here is set up to point to an amount which allows it to be
141
- # #in multiple currencies
142
- # t.column :money_amount_id, :integer
143
- # t.column :comment, :string
144
- #
145
- # t.timestamps
146
- # end
147
- # end
150
+ unless table_exists?(:recurring_payments)
151
+ create_table :recurring_payments do |t|
152
+ t.references :payment_account, :polymorphic => true
153
+ t.references :billing_account
154
+ t.float :pay_up_to_amount
155
+ t.float :payment_amount
156
+ t.integer :payment_day
157
+ t.date :from_date
158
+ t.date :thru_date
159
+ t.boolean :enabled
160
+
161
+ t.timestamps
162
+ end
163
+
164
+ add_index :recurring_payments, [:payment_account_id, :payment_account_type], :name => 'payment_account_idx'
165
+ add_index :recurring_payments, :billing_account_id
166
+ end
148
167
 
149
168
  # Create payment applictions
150
169
  unless table_exists?(:payment_applications)
151
170
  create_table :payment_applications do |t|
152
171
 
153
- t.column :payment_id, :integer
172
+ t.integer :financial_txn_id
154
173
 
155
174
  #these columns support the polymporphic relationship to the entities to which payments can be applied
156
175
  #this will be innvoices, invoice items or accounts
157
- t.column :payment_applied_to_type, :string
158
- t.column :payment_applied_to_id, :integer
176
+ t.references :payment_applied_to, :polymorphic => true
159
177
 
160
178
  #Payments here is set up to point to an amount which allows it to be
161
179
  #in multiple currencies
162
- t.column :applied_money_amount_id, :integer
163
- t.column :comment, :string
180
+ t.integer :applied_money_amount_id
181
+ t.string :comment
164
182
 
165
183
  t.timestamps
166
184
  end
185
+
186
+ add_index :payment_applications, [:payment_applied_to_id, :payment_applied_to_type], :name => 'payment_applied_to_idx'
187
+ add_index :payment_applications, :financial_txn_id
188
+ add_index :payment_applications, :applied_money_amount_id
167
189
  end
168
190
 
169
- # Create payment party roles
170
- unless table_exists?(:payment_party_roles)
171
- create_table :payment_party_roles do |t|
172
- t.column :description, :string
173
- t.column :payment_id, :integer
174
- t.column :party_id, :integer
175
- t.column :role_type_id, :integer
176
- t.column :external_identifier, :string
177
- t.column :external_id_source, :string
178
-
191
+ unless table_exists? :invoice_payment_term_sets
192
+ create_table :invoice_payment_term_sets do |t|
193
+ #foreign keys
194
+ t.references :invoice
195
+ t.references :invoice_item
196
+
197
+ #custom columns go here
198
+ t.string :description
199
+ t.string :comments
200
+ t.string :internal_identifier
201
+ t.string :external_identifier
202
+ t.string :external_id_source
203
+
204
+ t.timestamps
205
+ end
206
+
207
+ add_index :invoice_payment_term_sets, :invoice_id
208
+ add_index :invoice_payment_term_sets, :invoice_item_id
209
+ end
210
+
211
+ unless table_exists? :invoice_payment_terms
212
+ create_table :invoice_payment_terms do |t|
213
+ #foreign keys
214
+ t.references :invoice_payment_term_type
215
+ t.references :invoice_payment_term_set
216
+
217
+ #non-key columns
218
+ t.string :description
219
+ t.date :pay_by
220
+ t.float :amount
221
+
222
+ t.timestamps
223
+ end
224
+
225
+ add_index :invoice_payment_terms, :invoice_payment_term_type_id
226
+ add_index :invoice_payment_terms, :invoice_payment_term_set_id
227
+ end
228
+
229
+ unless table_exists? :invoice_payment_term_types
230
+ create_table :invoice_payment_term_types do |t|
231
+ #awesome nested set columns
232
+ t.integer :parent_id
233
+ t.integer :lft
234
+ t.integer :rgt
235
+
236
+ #custom columns go here
237
+ t.string :description
238
+ t.string :comments
239
+ t.string :internal_identifier
240
+ t.string :external_identifier
241
+ t.string :external_id_source
242
+
179
243
  t.timestamps
180
244
  end
181
245
  end
246
+
182
247
 
183
248
  end
184
249
 
185
250
  def self.down
186
251
  [
187
- :invoices, :invoice_types,
188
- :invoice_items, :invoice_item_types, :invoice_party_roles, :billing_accounts, :billing_contact_mechanisms,
189
- :payment_applications, :payment_party_roles
252
+ :invoices, :invoice_types, :invoice_payment_strategy_types,
253
+ :invoice_items, :invoice_item_types, :invoice_party_roles,
254
+ :billing_accounts, :billing_contact_mechanisms,
255
+ :payment_applications, :payment_party_roles, :recurring_payments,
256
+ :invoice_payment_term_sets,:invoice_payment_terms,:invoice_payment_term_types
190
257
  ].each do |tbl|
191
258
  if table_exists?(tbl)
192
259
  drop_table tbl
@@ -0,0 +1,13 @@
1
+ class AddTextToPayToRecurringPayments < ActiveRecord::Migration
2
+ def up
3
+ unless columns(:recurring_payments).collect {|c| c.name}.include?('text_to_pay')
4
+ add_column :recurring_payments, :text_to_pay, :boolean
5
+ end
6
+ end
7
+
8
+ def down
9
+ if columns(:recurring_payments).collect {|c| c.name}.include?('text_to_pay')
10
+ remove_column :recurring_payments, :text_to_pay
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ class AddBillingDateToBillingAccount < ActiveRecord::Migration
2
+ def up
3
+ unless columns(:billing_accounts).collect {|c| c.name}.include?('billing_date')
4
+ add_column :billing_accounts, :billing_date, :date
5
+ end
6
+ end
7
+
8
+ def down
9
+ if columns(:billing_accounts).collect {|c| c.name}.include?('billing_date')
10
+ remove_column :billing_accounts, :billing_date
11
+ end
12
+ end
13
+ end
@@ -6,5 +6,10 @@ 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
14
  end
10
15
  end
@@ -1,3 +1,9 @@
1
1
  module ErpInvoicing
2
- VERSION = "3.0.0"
2
+ module VERSION #:nodoc:
3
+ MAJOR = 3
4
+ MINOR = 0
5
+ TINY = 1
6
+
7
+ STRING = [MAJOR, MINOR, TINY].compact.join('.')
8
+ end
3
9
  end
data/lib/erp_invoicing.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require "erp_invoicing/version"
1
2
  require "erp_invoicing/engine"
2
3
 
3
4
  module ErpInvoicing
@@ -0,0 +1,80 @@
1
+ Ext.define("Compass.ErpApp.Desktop.Applications.InvoiceManagement.BillingAccountsPanel",{
2
+ extend:"Ext.panel.Panel",
3
+ alias:'widget.invoicemanagement-billingaccountspanel',
4
+ title:'Billing Accounts',
5
+
6
+ constructor : function(config) {
7
+ var tabPanel = Ext.create("Ext.tab.Panel",{
8
+ region:'south',
9
+ plugins: Ext.create('Ext.ux.TabCloseMenu', {
10
+ extraItemsTail: [
11
+ '-',
12
+ {
13
+ text: 'Closable',
14
+ checked: true,
15
+ hideOnClick: true,
16
+ handler: function (item) {
17
+ currentItem.tab.setClosable(item.checked);
18
+ }
19
+ }
20
+ ],
21
+ listeners: {
22
+ aftermenu: function () {
23
+ currentItem = null;
24
+ },
25
+ beforemenu: function (menu, item) {
26
+ var menuitem = menu.child('*[text="Closable"]');
27
+ currentItem = item;
28
+ menuitem.setChecked(item.closable);
29
+ }
30
+ }
31
+ }),
32
+ height:250,
33
+ split:true,
34
+ collapsible:true,
35
+ items:[]
36
+ });
37
+
38
+ config = Ext.apply({
39
+ layout:'border',
40
+ autoScroll:true,
41
+ items:[
42
+ {
43
+ xtype:'shared-billingaccountsgridpanel',
44
+ title:'',
45
+ showAddDelete:true,
46
+ region:'center',
47
+ listeners:{
48
+ 'itemclick':function(view, record, item, index, e, options){
49
+ var billingAccountNumber = record.get("account_number");
50
+ var billingAccountId = record.get("id");
51
+ var itemId = 'invoices-' + billingAccountId;
52
+ var invoicesGridPanel = tabPanel.query('#'+itemId)[0];
53
+
54
+ if(Compass.ErpApp.Utility.isBlank(invoicesGridPanel)){
55
+ invoicesGridPanel = Ext.create('widget.shared-invoicesgridpanel',{
56
+ billingAccountNumber:billingAccountNumber,
57
+ billingAccountId:billingAccountId,
58
+ itemId:itemId,
59
+ showAddDelete:true,
60
+ closable:true,
61
+ title:billingAccountNumber + ' Invoices'
62
+ });
63
+ tabPanel.add(invoicesGridPanel);
64
+ }
65
+ else{
66
+ invoicesGridPanel.store.load();
67
+ }
68
+
69
+ tabPanel.setActiveTab(invoicesGridPanel);
70
+ }
71
+ }
72
+ },
73
+ tabPanel]
74
+ }, config);
75
+
76
+ this.callParent([config]);
77
+ }
78
+
79
+ });
80
+
@@ -0,0 +1,48 @@
1
+ Ext.define("Compass.ErpApp.Desktop.Applications.InvoiceManagement.InvoicesPanel",{
2
+ extend:"Ext.panel.Panel",
3
+ alias:'widget.invoicemanagement_invoicespanel',
4
+ title:'Invoices',
5
+
6
+ constructor : function(config) {
7
+ var tabPanel = Ext.create("Ext.tab.Panel",{
8
+ region:'south',
9
+ height:250,
10
+ split:true,
11
+ collapsible:true,
12
+ items:[
13
+ {xtype:'shared-invoiceitemsgridpanel'},
14
+ {xtype:'shared-paymentsgridpanel'}
15
+ ]
16
+ });
17
+
18
+ config = Ext.apply({
19
+ layout:'border',
20
+ autoScroll:true,
21
+ items:[{
22
+ xtype:'shared-invoicesgridpanel',
23
+ title:'',
24
+ region:'center',
25
+ showAddDelete:true,
26
+ listeners:{
27
+ 'itemclick':function(view, record, item, index, e, options){
28
+ var invoiceId = record.get("id");
29
+ var itemsStore = tabPanel.query('shared-invoiceitemsgridpanel')[0].getStore();
30
+ itemsStore.proxy.extraParams.invoice_id = invoiceId;
31
+ itemsStore.load();
32
+
33
+ var paymentsStore = tabPanel.query('shared-paymentsgridpanel')[0].getStore();
34
+ paymentsStore.proxy.extraParams.invoice_id = invoiceId;
35
+ paymentsStore.load();
36
+
37
+
38
+ tabPanel.setActiveTab(0);
39
+ }
40
+ }
41
+ },tabPanel]
42
+ }, config);
43
+
44
+ this.callParent([config]);
45
+ }
46
+
47
+ });
48
+
@@ -0,0 +1,36 @@
1
+ Ext.define("Compass.ErpApp.Desktop.Applications.InvoiceManagement",{
2
+ extend:"Ext.ux.desktop.Module",
3
+ id:'invoice_management-win',
4
+ init : function(){
5
+ this.launcher = {
6
+ text: 'Invoice Management',
7
+ iconCls:'icon-creditcards',
8
+ handler: this.createWindow,
9
+ scope: this
10
+ }
11
+ },
12
+
13
+ createWindow : function(){
14
+ var desktop = this.app.getDesktop();
15
+ var win = desktop.getWindow('invoice_management');
16
+ if(!win){
17
+
18
+ win = desktop.createWindow({
19
+ id: 'invoice_management',
20
+ title:'Invoice Management',
21
+ width:1200,
22
+ height:800,
23
+ iconCls: 'icon-creditcards',
24
+ shim:false,
25
+ animCollapse:false,
26
+ constrainHeader:true,
27
+ layout: 'fit',
28
+ items:[
29
+ {xtype:'tabpanel', items:[{xtype:'invoicemanagement-billingaccountspanel'},
30
+ {xtype:'invoicemanagement_invoicespanel'}]}
31
+ ]
32
+ });
33
+ }
34
+ win.show();
35
+ }
36
+ });