<% 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
%>
<% acc_arr = Array.new %>
<% cate_arr = Array.new %>
<% sub_qty = 0 %>
<% sub_total = 0 %>
<% other_sub_total = 0 %>
<% count = 0 %>
<% total_price = 0 %>
<% cate_count = 0 %>
<% acc_count = 0 %>
<% grand_total = 0 %>
<% total_qty = 0 %>
<% total_amount = 0 %>
<% discount = 0 %>
<% total_item_foc = 0 %>
<% total_item_dis = 0.0 %>
<% total_tax = 0 %>
<% unless @sale_data.blank? %>
<% @sale_data.each do |sale| %>
<% if sale.status_type != "Discount" && sale.status_type != "foc"
total_qty += sale.total_item
end %>
<% if sale.status_type == "foc" && sale.price > 0
total_qty += sale.total_item
end %>
<% if sale.status_type == "Discount"
total_qty += sale.total_item*(-1)
end %>
<% if sale.status_type == "foc" && sale.grand_total < 0
total_item_foc += sale.grand_total*(-1)
end %>
<% if sale.status_type == "Discount" && sale.grand_total < 0
total_item_dis += sale.grand_total*(-1)
end %>
<% if !acc_arr.include?(sale.account_id) %>
| <%= sale.account_name %> |
|
<%= t("views.right_panel.detail.total_price_by") %> <%= sale.account_name %> |
<% @totalByAccount.each do |account, total| %>
<% if sale.account_id == account %>
<%= number_with_precision(total, precision:precision.to_i,delimiter:delimiter) %>
<% grand_total += total %>
<% end %>
<% end %>
|
<% acc_arr.push(sale.account_id) %>
<% end %>
| |
<% if !cate_arr.include?(sale.menu_category_id) %>
<%= sale.menu_category_name %> |
<% cate_arr.push(sale.menu_category_id) %>
<% else %>
|
<% end %>
<%= sale.item_code rescue '-' %> |
<%= sale.product_name rescue '-' %> |
<% if sale.status_type != "Discount" %>
<%= sale.total_item rescue '-' %> |
<%else%>
<%= sale.total_item*(-1) rescue '-' %> |
<% end %>
<%= number_with_precision(sale.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%> |
<%= number_with_precision(sale.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%> |
<% @menu_cate_count.each do |key,value| %>
<% if sale.account_id == key %>
<% count = count + 1 %>
<% sub_total += sale.grand_total %>
<% #sub_qty += sale.total_item %>
<% if sale.status_type !="Discount" && (!sale.product_name.include? "FOC")
sub_qty += sale.total_item
end %>
<% if sale.status_type =="Discount"
sub_qty += sale.total_item*(-1)
end %>
<% if count == value %>
| |
Total <%= sale.account_name %> Qty |
<%= sub_qty %> |
<%= t("views.right_panel.detail.sub_total") %> |
<%= number_with_precision(sub_total , precision:precision.to_i,delimiter:delimiter)%> |
<% sub_total = 0.0%>
<% sub_qty = 0 %>
<% count = 0%>
<% end %>
<% end %>
<% end %>
<% end %>
<% if @type == "other"%>
| Other Charges |
|
|
<% @other_charges.each do |other| %>
<% if other.total_item > 0
total_qty += other.total_item
end %>
<% grand_total +=other.grand_total%>
| |
Other Charges |
<%= other.item_code rescue '-' %> |
<%= other.product_name rescue '-' %> |
<%= other.total_item rescue '-' %> |
<%= number_with_precision(other.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%> |
<%= number_with_precision(other.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%> |
<% other_sub_total += other.grand_total %>
<% end %>
| |
<%= t("views.right_panel.detail.sub_total") %> |
<%= number_with_precision(other_sub_total , precision:precision.to_i,delimiter:delimiter)%> |
<%end%>
| |
<%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.item") %> |
<%= total_qty%> |
<%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %> |
<%= number_with_precision(grand_total , precision:precision.to_i,delimiter:delimiter)%> |
<% end %>
<% if @type == "other"%>
| Other Charges |
|
|
<% @other_charges.each do |other| %>
<% if other.total_item > 0
total_qty += other.total_item
end %>
<% grand_total +=other.grand_total%>
| |
Other Charges |
<%= other.item_code rescue '-' %> |
<%= other.product_name rescue '-' %> |
<%= other.total_item rescue '-' %> |
<%= number_with_precision(other.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%> |
<%= number_with_precision(other.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%> |
<% other_sub_total += other.grand_total %>
<% end %>
| |
<%= t("views.right_panel.detail.sub_total") %> |
<%= number_with_precision(other_sub_total , precision:precision.to_i,delimiter:delimiter)%> |
<%end%>