Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant

This commit is contained in:
Aung Myo
2018-08-08 16:17:22 +06:30
2 changed files with 88 additions and 10 deletions

View File

@@ -79,7 +79,20 @@
<% discount_amt = 0 %>
<% other_amt = 0 %>
<% total_nett = 0 %>
<% rounding_adj = 0%> <% gov_tax = 0 %> <% service_charge = 0 %>
<% rounding_adj = 0%> <% gov_tax = 0 %> <% service_charge = 0 %>
<% tax_profile_count = @tax_profiles.length %>
<%
ttax_count = tax_profile_count - @sale_taxes.length
ttax_flag = true
@sale_taxes.each do |tax|
if tax.tax_name.downcase.include?("service")
ttax_flag = false
end
end
%>
<%if @sale_data %>
<% @sale_data.each do |result| %>
@@ -89,8 +102,6 @@
<% total_sum += result.total_amount.to_f %>
<% discount_amt += result.total_discount.to_f %>
<% rounding_adj += result.rounding_adjustment.to_f %>
<% tax_profile_count = @tax_profiles.length %>
<% sale_tax_count = result.sale_taxes.length %>
<% tax_count = tax_profile_count - sale_tax_count %>
<% tax_flag = true %>
@@ -99,6 +110,7 @@
tax_flag = false
end
end %>
<tr>
<td><%= result.receipt_no rescue '-' %> </td>
@@ -148,7 +160,7 @@
<td colspan="2">&nbsp;</td>
<td><b><%= number_with_precision(total_sum, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
<td><b><%= number_with_precision(discount_amt, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
<% if !@sale_taxes.empty?
<!-- <% if !@sale_taxes.empty?
@sale_taxes.each do |tax| %>
<td>
<b><%= number_with_precision(tax.st_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b>
@@ -158,7 +170,38 @@
<% @tax_profiles.each do |tax| %>
<td><b>0</b></td>
<% end %>
<% end %>
<% end %> -->
<% if !@sale_taxes.empty? %>
<% num = 1
if ttax_flag && ttax_count > 0 %>
<% while num <= ttax_count %>
<td>
<%= number_with_precision(0, precision: precision.to_i ,delimiter: delimiter) %>
</td>
<% num += 1
end %>
<% end %>
<% @sale_taxes.each do |tax| %>
<td>
<%= number_with_precision(tax.st_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %>
</td>
<%end%>
<% num = 1
if ttax_flag==false && ttax_count > 0 %>
<% while num <= ttax_count %>
<td>
<%= number_with_precision(0, precision: precision.to_i ,delimiter: delimiter) %>
</td>
<% num += 1
end %>
<% end %>
<% else %>
<% @tax_profiles.each do |tax| %>
<td><%= number_with_precision(0, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<% end %>
<%end%>
<td><b><%= number_with_precision(old_grand_total.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '0' %></b></td>
<td><b><%= rounding_adj.to_f rescue '-' %></b></td>

View File

@@ -48,7 +48,19 @@
<% discount_amt = 0 %>
<% other_amt = 0 %>
<% total_nett = 0 %>
<% rounding_adj = 0%> <% gov_tax = 0 %> <% service_charge = 0 %>
<% rounding_adj = 0%> <% gov_tax = 0 %> <% service_charge = 0 %>
<% tax_profile_count = @tax_profiles.length %>
<%
ttax_count = tax_profile_count - @sale_taxes.length
ttax_flag = true
@sale_taxes.each do |tax|
if tax.tax_name.downcase.include?("service")
ttax_flag = false
end
end
%>
<%if @sale_data %>
<% @sale_data.each do |result| %>
@@ -58,8 +70,6 @@
<% total_sum += result.total_amount.to_f %>
<% discount_amt += result.total_discount.to_f %>
<% rounding_adj += result.rounding_adjustment.to_f %>
<% tax_profile_count = @tax_profiles.length %>
<% sale_tax_count = result.sale_taxes.length %>
<% tax_count = tax_profile_count - sale_tax_count %>
<% tax_flag = true %>
@@ -113,9 +123,34 @@
<td colspan="2">&nbsp;</td>
<td><b><%= total_sum rescue '-'%></b></td>
<td><b><%= discount_amt rescue '-'%></b></td>
<% @sale_taxes.each do |tax| %>
<!-- <% @sale_taxes.each do |tax| %>
<td><b><%= tax.st_amount.round(2) %></b></td>
<% end %>
<% end %> -->
<% if !@sale_taxes.empty? %>
<% num = 1
if ttax_flag && ttax_count > 0 %>
<% while num <= ttax_count %>
<td>0.00</td>
<% num += 1
end %>
<% end %>
<% @sale_taxes.each do |tax| %>
<td>
<%= tax.st_amount.to_f.round(2) %>
</td>
<%end%>
<% num = 1
if ttax_flag==false && ttax_count > 0 %>
<% while num <= ttax_count %>
<td>0.00</td>
<% num += 1
end %>
<% end %>
<% else %>
<% @tax_profiles.each do |tax| %>
<td>0.00</td>
<% end %>
<%end%>
<td><b><%= grand_total.to_f.round(2) rescue '-'%></b></td>
<td><b><%= rounding_adj rescue '-'%></b></td>
<td><b><%= grand_total.to_f.round + rounding_adj %></b></td>