erp_invoicing 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. data/GPL-3-LICENSE +674 -0
  2. data/README.rdoc +3 -0
  3. data/Rakefile +31 -0
  4. data/app/assets/javascripts/erp_invoicing/application.js +9 -0
  5. data/app/assets/stylesheets/erp_invoicing/application.css +7 -0
  6. data/app/controllers/erp_invoicing/erp_app/organizer/bill_pay/accounts_controller.rb +108 -0
  7. data/app/controllers/erp_invoicing/erp_app/organizer/bill_pay/base_controller.rb +22 -0
  8. data/app/helpers/erp_invoicing/application_helper.rb +4 -0
  9. data/app/models/extensions/financial_txn_account.rb +7 -0
  10. data/app/models/extensions/product_instance.rb +10 -0
  11. data/app/models/extensions/product_type.rb +10 -0
  12. data/app/models/extensions/work_effort.rb +10 -0
  13. data/app/models/invoice.rb +16 -0
  14. data/app/models/invoice_item.rb +13 -0
  15. data/app/models/invoice_item_type.rb +2 -0
  16. data/app/models/invoice_party_role.rb +7 -0
  17. data/app/models/invoice_type.rb +2 -0
  18. data/app/models/payment_application.rb +6 -0
  19. data/app/views/layouts/erp_invoicing/application.html.erb +14 -0
  20. data/app/widgets/bill_pay/base.rb +230 -0
  21. data/app/widgets/bill_pay/helpers/controller/bill_pay_controller_helper.rb +3 -0
  22. data/app/widgets/bill_pay/helpers/view/bill_pay_view_helper.rb +3 -0
  23. data/app/widgets/bill_pay/javascript/bill_pay.js +11 -0
  24. data/app/widgets/bill_pay/views/_menu.html.erb +63 -0
  25. data/app/widgets/bill_pay/views/_payment_history_table.html.erb +115 -0
  26. data/app/widgets/bill_pay/views/_statement_table.html.erb +117 -0
  27. data/app/widgets/bill_pay/views/account_home.html.erb +10 -0
  28. data/app/widgets/bill_pay/views/index.html.erb +4 -0
  29. data/app/widgets/bill_pay/views/make_payment.html.erb +24 -0
  30. data/app/widgets/bill_pay/views/payment_account_forms/bank_account.html.erb +28 -0
  31. data/app/widgets/bill_pay/views/payment_account_forms/credit_card.html.erb +48 -0
  32. data/app/widgets/bill_pay/views/payment_accounts.html.erb +120 -0
  33. data/app/widgets/bill_pay/views/payment_history.html.erb +104 -0
  34. data/app/widgets/bill_pay/views/pdf/layout.pdf.erb +35 -0
  35. data/app/widgets/bill_pay/views/statements.html.erb +4 -0
  36. data/config/routes.rb +6 -0
  37. data/db/data_migrations/20111121153349_create_bill_pay_organizer_application.rb +14 -0
  38. data/db/migrate/20111121000000_invoicing_services.rb +197 -0
  39. data/lib/erp_invoicing/engine.rb +10 -0
  40. data/lib/erp_invoicing/version.rb +3 -0
  41. data/lib/erp_invoicing.rb +4 -0
  42. data/lib/tasks/erp_invoicing_tasks.rake +4 -0
  43. data/public/javascripts/erp_app/organizer/applications/bill_pay/accounts_grid_panel.js +182 -0
  44. data/public/javascripts/erp_app/organizer/applications/bill_pay/base.js +134 -0
  45. data/public/javascripts/erp_app/organizer/applications/bill_pay/extensions.js +112 -0
  46. data/public/javascripts/erp_app/organizer/applications/bill_pay/make_payment_window.js +103 -0
  47. data/public/javascripts/erp_app/organizer/applications/bill_pay/payment_accounts_grid_panel.js +104 -0
  48. data/public/javascripts/erp_app/organizer/applications/bill_pay/transactions_grid_panel.js +84 -0
  49. metadata +187 -0
