<%= render :partial=>'shift_sale_report_filter',
:locals=>{ :period_type => true, :shift_name => true,:payments => true, :report_path =>reports_waste_and_spoilage_index_path} %>
<% time_arr = Array.new %>
<% menu_cat_arr = Array.new %>
<% footer_arr = Array.new %>
<% count = 0 %>
<% waste_and_spoil_item_count = 0%>
<% total_qty = 0 %>
<% time_count = 0 %>
<% @sale_data.each do |sale| %>
<% if !time_arr.include?(sale.date_format) %>
<% time_count = time_count + 1 %>
| |
|
Time :<%= sale.date_format %>
|
|
|
Date : |
| Menu Category |
Item Code |
Item Name |
Qty |
Price |
Total Price |
<% time_arr.push(sale.date_format) %>
<% menu_cat_arr.clear %>
<% count = 0 %>
<% 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.item_code.nil?%>
<% waste_and_spoil_item_count += sale.qty.to_i %>
<% if !menu_cat_arr.include?(sale.menu_category_name) %>
| <%= sale.menu_category_name %> |
<% menu_cat_arr.push(sale.menu_category_name) %>
<% else %>
|
<% end %>
<%= sale.item_code %> |
<%= sale.product_name %> |
<%= sale.total_item.to_i %> |
<%= sale.unit_price %> |
<%= sale.price %> |
<%= sale.date_format %> |
<% end %>
<% @hourly_total_qty.each do |qty| %>
<% qty_count = qty["total_qty"] %>
<% logger.debug ' qty count+++++++++++++++++++++++++' %>
<% logger.debug qty_count %>
<% #logger.debug ' normal count+++++++++++++++++++++++++' %>
<% #logger.debug sale.sale_items.count %>
<% end %>
<% count = count + 1 %>
<% logger.debug 'count ------------------------------------' %>
<% logger.debug count %>
<% if sale.sale_items.count == count %>
| |
Total Qty: |
<%= total_qty%> |
Grand Total: |
|
<% footer_arr.push(sale.sale_id) %>
<% end %>
<% end %>