<%= render :partial=>'shift_sale_report_filter',
:locals=>{ :period_type => true, :shift_name => true,:payments => true, :report_path =>reports_hourly_saleitem_index_path} %>
<% 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 :<%= sale.date_format %>
|
|
|
|
| Menu Category |
Item Code |
Item Name |
Qty |
Price |
Total Price |
<% time_arr.push(sale.date_format) %>
<% menu_cat_arr.clear %>
<% count = 0 %>
<% else %>
<% sale_item_count =sale_item_count +1 %>
<% end %>
<% 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
%>
<% 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) %>
| <%= 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.to_i %> |
<%= sale.grand_total.to_i %> |
<%= sale.date_format %> |
<% 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%>
|
Total Qty: |
<%= total_qty.to_i %>
<% total_qty = 0%>
|
Grand Total: |
<%= grand_total.to_i %>
<% grand_total = 0 %>
|
<% footer_arr.push(sale.sale_id) %>
<% else %>
<% end %>
<% end %>
<% end %>