Reads the month's paid sales from QuickBooks Online (invoices paid in full that month, sales receipts), deducts refund receipts, credit memos and adjustments, works out the commission pool with the threshold and marginal brackets, and records each sales rep's payout once the month is approved for payroll. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
16 lines
655 B
ERB
16 lines
655 B
ERB
<%= error_messages_for @rep %>
|
|
<% taken = CommissionRep.where.not(id: @rep.id).pluck(:user_id) %>
|
|
<% users = User.active.sorted.where.not(id: taken).to_a %>
|
|
<% users << @rep.user if @rep.user && !users.include?(@rep.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: @rep.persisted? } %>
|
|
</p>
|
|
<p>
|
|
<%= f.date_field :probation_until, label: :field_commission_rep_probation_until %>
|
|
<em class="info"><%= l(:text_commission_rep_probation) %></em>
|
|
</p>
|
|
<p><%= f.check_box :active %></p>
|
|
</div>
|