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>
33 lines
1.6 KiB
ERB
33 lines
1.6 KiB
ERB
<%= error_messages_for @technician %>
|
|
<% taken = BonusTechnician.where.not(id: @technician.id).pluck(:user_id) %>
|
|
<% users = User.active.sorted.where.not(id: taken).to_a %>
|
|
<% users << @technician.user if @technician.user && !users.include?(@technician.user) %>
|
|
<div class="box tabular">
|
|
<p>
|
|
<%= f.select :user_id, users.map { |user| [user.name, user.id] }, { include_blank: true, required: true, label: :field_user },
|
|
{ disabled: @technician.persisted? } %>
|
|
</p>
|
|
<p>
|
|
<label for="bonus_technician_customer_name"><%= l(:label_bonus_technician_customer) %></label>
|
|
<%= text_field_tag 'customer_name', @technician.customer&.name, id: 'bonus_technician_customer_name',
|
|
class: 'customer-name', autocomplete: 'off', size: 40, placeholder: l(:label_choose_a_customer),
|
|
data: { autocomplete_url: '/customers/autocomplete' } %>
|
|
<%= f.hidden_field :customer_id, id: 'customer_id' %>
|
|
<em class="info"><%= l(:text_bonus_technician_customer) %></em>
|
|
</p>
|
|
<p><%= f.select :role, BonusTechnician.role_options, required: true %></p>
|
|
<p>
|
|
<%= f.date_field :probation_until, label: :field_bonus_technician_probation_until %>
|
|
<em class="info"><%= l(:text_bonus_technician_probation) %></em>
|
|
</p>
|
|
<p><%= f.check_box :active %></p>
|
|
</div>
|
|
<%= javascript_tag do %>
|
|
$(function() {
|
|
if (window.initCustomerAutocomplete) { window.initCustomerAutocomplete(document); }
|
|
$('#bonus_technician_customer_name').on('input', function() {
|
|
if (!$(this).val()) { $('#customer_id').val(''); }
|
|
});
|
|
});
|
|
<% end %>
|