New plugin: weekly technician bonus credit memos (SOP-OPS-012)

Totals the shop's billable hours for a Sunday-Saturday week (picked
projects, trackers and users) against the SOP-OPS-012 target, and
credits each qualifying technician's QuickBooks customer account with a
credit memo: a "Tech Bonus <week> <total>/<goal> hours (total/goal)"
line, plus a separate tier line for every full 15 hours over the goal.
Credit memos are emailed through QuickBooks.

- Bonus technicians (admin): user, QuickBooks customer, role
  (technician/foreman), probation end
- Tech bonuses (global "Run tech bonuses" permission): week preview,
  attendance check, run, PDF and email again; re-running a week never
  credits anyone twice

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rickyandClaude Opus 5.5 committed 2026-11-16 12:13:30 -05:00
commit a2ecb74c1d
37 files changed
+2274

No files matched your search

+90
View File
@@ -0,0 +1,90 @@
en:
permission_run_tech_bonuses: "Run tech bonuses"
label_tech_bonus_plural: "Tech bonuses"
label_bonus_technician_plural: "Bonus technicians"
label_bonus_technician_new: "New bonus technician"
label_bonus_technician_customer: "Customer account"
label_bonus_role_technician: "Technician"
label_bonus_role_foreman: "Foreman"
field_bonus_technician_probation_until: "Probation until"
field_probation_until: "Probation until"
label_tech_bonus_week: "Week"
label_tech_bonus_history: "Weeks run"
label_tech_bonus_hours_total_goal: "Hours (total/goal)"
label_tech_bonus_tiers: "Tiers"
label_tech_bonus_credits: "Credit memos"
label_tech_bonus_failed_count: "%{count} failed"
label_tech_bonus_amount: "Amount"
label_tech_bonus_run_by: "Run by"
label_tech_bonus_time_report: "Time report"
label_tech_bonus_total_hours: "Shop hours"
label_tech_bonus_goal_hours: "Goal hours"
label_tech_bonus_tier_hours: "Tier hours"
label_tech_bonus_next_tier: "Hours to next tier"
label_tech_bonus_short_of_goal: "Hours short of goal"
label_tech_bonus_technicians: "Technicians"
label_tech_bonus_hours: "Hours"
label_tech_bonus_attended: "Attended"
label_tech_bonus_base: "Bonus"
label_tech_bonus_tier_bonus: "Tier bonus"
label_tech_bonus_credit_memo: "Credit memo"
label_tech_bonus_shop_hours: "Hours by user"
label_tech_bonus_hours_counted: "Billable hours"
label_tech_bonus_include_subprojects: "Include subprojects"
label_tech_bonus_trackers_exclude: "All trackers except"
label_tech_bonus_trackers_include: "Only these trackers"
label_tech_bonus_users: "Users"
label_tech_bonus_target: "Target and amounts"
label_tech_bonus_per_tier: "+ per tier"
label_tech_bonus_item: "Product/service"
label_tech_bonus_customer_memo: "Message on credit memo"
label_tech_bonus_email_credits: "Email credit memos"
label_tech_bonus_status_created: "Created"
label_tech_bonus_status_emailed: "Emailed"
label_tech_bonus_status_skipped: "Skipped"
label_tech_bonus_status_failed: "Failed"
button_tech_bonus_preview: "Show"
button_tech_bonus_run: "Create & email credit memos"
button_tech_bonus_record: "Record week"
button_tech_bonus_resend: "Email again"
notice_tech_bonus_run: "%{count} credit memo(s) for week %{week}."
notice_tech_bonus_goal_not_met: "Week %{week} didn't reach the goal, so there are no bonuses."
notice_tech_bonus_some_failed: "Some credit memos couldn't be made. See why below, then run the week again to retry them."
notice_tech_bonus_emailed: "Credit memo emailed to %{email}."
error_tech_bonus_week_not_over: "The week isn't over yet."
error_tech_bonus_no_item: "Pick the product/service for bonus credit memos in the plugin's settings."
error_tech_bonus_not_created: "QuickBooks didn't create the credit memo."
error_tech_bonus_not_emailed: "QuickBooks didn't email the credit memo."
text_tech_bonus_line: "Tech Bonus %{week} %{total}/%{goal} hours (total/goal)"
text_tech_bonus_tier_line: "Tier Bonus %{week} %{tiers} x %{hours} hours over goal"
text_tech_bonus_private_note: "Weekly billable hours bonus (SOP-OPS-012), week %{week} (%{from} to %{to}). Made by Redmine."
text_tech_bonus_tier_every: "every %{hours} hours over goal"
text_tech_bonus_week_in_progress: "This week isn't over until %{date}, so its hours can still change. Its bonus can be run once it's over."
text_tech_bonus_no_technicians: "No bonus technicians yet."
text_tech_bonus_attendance: "Uncheck a technician who missed any part of a scheduled shift this week: they don't get the bonus (SOP-OPS-012 §4)."
text_tech_bonus_run_confirm: "Create a credit memo in QuickBooks for each checked technician, and email it to them?"
text_tech_bonus_resend_confirm: "Email this credit memo again?"
text_tech_bonus_already_run: "Last run by %{user} on %{time}. Running it again only makes the credit memos still missing."
text_tech_bonus_helping: "not a technician"
text_tech_bonus_inactive: "Not active"
text_tech_bonus_probation: "On probation until %{date}"
text_tech_bonus_no_customer: "No customer account"
text_tech_bonus_missed_shift: "Missed a scheduled shift"
text_tech_bonus_no_email: "Not emailed: the customer account has no email in QuickBooks."
text_tech_bonus_email_failed: "Not emailed: %{error}"
text_bonus_technicians: "The technicians and Foreman who earn the weekly billable hours bonus (SOP-OPS-012). Their bonus is credited to their customer account in QuickBooks."
text_bonus_technician_customer: "Their customer account in QuickBooks. Credit memos are emailed to its email."
text_bonus_technician_probation: "The last day of their 90-day probation. Weeks that start on or before this day get no bonus."
text_tech_bonus_projects: "Time logged on these projects counts. None: every project."
text_tech_bonus_trackers: "Time logged without an issue counts with \"All trackers except\"."
text_tech_bonus_users: "Whose time counts toward the shop's hours besides the bonus technicians' (e.g. front desk staff who help in the shop). None: everyone's."
text_tech_bonus_goal: "The shop's weekly target (SOP-OPS-012: 110)."
text_tech_bonus_tier: "A tier bonus for every full this many hours over the goal (SOP-OPS-012: 15)."
text_tech_bonus_item: "The QuickBooks product/service on the credit memo lines (e.g. \"Tech Bonus\"). It sets the account the bonuses are booked to."
text_tech_bonus_email_credits: "Email each credit memo to the technician when it's made."
+23
View File
@@ -0,0 +1,23 @@
#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.
RedmineApp::Application.routes.draw do
# Weekly bonus: the weeks run, a week's hours and bonuses (by its Sunday, e.g. /tech_bonuses/2026-11-15)
get 'tech_bonuses', to: 'tech_bonuses#index', as: :tech_bonuses
get 'tech_bonuses/:week', to: 'tech_bonuses#show', as: :tech_bonus_week, constraints: { week: /\d{4}-\d{2}-\d{2}/ }
post 'tech_bonuses/:week', to: 'tech_bonuses#create', constraints: { week: /\d{4}-\d{2}-\d{2}/ }
get 'tech_bonuses/credits/:id/pdf', to: 'tech_bonuses#pdf', as: :tech_bonus_credit_pdf
post 'tech_bonuses/credits/:id/resend', to: 'tech_bonuses#resend', as: :resend_tech_bonus_credit
# Administration » Bonus technicians
resources :bonus_technicians, except: [:show]
end