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.
Files changed (107) hide show
  1. checksums.yaml +7 -0
  2. data/app/models/extensions/party.rb +15 -3
  3. data/app/models/invoice.rb +33 -1
  4. data/app/models/invoice_party_role.rb +16 -0
  5. data/app/models/payment_application.rb +17 -1
  6. data/lib/erp_invoicing/engine.rb +1 -1
  7. data/lib/erp_invoicing/version.rb +6 -2
  8. metadata +31 -234
  9. data/app/assets/javascripts/erp_invoicing/application.js +0 -9
  10. data/app/assets/stylesheets/erp_invoicing/application.css +0 -7
  11. data/app/controllers/erp_invoicing/erp_app/organizer/bill_pay/accounts_controller.rb +0 -166
  12. data/app/controllers/erp_invoicing/erp_app/organizer/bill_pay/base_controller.rb +0 -22
  13. data/app/controllers/erp_invoicing/erp_app/shared/billing_accounts_controller.rb +0 -111
  14. data/app/controllers/erp_invoicing/erp_app/shared/files_controller.rb +0 -52
  15. data/app/controllers/erp_invoicing/erp_app/shared/invoices_controller.rb +0 -208
  16. data/app/controllers/erp_invoicing/sms_controller.rb +0 -156
  17. data/app/helpers/erp_invoicing/application_helper.rb +0 -4
  18. data/app/views/layouts/erp_invoicing/application.html.erb +0 -14
  19. data/db/data_migrations/20111121153349_create_bill_pay_organizer_application.rb +0 -14
  20. data/db/data_migrations/20120118181839_create_invoice_management_desktop_application.rb +0 -26
  21. data/db/data_migrations/20120229174322_add_billpay_widget.rb +0 -26
  22. data/public/javascripts/erp_app/desktop/applications/invoice_management/billing_accounts_panel.js +0 -79
  23. data/public/javascripts/erp_app/desktop/applications/invoice_management/invoices_panel.js +0 -48
  24. data/public/javascripts/erp_app/desktop/applications/invoice_management/module.js +0 -36
  25. data/public/javascripts/erp_app/organizer/applications/bill_pay/base.js +0 -146
  26. data/public/javascripts/erp_app/organizer/applications/bill_pay/extensions.js +0 -21
  27. data/public/javascripts/erp_app/organizer/applications/bill_pay/make_payment_window.js +0 -109
  28. data/public/javascripts/erp_app/organizer/applications/bill_pay/payment_accounts_grid_panel.js +0 -105
  29. data/public/javascripts/erp_app/organizer/applications/bill_pay/transactions_grid_panel.js +0 -84
  30. data/public/javascripts/erp_app/shared/add_invoice_window.js +0 -220
  31. data/public/javascripts/erp_app/shared/billing_accounts_grid_panel.js +0 -316
  32. data/public/javascripts/erp_app/shared/invoice_items_grid_panel.js +0 -152
  33. data/public/javascripts/erp_app/shared/invoices_grid_panel.js +0 -361
  34. data/public/javascripts/erp_app/shared/payments_grid_panel.js +0 -74
  35. data/spec/dummy/db/data_migrations/20101011152441_payment_gateway_actions.erp_commerce.rb +0 -28
  36. data/spec/dummy/db/data_migrations/20101014142230_financial_txn_types.erp_txns_and_accts.rb +0 -16
  37. data/spec/dummy/db/data_migrations/20110109173616_create_capability_scope_types.erp_tech_svcs.rb +0 -15
  38. data/spec/dummy/db/data_migrations/20110324010232_product_role_types.erp_products.rb +0 -24
  39. data/spec/dummy/db/data_migrations/20110509223702_add_publisher_role.knitkit.rb +0 -22
  40. data/spec/dummy/db/data_migrations/20110525001935_add_usd_currency.erp_base_erp_svcs.rb +0 -12
  41. data/spec/dummy/db/data_migrations/20110527160807_add_default_prod_avail_types.erp_products.rb +0 -27
  42. data/spec/dummy/db/data_migrations/20110605231556_create_order_party_roles.erp_orders.rb +0 -24
  43. data/spec/dummy/db/data_migrations/20110608185830_create_default_dynamic_models_and_forms.erp_forms.rb +0 -33
  44. data/spec/dummy/db/data_migrations/20110609150135_add_iso_codes.erp_base_erp_svcs.rb +0 -19
  45. data/spec/dummy/db/data_migrations/20110728201729_erp_app_setup.erp_app.rb +0 -252
  46. data/spec/dummy/db/data_migrations/20110728201730_create_desktop_app_product_manager.erp_products.rb +0 -26
  47. data/spec/dummy/db/data_migrations/20110728201731_create_desktop_app_order_manager.erp_orders.rb +0 -26
  48. data/spec/dummy/db/data_migrations/20110728201732_create_organizer_app_order_management.erp_orders.rb +0 -15
  49. data/spec/dummy/db/data_migrations/20110728201733_update_preferences.erp_app.rb +0 -53
  50. data/spec/dummy/db/data_migrations/20110802200222_schedule_delete_expired_sessions_job.erp_tech_svcs.rb +0 -16
  51. data/spec/dummy/db/data_migrations/20110816153456_add_knitkit_application.knitkit.rb +0 -32
  52. data/spec/dummy/db/data_migrations/20110816161238_create_desktop_app_audit_log_viewer.erp_app.rb +0 -21
  53. data/spec/dummy/db/data_migrations/20110817160743_add_file_manager_application.erp_app.rb +0 -32
  54. data/spec/dummy/db/data_migrations/20110828190913_create_desktop_app_dynamic_forms.erp_forms.rb +0 -19
  55. data/spec/dummy/db/data_migrations/20110913145838_setup_compass_ae_instance.erp_base_erp_svcs.rb +0 -12
  56. data/spec/dummy/db/data_migrations/20111108183739_add_default_capabilities.erp_app.rb +0 -23
  57. data/spec/dummy/db/data_migrations/20111108183740_add_new_contact_widgets.erp_app.rb +0 -42
  58. data/spec/dummy/db/data_migrations/20111111144706_setup_audit_log_types.erp_tech_svcs.rb +0 -22
  59. data/spec/dummy/db/data_migrations/20111118182910_setup_knitkit_capabilities.knitkit.rb +0 -128
  60. data/spec/dummy/db/data_migrations/20111121153349_create_bill_pay_organizer_application.erp_invoicing.rb +0 -15
  61. data/spec/dummy/db/data_migrations/20120109173616_create_download_capability_type.erp_tech_svcs.rb +0 -14
  62. data/spec/dummy/db/data_migrations/20120118181839_create_invoice_management_desktop_application.erp_invoicing.rb +0 -27
  63. data/spec/dummy/db/data_migrations/20120127144444_create_website_role_types.knitkit.rb +0 -14
  64. data/spec/dummy/db/data_migrations/20120127150505_create_website_default_configuration.knitkit.rb +0 -73
  65. data/spec/dummy/db/data_migrations/20120127150506_add_primary_host_to_website_configuration.knitkit.rb +0 -34
  66. data/spec/dummy/db/data_migrations/20120229160222_add_userinfo_widget.erp_app.rb +0 -29
  67. data/spec/dummy/db/data_migrations/20120229174322_add_billpay_widget.erp_invoicing.rb +0 -27
  68. data/spec/dummy/db/data_migrations/20120229174343_add_orders_widget.erp_orders.rb +0 -29
  69. data/spec/dummy/db/data_migrations/20120316150424_add_is_template_to_default_website_config.knitkit.rb +0 -17
  70. data/spec/dummy/db/data_migrations/20120405193721_create_party_and_role_type_for_communication_events.erp_app.rb +0 -11
  71. data/spec/dummy/db/data_migrations/20120411180756_create_user_management_mobile_application.erp_app.rb +0 -19
  72. data/spec/dummy/db/data_migrations/20120418164215_create_configuration_management_desktop_application.erp_app.rb +0 -23
  73. data/spec/dummy/db/data_migrations/20120605154637_add_calculate_balance_strategy_types.erp_invoicing.rb +0 -21
  74. data/spec/dummy/db/data_migrations/20120809020508_update_website_and_configuration.knitkit.rb +0 -78
  75. data/spec/dummy/db/data_migrations/20120824013449_create_ticket_form.erp_forms.rb +0 -67
  76. data/spec/dummy/db/data_migrations/20121026013449_update_ticket_form.erp_forms.rb +0 -65
  77. data/spec/dummy/db/data_migrations/20121026191738_update_contact_form.erp_forms.rb +0 -27
  78. data/spec/dummy/db/data_migrations/20121116155018_create_group_relationship_and_role_types.erp_tech_svcs.rb +0 -20
  79. data/spec/dummy/db/data_migrations/20121129185611_upgrade_website_role_iid.knitkit.rb +0 -21
  80. data/spec/dummy/db/data_migrations/20121130201859_upgrade_remove_system_mgmt_app.erp_app.rb +0 -16
  81. data/spec/dummy/db/data_migrations/20121130212146_note_capabilities.erp_tech_svcs.rb +0 -24
  82. data/spec/dummy/db/data_migrations/20121218175028_create_security_management_desktop_application.erp_app.rb +0 -23
  83. data/spec/dummy/db/migrate/20121214000230_base_erp_services.erp_base_erp_svcs.rb +0 -461
  84. data/spec/dummy/db/migrate/20121214000231_base_tech_services.erp_tech_svcs.rb +0 -255
  85. data/spec/dummy/db/migrate/20121214000232_create_has_attribute_tables.erp_tech_svcs.rb +0 -39
  86. data/spec/dummy/db/migrate/20121214000233_base_app_framework.erp_app.rb +0 -276
  87. data/spec/dummy/db/migrate/20121214000234_dynamic_forms.erp_forms.rb +0 -95
  88. data/spec/dummy/db/migrate/20121214000235_create_tickets.erp_forms.rb +0 -19
  89. data/spec/dummy/db/migrate/20121214000236_upgrade_dynamic_forms_table.erp_forms.rb +0 -32
  90. data/spec/dummy/db/migrate/20121214000237_setup_knitkit.knitkit.rb +0 -316
  91. data/spec/dummy/db/migrate/20121214000238_invoicing_services.erp_invoicing.rb +0 -277
  92. data/spec/dummy/db/migrate/20121214000239_base_inventory.erp_inventory.rb +0 -91
  93. data/spec/dummy/db/migrate/20121214000240_base_inventory_indexes.erp_inventory.rb +0 -48
  94. data/spec/dummy/db/migrate/20121214000241_base_txns_and_accts.erp_txns_and_accts.rb +0 -364
  95. data/spec/dummy/db/migrate/20121214000242_agreements_services.erp_agreements.rb +0 -160
  96. data/spec/dummy/db/migrate/20121214000243_agreements_services_indexes.erp_agreements.rb +0 -52
  97. data/spec/dummy/db/migrate/20121214000244_base_orders.erp_orders.rb +0 -178
  98. data/spec/dummy/db/migrate/20121214000245_base_products.erp_products.rb +0 -234
  99. data/spec/dummy/db/migrate/20121214000246_base_products_indexes.erp_products.rb +0 -59
  100. data/spec/dummy/db/migrate/20121214000247_erp_commerce_base.erp_commerce.rb +0 -442
  101. data/spec/dummy/db/migrate/20121214000248_base_work_efforts.erp_work_effort.rb +0 -211
  102. data/spec/dummy/db/migrate/20130107181155_create_groups.erp_tech_svcs.rb +0 -19
  103. data/spec/dummy/db/migrate/20130107181156_upgrade_security.erp_tech_svcs.rb +0 -54
  104. data/spec/dummy/db/migrate/20130107181157_upgrade_security2.erp_tech_svcs.rb +0 -270
  105. data/spec/dummy/db/schema.rb +0 -2569
  106. data/spec/dummy/db/spec.sqlite3 +0 -0
  107. data/spec/dummy/log/spec.log +0 -64744
