224 lines
13 KiB
Plaintext
Executable File
224 lines
13 KiB
Plaintext
Executable File
|
|
<div class="page-header">
|
|
<ol class="breadcrumb">
|
|
<li class="breadcrumb-item"><a href="<%= root_path %>"><%= t("views.right_panel.button.home") %></a></li>
|
|
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.daily_sale_report") %></li>
|
|
<span class="float-right">
|
|
<%= link_to 'Back', dashboard_path %>
|
|
</span>
|
|
</ol>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-md-12 col-lg-12 col-sm-12 ">
|
|
<%= render :partial=>'shift_sale_report_filter',
|
|
:locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_dailysale_index_path} %>
|
|
<hr />
|
|
<div class=" text-right">
|
|
<a href="javascript:export_to('<%=reports_dailysale_index_path%>.xls')" class = "btn btn-info wave-effects"><%= t("views.btn.exp_to_excel") %></a>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-md-12 col-lg-12">
|
|
<div class="card mbl_card">
|
|
<div class="body table-responsive">
|
|
<table class="table table-bordered">
|
|
<thead>
|
|
<tr>
|
|
<th colspan="<%= column_count = @payment_methods.length + 11 + @tax_profiles.length %>"> <%= 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>
|
|
<% @count = 1 %>
|
|
<% @payment_methods.each_slice(10) do |slice| %>
|
|
<!-- <tr>
|
|
<th></th>
|
|
<th></th>
|
|
<% alph = "A" %>
|
|
|
|
<% slice.each do |payment_method| %>
|
|
<th style="text-align:center;">
|
|
<%= alph %>
|
|
</th>
|
|
<% alph = alph.ord.next.chr %>
|
|
<% @count += 1 %>
|
|
<% end %>
|
|
<th style="text-align:center;" ><%= alph %></th>
|
|
<th style="text-align:center;"><%= alph = alph.ord.next.chr %></th>
|
|
<th style="text-align:center;"><%= alph = alph.ord.next.chr %></th>
|
|
<th style="text-align:center;"><%= alph = alph.ord.next.chr %></th>
|
|
<th style="text-align:center;"><%= alph = alph.ord.next.chr %></th>
|
|
<th style="text-align:center;"><%= alph = alph.ord.next.chr %></th>
|
|
</tr> -->
|
|
<!-- <tr>
|
|
<th style='text-align:center;'><%= t("views.right_panel.detail.sr") %></th>
|
|
<th style='text-align:center;'><%= t("views.right_panel.detail.date") %></th>
|
|
<% slice.each do |payment_method| %>
|
|
<th style="text-align:center;">
|
|
<%= payment_method %>
|
|
</th>
|
|
<% end %>
|
|
<th style='text-align:center;'><%= t("views.right_panel.detail.cash_sales") %></th>
|
|
<th style='text-align:center;'><%= t("views.right_panel.detail.credit_sales") %></th>
|
|
<th style='text-align:center;'><%= t("views.right_panel.detail.void_amount") %></th>
|
|
<th style='text-align:center;'><%= t("views.right_panel.detail.foc_sales") %></th>
|
|
<% if @payment_methods.include? ("GiftVoucher") %>
|
|
<th style='text-align:center;'><%= t("views.right_panel.detail.giftvoucher_sales") %></th>
|
|
<% end %>
|
|
<th style='text-align:center;'>(<%= t("views.right_panel.detail.discount") %>)</th>
|
|
<!-- <th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %> + <br/> <%= t("views.right_panel.detail.rnd_adj_sh") %></th> -->
|
|
<!-- <th style='text-align:center;'><%= t("views.right_panel.detail.rnd_adj_sh") %></th>
|
|
<th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %></th>
|
|
</tr> -->
|
|
<% end %>
|
|
<tr>
|
|
<th></th>
|
|
<th></th>
|
|
<th colspan="<%= @count + 1 %>" style='text-align:center;'>Income</th>
|
|
<th colspan='4' style='text-align:center;'>Outgoing</th>
|
|
<th colspan='<%= @tax_profiles.size %>' style='text-align:center;'>Tax</th>
|
|
<th style='text-align:center; cursor: help;' data-toggle="tooltip" data-placement="top" title="Net Sales = Income - Tax"><i class="material-icons md-18">live_help</i></th>
|
|
<th style='text-align:center; cursor: help;' data-toggle="tooltip" data-placement="top" title="Gross Sales = Income + Discount"><i class="material-icons md-18">live_help</i></th>
|
|
<th style='text-align:center; cursor: help;' data-toggle="tooltip" data-placement="top" title="Total Sales = Gross Sales - Discount"><i class="material-icons md-18">live_help</i></th>
|
|
</tr>
|
|
<tr>
|
|
<th style='text-align:center;'><%= t("views.right_panel.detail.sr") %></th>
|
|
<th style='text-align:center;'><%= t("views.righ_panel.detail.date") %></th>
|
|
<% @payment_methods.each do |method| %>
|
|
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.#{method}") %></th>
|
|
<% end %>
|
|
<th style='text-align:center;'><%= t("views.right_panel.detail.cash_sales") %></th>
|
|
<th style='text-align:center;'><%= t("views.right_panel.detail.credit_sales") %></th>
|
|
<th style='text-align:center;'><%= t("views.right_panel.detail.void_amount") %></th>
|
|
<th style='text-align:center;'><%= t("views.right_panel.detail.foc_sales") %></th>
|
|
<th style='text-align:center;'>(<%= t("views.right_panel.detail.discount") %>)</th>
|
|
<!-- <th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %> + <br/> <%= t("views.right_panel.detail.rnd_adj_sh") %></th> -->
|
|
<th style='text-align:center;'><%= t("views.right_panel.detail.rnd_adj_sh") %></th>
|
|
<% if @tax_profiles.present? %>
|
|
<% @tax_profiles.each do |name| %>
|
|
<th style='text-align:center;'><%= t name %></th>
|
|
<% end %>
|
|
<% end %>
|
|
<th style='text-align:center;'><%= t("views.right_panel.detail.net_sales") %></th>
|
|
<th style='text-align:center;'><%= t("views.right_panel.detail.gross_sales") %></th>
|
|
<th style='text-align:center;'><%= t("views.right_panel.detail.total_sales") %></th>
|
|
</tr>
|
|
</thead>
|
|
<% unless @sale_data.blank? %>
|
|
<tbody>
|
|
<% void = 0 %>
|
|
<% cash = 0 %>
|
|
<% credit = 0 %>
|
|
<% foc = 0 %>
|
|
<% discount = 0 %>
|
|
<% total = 0 %>
|
|
<% grand_total = 0 %>
|
|
<% old_grand_total = 0 %>
|
|
<% gross_sale = 0 %>
|
|
<% total_sale = 0 %>
|
|
<% tax = 0 %>
|
|
<% net_sale = 0 %>
|
|
<% count = 1 %> <% rounding_adj = 0 %>
|
|
|
|
<% @sale_data.each do |sale| %>
|
|
<% void += sale[:void_amount] %>
|
|
<% cash += sale[:cash_amount]-sale[:total_change_amount] %>
|
|
<% credit += sale[:credit_amount] %>
|
|
<% foc += sale[:foc_amount] %>
|
|
<% discount += sale[:total_discount] %>
|
|
<% total += sale[:grand_total].to_f + sale[:rounding_adj].to_f %>
|
|
<% grand_total += sale[:grand_total].to_f %>
|
|
<% old_grand_total += sale[:old_grand_total].to_f %>
|
|
<% rounding_adj += sale[:rounding_adj].to_f %>
|
|
<% gross_sale += sale[:gross_sale].to_f %>
|
|
<% total_sale += sale[:total_sale].to_f %>
|
|
<% tax += sale[:tax].to_f %>
|
|
<% net_sale += sale[:net_sale].to_f %>
|
|
<tr>
|
|
<td style='text-align:right;'><%= count %></td>
|
|
<td><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %></td>
|
|
<% @payment_methods.each do |method| %>
|
|
<td style='text-align:right;'><%= number_format(sale[method.parameterize.to_sym], precision:precision.to_i, delimiter: delimiter) rescue 0 %></td>
|
|
<% end %>
|
|
<td style='text-align:right;'><%= number_format(sale[:cash_amount]-sale[:total_change_amount], precision:precision.to_i, delimiter: delimiter) rescue '-'%></td>
|
|
<td style='text-align:right;'><%= number_format(sale[:credit_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
|
<td style='color:red;text-align:right;'><%= number_format(sale[:void_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
|
<td style='text-align:right;'><%= number_format(sale[:foc_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
|
|
|
<td style='text-align:right;'>(<%= number_format(sale[:total_discount], precision:precision,delimiter:delimiter) rescue '-'%>)</td>
|
|
<!-- <td style='text-align:right;'><%= number_format(sale[:grand_total].to_f + sale[:rounding_adj].to_f , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td> -->
|
|
<td style='text-align:right;'><%= number_format(sale[:rounding_adj], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
|
|
|
<% if @tax_profiles.present? %>
|
|
<% @tax_profiles.each do |name| %>
|
|
<td style='text-align:right;'><%= number_format(sale[name.parameterize.to_sym], precision:precision.to_i,delimiter:delimiter) rescue '-' %></td>
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<td style='text-align:right;'><%= number_format(sale[:net_sale], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
|
<td style='text-align:right;'><%= number_format(sale[:gross_sale], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
|
<td style='text-align:right;'><%= number_format(sale[:total_sale], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
|
|
|
</tr>
|
|
<% count = count + 1 %>
|
|
<% end %>
|
|
<% colspan = 7 %>
|
|
<tr style="font-weight:600;">
|
|
<td colspan="2" style='text-align:center;'>Total</td>
|
|
<% @payment_methods.each do |method| %>
|
|
<% colspan += 1 %>
|
|
<td style='text-align:right;'><%= number_format(@sale_data.inject(0.0.to_d) { |sum, sale| sum + sale[method.parameterize.to_sym] }, precision:precision.to_i,delimiter:delimiter) rescue 0 %></td>
|
|
<% end %>
|
|
<td style='text-align:right;'><%= number_format(cash, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
|
<td style='text-align:right;'><%= number_format(credit, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
|
<td style='color:red;text-align:right;'><%= number_format(void, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
|
<td style='text-align:right;'><%= number_format(foc, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
|
|
|
<td style='text-align:right;'>(<%= number_format(discount, precision:precision.to_i,delimiter:delimiter) rescue '-'%>)</td>
|
|
<td style='text-align:right;'><%= number_format(rounding_adj, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
|
|
|
<% if @tax_profiles.present? %>
|
|
<% @tax_profiles.each do |name| %>
|
|
<td style='text-align:right;'><%= number_format(@sale_data.inject(0.0.to_d) { |sum, sale| sum + sale[name.parameterize.to_sym] }, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<td style='text-align:right;'><%= number_format(net_sale, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
|
<td style='text-align:right;'><%= number_format(gross_sale, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
|
<td style='text-align:right;'><%= number_format(total_sale, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
|
</tr>
|
|
<tr style="font-weight:600;">
|
|
<td colspan="<%= column_count %>"> </td>
|
|
</tr>
|
|
<% total_tax = 0 %>
|
|
<% net = 0 %>
|
|
<% if @tax_profiles.present? %>
|
|
<% @tax_profiles.each do |name| %>
|
|
<tr style="font-weight:600;">
|
|
<td colspan="<%= colspan + 2 %>" style='text-align:right;'><%= t name rescue '-'%></td>
|
|
<td colspan="5" style='text-align:right;'>
|
|
<%= number_format(@sale_data.inject(0.0.to_d) { |sum, sale| sum + sale[name.parameterize.to_sym] }, precision:precision.to_i,delimiter:delimiter) rescue '-'%>
|
|
</td>
|
|
</tr>
|
|
<% end %>
|
|
<% net = grand_total %>
|
|
<% net = net - rounding_adj%>
|
|
<% net = net - total_tax %>
|
|
<tr style="font-weight:600;">
|
|
<td colspan="<%= colspan + 2 %>" style='text-align:right;'><%= t("views.right_panel.detail.net_amount") %></td>
|
|
<td colspan="5" style='text-align:right;'><%= number_format(net, precision:precision.to_i,delimiter:delimiter) rescue '-' %></td>
|
|
</tr>
|
|
<% else %>
|
|
<tr style="font-weight:600;">
|
|
<td colspan="<%= colspan + 2 %>" style='text-align:right;'><%= t("views.right_panel.detail.net_amount") %></td>
|
|
<td colspan="5" style='text-align:right;'><%= number_format(net_sale, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
|
</tr>
|
|
<% end %>
|
|
</tbody>
|
|
<% end %>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|