@@ -0,0 +1,134 @@
1
+ Ext.ns("Compass.ErpApp.Organizer.Applications.BillPay");
2
+
3
+ Ext.define("Compass.ErpApp.Organizer.Applications.BillPay.Layout",{
4
+ extend:"Ext.panel.Panel",
5
+ alias:'widget.organizer_billpaylayout',
6
+ accountId:null,
7
+ constructor : function(config) {
8
+ var southPanel = Ext.create("Ext.panel.Panel",{
9
+ layout:'fit',
10
+ region:'south',
11
+ height:300,
12
+ collapsible:true,
13
+ border:false,
14
+ items:[config['southComponent']]
15
+ });
16
+
17
+ var centerPanel = Ext.create("Ext.panel.Panel",{
18
+ layout:'fit',
19
+ region:'center',
20
+ autoScroll:true,
21
+ items:[config['centerComponent']]
22
+ })
23
+
24
+ config = Ext.apply({
25
+ layout:'border',
26
+ frame: false,
27
+ autoScroll:true,
28
+ region:'center',
29
+ items:[
30
+ centerPanel,
31
+ southPanel
32
+ ]
33
+
34
+ }, config);
35
+ this.callParent([config]);
36
+ },
37
+
38
+ /**
39
+ * set the private member accountId
40
+ * @param {Integer} accountId
41
+ */
42
+ setaccountId : function(accountId){
43
+ this.accountId = accountId;
44
+ },
45
+
46
+
47
+ loadAccountDetails : function(accountId){
48
+ if(accountId == null){
49
+ Ext.Msg.alert('Error', 'Account must be selected.');
50
+ }
51
+ else{
52
+ this.accountId = accountId;
53
+ var tabPanel = this.query('tabpanel')[0];
54
+
55
+ var transactionsGrid = tabPanel.query('billpay_transactionsgridpanel')[0];
56
+ transactionsGrid.getStore().load({
57
+ params:{
58
+ account_id:this.account_id
59
+ }
60
+ });
61
+
62
+ var paymentAccountsGrid = tabPanel.query('billpay_paymentaccountsgridpanel')[0];
63
+ paymentAccountsGrid.getStore().load({
64
+ params:{
65
+ account_id:this.account_id
66
+ }
67
+ });
68
+
69
+ tabPanel.setActiveTab(0);
70
+ }
71
+ },
72
+
73
+ loadRemoteData:function(){
74
+ this.orderId = null;
75
+ var accountsGridPanel = this.query('billpay_accountsgridpanel')[0]
76
+ accountsGridPanel.getStore().load();
77
+ }
78
+
79
+ });
80
+
81
+ Compass.ErpApp.Organizer.Applications.BillPay.Base = function(config){
82
+
83
+ //setup extensions
84
+ Compass.ErpApp.Organizer.Applications.BillPay.loadExtensions();
85
+
86
+ var treeMenuStore = Ext.create('Compass.ErpApp.Organizer.DefaultMenuTreeStore', {
87
+ url:'/erp_invoicing/erp_app/organizer/bill_pay/base/menu',
88
+ rootText:'Menu',
89
+ rootIconCls:'icon-content'
90
+ });
91
+
92
+ var menuTreePanel = {
93
+ xtype:'defaultmenutree',
94
+ title:'BillPay',
95
+ store:treeMenuStore,
96
+ menuRootIconCls:'icon-content',
97
+ rootNodeTitle:'Menu',
98
+ treeConfig:{
99
+ store:treeMenuStore
100
+ }
101
+ };
102
+
103
+ var southTabPanel = {
104
+ xtype:'tabpanel',
105
+ items:[{
106
+ xtype:'billpay_transactionsgridpanel'
107
+ },{
108
+ xtype:'billpay_paymentaccountsgridpanel'
109
+ }]
110
+ };
111
+
112
+ var layout = {
113
+ id:'billpay_layout',
114
+ xtype:'organizer_billpaylayout',
115
+ centerComponent:{
116
+ id:'billpay_accountsGrid',
117
+ xtype:'billpay_accountsgridpanel',
118
+ listeners:{
119
+ 'itemclick':function(view, record, item, index, e, options){
120
+ var id = record.get("id");
121
+ var layout = view.findParentByType('organizer_billpaylayout');
122
+ layout.loadAccountDetails(id);
123
+ }
124
+ }
125
+ },
126
+ southComponent:southTabPanel
127
+ };
128
+
129
+ this.setup = function(){
130
+ config['organizerLayout'].addApplication(menuTreePanel, [layout]);
131
+ };
132
+
133
+ };
134
+
@@ -0,0 +1,112 @@
1
+ Compass.ErpApp.Organizer.Applications.BillPay.loadExtensions = function(){
2
+ //add Bill Pay tab to individuals tab panel
3
+ var individualsTabPanel = Ext.getCmp('individualsTabPanel');
4
+ individualsTabPanel.add({
5
+ title:'Bill Pay',
6
+ xtype:'billpay_accountsgridpanel',
7
+ columns: [
8
+ {
9
+ header:'Account Number',
10
+ sortable: true,
11
+ dataIndex: 'account_number'
12
+ },
13
+ {
14
+ header:'Payment Due',
15
+ sortable: true,
16
+ width:150,
17
+ dataIndex: 'payment_due'
18
+ },
19
+ {
20
+ header:'Next Billing Date',
21
+ sortable: true,
22
+ width:150,
23
+ dataIndex: 'billing_date'
24
+ },
25
+ {
26
+ header:'Next Payment Due',
27
+ sortable: true,
28
+ dataIndex: 'due_date'
29
+ },
30
+ {
31
+ menuDisabled:true,
32
+ resizable:false,
33
+ xtype:'actioncolumn',
34
+ header:'Make Payment',
35
+ align:'center',
36
+ width:100,
37
+ items:[{
38
+ icon:'/images/icons/creditcards/creditcards_16x16.png',
39
+ tooltip:'Make Payment',
40
+ handler :function(grid, rowIndex, colIndex){
41
+ var rec = grid.getStore().getAt(rowIndex);
42
+ var makePaymentWindow = Ext.create("Compass.ErpApp.Organizer.Applications.BillPay.MakePaymentWindow",{
43
+ amount:rec.get('payment_due'),
44
+ accountId:rec.get('id')
45
+ });
46
+ makePaymentWindow.show();
47
+ }
48
+ }]
49
+ },
50
+ {
51
+ menuDisabled:true,
52
+ resizable:false,
53
+ xtype:'actioncolumn',
54
+ header:'Account Details',
55
+ align:'center',
56
+ width:100,
57
+ items:[{
58
+ icon:'/images/icons/about/about_16x16.png',
59
+ tooltip:'View Account Details',
60
+ handler :function(grid, rowIndex, colIndex){
61
+ var rec = grid.getStore().getAt(rowIndex);
62
+ var accountId = rec.get('id');
63
+
64
+ var billPayLayout = Ext.getCmp('billpay_layout');
65
+ billPayLayout.loadAccountDetails(accountId);
66
+ var accountsGridPanel = billPayLayout.query('billpay_accountsgridpanel')[0];
67
+ accountsGridPanel.getStore().load({
68
+ params:{
69
+ account_id:accountId,
70
+ start:1,
71
+ limit:1
72
+ }
73
+ })
74
+
75
+ Compass.ErpApp.Organizer.Layout.setActiveCenterItem('billpay_layout', false);
76
+ }
77
+ }]
78
+ },
79
+ {
80
+ menuDisabled:true,
81
+ resizable:false,
82
+ xtype:'actioncolumn',
83
+ header:'Delete',
84
+ align:'center',
85
+ width:60,
86
+ items:[{
87
+ icon:'/images/icons/delete/delete_16x16.png',
88
+ tooltip:'Delete',
89
+ handler :function(grid, rowIndex, colIndex){
90
+ var rec = grid.getStore().getAt(rowIndex);
91
+ grid.deleteOrder(rec);
92
+ }
93
+ }]
94
+ }
95
+ ],
96
+ listeners:{
97
+ activate:function(grid){
98
+ var contactsLayout = grid.findParentByType('contactslayout');
99
+ if(!Compass.ErpApp.Utility.isBlank(contactsLayout.partyId)){
100
+ var store = grid.getStore();
101
+ store.proxy.extraParams.party_id = contactsLayout.partyId;
102
+ store.load({
103
+ params:{
104
+ start:0,
105
+ limit:10
106
+ }
107
+ })
108
+ }
109
+ }
110
+ }
111
+ });
112
+ };
@@ -0,0 +1,103 @@
1
+ Ext.define("Compass.ErpApp.Organizer.Applications.BillPay.MakePaymentWindow",{
2
+ extend:"Ext.window.Window",
3
+ alias:'widget.billpay_makepaymentwindow',
4
+ constructor : function(config) {
5
+ config = Ext.apply({
6
+ layout:'fit',
7
+ width:300,
8
+ title:'Make Payment',
9
+ iconCls:'icon-credit_cards',
10
+ buttonAlign:'center',
11
+ plain: true,
12
+ items: Ext.create('Ext.form.Panel',{
13
+ baseParams:{
14
+ account_id:config.accountId
15
+ },
16
+ url:config['url'],
17
+ items: [
18
+ {
19
+ xtype:'displayfield',
20
+ value:config['amount'],
21
+ fieldLabel:'Amount'
22
+ },
23
+ {
24
+ xtype:'combo',
25
+ name:'payment_account_id',
26
+ loadingText:'Retrieving Payment Accounts...',
27
+ store:Ext.create('Ext.data.Store',{
28
+ proxy:{
29
+ type:'ajax',
30
+ reader:{
31
+ type:'json',
32
+ root:'payment_accounts'
33
+ },
34
+ extraParams:{
35
+ account_id:config.accountId
36
+ },
37
+ url:'/erp_invoicing/erp_app/organizer/bill_pay/accounts/payment_accounts'
38
+ },
39
+ fields:[
40
+ 'id',
41
+ 'description'
42
+ ]
43
+ }),
44
+ forceSelection:true,
45
+ editable:false,
46
+ fieldLabel:'Payment Account',
47
+ autoSelect:true,
48
+ typeAhead: true,
49
+ mode: 'remote',
50
+ displayField:'description',
51
+ valueField:'id',
52
+ triggerAction: 'all',
53
+ allowBlank:false
54
+ }
55
+ ]
56
+ }),
57
+ buttons: [{
58
+ text:'Submit',
59
+ listeners:{
60
+ 'click':function(button){
61
+ var win = button.findParentByType('creditcardwindow');
62
+ var formPanel = win.findByType('form')[0];
63
+ //formPanel.findById('credit_card_amount_hidden').setValue(formPanel.findById('credit_card_amount').getValue().replace("$","").replace(",",""));
64
+ if(win.validateCreditCardInfo(formPanel.getForm())){
65
+ formPanel.getForm().submit({
66
+ method:config['method'] || 'POST',
67
+ waitMsg:'Processing Credit Card...',
68
+ success:function(form, action){
69
+ var response = Ext.util.JSON.decode(action.response.responseText);
70
+ win.fireEvent('charge_response', win, response);
71
+ },
72
+ failure:function(form, action){
73
+ if(action.response != null){
74
+ var response = Ext.util.JSON.decode(action.response.responseText);
75
+ win.fireEvent('charge_failure', win, response);
76
+ }
77
+ else
78
+ {
79
+ Ext.Msg.alert("Error", 'Error Processing Credit Card');
80
+ }
81
+ }
82
+ });
83
+ }
84
+ }
85
+ }
86
+ },
87
+ {
88
+ text: 'Cancel',
89
+ listeners:{
90
+ 'click':function(button){
91
+ var win = button.findParentByType('billpay_makepaymentwindow');
92
+ win.close();
93
+ }
94
+ }
95
+ }]
96
+ }, config);
97
+
98
+ this.callParent([config]);
99
+ }
100
+
101
+ });
102
+
103
+
@@ -0,0 +1,104 @@
1
+ Ext.define("Compass.ErpApp.Organizer.Applications.BillPay.PaymentAccountsGridPanel",{
2
+ extend:"Ext.grid.Panel",
3
+ alias:'widget.billpay_paymentaccountsgridpanel',
4
+
5
+ initComponent : function(){
6
+ this.bbar = Ext.create("Ext.PagingToolbar",{
7
+ pageSize: this.initialConfig['pageSize'] || 50,
8
+ store:this.store,
9
+ displayInfo: true,
10
+ displayMsg: '{0} - {1} of {2}',
11
+ emptyMsg: "Empty"
12
+ });
13
+
14
+ this.callParent(arguments);
15
+ },
16
+
17
+ constructor : function(config) {
18
+ var store = Ext.create("Ext.data.Store",{
19
+ proxy:{
20
+ type:'ajax',
21
+ url: '/erp_invoicing/erp_app/organizer/bill_pay/accounts/payment_accounts',
22
+ reader:{
23
+ type:'json',
24
+ root: 'payment_accounts'
25
+ }
26
+ },
27
+ extraParams:{
28
+ account_id:null
29
+ },
30
+ totalProperty: 'totalCount',
31
+ idProperty: 'id',
32
+ fields:[
33
+ 'id',
34
+ 'description',
35
+ 'account_type'
36
+ ]
37
+ });
38
+
39
+ config = Ext.apply({
40
+ title:'Payment Accounts',
41
+ columns: [
42
+ {
43
+ header:'Description',
44
+ sortable: true,
45
+ dataIndex: 'description'
46
+ },
47
+ {
48
+ header:'Account Type',
49
+ sortable: true,
50
+ width:150,
51
+ dataIndex: 'account_type'
52
+ },
53
+ {
54
+ menuDisabled:true,
55
+ resizable:false,
56
+ xtype:'actioncolumn',
57
+ header:'Edit',
58
+ align:'center',
59
+ width:100,
60
+ items:[{
61
+ icon:'/images/icons/edit/edit_16x16.png',
62
+ tooltip:'View Payor Info',
63
+ handler :function(grid, rowIndex, colIndex){
64
+
65
+ }
66
+ }]
67
+ },
68
+ {
69
+ menuDisabled:true,
70
+ resizable:false,
71
+ xtype:'actioncolumn',
72
+ header:'Delete',
73
+ align:'center',
74
+ width:60,
75
+ items:[{
76
+ icon:'/images/icons/delete/delete_16x16.png',
77
+ tooltip:'Delete',
78
+ handler :function(grid, rowIndex, colIndex){
79
+
80
+ }
81
+ }]
82
+ }
83
+ ],
84
+ loadMask: true,
85
+ autoScroll:true,
86
+ stripeRows: true,
87
+ store:store,
88
+ tbar:{
89
+ items:[
90
+ {
91
+ text: 'Add',
92
+ xtype:'button',
93
+ iconCls: 'icon-add',
94
+ handler: function(btn) {
95
+
96
+ }
97
+ }
98
+ ]
99
+ }
100
+ }, config);
101
+
102
+ this.callParent([config]);
103
+ }
104
+ });