@@ -1,156 +0,0 @@
1
- module ErpInvoicing
2
- class SmsController < ::ActionController::Base
3
- before_filter :allow_by_ip
4
-
5
- # Receive SMS callback from clickatell
6
- # Example: If you provide this URL http://www.yourdomain.com/erp_invoicing/sms/receive_response then we will do a POST or GET as follows:
7
- # https://www.yourdomain.com/sms/receive_response?api_id=12345&from=279991235642&to=27123456789&
8
- # timestamp=2008-08-0609:43:50&text=Hereisthe%20messagetext&charset=ISO-8859-1&udh=&moMsgId=b2aee337abd962489b123fda9c3480fa
9
- def receive_response
10
- message_text = params[:text]
11
- moMsgId = params[:moMsgId]
12
- to_number = params[:to]
13
- from_number = params[:from]
14
-
15
- if message_text.blank? or to_number.blank? or from_number.blank?
16
- Rails.logger.error 'ErpInvoicing::SmsController#receive_response called with insufficient data'
17
- render_false and return
18
- render :json => {:success => false} and return
19
- end
20
-
21
- # find the comm event sent within past 10mins where that incoming message is a reponse to
22
- cmm_evt = CommunicationEvent.find_by_sql("SELECT * FROM communication_events
23
- JOIN phone_numbers from_phone ON from_contact_mechanism_id=from_phone.id
24
- JOIN phone_numbers to_phone ON to_contact_mechanism_id=to_phone.id
25
- WHERE from_contact_mechanism_type = 'PhoneNumber'
26
- AND from_contact_mechanism_type='PhoneNumber'
27
- AND from_phone.phone_number = '#{to_number.to_s}'
28
- AND (to_phone.phone_number = '#{from_number.to_s}' OR to_phone.phone_number = '#{from_number[1..from_number.length]}')
29
- AND communication_events.created_at > '#{SMS_TIME_WINDOW.minutes.ago.to_s}'
30
- ORDER BY communication_events.created_at DESC").first
31
-
32
- unless cmm_evt.nil?
33
- if message_text.downcase.include?('yespay') or message_text.downcase.include?('yes pay')
34
- billing_account = BillingAccount.find(cmm_evt.case_id)
35
- payment_due = billing_account.payment_due
36
-
37
- # TODO: scrape for amount and compare with payment_due on account?
38
-
39
- if billing_account.has_outstanding_balance?
40
- success = submit_payment(cmm_evt, billing_account) if billing_account.has_outstanding_balance?
41
- else
42
- Rails.logger.error 'ErpInvoicing::SmsController#receive_response called: skipping payment NO OUTSTANDING BALANCE TO PAY'
43
- end
44
- to_party = cmm_evt.from_party
45
-
46
- # log communication event
47
- new_cmm_evt = CommunicationEvent.new
48
- new_cmm_evt.short_description = 'SMS Response'
49
- new_cmm_evt.comm_evt_purpose_types << CommEvtPurposeType.find_by_internal_identifier('sms_response')
50
- new_cmm_evt.to_role = RoleType.find_by_internal_identifier('application')
51
- new_cmm_evt.to_party = to_party
52
- new_cmm_evt.to_contact_mechanism = to_party.default_phone_number
53
- new_cmm_evt.from_contact_mechanism = cmm_evt.to_party.billing_phone_number
54
- new_cmm_evt.from_role = RoleType.find_by_internal_identifier('customer')
55
- new_cmm_evt.from_party = cmm_evt.to_party
56
- new_cmm_evt.case_id = cmm_evt.case_id
57
- new_cmm_evt.notes = "From Number: #{from_number}, To Number: #{to_number}, Message: #{message_text}, Payment: #{success}"
58
- new_cmm_evt.external_identifier = moMsgId
59
- new_cmm_evt.save
60
-
61
- if success
62
- # send successful payment notification
63
- clikatell = ErpTechSvcs::SmsWrapper::Clickatell.new
64
- clikatell.send_message(from_number, SMS_SUCCESS_NOTIFICATION.gsub('payment_due', payment_due.to_s), :mo => 1, :from => to_number)
65
- render_true and return
66
- else
67
- render_false and return
68
- end
69
- end
70
- else
71
- Rails.logger.error "ErpInvoicing::SmsController#receive_ ation event #{moMsgId}"
72
- render :json => {:success => false} and return
73
- end
74
- end
75
-
76
- protected
77
- def submit_payment(cmm_evt, billing_account)
78
- party = cmm_evt.to_party
79
-
80
- @error_message = nil
81
- @message = nil
82
- @payment_accounts = party.payment_accounts
83
-
84
- root_account = BizTxnAcctRoot.find(@payment_accounts.first)
85
- @payment_account = root_account.account
86
- @amount = billing_account.payment_due
87
- @payment_date = Date.today
88
-
89
- money = Money.create(
90
- :amount => @amount.to_d,
91
- :description => "Clicktopay Payment Applied",
92
- :currency => Currency.usd
93
- )
94
- financial_txn = FinancialTxn.new(:apply_date => @payment_date)
95
- financial_txn.description = "Clicktopay Payment Applied"
96
- financial_txn.money = money
97
- financial_txn.account = root_account
98
- financial_txn.save
99
-
100
- PaymentApplication.create(
101
- :financial_txn => financial_txn,
102
- :payment_applied_to => billing_account,
103
- :money => money
104
- )
105
-
106
- if financial_txn.apply_date == Date.today
107
- case @payment_account.class.to_s
108
- when "BankAccount"
109
- financial_txn.txn_type = BizTxnType.ach_sale
110
- financial_txn.save
111
- result = @payment_account.purchase(financial_txn, ErpCommerce::Config.active_merchant_gateway_wrapper)
112
- if !result[:payment].nil? and result[:payment].success
113
- @authorization_code = result[:payment].authorization_code
114
- else
115
- @message = result[:message]
116
- end
117
- when "CreditCardAccount"
118
- financial_txn.txn_type = BizTxnType.cc_sale
119
- financial_txn.save
120
- result = @payment_account.purchase(financial_txn, '123', ErpCommerce::Config.active_merchant_gateway_wrapper)
121
- if !result[:payment].nil? and result[:payment].success
122
- @authorization_code = result[:payment].authorization_code
123
- else
124
- @message = result[:message]
125
- end
126
- end
127
- end
128
-
129
- if @error_message.nil?
130
- Rails.logger.info 'ErpInvoicing::SmsController#submit_payment called: payment successful'
131
- else
132
- Rails.logger.error 'ErpInvoicing::SmsController#submit_payment called: payment failed'
133
- end
134
- end
135
-
136
-
137
- def render_false
138
- render :json => {:success => false}
139
- end
140
-
141
- def render_true
142
- render :json => {:success => true}
143
- end
144
-
145
- def allow_by_ip
146
- Rails.logger.info "ErpInvoicing::SmsController#allow_by_ip called: request from #{request.remote_ip}"
147
- if request.remote_ip != SMS_SERVICE_IP
148
- redirect_to '/'
149
- flash.now[:notice] = "Access denied!"
150
- return false
151
- end
152
- end
153
-
154
-
155
- end
156
- end
@@ -1,4 +0,0 @@
1
- module ErpInvoicing
2
- module ApplicationHelper
3
- end
4
- end
@@ -1,14 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>ErpInvoicing</title>
5
- <%= stylesheet_link_tag "erp_invoicing/application" %>
6
- <%= javascript_include_tag "erp_invoicing/application" %>
7
- <%= csrf_meta_tags %>
8
- </head>
9
- <body>
10
-
11
- <%= yield %>
12
-
13
- </body>
14
- </html>
@@ -1,14 +0,0 @@
1
- class CreateBillPayOrganizerApplication
2
- def self.up
3
- OrganizerApplication.create(
4
- :description => 'Bill Pay',
5
- :icon => 'icon-creditcards',
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
@@ -1,26 +0,0 @@
1
- class CreateInvoiceManagementDesktopApplication
2
- def self.up
3
- app = DesktopApplication.create(
4
- :description => 'Invoice Management',
5
- :icon => 'icon-creditcards',
6
- :javascript_class_name => 'Compass.ErpApp.Desktop.Applications.InvoiceManagement',
7
- :internal_identifier => 'invoice_management',
8
- :shortcut_id => 'invoice_management-win'
9
- )
10
-
11
- app.save
12
-
13
- pt1 = PreferenceType.iid('desktop_shortcut')
14
- pt1.preferenced_records << app
15
- pt1.save
16
-
17
- pt2 = PreferenceType.iid('autoload_application')
18
- pt2.preferenced_records << app
19
- pt2.save
20
-
21
- end
22
-
23
- def self.down
24
- DesktopApplication.destroy_all(['internal_identifier = ?','invoice_management'])
25
- end
26
- end
@@ -1,26 +0,0 @@
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
- end
19
- end
20
-
21
- def self.down
22
- #remove data here
23
- Widget.find_by_internal_identifier('billpay').destroy
24
- end
25
-
26
- end
@@ -1,79 +0,0 @@
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
- items:[
41
- {
42
- xtype:'shared-billingaccountsgridpanel',
43
- title:'',
44
- showAddDelete:true,
45
- region:'center',
46
- listeners:{
47
- 'itemclick':function(view, record, item, index, e, options){
48
- var billingAccountNumber = record.get("account_number");
49
- var billingAccountId = record.get("id");
50
- var itemId = 'invoices-' + billingAccountId;
51
- var invoicesGridPanel = tabPanel.query('#'+itemId)[0];
52
-
53
- if(Compass.ErpApp.Utility.isBlank(invoicesGridPanel)){
54
- invoicesGridPanel = Ext.create('widget.shared-invoicesgridpanel',{
55
- billingAccountNumber:billingAccountNumber,
56
- billingAccountId:billingAccountId,
57
- itemId:itemId,
58
- showAddDelete:true,
59
- closable:true,
60
- title:billingAccountNumber + ' Invoices'
61
- });
62
- tabPanel.add(invoicesGridPanel);
63
- }
64
- else{
65
- invoicesGridPanel.store.load();
66
- }
67
-
68
- tabPanel.setActiveTab(invoicesGridPanel);
69
- }
70
- }
71
- },
72
- tabPanel]
73
- }, config);
74
-
75
- this.callParent([config]);
76
- }
77
-
78
- });
79
-
@@ -1,48 +0,0 @@
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
-
@@ -1,36 +0,0 @@
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
- });
@@ -1,146 +0,0 @@
1
- Ext.define("Compass.ErpApp.Organizer.Applications.BillPay.AccountDetailsPanel",{
2
- extend:"Ext.panel.Panel",
3
- alias:'widget.organizer-billpayaccountdetailspanel',
4
- constructor : function(config) {
5
- var southPanel = {
6
- xtype:'tabpanel',
7
- region:'south',
8
- height:300,
9
- split:true,
10
- collapsible:true,
11
- items:[{
12
- xtype:'shared-invoicesgridpanel',
13
- billingAccountNumber:config.billingAccountNumber,
14
- billingAccountId:config.billingAccountId,
15
- showAddDelete:true
16
- },{
17
- xtype:'billpay-paymentaccountsgridpanel',
18
- billingAccountNumber:config.billingAccountNumber,
19
- billingAccountId:config.billingAccountId
20
- }]
21
- };
22
-
23
- var billingAccount = config.billingAccount;
24
- var billing_account_details = new Ext.Template(["<div style=\"padding: 10px;\"> ",
25
- "Account Number: "+ billingAccount.get('account_number') +"<br>",
26
- "Send Paper Bills: "+ billingAccount.get('send_paper_bills') +"<br>",
27
- "Payable Online: "+ billingAccount.get('payable_online') +"<br>",
28
- "Calculate Balance: "+ billingAccount.get('calculate_balance') +"<br>",
29
- "Payment Due: "+ billingAccount.get('payment_due') +"<br>",
30
- "Balance: "+ billingAccount.get('balance') +"<br>",
31
- "Balance Date: "+ Ext.Date.format(billingAccount.get('balance_date'), 'm/d/Y') +"<br>",
32
- "Due Date: "+ Ext.Date.format(billingAccount.get('due_date'), 'm/d/Y') +"<br>",
33
- "</div>"]);
34
-
35
- var centerPanel = {
36
- xtype:'panel',
37
- layout:'fit',
38
- region:'center',
39
- autoScroll:true,
40
- html:billing_account_details
41
- };
42
-
43
- config = Ext.apply({
44
- layout:'border',
45
- frame: false,
46
- autoScroll:true,
47
- region:'center',
48
- items:[
49
- centerPanel,
50
- southPanel
51
- ]
52
-
53
- }, config);
54
- this.callParent([config]);
55
- }
56
-
57
- });
58
-
59
- Compass.ErpApp.Organizer.Applications.BillPay.Base = function(config){
60
-
61
- //setup extensions
62
- //Compass.ErpApp.Organizer.Applications.BillPay.loadExtensions();
63
-
64
- var treeMenuStore = Ext.create('Compass.ErpApp.Organizer.DefaultMenuTreeStore', {
65
- url:'/erp_invoicing/erp_app/organizer/bill_pay/base/menu',
66
- rootText:'Menu',
67
- rootIconCls:'icon-content'
68
- });
69
-
70
- var menuTreePanel = {
71
- id:'billpaymenu',
72
- xtype:'defaultmenutree',
73
- title:'BillPay',
74
- store:treeMenuStore,
75
- menuRootIconCls:'icon-content',
76
- rootNodeTitle:'Menu',
77
- treeConfig:{
78
- store:treeMenuStore
79
- }
80
- };
81
-
82
- var tabPanel = {
83
- xtype:'tabpanel',
84
- title:'Bill Pay',
85
- itemId:'billpay-application',
86
- plugins: Ext.create('Ext.ux.TabCloseMenu', {
87
- extraItemsTail: [
88
- '-',
89
- {
90
- text: 'Closable',
91
- checked: true,
92
- hideOnClick: true,
93
- handler: function (item) {
94
- currentItem.tab.setClosable(item.checked);
95
- }
96
- }
97
- ],
98
- listeners: {
99
- aftermenu: function () {
100
- currentItem = null;
101
- },
102
- beforemenu: function (menu, item) {
103
- var menuitem = menu.child('*[text="Closable"]');
104
- currentItem = item;
105
- menuitem.setChecked(item.closable);
106
- }
107
- }
108
- }),
109
- items:[{
110
- xtype:'shared-billingaccountsgridpanel',
111
- title:'Search',
112
- closable:false,
113
- autoLoad:false,
114
- listeners:{
115
- 'itemdblclick':function(view, record, item, index, e, options){
116
- var tabPanel = view.ownerCt.up('tabpanel');
117
- var billingAccountNumber = record.get("account_number");
118
- var billingAccountId = record.get("id");
119
- var itemId = 'billingaccount'+billingAccountId;
120
- item = tabPanel.query('#'+itemId).first();
121
-
122
- if(Compass.ErpApp.Utility.isBlank(item)){
123
- item = Ext.create("widget.organizer-billpayaccountdetailspanel",{
124
- title:billingAccountNumber,
125
- closable:true,
126
- itemId:itemId,
127
- billingAccountId:billingAccountId,
128
- billingAccountNumber:billingAccountNumber,
129
- billingAccount: record
130
- });
131
- tabPanel.add(item);
132
- }
133
-
134
- tabPanel.setActiveTab(item);
135
-
136
- }
137
- }
138
- }]
139
- };
140
-
141
- this.setup = function(){
142
- config['organizerLayout'].addApplication(menuTreePanel, [tabPanel]);
143
- };
144
-
145
- };
146
-
@@ -1,21 +0,0 @@
1
- Ext.define("Compass.ErpApp.Organizer.Applications.BillPay.PartyAccountsTab",{
2
- extend:"Compass.ErpApp.Shared.BillingAccountsGridPanel",
3
- alias:'widget.billpay',
4
- title:'Accounts',
5
- listeners:{
6
- activate:function(grid){
7
- var contactsLayout = grid.findParentByType('contactslayout');
8
- if(!Compass.ErpApp.Utility.isBlank(contactsLayout.partyId)){
9
- var store = grid.getStore();
10
- store.proxy.extraParams.party_id = contactsLayout.partyId;
11
- store.load({
12
- params:{
13
- start:0,
14
- limit:10
15
- }
16
- })
17
- }
18
- }
19
- }
20
-
21
- });
@@ -1,109 +0,0 @@
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
- id: 'billpay_makepayment_window',
7
- layout:'fit',
8
- width:300,
9
- title:'Make Payment',
10
- iconCls:'icon-creditcards',
11
- buttonAlign:'center',
12
- plain: true,
13
- items: Ext.create('Ext.form.Panel',{
14
- id: 'billpay_makepayment_form',
15
- baseParams:{
16
- billing_account_id:config.billing_account_id
17
- },
18
- url:config['url'],
19
- items: [
20
- {
21
- xtype:'numberfield',
22
- value:config['amount'],
23
- fieldLabel:'Amount',
24
- name: 'amount'
25
- },
26
- {
27
- xtype:'combo',
28
- name:'payment_account_id',
29
- loadingText:'Retrieving Payment Accounts...',
30
- store:Ext.create('Ext.data.Store',{
31
- proxy:{
32
- type:'ajax',
33
- reader:{
34
- type:'json',
35
- root:'payment_accounts'
36
- },
37
- extraParams:{
38
- account_id:config.accountId
39
- },
40
- url:'/erp_invoicing/erp_app/organizer/bill_pay/accounts/payment_accounts'
41
- },
42
- fields:[
43
- 'id',
44
- 'description'
45
- ]
46
- }),
47
- forceSelection:true,
48
- editable:false,
49
- fieldLabel:'Payment Account',
50
- autoSelect:true,
51
- typeAhead: true,
52
- mode: 'remote',
53
- displayField:'description',
54
- valueField:'id',
55
- triggerAction: 'all',
56
- allowBlank:false
57
- }
58
- ]
59
- }),
60
- buttons: [{
61
- text:'Submit',
62
- listeners:{
63
- 'click':function(button){
64
- var win = Ext.getCmp('billpay_makepayment_window');
65
- var formPanel = Ext.getCmp('billpay_makepayment_form');
66
- //formPanel.findById('credit_card_amount_hidden').setValue(formPanel.findById('credit_card_amount').getValue().replace("$","").replace(",",""));
67
- //if(win.validateCreditCardInfo(formPanel.getForm())){
68
- formPanel.getForm().submit({
69
- method:config['method'] || 'POST',
70
- waitMsg:'Processing Credit Card...',
71
- success:function(form, action){
72
- var response = Ext.decode(action.response.responseText);
73
- //win.fireEvent('charge_response', win, response);
74
- if (response.success == true){ win.destroy(); }
75
- Ext.Msg.alert('Success','Payment Successful');
76
- },
77
- failure:function(form, action){
78
- if(action.response != null){
79
- var response = Ext.decode(action.response.responseText);
80
- //win.fireEvent('charge_failure', win, response);
81
- Ext.Msg.alert('Error','Payment Failed');
82
- }
83
- else
84
- {
85
- Ext.Msg.alert("Error", 'Error Processing Credit Card');
86
- }
87
- }
88
- });
89
- //}
90
- }
91
- }
92
- },
93
- {
94
- text: 'Cancel',
95
- listeners:{
96
- 'click':function(button){
97
- var win = button.findParentByType('billpay_makepaymentwindow');
98
- win.destroy();
99
- }
100
- }
101
- }]
102
- }, config);
103
-
104
- this.callParent([config]);
105
- }
106
-
107
- });
108
-
109
-