<% time_arr = Array.new %> <% acc_arr = Array.new %> <% sale_item_count =0 %> <% menu_cat_arr = Array.new %> <% footer_arr = Array.new %> <% count = 0 %> <% waste_and_spoil_item_count = 0%> <% total_qty = 0 %> <% time_count = 0 %> <% grand_total = 0 %> <% @sale_data.each do |sale| %> <% if !time_arr.include?(sale.date_format) %> <% sale_item_count =1 %> <% time_count = time_count + 1 %> <% time_arr.push(sale.date_format) %> <% menu_cat_arr.clear %> <% count = 0 %> <% else %> <% sale_item_count =sale_item_count +1 %> <% end %> <% 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 grand_total += sale.grand_total*(-1) end %> <% if sale.status_type == "Discount" && sale.grand_total < 0 grand_total += sale.grand_total*(-1) end %> <% if sale.status_type == "promotion" && sale.grand_total < 0 grand_total += sale.grand_total*(-1) end %> <% grand_total += sale.grand_total %> <% if !sale.item_code.nil?%> <% waste_and_spoil_item_count += sale.qty.to_i %> <% if !menu_cat_arr.include?(sale.menu_category_name) %> <% menu_cat_arr.push(sale.menu_category_name) %> <% else %> <% end %> <% end %> <% count = count + 1 %> <% @hourly_total_qty.each do |hr| %> <% if hr["date"].to_s == sale.date_format.to_s && hr["total_qty"].to_i ==sale_item_count%> <% footer_arr.push(sale.sale_id) %> <% else %> <% end %> <% end %> <% end %>
 
Time :<%= sale.date_format %>
Menu Category Item Code Item Name Qty Price Total Price
<%= sale.menu_category_name %> <%= sale.item_code %> <%= sale.product_name %> <%= sale.total_item.to_i %> <%= number_format(sale.unit_price.to_i, precision:precision.to_i,delimiter:delimiter) %> <%= number_format(sale.grand_total.to_i, precision:precision.to_i,delimiter:delimiter) %>
Total Qty: <%= total_qty.to_i %> <% total_qty = 0%> Grand Total: <%= number_format(grand_total.to_i, precision:precision.to_i,delimiter:delimiter) %> <% grand_total = 0 %>