improve receipt/details reports and implement number formatting
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
This commit is contained in:
@@ -28,18 +28,6 @@
|
||||
<div class="margin-top-20">
|
||||
<div class="card">
|
||||
<div class="table-responsive">
|
||||
<% 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
|
||||
%>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -66,14 +54,14 @@
|
||||
<td>
|
||||
<% menu_item = MenuItemInstance.find_by_item_instance_code(result.item_code)%>
|
||||
<% if menu_item.nil? %>
|
||||
<% if !arr_item_code.include?(result.item_code) %>
|
||||
<% 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) %>
|
||||
<% 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) %>
|
||||
@@ -98,7 +86,7 @@
|
||||
<!-- <tr style="border-top: 3px solid grey;">
|
||||
<td colspan="3"></td>
|
||||
<td><b><%= total_stock_count rescue '-' %></b></td>
|
||||
<td><b><%= number_with_precision(total_stock_balance, precision:precision.to_i,delimiter:delimiter) 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> -->
|
||||
@@ -108,4 +96,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user