<%= render :partial=>'staff_meal_report_filter', :locals=>{ :period_type => true, :shift_name => true, :report_path =>reports_staff_meal_index_path} %>
<% if @shift_from %> <% if @shift_data.employee %> <% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %> <% end %> <% end %> <% 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) %> <% acc_arr.push(sale.account_id) %> <% end %> <% if !cate_arr.include?(sale.menu_category_id) %> <% cate_arr.push(sale.menu_category_id) %> <% else %> <% end %> <% if sale.status_type != "Discount" %> <%else%> <% end %> <% @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 %> <% sub_total = 0.0%> <% sub_qty = 0 %> <% count = 0%> <% end %> <% end %> <% end %> <% end %> <% if @product.present?%> <% @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_sub_total += product.grand_total %> <% end %> <%end%> <% if @type =="" || @type =="all" || @type.nil? %> <% end %> <% end %> <% if @type == "other"%> <% @other_charges.each do |other| %> <% if other.total_item > 0 total_qty += other.total_item end %> <% grand_total +=other.grand_total%> <% other_sub_total += other.grand_total %> <% end %> <%end%>
<%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <%= t("views.right_panel.detail.to_date") %> : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%>
<%= t("views.right_panel.detail.shift_name") %> = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )
  <%= t("views.right_panel.header.menu_category") %> <%= t("views.right_panel.detail.code") %> <%= t("views.right_panel.detail.product") %> <%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.item") %> <%= t("views.right_panel.detail.unit_price") %> <%= t("views.right_panel.detail.revenue") %>
<%= 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 %>
 <%= sale.menu_category_name %> <%= sale.item_code rescue '-' %> <%= sale.product_name rescue '-' %><%= sale.total_item rescue '-' %><%= sale.total_item*(-1) rescue '-' %><%= number_format(sale.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%> <%= number_format(sale.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%>
  Total <%= sale.account_name %> Qty <%= sub_qty %> <%= t("views.right_panel.detail.sub_total") %> <%= number_format(sub_total , precision:precision.to_i,delimiter:delimiter)%>
Product  
  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 '-'%>
  Total Product Qty <%= p_qty %> <%= t("views.right_panel.detail.sub_total") %> <%= number_format(product_sub_total , precision:precision.to_i,delimiter:delimiter)%>
  <%= 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)%>
Other Charges  
  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 '-'%>
  <%= t("views.right_panel.detail.sub_total") %> <%= number_format(other_sub_total , precision:precision.to_i,delimiter:delimiter)%>