<% acc_arr = Array.new %>
<% cate_arr = Array.new %>
<% p_qty = 0 %>
<% sub_qty = 0 %>
<% sub_total = 0 %>
<% other_sub_total = 0 %>
<% product_sub_total = 0 %>
<% count = 0 %>
<% row_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| %>
<% row_count += 1 %>
<% if sale.status_type != "Discount" && sale.status_type != "foc" && sale.status_type != "promotion"
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 =="promotion" && @type == "promotion"
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_format(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_format(sale.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%> |
<%= number_format(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") && sale.status_type != "promotion"
sub_qty += sale.total_item
end %>
<% if sale.status_type =="Discount"
sub_qty += sale.total_item*(-1)
end %>
<% if sale.status_type == "promotion" && @type == "promotion"
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_format(sub_total , precision:precision.to_i,delimiter:delimiter)%> |
<% sub_total = 0.0%>
<% sub_qty = 0 %>
<% count = 0%>
<% end %>
<% end %>
<% end %>
<% end %>
<% if @product.present?%>
| Product |
|
|
<% @product.each do |product| %>
<% if product.total_item > 0
total_qty += product.total_item
end %>
<% grand_total +=product.grand_total
p_qty += product.total_item%>
| |
Product |
<%= product.product_code rescue '-' %> |
<%= product.product_name rescue '-' %> |
<%= product.total_item rescue '-' %> |
<%= number_format(product.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%> |
<%= number_format(product.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%> |
<% product_sub_total += product.grand_total %>
<% end %>
| |
Total Product Qty |
<%= p_qty %> |
<%= t("views.right_panel.detail.sub_total") %> |
<%= number_format(product_sub_total , precision:precision.to_i,delimiter:delimiter)%> |
<%end%>
<% if @type == "other" || @other_charges.present?%>
| 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_format(other.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%> |
<%= number_format(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_format(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_format(grand_total , precision:precision.to_i,delimiter:delimiter)%> |
<% if @type =="" || @type =="all" || @type.nil? %>
| |
Total FOC Amount |
<%= number_format(@foc_data , precision:precision.to_i,delimiter:delimiter)%> |
| |
<%= t("views.right_panel.detail.net_amount") %> |
<%= number_format(grand_total -@foc_data , precision:precision.to_i,delimiter:delimiter)%> |
<% 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_format(other.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%> |
<%= number_format(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_format(other_sub_total , precision:precision.to_i,delimiter:delimiter)%> |
<%end%>