Files
redmine_qbo_bonus/app/views/settings/_qbo_bonus.html.erb
T
rickyandClaude Opus 5.5 a2ecb74c1d 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>
2026-11-16 12:13:30 -05:00

85 lines
4.6 KiB
ERB

<%# Settings for redmine_qbo_bonus (Administration » Plugins » Configure) %>
<% s = RedmineQboBonus::Settings %>
<% field = ->(key) { "settings[#{key}]" } %>
<p>
<%= link_to sprite_icon('user', l(:label_bonus_technician_plural)), bonus_technicians_path, class: 'icon icon-user' %>
<%= link_to sprite_icon('time', l(:label_tech_bonus_plural)), tech_bonuses_path, class: 'icon icon-time' %>
</p>
<fieldset class="box tabular">
<legend><%= l(:label_tech_bonus_hours_counted) %></legend>
<p>
<label for="qbo_bonus_projects"><%= l(:label_project_plural) %></label>
<%= hidden_field_tag "#{field.call('project_ids')}[]", '', id: nil %>
<%= select_tag "#{field.call('project_ids')}[]",
project_tree_options_for_select(Project.active.sorted.to_a, selected: Project.where(id: s.project_ids).to_a),
multiple: true, size: 8, id: 'qbo_bonus_projects' %>
<em class="info"><%= l(:text_tech_bonus_projects) %></em>
</p>
<p>
<label for="qbo_bonus_subprojects"><%= l(:label_tech_bonus_include_subprojects) %></label>
<%= hidden_field_tag field.call('include_subprojects'), '0', id: nil %>
<%= check_box_tag field.call('include_subprojects'), '1', s.include_subprojects?, id: 'qbo_bonus_subprojects' %>
</p>
<p>
<label for="qbo_bonus_trackers"><%= l(:label_tracker_plural) %></label>
<%= select_tag field.call('tracker_mode'),
options_for_select([[l(:label_tech_bonus_trackers_exclude), 'exclude'], [l(:label_tech_bonus_trackers_include), 'include']], s.tracker_mode),
id: 'qbo_bonus_tracker_mode' %><br>
<%= hidden_field_tag "#{field.call('tracker_ids')}[]", '', id: nil %>
<%= select_tag "#{field.call('tracker_ids')}[]", options_from_collection_for_select(Tracker.sorted, :id, :name, s.tracker_ids),
multiple: true, size: 8, id: 'qbo_bonus_trackers' %>
<em class="info"><%= l(:text_tech_bonus_trackers) %></em>
</p>
<p>
<label for="qbo_bonus_users"><%= l(:label_tech_bonus_users) %></label>
<%= hidden_field_tag "#{field.call('user_ids')}[]", '', id: nil %>
<%= select_tag "#{field.call('user_ids')}[]", options_from_collection_for_select(User.active.sorted, :id, :name, s.user_ids),
multiple: true, size: 8, id: 'qbo_bonus_users' %>
<em class="info"><%= l(:text_tech_bonus_users) %></em>
</p>
</fieldset>
<fieldset class="box tabular">
<legend><%= l(:label_tech_bonus_target) %></legend>
<p>
<label for="qbo_bonus_goal"><%= l(:label_tech_bonus_goal_hours) %></label>
<%= number_field_tag field.call('goal_hours'), RedmineQboBonus.format_hours(s.goal_hours), id: 'qbo_bonus_goal', min: 0, step: 0.25, style: 'width: 6em' %>
<em class="info"><%= l(:text_tech_bonus_goal) %></em>
</p>
<p>
<label for="qbo_bonus_tier"><%= l(:label_tech_bonus_tier_hours) %></label>
<%= number_field_tag field.call('tier_hours'), RedmineQboBonus.format_hours(s.tier_hours), id: 'qbo_bonus_tier', min: 0.25, step: 0.25, style: 'width: 6em' %>
<em class="info"><%= l(:text_tech_bonus_tier) %></em>
</p>
<% BonusTechnician::ROLES.each do |role| %>
<p>
<label for="qbo_bonus_<%= role %>_amount"><%= l("label_bonus_role_#{role}") %></label>
<%= number_field_tag field.call("#{role}_amount"), RedmineQboBonus.format_hours(s.amount(role)), id: "qbo_bonus_#{role}_amount", min: 0, step: 0.01, style: 'width: 6em' %>
<%= l(:label_tech_bonus_per_tier) %>
<%= number_field_tag field.call("#{role}_tier_amount"), RedmineQboBonus.format_hours(s.tier_amount(role)), id: "qbo_bonus_#{role}_tier_amount", min: 0, step: 0.01, style: 'width: 6em' %>
</p>
<% end %>
</fieldset>
<fieldset class="box tabular">
<legend><%= l(:label_tech_bonus_credit_memo) %></legend>
<p>
<label for="qbo_bonus_item"><%= l(:label_tech_bonus_item) %><span class="required"> *</span></label>
<%= select_tag field.call('item_id'), options_from_collection_for_select(Item.sellable.order(:name), :id, :name, s.item_id),
include_blank: true, id: 'qbo_bonus_item' %>
<em class="info"><%= l(:text_tech_bonus_item) %></em>
</p>
<p>
<label for="qbo_bonus_memo"><%= l(:label_tech_bonus_customer_memo) %></label>
<%= text_area_tag field.call('customer_memo'), s.customer_memo, id: 'qbo_bonus_memo', rows: 2, cols: 60 %>
</p>
<p>
<label for="qbo_bonus_email"><%= l(:label_tech_bonus_email_credits) %></label>
<%= hidden_field_tag field.call('email_credits'), '0', id: nil %>
<%= check_box_tag field.call('email_credits'), '1', s.email_credits?, id: 'qbo_bonus_email' %>
<em class="info"><%= l(:text_tech_bonus_email_credits) %></em>
</p>
</fieldset>