1) eager load reports for receipt/details 2) introduce number_format lookups to replace print_settings for number formatting 3) implement NumberFormattable concern, reference number_format lookups or print_settings if not exist, to get number format settings and number formatting 4) replace rails NumberHelper.number_with_precision with NumberFormattable.number_format hopefully to reduce overhead, formatting numbers for huge lists of data
79 lines
3.5 KiB
Plaintext
Executable File
79 lines
3.5 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="container margin-top-20">
|
|
<div class="card row">
|
|
<div class="table-responsive">
|
|
<table class="table table-striped">
|
|
<thead>
|
|
<tr>
|
|
<th colspan="7"> From Date : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - To Date : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %></th>
|
|
</tr>
|
|
<tr>
|
|
<th><%= t("views.right_panel.detail.item") %> <%= t("views.right_panel.detail.name") %></th>
|
|
<th><%= t("views.right_panel.detail.stock_count") %></th>
|
|
<th><%= t("views.right_panel.detail.stock_balance") %></th>
|
|
<th><%= t("views.right_panel.detail.different") %></th>
|
|
<th><%= t("views.right_panel.detail.remark") %></th>
|
|
<th><%= t("views.right_panel.detail.checked_by") %></th>
|
|
<th><%= t("views.right_panel.detail.stock_check") %> <%= t("views.right_panel.detail.reason") %></th>
|
|
<th><%= t :date_time %></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<% total_stock_count = 0 %>
|
|
<% total_stock_balance = 0 %>
|
|
<% total_different = 0 %>
|
|
<% arr_item_code = [] %>
|
|
<% @transaction.each do |result| %>
|
|
<tr>
|
|
<td>
|
|
<% menu_item = MenuItemInstance.find_by_item_instance_code(result.item_code)%>
|
|
<% if menu_item.nil? %>
|
|
<% if !arr_item_code.include?(result.item_code) %>
|
|
<%= Product.find_by_item_code(result.item_code).name rescue "-" %>
|
|
<% arr_item_code.push(result.item_code) %>
|
|
<% else %>
|
|
|
|
<% end %>
|
|
<% else %>
|
|
<% if !arr_item_code.include?(result.item_code) %>
|
|
<%= menu_item.menu_item.name rescue "-" %>
|
|
- <%= menu_item.item_instance_name rescue "-" %>
|
|
<% arr_item_code.push(result.item_code) %>
|
|
<% else %>
|
|
|
|
<% end %>
|
|
<% end %>
|
|
</td>
|
|
<td><%= result.stock_count rescue '-' %></td>
|
|
<td><%= result.stock_balance rescue '-' %></td>
|
|
<td><%= result.different rescue '-' %></td>
|
|
<td><%= result.remark rescue '-' %></td>
|
|
<td><%= Employee.find(result.stock_check.check_by).name rescue '-' %></td>
|
|
<td><%= result.stock_check.reason rescue '-' %></td>
|
|
<td><%= result.created_at.utc.getlocal.strftime("%e %b %Y %I:%M %p") rescue '-' %></td>
|
|
</tr>
|
|
<% !result.stock_count.nil? ? total_stock_count += result.stock_count : total_stock_count += 0 %>
|
|
<% !result.stock_balance.nil? ? total_stock_balance += result.stock_balance : total_stock_balance += 0 %>
|
|
<% !result.different.nil? ? total_different += result.different : total_different += 0 %>
|
|
<% end %>
|
|
|
|
<!-- <tr style="border-top: 3px solid grey;">
|
|
<td colspan="3"></td>
|
|
<td><b><%= total_stock_count rescue '-' %></b></td>
|
|
<td><b><%= number_format(total_stock_balance, precision:precision.to_i,delimiter:delimiter) rescue '-' %></b></td>
|
|
<td><b><%= total_different rescue '-' %></b></td>
|
|
<td></td>
|
|
</tr> -->
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html> |