update precision and delimetor all

This commit is contained in:
Aung Myo
2018-01-08 17:00:00 +06:30
parent 770f80b12e
commit cd2f9fdcb0
21 changed files with 360 additions and 159 deletions

View File

@@ -45,6 +45,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
%>
<% unless @sale_data.blank? %>
<% acc_arr = Array.new %>
<% cate_arr = Array.new %>
@@ -86,7 +98,7 @@
<td>
<% @totalByAccount.each do |account, total| %>
<% if sale.account_id == account %>
<b><%= total %></b>
<b><%= number_with_precision(total, precision:precision,delimiter:delimiter) %></b>
<% grand_total += total %>
<% end %>
<% end %>
@@ -105,8 +117,8 @@
<td><%= sale.item_code rescue '-' %></td>
<td><%= sale.product_name rescue '-' %></td>
<td><%= sale.total_item rescue '-' %></td>
<td><%= sale.unit_price rescue '-' %></td>
<td><%= sale.grand_total rescue '-' %></td>
<td><%= number_with_precision(sale.unit_price , precision:precision,delimiter:delimiter) rescue '-'%></td>
<td><%= number_with_precision(sale.grand_total , precision:precision,delimiter:delimiter) rescue '-'%></td>
</tr>
<!-- sub total -->
@@ -121,7 +133,7 @@
<td><b>Total <%= sale.account_name %> Qty </b> </td>
<td><b><%= sub_qty %></b></td>
<td><%= t("views.right_panel.detail.sub_total") %></td>
<td ><span class="underline"><%= sub_total %></span></td>
<td ><span class="underline"><%= number_with_precision(sub_total , precision:precision,delimiter:delimiter)%> </span></td>
</tr>
<% sub_total = 0.0%>
<% sub_qty = 0 %>
@@ -149,8 +161,8 @@
<td><%= other.item_code rescue '-' %></td>
<td><%= other.product_name rescue '-' %></td>
<td><%= other.total_item rescue '-' %></td>
<td><%= other.unit_price rescue '-' %></td>
<td><%= other.grand_total rescue '-' %></td>
<td> <%= number_with_precision(other.unit_price , precision:precision,delimiter:delimiter) rescue '-'%></td>
<td> <%= number_with_precision(other.grand_total , precision:precision,delimiter:delimiter) rescue '-'%></td>
</tr>
<!-- sub total -->
@@ -160,7 +172,7 @@
<tr>
<td colspan="5">&nbsp;</td>
<td><%= t("views.right_panel.detail.sub_total") %></td>
<td ><span><%= other_sub_total %></span></td>
<td ><span><%= number_with_precision(other_sub_total , precision:precision,delimiter:delimiter)%></span></td>
</tr>
<%end%>
<!-- End Other Charges -->
@@ -169,29 +181,29 @@
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.item") %></td>
<td><span><%= total_qty%></span></td>
<td style="border-bottom:2px solid grey;"><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></td>
<td style="border-bottom:2px solid grey;"><span><%= grand_total%></span></td>
<td style="border-bottom:2px solid grey;"><span><%= number_with_precision(grand_total , precision:precision,delimiter:delimiter)%></span></td>
</tr>
<% end %>
<tr>
<td colspan="5">&nbsp;</td>
<td><%= t("views.right_panel.detail.foc_item") %> <%= t("views.right_panel.detail.amount") %></td>
<td><span><%= total_item_foc %></span></td>
<td><span><%= number_with_precision(total_item_foc , precision:precision,delimiter:delimiter) %></span></td>
</tr>
<tr>
<td colspan="5">&nbsp;</td>
<td style="border-bottom:2px solid grey;"><%= t("views.right_panel.detail.item_discount") %> <%= t("views.right_panel.detail.amount") %></td>
<td style="border-bottom:2px solid grey;"><span><%= total_item_dis %></span></td>
<td style="border-bottom:2px solid grey;"><span><%= number_with_precision(total_item_dis , precision:precision,delimiter:delimiter) %></span></td>
</tr>
<tr>
<td colspan="5">&nbsp;</td>
<td><%= t("views.right_panel.detail.foc_sales") %></td>
<td><span><%= @foc_data %></span></td>
<td><span><%= number_with_precision(@foc_data , precision:precision,delimiter:delimiter) %></span></td>
</tr>
<tr>
<td colspan="5">&nbsp;</td>
<td style="border-bottom:2px solid grey;"><%= t("views.right_panel.detail.discount") %> <%= t("views.right_panel.detail.amount") %></td>
<td style="border-bottom:2px solid grey;"><span><%= @discount_data %></span></td>
<td style="border-bottom:2px solid grey;"><span><%= number_with_precision(@discount_data , precision:precision,delimiter:delimiter) %></span></td>
</tr>
<% @sale_taxes.each do |tax| %>
@@ -207,7 +219,7 @@
<td colspan="5">&nbsp;</td>
<td style="border-top:2px solid grey;">Net Amount</td>
<!-- <td><span class="double_underline"><%= grand_total.to_f - @discount_data.to_f%></span></td> -->
<td style="border-top:2px solid grey;"><%= grand_total.to_f - @discount_data.to_f%></td>
<td style="border-top:2px solid grey;"><%= number_with_precision(grand_total.to_f - @discount_data.to_f , precision:precision,delimiter:delimiter)%></td>
</tr>
<!-- <tr>
<td colspan="5">&nbsp;</td>