162 lines
8.8 KiB
Plaintext
Executable File
162 lines
8.8 KiB
Plaintext
Executable File
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta http-equiv="Content-type" content="application/vnd.ms-excel; charset=UTF-8">
|
|
</head>
|
|
<body>
|
|
<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 + 12 %>"> <%= 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| %>
|
|
<% 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>
|
|
</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>
|
|
|
|
<% @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>
|
|
<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>
|
|
<% if @tax.blank? %>
|
|
<th style='text-align:center;'><%= t("views.right_panel.detail.tax") %></th>
|
|
<th style='text-align:center;'><%= t("views.right_panel.detail.net_sales") %></th>
|
|
<% end %>
|
|
|
|
</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].to_f, 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>
|
|
<% if @tax.blank? %>
|
|
<td style='text-align:right;'><%= number_format(sale[:tax], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
|
<td style='text-align:right;'><%= number_format(sale[:net_sale], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
|
<% end %>
|
|
|
|
</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>
|
|
<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>
|
|
<% if @tax.blank? %>
|
|
<td style='text-align:right;'><%= number_format(tax, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
|
<td style='text-align:right;'><%= number_format(net_sale, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
|
<% end %>
|
|
|
|
</tr>
|
|
<tr style="font-weight:600;">
|
|
<td colspan="<%= column_count %>"> </td>
|
|
</tr>
|
|
<% total_tax = 0 %>
|
|
<% net = 0 %>
|
|
<% unless @tax.blank? %>
|
|
<% @tax.each do |tax|
|
|
total_tax += tax.tax_amount.to_f %>
|
|
<tr style="font-weight:600;">
|
|
<td colspan="<%= colspan + 2 %>" style='text-align:right;'><%= tax.tax_name rescue '-'%></td>
|
|
<td colspan="1" style='text-align:right;'><%= number_format(tax.tax_amount, 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="1" 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="1" 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>
|
|
</body>
|
|
</html>
|