erp_invoicing 3.1.0 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/app/models/extensions/party.rb +15 -3
- data/app/models/invoice.rb +33 -1
- data/app/models/invoice_party_role.rb +16 -0
- data/app/models/payment_application.rb +17 -1
- data/lib/erp_invoicing/engine.rb +1 -1
- data/lib/erp_invoicing/version.rb +6 -2
- metadata +31 -234
- data/app/assets/javascripts/erp_invoicing/application.js +0 -9
- data/app/assets/stylesheets/erp_invoicing/application.css +0 -7
- data/app/controllers/erp_invoicing/erp_app/organizer/bill_pay/accounts_controller.rb +0 -166
- data/app/controllers/erp_invoicing/erp_app/organizer/bill_pay/base_controller.rb +0 -22
- data/app/controllers/erp_invoicing/erp_app/shared/billing_accounts_controller.rb +0 -111
- data/app/controllers/erp_invoicing/erp_app/shared/files_controller.rb +0 -52
- data/app/controllers/erp_invoicing/erp_app/shared/invoices_controller.rb +0 -208
- data/app/controllers/erp_invoicing/sms_controller.rb +0 -156
- data/app/helpers/erp_invoicing/application_helper.rb +0 -4
- data/app/views/layouts/erp_invoicing/application.html.erb +0 -14
- data/db/data_migrations/20111121153349_create_bill_pay_organizer_application.rb +0 -14
- data/db/data_migrations/20120118181839_create_invoice_management_desktop_application.rb +0 -26
- data/db/data_migrations/20120229174322_add_billpay_widget.rb +0 -26
- data/public/javascripts/erp_app/desktop/applications/invoice_management/billing_accounts_panel.js +0 -79
- data/public/javascripts/erp_app/desktop/applications/invoice_management/invoices_panel.js +0 -48
- data/public/javascripts/erp_app/desktop/applications/invoice_management/module.js +0 -36
- data/public/javascripts/erp_app/organizer/applications/bill_pay/base.js +0 -146
- data/public/javascripts/erp_app/organizer/applications/bill_pay/extensions.js +0 -21
- data/public/javascripts/erp_app/organizer/applications/bill_pay/make_payment_window.js +0 -109
- data/public/javascripts/erp_app/organizer/applications/bill_pay/payment_accounts_grid_panel.js +0 -105
- data/public/javascripts/erp_app/organizer/applications/bill_pay/transactions_grid_panel.js +0 -84
- data/public/javascripts/erp_app/shared/add_invoice_window.js +0 -220
- data/public/javascripts/erp_app/shared/billing_accounts_grid_panel.js +0 -316
- data/public/javascripts/erp_app/shared/invoice_items_grid_panel.js +0 -152
- data/public/javascripts/erp_app/shared/invoices_grid_panel.js +0 -361
- data/public/javascripts/erp_app/shared/payments_grid_panel.js +0 -74
- data/spec/dummy/db/data_migrations/20101011152441_payment_gateway_actions.erp_commerce.rb +0 -28
- data/spec/dummy/db/data_migrations/20101014142230_financial_txn_types.erp_txns_and_accts.rb +0 -16
- data/spec/dummy/db/data_migrations/20110109173616_create_capability_scope_types.erp_tech_svcs.rb +0 -15
- data/spec/dummy/db/data_migrations/20110324010232_product_role_types.erp_products.rb +0 -24
- data/spec/dummy/db/data_migrations/20110509223702_add_publisher_role.knitkit.rb +0 -22
- data/spec/dummy/db/data_migrations/20110525001935_add_usd_currency.erp_base_erp_svcs.rb +0 -12
- data/spec/dummy/db/data_migrations/20110527160807_add_default_prod_avail_types.erp_products.rb +0 -27
- data/spec/dummy/db/data_migrations/20110605231556_create_order_party_roles.erp_orders.rb +0 -24
- data/spec/dummy/db/data_migrations/20110608185830_create_default_dynamic_models_and_forms.erp_forms.rb +0 -33
- data/spec/dummy/db/data_migrations/20110609150135_add_iso_codes.erp_base_erp_svcs.rb +0 -19
- data/spec/dummy/db/data_migrations/20110728201729_erp_app_setup.erp_app.rb +0 -252
- data/spec/dummy/db/data_migrations/20110728201730_create_desktop_app_product_manager.erp_products.rb +0 -26
- data/spec/dummy/db/data_migrations/20110728201731_create_desktop_app_order_manager.erp_orders.rb +0 -26
- data/spec/dummy/db/data_migrations/20110728201732_create_organizer_app_order_management.erp_orders.rb +0 -15
- data/spec/dummy/db/data_migrations/20110728201733_update_preferences.erp_app.rb +0 -53
- data/spec/dummy/db/data_migrations/20110802200222_schedule_delete_expired_sessions_job.erp_tech_svcs.rb +0 -16
- data/spec/dummy/db/data_migrations/20110816153456_add_knitkit_application.knitkit.rb +0 -32
- data/spec/dummy/db/data_migrations/20110816161238_create_desktop_app_audit_log_viewer.erp_app.rb +0 -21
- data/spec/dummy/db/data_migrations/20110817160743_add_file_manager_application.erp_app.rb +0 -32
- data/spec/dummy/db/data_migrations/20110828190913_create_desktop_app_dynamic_forms.erp_forms.rb +0 -19
- data/spec/dummy/db/data_migrations/20110913145838_setup_compass_ae_instance.erp_base_erp_svcs.rb +0 -12
- data/spec/dummy/db/data_migrations/20111108183739_add_default_capabilities.erp_app.rb +0 -23
- data/spec/dummy/db/data_migrations/20111108183740_add_new_contact_widgets.erp_app.rb +0 -42
- data/spec/dummy/db/data_migrations/20111111144706_setup_audit_log_types.erp_tech_svcs.rb +0 -22
- data/spec/dummy/db/data_migrations/20111118182910_setup_knitkit_capabilities.knitkit.rb +0 -128
- data/spec/dummy/db/data_migrations/20111121153349_create_bill_pay_organizer_application.erp_invoicing.rb +0 -15
- data/spec/dummy/db/data_migrations/20120109173616_create_download_capability_type.erp_tech_svcs.rb +0 -14
- data/spec/dummy/db/data_migrations/20120118181839_create_invoice_management_desktop_application.erp_invoicing.rb +0 -27
- data/spec/dummy/db/data_migrations/20120127144444_create_website_role_types.knitkit.rb +0 -14
- data/spec/dummy/db/data_migrations/20120127150505_create_website_default_configuration.knitkit.rb +0 -73
- data/spec/dummy/db/data_migrations/20120127150506_add_primary_host_to_website_configuration.knitkit.rb +0 -34
- data/spec/dummy/db/data_migrations/20120229160222_add_userinfo_widget.erp_app.rb +0 -29
- data/spec/dummy/db/data_migrations/20120229174322_add_billpay_widget.erp_invoicing.rb +0 -27
- data/spec/dummy/db/data_migrations/20120229174343_add_orders_widget.erp_orders.rb +0 -29
- data/spec/dummy/db/data_migrations/20120316150424_add_is_template_to_default_website_config.knitkit.rb +0 -17
- data/spec/dummy/db/data_migrations/20120405193721_create_party_and_role_type_for_communication_events.erp_app.rb +0 -11
- data/spec/dummy/db/data_migrations/20120411180756_create_user_management_mobile_application.erp_app.rb +0 -19
- data/spec/dummy/db/data_migrations/20120418164215_create_configuration_management_desktop_application.erp_app.rb +0 -23
- data/spec/dummy/db/data_migrations/20120605154637_add_calculate_balance_strategy_types.erp_invoicing.rb +0 -21
- data/spec/dummy/db/data_migrations/20120809020508_update_website_and_configuration.knitkit.rb +0 -78
- data/spec/dummy/db/data_migrations/20120824013449_create_ticket_form.erp_forms.rb +0 -67
- data/spec/dummy/db/data_migrations/20121026013449_update_ticket_form.erp_forms.rb +0 -65
- data/spec/dummy/db/data_migrations/20121026191738_update_contact_form.erp_forms.rb +0 -27
- data/spec/dummy/db/data_migrations/20121116155018_create_group_relationship_and_role_types.erp_tech_svcs.rb +0 -20
- data/spec/dummy/db/data_migrations/20121129185611_upgrade_website_role_iid.knitkit.rb +0 -21
- data/spec/dummy/db/data_migrations/20121130201859_upgrade_remove_system_mgmt_app.erp_app.rb +0 -16
- data/spec/dummy/db/data_migrations/20121130212146_note_capabilities.erp_tech_svcs.rb +0 -24
- data/spec/dummy/db/data_migrations/20121218175028_create_security_management_desktop_application.erp_app.rb +0 -23
- data/spec/dummy/db/migrate/20121214000230_base_erp_services.erp_base_erp_svcs.rb +0 -461
- data/spec/dummy/db/migrate/20121214000231_base_tech_services.erp_tech_svcs.rb +0 -255
- data/spec/dummy/db/migrate/20121214000232_create_has_attribute_tables.erp_tech_svcs.rb +0 -39
- data/spec/dummy/db/migrate/20121214000233_base_app_framework.erp_app.rb +0 -276
- data/spec/dummy/db/migrate/20121214000234_dynamic_forms.erp_forms.rb +0 -95
- data/spec/dummy/db/migrate/20121214000235_create_tickets.erp_forms.rb +0 -19
- data/spec/dummy/db/migrate/20121214000236_upgrade_dynamic_forms_table.erp_forms.rb +0 -32
- data/spec/dummy/db/migrate/20121214000237_setup_knitkit.knitkit.rb +0 -316
- data/spec/dummy/db/migrate/20121214000238_invoicing_services.erp_invoicing.rb +0 -277
- data/spec/dummy/db/migrate/20121214000239_base_inventory.erp_inventory.rb +0 -91
- data/spec/dummy/db/migrate/20121214000240_base_inventory_indexes.erp_inventory.rb +0 -48
- data/spec/dummy/db/migrate/20121214000241_base_txns_and_accts.erp_txns_and_accts.rb +0 -364
- data/spec/dummy/db/migrate/20121214000242_agreements_services.erp_agreements.rb +0 -160
- data/spec/dummy/db/migrate/20121214000243_agreements_services_indexes.erp_agreements.rb +0 -52
- data/spec/dummy/db/migrate/20121214000244_base_orders.erp_orders.rb +0 -178
- data/spec/dummy/db/migrate/20121214000245_base_products.erp_products.rb +0 -234
- data/spec/dummy/db/migrate/20121214000246_base_products_indexes.erp_products.rb +0 -59
- data/spec/dummy/db/migrate/20121214000247_erp_commerce_base.erp_commerce.rb +0 -442
- data/spec/dummy/db/migrate/20121214000248_base_work_efforts.erp_work_effort.rb +0 -211
- data/spec/dummy/db/migrate/20130107181155_create_groups.erp_tech_svcs.rb +0 -19
- data/spec/dummy/db/migrate/20130107181156_upgrade_security.erp_tech_svcs.rb +0 -54
- data/spec/dummy/db/migrate/20130107181157_upgrade_security2.erp_tech_svcs.rb +0 -270
- data/spec/dummy/db/schema.rb +0 -2569
- data/spec/dummy/db/spec.sqlite3 +0 -0
- data/spec/dummy/log/spec.log +0 -64744
@@ -1,316 +0,0 @@
|
|
1
|
-
Ext.define('Compass.ErpApp.Shared.BillingAccount',{
|
2
|
-
extend:'Ext.data.Model',
|
3
|
-
fields:[{
|
4
|
-
name:'id'
|
5
|
-
},{
|
6
|
-
name:'account_number'
|
7
|
-
},{
|
8
|
-
name:'calculate_balance'
|
9
|
-
},{
|
10
|
-
name:'payment_due'
|
11
|
-
},{
|
12
|
-
name:'balance'
|
13
|
-
},{
|
14
|
-
name:'due_date'
|
15
|
-
},{
|
16
|
-
name:'balance_date'
|
17
|
-
},{
|
18
|
-
name:'payable_online'
|
19
|
-
},{
|
20
|
-
name:'send_paper_bills'
|
21
|
-
}],
|
22
|
-
validations:[
|
23
|
-
{
|
24
|
-
type:'presence',
|
25
|
-
field: 'account_number'
|
26
|
-
},
|
27
|
-
{
|
28
|
-
type:'presence',
|
29
|
-
field: 'balance'
|
30
|
-
},
|
31
|
-
{
|
32
|
-
type:'presence',
|
33
|
-
field: 'payment_due'
|
34
|
-
}
|
35
|
-
]
|
36
|
-
});
|
37
|
-
|
38
|
-
Ext.define("Compass.ErpApp.Shared.BillingAccountsGridPanel",{
|
39
|
-
extend:"Ext.grid.Panel",
|
40
|
-
alias:'widget.shared-billingaccountsgridpanel',
|
41
|
-
title:'Billing Accounts',
|
42
|
-
addDocument : function(rec){
|
43
|
-
var uploadWindow = new Compass.ErpApp.Shared.UploadWindow({
|
44
|
-
standardUploadUrl:'/erp_invoicing/erp_app/shared/billing_accounts/'+rec.get('id')+'/upload_file',
|
45
|
-
extraPostData:{}
|
46
|
-
});
|
47
|
-
uploadWindow.show();
|
48
|
-
},
|
49
|
-
|
50
|
-
initComponent : function(){
|
51
|
-
this.setParams = function(params) {
|
52
|
-
this.partyId = params.partyId;
|
53
|
-
this.store.proxy.extraParams.party_id = params.partyId;
|
54
|
-
};
|
55
|
-
|
56
|
-
this.callParent(this.arguemnts);
|
57
|
-
},
|
58
|
-
|
59
|
-
constructor : function(config) {
|
60
|
-
var self = this;
|
61
|
-
|
62
|
-
var store = Ext.create('Ext.data.Store', {
|
63
|
-
fields:['id', 'account_number', 'calculate_balance', 'payment_due','balance', {
|
64
|
-
name:'due_date',
|
65
|
-
type:'date',
|
66
|
-
dateFormat:'Y-m-d'
|
67
|
-
}, {
|
68
|
-
name:'balance_date',
|
69
|
-
type:'date',
|
70
|
-
dateFormat:'Y-m-d'
|
71
|
-
},'payable_online','send_paper_bills'],
|
72
|
-
autoLoad: Compass.ErpApp.Utility.isBlank(config['autoLoad']) ? true : config['autoLoad'],
|
73
|
-
autoSync: true,
|
74
|
-
proxy: {
|
75
|
-
type: 'rest',
|
76
|
-
url:'/erp_invoicing/erp_app/shared/billing_accounts/index',
|
77
|
-
extraParams:{
|
78
|
-
account_number:null
|
79
|
-
},
|
80
|
-
reader: {
|
81
|
-
type: 'json',
|
82
|
-
successProperty: 'success',
|
83
|
-
idProperty: 'id',
|
84
|
-
root: 'billing_accounts',
|
85
|
-
totalProperty:'totalCount',
|
86
|
-
messageProperty: 'messages'
|
87
|
-
},
|
88
|
-
writer: {
|
89
|
-
type: 'json',
|
90
|
-
writeAllFields:true,
|
91
|
-
root: 'billingAccount'
|
92
|
-
},
|
93
|
-
listeners: {
|
94
|
-
exception: function(proxy, response, operation){
|
95
|
-
Ext.MessageBox.show({
|
96
|
-
title: 'REMOTE EXCEPTION',
|
97
|
-
msg: 'Error performing action please try again.',
|
98
|
-
icon: Ext.MessageBox.ERROR,
|
99
|
-
buttons: Ext.Msg.OK
|
100
|
-
});
|
101
|
-
}
|
102
|
-
}
|
103
|
-
}
|
104
|
-
});
|
105
|
-
|
106
|
-
var editingPlugin = Ext.create('Ext.grid.plugin.RowEditing', {
|
107
|
-
clicksToMoveEditor: 1
|
108
|
-
});
|
109
|
-
|
110
|
-
var tbar = {
|
111
|
-
items:[]
|
112
|
-
};
|
113
|
-
if(config.showAddDelete){
|
114
|
-
tbar.items.push({
|
115
|
-
text: 'Add',
|
116
|
-
xtype:'button',
|
117
|
-
iconCls: 'icon-add',
|
118
|
-
handler: function(button) {
|
119
|
-
var grid = button.up('shared-billingaccountsgridpanel');
|
120
|
-
grid.store.insert(0, new Compass.ErpApp.Shared.BillingAccount({
|
121
|
-
payment_due:0.00,
|
122
|
-
balance:0.00,
|
123
|
-
due_date:new Date(),
|
124
|
-
balance_date:new Date()
|
125
|
-
}));
|
126
|
-
editingPlugin.startEdit(0,0);
|
127
|
-
}
|
128
|
-
});
|
129
|
-
|
130
|
-
tbar.items.push('-');
|
131
|
-
tbar.items.push({
|
132
|
-
text: 'Delete',
|
133
|
-
type:'button',
|
134
|
-
iconCls: 'icon-delete',
|
135
|
-
handler: function(button) {
|
136
|
-
Ext.MessageBox.confirm('Confirm', 'Are you sure you want to delete this billing account?', function(btn){
|
137
|
-
if(btn == 'no'){
|
138
|
-
return false;
|
139
|
-
}
|
140
|
-
else
|
141
|
-
{
|
142
|
-
var selection = self.getView().getSelectionModel().getSelection()[0];
|
143
|
-
if (selection) {
|
144
|
-
store.remove(selection);
|
145
|
-
}
|
146
|
-
}
|
147
|
-
});
|
148
|
-
}
|
149
|
-
});
|
150
|
-
tbar.items.push('|');
|
151
|
-
}
|
152
|
-
|
153
|
-
tbar.items = tbar.items.concat([
|
154
|
-
'<span class="x-btn-inner">Account Number:</span>',
|
155
|
-
{
|
156
|
-
xtype:'textfield',
|
157
|
-
hideLabel:true,
|
158
|
-
itemId:'accountNumberSearchTextField'
|
159
|
-
},
|
160
|
-
{
|
161
|
-
text:'Search',
|
162
|
-
iconCls:'icon-search',
|
163
|
-
handler:function(btn){
|
164
|
-
var grid = btn.up('shared-billingaccountsgridpanel');
|
165
|
-
grid.store.proxy.extraParams.account_number = grid.query('#accountNumberSearchTextField').first().getValue();
|
166
|
-
grid.store.load();
|
167
|
-
}
|
168
|
-
},
|
169
|
-
'|',
|
170
|
-
{
|
171
|
-
text: 'All',
|
172
|
-
xtype:'button',
|
173
|
-
iconCls: 'icon-eye',
|
174
|
-
handler: function(btn) {
|
175
|
-
var grid = btn.up('shared-billingaccountsgridpanel');
|
176
|
-
grid.store.proxy.extraParams.account_number = null;
|
177
|
-
grid.store.load();
|
178
|
-
}
|
179
|
-
}]);
|
180
|
-
|
181
|
-
config = Ext.apply({
|
182
|
-
plugins:[editingPlugin],
|
183
|
-
columns: [
|
184
|
-
{
|
185
|
-
header:'Account Number',
|
186
|
-
width:300,
|
187
|
-
dataIndex: 'account_number',
|
188
|
-
editor:{
|
189
|
-
xtype:'textfield'
|
190
|
-
}
|
191
|
-
},
|
192
|
-
{
|
193
|
-
header:'Send Paper Bills',
|
194
|
-
width:100,
|
195
|
-
sortable: false,
|
196
|
-
dataIndex: 'send_paper_bills',
|
197
|
-
renderer:function(v){
|
198
|
-
var result = ''
|
199
|
-
if(v){
|
200
|
-
result = 'Yes';
|
201
|
-
}
|
202
|
-
else{
|
203
|
-
result = 'No';
|
204
|
-
}
|
205
|
-
return result;
|
206
|
-
},
|
207
|
-
editor:{
|
208
|
-
xtype:'combo',
|
209
|
-
store:[[true,'Yes'],[false,'No']],
|
210
|
-
forceSelection:true,
|
211
|
-
triggerAction:'all'
|
212
|
-
}
|
213
|
-
},
|
214
|
-
{
|
215
|
-
header:'Payable Online',
|
216
|
-
width:100,
|
217
|
-
sortable: false,
|
218
|
-
dataIndex: 'payable_online',
|
219
|
-
renderer:function(v){
|
220
|
-
var result = ''
|
221
|
-
if(v){
|
222
|
-
result = 'Yes';
|
223
|
-
}
|
224
|
-
else{
|
225
|
-
result = 'No';
|
226
|
-
}
|
227
|
-
return result;
|
228
|
-
},
|
229
|
-
editor:{
|
230
|
-
xtype:'combo',
|
231
|
-
store:[[true,'Yes'],[false,'No']],
|
232
|
-
forceSelection:true,
|
233
|
-
triggerAction:'all'
|
234
|
-
}
|
235
|
-
},
|
236
|
-
{
|
237
|
-
header:'Calculate Balance',
|
238
|
-
width:100,
|
239
|
-
sortable: false,
|
240
|
-
dataIndex: 'calculate_balance',
|
241
|
-
renderer:function(v){
|
242
|
-
var result = ''
|
243
|
-
if(v){
|
244
|
-
result = 'Yes';
|
245
|
-
}
|
246
|
-
else{
|
247
|
-
result = 'No';
|
248
|
-
}
|
249
|
-
return result;
|
250
|
-
},
|
251
|
-
editor:{
|
252
|
-
xtype:'combo',
|
253
|
-
store:[[true,'Yes'],[false,'No']],
|
254
|
-
forceSelection:true,
|
255
|
-
triggerAction:'all'
|
256
|
-
}
|
257
|
-
},
|
258
|
-
{
|
259
|
-
header:'Payment Due',
|
260
|
-
width:100,
|
261
|
-
dataIndex: 'payment_due',
|
262
|
-
renderer:function(v){
|
263
|
-
return parseFloat(v).toFixed(2);
|
264
|
-
},
|
265
|
-
editor:{
|
266
|
-
xtype:'numberfield'
|
267
|
-
}
|
268
|
-
},
|
269
|
-
{
|
270
|
-
header:'Balance',
|
271
|
-
width:100,
|
272
|
-
dataIndex: 'balance',
|
273
|
-
renderer:function(v){
|
274
|
-
return parseFloat(v).toFixed(2);
|
275
|
-
},
|
276
|
-
editor:{
|
277
|
-
xtype:'numberfield'
|
278
|
-
}
|
279
|
-
},
|
280
|
-
{
|
281
|
-
header:'Balance Date',
|
282
|
-
width:150,
|
283
|
-
dataIndex: 'balance_date',
|
284
|
-
renderer: Ext.util.Format.dateRenderer('m/d/Y'),
|
285
|
-
editor:{
|
286
|
-
xtype:'datefield'
|
287
|
-
}
|
288
|
-
},
|
289
|
-
{
|
290
|
-
header:'Due Date',
|
291
|
-
width:150,
|
292
|
-
dataIndex: 'due_date',
|
293
|
-
renderer: Ext.util.Format.dateRenderer('m/d/Y'),
|
294
|
-
editor:{
|
295
|
-
xtype:'datefield'
|
296
|
-
}
|
297
|
-
}
|
298
|
-
],
|
299
|
-
store:store,
|
300
|
-
loadMask: true,
|
301
|
-
autoScroll:true,
|
302
|
-
stripeRows: true,
|
303
|
-
tbar:tbar,
|
304
|
-
bbar:Ext.create("Ext.PagingToolbar",{
|
305
|
-
pageSize:50,
|
306
|
-
store:store,
|
307
|
-
displayInfo: true,
|
308
|
-
displayMsg: '{0} - {1} of {2}',
|
309
|
-
emptyMsg: "Empty"
|
310
|
-
})
|
311
|
-
|
312
|
-
}, config);
|
313
|
-
|
314
|
-
this.callParent([config]);
|
315
|
-
}
|
316
|
-
});
|
@@ -1,152 +0,0 @@
|
|
1
|
-
Ext.define('Compass.ErpApp.Shared.InvoiceItem',{
|
2
|
-
extend:'Ext.data.Model',
|
3
|
-
fields:['item_description','quantity', 'id','created_at','amount', 'invoice_id'],
|
4
|
-
validations:[
|
5
|
-
{
|
6
|
-
type:'presence',
|
7
|
-
field:'item_description'
|
8
|
-
},
|
9
|
-
{
|
10
|
-
type:'presence',
|
11
|
-
field:'quantity'
|
12
|
-
},
|
13
|
-
{
|
14
|
-
type:'presence',
|
15
|
-
field:'amount'
|
16
|
-
}
|
17
|
-
]
|
18
|
-
});
|
19
|
-
|
20
|
-
Ext.define("Compass.ErpApp.Shared.InvoiceItemsGridPanel",{
|
21
|
-
extend:"Ext.grid.Panel",
|
22
|
-
alias:'widget.shared-invoiceitemsgridpanel',
|
23
|
-
title:'Invoice Items',
|
24
|
-
initComponent : function(){
|
25
|
-
this.callParent(this.arguemnts);
|
26
|
-
},
|
27
|
-
|
28
|
-
constructor : function(config) {
|
29
|
-
var self = this;
|
30
|
-
|
31
|
-
var store = Ext.create('Ext.data.Store', {
|
32
|
-
fields:['item_description','quantity', 'id','created_at','amount'],
|
33
|
-
autoLoad: false,
|
34
|
-
autoSync: true,
|
35
|
-
proxy: {
|
36
|
-
type: 'rest',
|
37
|
-
url:'/erp_invoicing/erp_app/shared/invoices/invoice_items',
|
38
|
-
extraParams:{
|
39
|
-
invoice_id:null
|
40
|
-
},
|
41
|
-
reader: {
|
42
|
-
type: 'json',
|
43
|
-
successProperty: 'success',
|
44
|
-
idProperty: 'id',
|
45
|
-
root: 'invoice_items',
|
46
|
-
totalProperty:'totalCount',
|
47
|
-
messageProperty: 'messages'
|
48
|
-
},
|
49
|
-
writer: {
|
50
|
-
type: 'json',
|
51
|
-
writeAllFields:true,
|
52
|
-
root: 'data'
|
53
|
-
},
|
54
|
-
listeners: {
|
55
|
-
exception: function(proxy, response, operation){
|
56
|
-
Ext.MessageBox.show({
|
57
|
-
title: 'REMOTE EXCEPTION',
|
58
|
-
msg: 'Error performing action please try again.',
|
59
|
-
icon: Ext.MessageBox.ERROR,
|
60
|
-
buttons: Ext.Msg.OK
|
61
|
-
});
|
62
|
-
}
|
63
|
-
}
|
64
|
-
}
|
65
|
-
});
|
66
|
-
|
67
|
-
this.editingPlugin = Ext.create('Ext.grid.plugin.RowEditing', {
|
68
|
-
clicksToMoveEditor: 1
|
69
|
-
});
|
70
|
-
|
71
|
-
config = Ext.apply({
|
72
|
-
plugins:[this.editingPlugin],
|
73
|
-
layout:'fit',
|
74
|
-
columns: [
|
75
|
-
{
|
76
|
-
header:'Description',
|
77
|
-
width:500,
|
78
|
-
sortable: false,
|
79
|
-
dataIndex: 'item_description',
|
80
|
-
editor:{
|
81
|
-
xtype:'textfield'
|
82
|
-
}
|
83
|
-
},
|
84
|
-
{
|
85
|
-
header:'Quantity',
|
86
|
-
sortable: false,
|
87
|
-
dataIndex: 'quantity',
|
88
|
-
editor:{
|
89
|
-
xtype:'numberfield'
|
90
|
-
}
|
91
|
-
},
|
92
|
-
{
|
93
|
-
header:'Amount',
|
94
|
-
sortable: true,
|
95
|
-
dataIndex: 'amount',
|
96
|
-
editor:{
|
97
|
-
xtype:'numberfield'
|
98
|
-
}
|
99
|
-
|
100
|
-
},
|
101
|
-
{
|
102
|
-
header: 'Created At',
|
103
|
-
sortable: true,
|
104
|
-
width:150,
|
105
|
-
dataIndex: 'created_at',
|
106
|
-
renderer: Ext.util.Format.dateRenderer('m/d/Y H:i:s')
|
107
|
-
}
|
108
|
-
],
|
109
|
-
autoScroll:true,
|
110
|
-
stripeRows: true,
|
111
|
-
store:store,
|
112
|
-
viewConfig:{
|
113
|
-
loadMask:false,
|
114
|
-
forceFit:true
|
115
|
-
},
|
116
|
-
tbar:{
|
117
|
-
items:[{
|
118
|
-
text: 'Add',
|
119
|
-
xtype:'button',
|
120
|
-
iconCls: 'icon-add',
|
121
|
-
handler: function(button) {
|
122
|
-
var grid = button.up('shared-invoiceitemsgridpanel');
|
123
|
-
var edit = grid.editingPlugin;
|
124
|
-
grid.store.insert(0, new Compass.ErpApp.Shared.InvoiceItem({invoice_id:grid.getStore().proxy.extraParams.invoice_id}));
|
125
|
-
edit.startEdit(0,0);
|
126
|
-
}
|
127
|
-
},'-',
|
128
|
-
{
|
129
|
-
text: 'Delete',
|
130
|
-
type:'button',
|
131
|
-
iconCls: 'icon-delete',
|
132
|
-
handler: function(button) {
|
133
|
-
Ext.MessageBox.confirm('Confirm', 'Are you sure you want to delete this invoice item?', function(btn){
|
134
|
-
if(btn == 'no'){
|
135
|
-
return false;
|
136
|
-
}
|
137
|
-
else
|
138
|
-
{
|
139
|
-
var selection = self.getView().getSelectionModel().getSelection()[0];
|
140
|
-
if (selection) {
|
141
|
-
self.store.remove(selection);
|
142
|
-
}
|
143
|
-
}
|
144
|
-
});
|
145
|
-
}
|
146
|
-
}]
|
147
|
-
}
|
148
|
-
}, config);
|
149
|
-
|
150
|
-
this.callParent([config]);
|
151
|
-
}
|
152
|
-
});
|