Files
sx-fc/app/views/reports/void_sale/index.xls.erb
2025-06-30 17:23:23 +06:30

75 lines
3.1 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">
<div class="margin-top-20">
<div class="card">
<% if @sale_data.count > 0 %>
<table class="table table-striped" border="0">
<thead>
<% if !params[:from].blank?%>
<tr>
<th colspan="7"><%= t("views.right_panel.detail.from_date") %> : <%= params[:from] rescue '-'%> , <%= t("views.right_panel.detail.to_date") %> : <%= params[:to] rescue '-'%></th>
</tr>
<% end %>
<% if @shift_from %>
<tr>
<% if @shift %>
<% cashier_name = !@shift.nil? ? @shift[0].employee.name : '-' %>
<% end %>
<th colspan="3"><%= t("views.right_panel.detail.shift_name") %> = <%= @shift_from rescue '-'%> - <%= @shift_to rescue '-'%> ( <%= cashier_name rescue '-'%> )</th>
</tr>
<% end %>
<tr>
<th><%= t("views.right_panel.detail.receipt_no") %></th>
<th><%= t("views.right_panel.detail.sale_date") %></th>
<th><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></th>
<th><%= t("views.right_panel.detail.grand_total") %></th>
<th><%= t("views.right_panel.detail.rnd_adj_sh") %></th>
<th><%= t("views.right_panel.detail.grand_total") %> + <br/><%= t("views.right_panel.detail.rnd_adj_sh") %></th>
<th>Status</th>
</tr>
</thead>
<tbody>
<% total_amount = 0.0 %>
<% grand_total = 0.0 %>
<% rounding_adjustment = 0.0 %>
<% grand_rounding_adjustment = 0.0 %>
<% @sale_data.each do |result| %>
<% result[:items].each do |item| %>
<tr>
<td><%= item.receipt_no rescue '-' %> </td>
<td><%= item.receipt_date.strftime("%e %b %I:%M%p") rescue '-' %></td>
<td><%= item.total_amount.to_f rescue '-'%> </td>
<td><%= item.grand_total.to_f rescue '-'%> </td>
<td><%= item.rounding_adjustment.to_f rescue '-' %></td>
<td><%= item.grand_total.to_f + item.rounding_adjustment.to_f rescue '-'%> </td>
<td><%= item.sale_audits.where(action: 'CANCEL_MMQR_PAYMENT').exists? ? "payment cancelled (mmqr)" : item.sale_status rescue '-' %> </td>
<!-- <td><%= item.remarks rescue '-' %> </td> -->
</tr>
<% total_amount = total_amount.to_f + item.total_amount.to_f %>
<% grand_total = grand_total.to_f + item.grand_total.to_f %>
<% rounding_adjustment = rounding_adjustment.to_f + item.rounding_adjustment.to_f %>
<% grand_rounding_adjustment = grand_rounding_adjustment.to_f + item.grand_total.to_f + item.rounding_adjustment.to_f %>
<% end %>
<% end %>
<tr style="border-top:4px double #666;font-weight:600;">
<td colspan="2" style="text-align:center;">Total Void Amount :</td>
<td><%= total_amount rescue '-' %></td>
<td><%= grand_total rescue '-' %></td>
<td><%= rounding_adjustment rescue '-'%></td>
<td colspan="1"><%= grand_rounding_adjustment rescue '-'%></td>
</tr>
</tbody>
</table>
<% end %>
</div>
</div>
</body>
</html>