Files
redmine_qbo_commission/app/views/sales_commissions/index.html.erb
T
rickyandClaude Opus 5.5 6fcd5f9b64 New plugin: monthly sales commission (SOP-OPS-013)
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>
2026-11-16 18:53:25 -05:00

58 lines
2.5 KiB
ERB

<%= render partial: 'sales_commissions/styles' %>
<div class="contextual">
<% if User.current.admin? %>
<%= link_to sprite_icon('user', l(:label_commission_rep_plural)), commission_reps_path, class: 'icon icon-user' %>
<%= link_to sprite_icon('settings', l(:label_settings)), plugin_settings_path('redmine_qbo_commission'), class: 'icon icon-settings' %>
<% end %>
</div>
<h2><%= l(:label_sales_commission) %></h2>
<%= form_tag(sales_commissions_path, method: :get, id: 'sales-commission-month-picker', class: 'sales-commission-picker') do %>
<label for="sales_commission_month"><%= l(:label_sales_commission_month) %></label>
<%= select_tag 'month', options_for_select(@months.map { |month| [month.name, month.to_param] }, (@months.second || @months.first).to_param),
id: 'sales_commission_month' %>
<%= submit_tag l(:button_sales_commission_show), name: nil %>
<% end %>
<h3><%= l(:label_sales_commission_history) %></h3>
<% if @commission_months.empty? %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% else %>
<div class="autoscroll">
<table class="list sales-commission-table">
<thead>
<tr>
<th><%= l(:label_sales_commission_month) %></th>
<th><%= l(:field_status) %></th>
<th><%= l(:label_sales_commission_net_sales) %></th>
<th><%= l(:label_sales_commission_pool) %></th>
<th><%= l(:label_sales_commission_payouts_total) %></th>
<th><%= l(:label_sales_commission_approved_by) %></th>
</tr>
</thead>
<tbody>
<% @commission_months.each do |record| %>
<tr>
<td class="name"><%= link_to record.month.name, sales_commission_month_path(record.month.to_param) %></td>
<td class="text">
<% if record.approved? %>
<span class="sales-commission-ok"><%= l(:label_sales_commission_status_approved) %></span>
<% else %>
<span class="sales-commission-miss"><%= l(:label_sales_commission_status_open) %></span>
<% end %>
</td>
<td><%= record.approved? ? commission_money(record.net_sales) : '' %></td>
<td><%= record.approved? ? commission_money(record.pool) : '' %></td>
<td><%= record.approved? ? commission_money(record.payouts_total) : '' %></td>
<td class="text"><%= record.approved_by ? link_to_user(record.approved_by) : '' %> <%= format_time(record.approved_at) if record.approved_at %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
<% end %>
<% html_title l(:label_sales_commission) %>