Files
sx-fc/app/views/reports/commission/index.html.erb
2018-01-08 17:00:00 +06:30

97 lines
3.9 KiB
Plaintext
Executable File

<div class="page-header">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.commission_report") %></li>
<span class="float-right">
<%= link_to 'Back', dashboard_path %>
</span>
</ol>
</div>
<div class="row">
<div class="col-md-12">
<!-- <div class="container"> -->
<%= render :partial => 'commission_report_filter',
:locals => {:period_type => true, :shift_name => true, :report_path => reports_commission_index_path} %>
<hr/>
<!-- </div> -->
<!-- <div class="container"> -->
<!-- <div class="row"> -->
<div class="text-right">
<a href="javascript:export_to('<%= reports_commission_index_path %>.xls')" class="btn btn-info wave-effects"><%= t("views.btn.exp_to_excel") %></a>
</div>
<!-- </div> -->
<!-- </div> -->
<div class="margin-top-20">
<div class="card">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th colspan="9"> <%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <%= t("views.right_panel.detail.to_date") %> : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %></th>
</tr>
<tr>
<th><%= t :sale %></th>
<th><%= t :sale %> <%= t("views.right_panel.detail.item") %></th>
<th><%= t :commissioner %> <%= t("views.right_panel.detail.name") %></th>
<th><%= t("views.right_panel.detail.product") %> <%= t("views.right_panel.detail.name") %></th>
<th><%= t("views.right_panel.detail.qty") %></th>
<th><%= t("views.right_panel.detail.commission_price") %></th>
<th><%= t("views.right_panel.detail.commission_amount") %></th>
<th><%= t("views.right_panel.detail.date") %></th>
</tr>
</thead>
<tbody>
<% if @print_settings.precision.to_i > 0
precision = @print_settings.precision
else
precision = 0
end
#check delimiter
if @print_settings.delimiter
delimiter = ","
else
delimiter = ""
end
%>
<% total_qty = 0 %>
<% total_price = 0 %>
<% total_amount = 0 %>
<% @transaction.each do |result| %>
<tr>
<td><%= result.sale_id rescue '-' %></td>
<td><%= result.sale_item_id rescue '-' %></td>
<td><%= result.commissioner.name rescue '-' %></td>
<td><%= result.commission.menu_item.name rescue '-' %></td>
<td><%= number_with_precision(result.qty.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<td><%= number_with_precision(result.price.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<td><%= number_with_precision(result.amount.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<td><%= result.updated_at.strftime("%e %b %Y %I:%M%p") rescue '-' %></td>
</tr>
<% total_qty += result.qty.to_f %>
<% total_price += result.price.to_f %>
<% total_amount += result.amount.to_f %>
<% end %>
<tr style="border-top: 3px solid grey;">
<td colspan="4"></td>
<td><b><%= number_with_precision(total_qty, precision: precision.to_i ,delimiter: delimiter) rescue '-'%></b></td>
<td><b><%= number_with_precision(total_price, precision: precision.to_i ,delimiter: delimiter) rescue '-'%></b></td>
<td><b><%= number_with_precision(total_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-'%></b></td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<script>
$(function () {
});
</script>