48 lines
2.9 KiB
Ruby
48 lines
2.9 KiB
Ruby
#The MIT License (MIT)
|
|
#
|
|
#Copyright (c) 2026 rick barrette
|
|
#
|
|
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
#
|
|
#The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
#
|
|
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
Redmine::Plugin.register :redmine_qbo_commission do
|
|
|
|
# About
|
|
name 'Redmine QBO Commission plugin'
|
|
author 'Rick Barrette'
|
|
description 'Monthly sales commission (SOP-OPS-013): totals the month\'s paid sales from QuickBooks Online, ' \
|
|
'works out the commission pool, and records each sales rep\'s payout for payroll'
|
|
version '2026.11.2'
|
|
url 'https://gitea.rickbarrette.org/ricky/redmine_qbo_commission'
|
|
author_url 'https://barrettefabrication.com'
|
|
requires_redmine version_or_higher: '7.0.0'
|
|
|
|
# The QuickBooks connection lives in redmine_qbo
|
|
begin
|
|
requires_redmine_plugin :redmine_qbo, version_or_higher: '2026.11.0'
|
|
rescue Redmine::PluginNotFound
|
|
raise 'Please install the redmine_qbo plugin (https://github.com/rickbarrette/redmine_qbo)'
|
|
end
|
|
|
|
settings default: RedmineQboCommission::Settings::DEFAULTS.dup, partial: 'settings/qbo_commission'
|
|
|
|
# Seeing a month's sales, pool and payouts (e.g. the sales reps, to follow the month toward the threshold)
|
|
permission :view_sales_commission, { sales_commissions: [:current, :show] }, global: true
|
|
# The months, adjusting and approving a month for payroll, reopening it, the payroll CSV
|
|
permission :approve_sales_commission,
|
|
{ sales_commissions: [:index, :current, :show, :update, :refresh, :reopen,
|
|
:add_adjustment, :remove_adjustment, :txn_pdf] },
|
|
global: true
|
|
|
|
menu :top_menu, :sales_commissions, { controller: 'sales_commissions', action: 'current' },
|
|
caption: :label_sales_commission, after: :my_page,
|
|
if: proc { RedmineQboCommission.visible? }
|
|
|
|
# The sales reps who earn the commission
|
|
menu :admin_menu, :commission_reps, { controller: 'commission_reps', action: 'index' },
|
|
caption: :label_commission_rep_plural, icon: 'user', html: { class: 'icon icon-user' }
|
|
end
|