erp_invoicing 3.0.0

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.
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,104 @@
1
+ <style>
2
+ *
3
+ {
4
+ border: 0;
5
+ margin: 0;
6
+ padding: 0;
7
+ }
8
+
9
+ table
10
+ {
11
+ text-align: left;
12
+ border-spacing: 0px;
13
+ border: 1px solid #aeb3b6;
14
+ border-collapse: collapse;
15
+
16
+ }
17
+
18
+
19
+ table a, table, tbody, tfoot, tr, th, td
20
+ {
21
+ font-family: Arial, Helvetica, sans-serif;
22
+ line-height: 2.0em;
23
+ font-size: 13px;
24
+ color: #55595c;
25
+ }
26
+ tbody td{
27
+ line-height: 2.5em;
28
+ }
29
+
30
+ table caption
31
+ {
32
+ padding: .4em 0 ;
33
+ font-size: 240%;
34
+ font-style: normal;
35
+ color: #FB7E00;
36
+ }
37
+
38
+ table a
39
+ {
40
+ display: block;
41
+ text-decoration: none;
42
+ color: #FF8E53;
43
+ padding-right: 1.5em;
44
+
45
+ }
46
+
47
+ table a:hover, table a:focus
48
+ {
49
+ text-decoration: underline;
50
+ }
51
+
52
+ table th a
53
+ {
54
+ color: #FF8E53;
55
+ text-align: right;
56
+ }
57
+ table .odd th a,table .odd td a,table .odd td{
58
+ color: #666;
59
+ padding-right: 1.0 em;
60
+ }
61
+
62
+ table th a:hover, table th a:focus, tbody tr:hover th
63
+ {
64
+ background-color: #FFCC99;
65
+ color: #fff !important;
66
+ }
67
+ table .odd th,table .odd td{
68
+ background-color: #DDDDDD;
69
+ }
70
+
71
+ thead th
72
+ {
73
+ text-transform: uppercase;
74
+ font-weight: normal;
75
+ letter-spacing: 1px;
76
+ color: #25c1e2;
77
+ }
78
+
79
+ tbody th
80
+ {
81
+ padding-right: 1.0em;
82
+ color: #25c1e2;
83
+ font-style: normal;
84
+ background-color: #fff;
85
+ border-bottom: 1px dotted #aeb3b6;
86
+ }
87
+
88
+ td
89
+ {
90
+ color: #FF8E1C;
91
+ border-bottom: 1px dotted #aeb3b6;
92
+ padding-right: 0.5em;
93
+
94
+ }
95
+
96
+ tbody tr.odd
97
+ {
98
+ border-bottom: 1px dotted #aeb3b6;
99
+ }
100
+ </style>
101
+ <h2>Payment History</h2>
102
+ <a href="<%=build_widget_url(:download_payment_history)%>">Download History</a>
103
+ <br/><br/>
104
+ <%= render :partial => '/payment_history_table' , :locals => {:payments => @payments}%>
@@ -0,0 +1,35 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml">
3
+ <head>
4
+ <title>Statement</title>
5
+ </head>
6
+ <style type="text/css">
7
+ #container{
8
+ width:610px;
9
+ }
10
+ #body{
11
+ font-size: 10px;
12
+ font-family: "Lucida Grande";
13
+ }
14
+ .bold{
15
+ font-weight:bold;
16
+ }
17
+ .center{
18
+ text-align:center;
19
+ }
20
+ img{
21
+ border:none;
22
+ }
23
+ </style>
24
+
25
+ <body>
26
+ <div id="container">
27
+ <h1><%= @title %></h1>
28
+ <div id="body">
29
+ <div>
30
+ <%= render @body_options %>
31
+ </div>
32
+ </div>
33
+ </div>
34
+ </body>
35
+ </html>
@@ -0,0 +1,4 @@
1
+ <h2>My Statement</h2>
2
+ <a href="<%=build_widget_url(:download_statement)%>">Download Statement</a>
3
+ <br/><br/>
4
+ <%= render :partial => '/statement_table' , :locals => {:transactions => @statement[:tranactions]}%>
data/config/routes.rb ADDED
@@ -0,0 +1,6 @@
1
+ ErpInvoicing::Engine.routes.draw do
2
+
3
+ match '/erp_app/organizer/bill_pay/base(/:action)' => "erp_app/organizer/bill_pay/base#index"
4
+ match '/erp_app/organizer/bill_pay/accounts(/:action)' => "erp_app/organizer/bill_pay/accounts#index"
5
+
6
+ end
@@ -0,0 +1,14 @@
1
+ class CreateBillPayOrganizerApplication
2
+ def self.up
3
+ OrganizerApplication.create(
4
+ :description => 'Bill Pay',
5
+ :icon => 'icon-credit_cards',
6
+ :javascript_class_name => 'Compass.ErpApp.Organizer.Applications.BillPay.Base',
7
+ :internal_identifier => 'bill_pay'
8
+ )
9
+ end
10
+
11
+ def self.down
12
+ OrganizerApplication.destroy_all(:conditions => ['internal_identifier = ?','bill_pay'])
13
+ end
14
+ end
@@ -0,0 +1,197 @@
1
+ #***********************************************************************************************************
2
+ # TODO
3
+ #
4
+ # Should all amounts be using amount_ids? Particularly payments, which can be in multiple currencies
5
+ # Money amounts in commerce are floats - that doesn't seem right????
6
+ #***********************************************************************************************************
7
+
8
+ class InvoicingServices < ActiveRecord::Migration
9
+ def self.up
10
+
11
+ # Create invoices
12
+ unless table_exists?(:invoices)
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
21
+ t.references :invoice_type
22
+
23
+ t.timestamps
24
+ end
25
+ end
26
+
27
+ # Create invoice types (not in silverston models - may be removed in future releases)
28
+ unless table_exists?(:invoice_types)
29
+
30
+ 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
43
+ end
44
+ end
45
+
46
+ # Create invoice items
47
+ unless table_exists?(:invoice_items)
48
+ create_table :invoice_items do |t|
49
+ #foreign keys
50
+ t.column :invoice_id, :integer
51
+ t.column :invoice_item_type_id, :integer
52
+
53
+ #these columns support the polymporphic relationship to invoice-able items
54
+ t.column :invoiceable_item_type, :string
55
+ t.column :invoiceable_item_id, :integer
56
+
57
+ #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
63
+
64
+ t.timestamps
65
+ end
66
+ end
67
+
68
+ # Create invoice item types
69
+ unless table_exists?(:invoice_item_types)
70
+ 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
83
+ end
84
+ end
85
+
86
+ # Create invoice_party_roles
87
+ unless table_exists?(:invoice_party_roles)
88
+ 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
95
+
96
+ t.timestamps
97
+ end
98
+ end
99
+
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
113
+
114
+ # Create billing contact mechanisms
115
+ unless table_exists?(:billing_contact_mechanisms)
116
+ create_table :billing_contact_mechanisms do |t|
117
+ t.column :description, :string
118
+ #these columns support a polymorphic relationship to the contact mechanism for an invoice and billing account
119
+ #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
122
+
123
+ t.timestamps
124
+ end
125
+ end
126
+
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
148
+
149
+ # Create payment applictions
150
+ unless table_exists?(:payment_applications)
151
+ create_table :payment_applications do |t|
152
+
153
+ t.column :payment_id, :integer
154
+
155
+ #these columns support the polymporphic relationship to the entities to which payments can be applied
156
+ #this will be innvoices, invoice items or accounts
157
+ t.column :payment_applied_to_type, :string
158
+ t.column :payment_applied_to_id, :integer
159
+
160
+ #Payments here is set up to point to an amount which allows it to be
161
+ #in multiple currencies
162
+ t.column :applied_money_amount_id, :integer
163
+ t.column :comment, :string
164
+
165
+ t.timestamps
166
+ end
167
+ end
168
+
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
+
179
+ t.timestamps
180
+ end
181
+ end
182
+
183
+ end
184
+
185
+ def self.down
186
+ [
187
+ :invoices, :invoice_types,
188
+ :invoice_items, :invoice_item_types, :invoice_party_roles, :billing_accounts, :billing_contact_mechanisms,
189
+ :payment_applications, :payment_party_roles
190
+ ].each do |tbl|
191
+ if table_exists?(tbl)
192
+ drop_table tbl
193
+ end
194
+ end
195
+
196
+ end
197
+ end
@@ -0,0 +1,10 @@
1
+ module ErpInvoicing
2
+ class Engine < Rails::Engine
3
+ isolate_namespace ErpInvoicing
4
+
5
+ initializer "erp_invoicing.merge_public" do |app|
6
+ app.middleware.insert_before Rack::Lock, ::ActionDispatch::Static, "#{root}/public"
7
+ end
8
+
9
+ end
10
+ end
@@ -0,0 +1,3 @@
1
+ module ErpInvoicing
2
+ VERSION = "3.0.0"
3
+ end
@@ -0,0 +1,4 @@
1
+ require "erp_invoicing/engine"
2
+
3
+ module ErpInvoicing
4
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :erp_invoicing do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,182 @@
1
+ Ext.define("Compass.ErpApp.Organizer.Applications.BillPay.AccountsGridPanel",{
2
+ extend:"Ext.grid.Panel",
3
+ alias:'widget.billpay_accountsgridpanel',
4
+ deleteAccount : function(rec){
5
+
6
+ },
7
+
8
+ initComponent : function(){
9
+ this.bbar = Ext.create("Ext.PagingToolbar",{
10
+ pageSize: this.initialConfig['pageSize'] || 50,
11
+ store:this.store,
12
+ displayInfo: true,
13
+ displayMsg: '{0} - {1} of {2}',
14
+ emptyMsg: "Empty"
15
+ });
16
+
17
+ this.callParent(arguments);
18
+ },
19
+
20
+ constructor : function(config) {
21
+ var store = Ext.create("Ext.data.Store",{
22
+ proxy:{
23
+ type:'ajax',
24
+ url: '/erp_invoicing/erp_app/organizer/bill_pay/accounts',
25
+ reader:{
26
+ type:'json',
27
+ root: 'accounts'
28
+ }
29
+ },
30
+ extraParams:{
31
+ party_id:null,
32
+ account_id:null
33
+ },
34
+ totalProperty: 'totalCount',
35
+ idProperty: 'id',
36
+ fields:[
37
+ 'id',
38
+ 'account_number',
39
+ 'payment_due',
40
+ 'billing_date',
41
+ 'due_date',
42
+ 'party_id'
43
+ ]
44
+ });
45
+
46
+ config = Ext.apply({
47
+ columns: [
48
+ {
49
+ header:'Account Number',
50
+ sortable: true,
51
+ dataIndex: 'account_number'
52
+ },
53
+ {
54
+ header:'Payment Due',
55
+ sortable: true,
56
+ width:150,
57
+ dataIndex: 'payment_due'
58
+ },
59
+ {
60
+ header:'Next Billing Date',
61
+ sortable: true,
62
+ width:150,
63
+ dataIndex: 'billing_date'
64
+ },
65
+ {
66
+ header:'Next Payment Due',
67
+ sortable: true,
68
+ dataIndex: 'due_date'
69
+ },
70
+ {
71
+ menuDisabled:true,
72
+ resizable:false,
73
+ xtype:'actioncolumn',
74
+ header:'Make Payment',
75
+ align:'center',
76
+ width:100,
77
+ items:[{
78
+ icon:'/images/icons/creditcards/creditcards_16x16.png',
79
+ tooltip:'Make Payment',
80
+ handler :function(grid, rowIndex, colIndex){
81
+ var rec = grid.getStore().getAt(rowIndex);
82
+ var makePaymentWindow = Ext.create("Compass.ErpApp.Organizer.Applications.BillPay.MakePaymentWindow",{
83
+ amount:rec.get('payment_due'),
84
+ accountId:rec.get('id')
85
+ });
86
+ makePaymentWindow.show();
87
+ }
88
+ }]
89
+ },
90
+ {
91
+ menuDisabled:true,
92
+ resizable:false,
93
+ xtype:'actioncolumn',
94
+ header:'Customer Info',
95
+ align:'center',
96
+ width:100,
97
+ items:[{
98
+ icon:'/images/icons/about/about_16x16.png',
99
+ tooltip:'View Payor Info',
100
+ handler :function(grid, rowIndex, colIndex){
101
+ var rec = grid.getStore().getAt(rowIndex);
102
+ var partyId = rec.get('party_id');
103
+
104
+ var individualsGrid = Ext.getCmp('individualSearchGrid');
105
+
106
+ var index = individualsGrid.getStore().find("id", partyId);
107
+ var record = individualsGrid.getStore().getAt(index);
108
+ individualsGrid.getSelectionModel().select([record], false);
109
+ Compass.ErpApp.Organizer.Layout.setActiveCenterItem('individuals_search_grid');
110
+ var individualsTabPanel = Ext.getCmp('individualsTabPanel');
111
+ var accountsGridPanel = individualsTabPanel.query('billpay_accountsgridpanel')[0];
112
+ individualsTabPanel.setActiveTab(accountsGridPanel.id);
113
+ }
114
+ }]
115
+ },
116
+ {
117
+ menuDisabled:true,
118
+ resizable:false,
119
+ xtype:'actioncolumn',
120
+ header:'Delete',
121
+ align:'center',
122
+ width:60,
123
+ items:[{
124
+ icon:'/images/icons/delete/delete_16x16.png',
125
+ tooltip:'Delete',
126
+ handler :function(grid, rowIndex, colIndex){
127
+ var rec = grid.getStore().getAt(rowIndex);
128
+ grid.deleteOrder(rec);
129
+ }
130
+ }]
131
+ }
132
+ ],
133
+ loadMask: true,
134
+ autoScroll:true,
135
+ stripeRows: true,
136
+ store:store,
137
+ tbar:{
138
+ items:[
139
+ {
140
+ xtype:'numberfield',
141
+ hideLabel:true,
142
+ emptyText:'Account Number'
143
+ },
144
+ {
145
+ text:'Search',
146
+ iconCls:'icon-search',
147
+ handler:function(btn){
148
+ var accountNumber = btn.findParentByType('toolbar').query('numberfield')[0].getValue();
149
+ var store = btn.findParentByType('billpay_accountsgridpanel').getStore();
150
+ store.load({
151
+ params:{
152
+ account_number:accountNumber
153
+ }
154
+ });
155
+ }
156
+ },
157
+ '|',
158
+ {
159
+ text: 'All',
160
+ xtype:'button',
161
+ iconCls: 'icon-eye',
162
+ handler: function(btn) {
163
+ btn.findParentByType('billpay_accountsgridpanel').store.proxy.extraParams.account_number = null;
164
+ btn.findParentByType('billpay_accountsgridpanel').store.load();
165
+ }
166
+ },
167
+ '|',
168
+ {
169
+ text: 'Add',
170
+ xtype:'button',
171
+ iconCls: 'icon-add',
172
+ handler: function(btn) {
173
+
174
+ }
175
+ }
176
+ ]
177
+ }
178
+ }, config);
179
+
180
+ this.callParent([config]);
181
+ }
182
+ });