add delimiter at report

This commit is contained in:
NyanLinHtut
2019-09-26 10:10:07 +06:30
parent 9d330bb28c
commit ec9e4fb7eb
5 changed files with 53 additions and 19 deletions

View File

@@ -133,4 +133,4 @@ gem 'momentjs-rails' # for date-range selector
# gem 'bootstrap-datepicker-rails' # date picker
# gem 'jquery-datetimepicker-rails'
# gem 'select2-rails' # for multi-select and auto-complete select box
gem "chartkick" #chart lib
gem "chartkick" #chart lib

View File

@@ -157,6 +157,15 @@ GEM
minitest (5.11.3)
momentjs-rails (2.20.1)
railties (>= 3.1)
monetize (1.9.2)
money (~> 6.12)
money (6.13.4)
i18n (>= 0.6.4, <= 2)
money-rails (1.13.2)
activesupport (>= 3.0)
monetize (~> 1.9.0)
money (~> 6.13.2)
railties (>= 3.0)
multi_xml (0.6.0)
mysql2 (0.4.10)
nested_form (0.3.2)
@@ -338,6 +347,7 @@ DEPENDENCIES
material_icons
mini_magick
momentjs-rails
money-rails (~> 1.12)
mysql2 (>= 0.3.18, < 0.5)
nested_form
pdfjs_viewer-rails

View File

@@ -113,9 +113,9 @@
<td><%= sale.item_code %></td>
<td><%= sale.product_name %></td>
<td><%= sale.total_item.to_i %></td>
<td><%= sale.unit_price.to_i %></td>
<td><%= sale.grand_total.to_i %></td>
<td><%= sale.date_format %></td>
<td><%= number_with_precision(sale.unit_price.to_i, precision:precision.to_i,delimiter:delimiter) %></td>
<td><%= number_with_precision(sale.grand_total.to_i, precision:precision.to_i,delimiter:delimiter) %></td>
<!-- <td><%= sale.date_format %></td> -->
</tr>
<% end %>
<!-- new tr -->
@@ -133,7 +133,7 @@
<td style="text-align:right"> <strong>Grand Total: </strong></td>
<td >
<span class="underline" style="text-align:right">
<strong><%= grand_total.to_i %></strong>
<strong><%= number_with_precision(grand_total.to_i, precision:precision.to_i,delimiter:delimiter) %></strong>
<% grand_total = 0 %>
</span>
</td>

View File

@@ -43,6 +43,18 @@
</tr>
</thead>
<tbody>
<% 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
%>
<% grand_total = 0 %>
<% @sale_data.each do |result| %>
<% table_name=nil
@@ -58,7 +70,7 @@
<td><%= table_type %> - <%= table_name %></td>
<td><%= result.receipt_no rescue '-' %> </td>
<td><%= result.cashier_name rescue '-' %></td>
<td><%=result.grand_total%></td>
<td><%= number_with_precision(result.grand_total, precision:precision.to_i,delimiter:delimiter) %></td>
<!-- <td>&nbsp;</td> -->
</tr>
@@ -84,8 +96,8 @@
<% end %>
</td>
<td><%= item.qty rescue '-' %></td>
<td><%= item.unit_price rescue '-' %></td>
<td><%= item.price rescue '-' %></td>
<td><%= number_with_precision(item.unit_price, precision:precision.to_i,delimiter:delimiter) rescue '-' %></td>
<td><%= number_with_precision(item.price, precision:precision.to_i,delimiter:delimiter) rescue '-' %></td>
<td><%=l item.created_at.utc.getlocal, :format => :short rescue '-' %> </td>
</tr>
<% end %>
@@ -108,7 +120,7 @@
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></td>
<td><%= result.total_amount %></td>
<td><%= number_with_precision(result.total_amount, precision:precision.to_i,delimiter:delimiter) %></td>
<td>&nbsp;</td>
</tr>
<% end %>
@@ -120,7 +132,7 @@
<td><%= t("views.right_panel.detail.total") %>
<%= t("views.right_panel.detail.discount") %>
<%= t("views.right_panel.detail.amount") %></td>
<td> - <%= result.total_discount %> </td>
<td> - <%= number_with_precision(result.total_discount, precision:precision.to_i,delimiter:delimiter) %> </td>
<td>&nbsp;</td>
</tr>
<% end %>
@@ -130,7 +142,7 @@
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>Tax Amount </td>
<td><%= result.total_tax %> </td>
<td><%= number_with_precision(result.total_tax, precision:precision.to_i,delimiter:delimiter) %> </td>
<td>&nbsp;</td>
</tr>
<% end %>
@@ -142,7 +154,7 @@
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>Payment <%= rec.payment_method.upcase %></td>
<td><%= rec.payment_amount %> ( <%= rec.payment_status %> )</td>
<td><%= number_with_precision(rec.payment_amount, precision:precision.to_i,delimiter:delimiter) %> ( <%= rec.payment_status %> )</td>
<td>&nbsp;</td>
</tr>
@@ -162,7 +174,7 @@
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><%= t("views.right_panel.detail.change") %> <%= t("views.right_panel.detail.amount") %></td>
<td><%= result.amount_changed %></td>
<td><%= number_with_precision(result.amount_changed, precision:precision.to_i,delimiter:delimiter) %></td>
<td>&nbsp;</td>
</tr>
<% end %>
@@ -184,7 +196,7 @@
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><b>Total Nett</b> - <b><%= grand_total %></b></td>
<td><b>Total Nett</b> - <b><%= number_with_precision(grand_total, precision:precision.to_i,delimiter:delimiter) %></b></td>
<td>&nbsp;</td>
</tr>

View File

@@ -45,6 +45,18 @@
<tbody>
<% 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
%>
<% receipt_arr = Array.new %>
<% menu_cat_arr = Array.new %>
<% footer_arr = Array.new %>
@@ -65,10 +77,10 @@
<td>&nbsp;</td>
<% end %>
<td><%= sale.product_name %></td>
<td><%= sale.product_code %></td>
<td><%= sale.product_code.to_i %></td>
<td><%= sale.qty.to_i %></td>
<td><%= sale.unit_price %></td>
<td><%= sale.price %></td>
<td><%= number_with_precision(sale.unit_price, precision:precision.to_i,delimiter:delimiter) %></td>
<td><%= number_with_precision(sale.price, precision:precision.to_i,delimiter:delimiter) %></td>
</tr>
@@ -79,13 +91,13 @@
<td colspan="2" style="text-align:right"> <strong>Total Qty: </strong></td>
<td>
<span class="underline" style="text-align:right">
<strong><%= waste_and_spoil_item_count %></strong>
<strong><%= number_with_precision(waste_and_spoil_item_count, precision:precision.to_i,delimiter:delimiter) %></strong>
<% waste_and_spoil_item_count = 0%>
</span></td>
<td style="text-align:right"> <strong>Grand Total: </strong></td>
<td >
<span class="underline" style="text-align:right">
<strong><%= grand_total %></strong>
<strong><%= number_with_precision(grand_total, precision:precision.to_i,delimiter:delimiter) %></strong>
</span>
</td>
</tr>