<% @complete.each do |sale| %>
<%= sale.receipt_no %> <%= sale.sale_status %>
<% end %>
<% @tables.each do |table| %> <% if table.status == 'occupied' %> <% if table.get_booking.nil? %> <% if table.get_checkout_booking.nil? %>
<% else %>
<% end %>
<%= table.name %>
<%= table.zone.name %> billed
<% else %> <% if table.get_checkout_booking.nil? %>
<% else %>
<% end %>
<%= table.name %>
<%= table.zone.name %> new
<% end %> <% else %>
<%= table.name %>
<%= table.zone.name %> new
<% end %> <% end %>
<% @rooms.each do |room| %> <% if room.status == 'occupied' %> <% if room.get_booking.nil? %> <% if room.get_checkout_booking.nil? %>
<% else %>
<% end %>
<%= room.name %>
<%= room.zone.name %> billed
<% else %> <% if room.get_checkout_booking.nil? %>
<% else %>
<% end %>
<%= room.name %>
<%= room.zone.name %> new
<% end %> <% else %>
<%= room.name %>
<%= room.zone.name %>
<% end %> <% end %>
<% @orders.each do |order| %>
text-white" data-id="<%= order.order_id %>">
<% order_status = "" %> <% sale_order = order.sale_orders.first %> <% if sale_order %> <% unless sale_order.sale_id.nil? %> <% sale = Sale.find(sale_order.sale_id) %> <% order_status = sale.sale_status %> <% if order_status == 'new' %> <% order_status = order.status %> <% end %> <% end %> <% else %> <% order_status = order.status %> <% end %> <%= order.order_id %> <% if !order_status.empty? %>| <%= order_status %> <% end %>
<% end %>
<%= t :credit %> <%= t :sale %> <%= t("views.right_panel.detail.date") %> <%= t("views.right_panel.detail.receipt_no") %> <%= t :cashier %> <%= t :customer %> <%= t("views.right_panel.detail.credit_amount") %>
<% existing_class = "" %><% existing_order = false %> <% if @status_sale == 'sale' unless @order_items.nil? || @order_items.empty?%> <% existing_class = "existing_invoice"%> <% existing_order = true %> <% tooltip = ' data-toggle=modal title=Add_To_Existing data-target=#invoiceModal'%> <%end%> <%end%>
> <% if @status_order == 'order' && @status_sale != 'sale' %> <% if !@obj_order.nil? %>
<% else %>
<% end %> ORDER DETAILS | Table <%= @dining.name rescue "" %> <% if @booking.checkout_by.nil? && !@booking.reserved_by.nil? %> <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %> <% else %> Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> <% end %>
<% elsif @status_sale == 'sale' %>
INVOICE DETAILS | Table <%= @dining.name rescue "" %> <% if !@booking.reserved_by.nil? && %> <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %> <% else %> Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> <% end %>
<% else %> ORDER DETAILS | Table <%= @dining.name rescue "" %> <% end %>
<% if (!@sale_array.empty?) && (!@date.nil?) %>
  Receipt No: <% if @status_sale == 'sale' %> <%= @obj_sale.receipt_no rescue '' %> <% end %>
Date: <%= @date.utc.getlocal.strftime("%d/%m/%Y-%I:%M %p") rescue '-' %>
<% elsif !@date.nil? %>
  Order No: <% if @status_order == 'order' %> <%= @obj_order.order_id rescue '' %> <% end %>
Date: <%= @date.utc.getlocal.strftime("%d/%m/%Y") rescue '-' %>
<% end %>
<% if @status_sale == 'sale' %>   Customer : <%= @obj_sale.customer.name rescue '' %> <% elsif @status_order == 'order' %>   Customer : <%= @customer.name rescue "" %> <% end %>
">
<% count = 0 sub_total = 0 if @status_sale == "sale" @obj_sale.sale_items.each do |sale_item| sub_total = sub_total + sale_item.price%> <%count += 1 %> <%end %> <% end %> <% if @status_order == 'order' && @status_sale != 'sale' unless @order_items.nil? || @order_items.empty? count = 0 @order_items.each do |order_item| set_item_prices = 0 count += 1 sub_total = sub_total + (order_item.price * order_item.qty) # unless order_item.price == 0 %> <% end %> <% end %> <% end %>
# Items QTY Price
<%= count %> <%= sale_item.product_name %> <%= sale_item.qty %> <%= sale_item.price %>
<%= count %> <%= order_item.item_name %> <% if !order_item.options.nil? && !order_item.options.empty? && order_item.options != "undefined" %> <% JSON.parse(order_item.options).each do |option| %>
<%= option %> <% end %> <% end %> <% if !order_item.set_menu_items.nil? && order_item.set_menu_items != '[]' JSON.parse(order_item.set_menu_items).each do |item_instance| set_item_prices += (item_instance["quantity"].to_f * item_instance["price"].to_f).to_f %>
<%= item_instance["item_instance_name"] %> <% if !item_instance["options"].nil? && !item_instance["options"].empty? %> <% (item_instance["options"]).each do |set_item_option| %>
<%= set_item_option %> <% end %> <% end %>
<% end sub_total += set_item_prices end %>
<%= order_item.qty %> <%= (order_item.qty*order_item.price).to_f + set_item_prices %>
<% if @status_sale == 'sale' unless @order_items.nil? || @order_items.empty?%> <% end %> <% if @sale_array.size > 1 %>

Pending Payment <% end %> <% @sale_array.each do |sale| if @sale_array.size > 1 unless sale.receipt_no == @obj_sale.receipt_no %>
Receipt No - <%= sale.receipt_no %>
<%end%> <% end%> <% end%> <%end %>
<% if @dining.status != "available" %> <% if @status_order == 'order' && @status_sale != 'sale' %> <%if !@order_items.empty? %> <% end %> <% if !@split_bill.nil? %> <% if @split_bill == '1' && (!(@order_items.nil?) || !(@order_items.empty?)) %> <% end %> <% end %> <% end %> <% if @status_sale == 'sale' %> <% if current_login_employee.role != "waiter" %> <% end %> <% if current_login_employee.role != "waiter" %> <% if current_login_employee.role == "cashier" %> Edit Void <% else %> <% end %> <% end %> <% if current_login_employee.role != "waiter" %> <%if @membership.discount && @obj_sale.customer.membership_id %> <%else%> <%end%> <% end %> <% end %> <% else %> <% if !@checkout_time.empty? && !@checkout_alert_time.empty? %> <% end %> <% end %> ">
<%= print_settings %> <% if @status_sale == 'sale' && (!@order_items.nil?) %> <%end%>