update order and request bill
This commit is contained in:
3
Gemfile
3
Gemfile
@@ -44,9 +44,6 @@ gem 'rack-cors'
|
|||||||
# Multi-tenancy for shops
|
# Multi-tenancy for shops
|
||||||
gem 'acts_as_tenant'
|
gem 'acts_as_tenant'
|
||||||
|
|
||||||
# Activerecord-Import is a library for bulk inserting data using ActiveRecord.
|
|
||||||
gem 'activerecord-import'
|
|
||||||
|
|
||||||
# image upload
|
# image upload
|
||||||
gem 'carrierwave', '~> 1.0'
|
gem 'carrierwave', '~> 1.0'
|
||||||
gem 'mini_magick'
|
gem 'mini_magick'
|
||||||
|
|||||||
@@ -41,8 +41,6 @@ GEM
|
|||||||
activemodel (= 5.1.7)
|
activemodel (= 5.1.7)
|
||||||
activesupport (= 5.1.7)
|
activesupport (= 5.1.7)
|
||||||
arel (~> 8.0)
|
arel (~> 8.0)
|
||||||
activerecord-import (1.0.3)
|
|
||||||
activerecord (>= 3.2)
|
|
||||||
activesupport (5.1.7)
|
activesupport (5.1.7)
|
||||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||||
i18n (>= 0.7, < 2)
|
i18n (>= 0.7, < 2)
|
||||||
@@ -322,7 +320,6 @@ PLATFORMS
|
|||||||
ruby
|
ruby
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
activerecord-import
|
|
||||||
acts_as_tenant
|
acts_as_tenant
|
||||||
aescrypt
|
aescrypt
|
||||||
axlsx (= 2.0.1)
|
axlsx (= 2.0.1)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class Api::BillController < Api::ApiController
|
|||||||
if !ShiftSale.current_shift.nil?
|
if !ShiftSale.current_shift.nil?
|
||||||
#create Bill by Booking ID
|
#create Bill by Booking ID
|
||||||
table = 0
|
table = 0
|
||||||
if (params[:booking_id])
|
if params[:booking_id].present?
|
||||||
booking = Booking.find(params[:booking_id])
|
booking = Booking.find(params[:booking_id])
|
||||||
if booking.booking_orders.count > 0
|
if booking.booking_orders.count > 0
|
||||||
if booking.checkin_at.utc.strftime("%Y-%m-%d %H:%M") > Time.now.utc.strftime("%Y-%m-%d %H:%M") && booking.checkout_at.nil?
|
if booking.checkin_at.utc.strftime("%Y-%m-%d %H:%M") > Time.now.utc.strftime("%Y-%m-%d %H:%M") && booking.checkout_at.nil?
|
||||||
@@ -51,13 +51,6 @@ class Api::BillController < Api::ApiController
|
|||||||
@status = false
|
@status = false
|
||||||
@error_message = "There is no order for '#{params[:booking_id]}'"
|
@error_message = "There is no order for '#{params[:booking_id]}'"
|
||||||
end
|
end
|
||||||
# elsif (params[:order_id])
|
|
||||||
# order = Order.find(params[:order_id])
|
|
||||||
# @status, @sale_id = Sale.generate_invoice_from_order(params[:order_id], current_login_employee, get_cashier, order.source)
|
|
||||||
#
|
|
||||||
# # for Job
|
|
||||||
# booking = Booking.find_by_sale_id(@sale_id)
|
|
||||||
# table = DiningFacility.find(booking.dining_facility_id)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Bind shift sale id to sale
|
# Bind shift sale id to sale
|
||||||
|
|||||||
@@ -67,15 +67,10 @@ class Api::OrdersController < Api::ApiController
|
|||||||
|
|
||||||
if checkin_checkout_time(params[:booking_id])
|
if checkin_checkout_time(params[:booking_id])
|
||||||
|
|
||||||
if params[:booking_id].present?
|
table = DiningFacility.find(params[:table_id]) if params[:table_id].present?
|
||||||
booking = Booking.find(params[:booking_id])
|
|
||||||
end
|
booking = table.current_checkin_booking if table
|
||||||
if params[:table_id].present?
|
booking ||= Booking.find(params[:booking_id]) if params[:booking_id].present?
|
||||||
if booking.nil? || booking.dining_facility_id.to_i != params[:table_id].to_i
|
|
||||||
table = DiningFacility.find(params[:table_id])
|
|
||||||
booking = table.get_current_booking
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
#for extratime
|
#for extratime
|
||||||
is_extra_time = false
|
is_extra_time = false
|
||||||
@@ -118,6 +113,7 @@ class Api::OrdersController < Api::ApiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
@status, @booking = @order.generate
|
@status, @booking = @order.generate
|
||||||
|
|
||||||
if @status && @booking
|
if @status && @booking
|
||||||
Order.process_order_queue(@order.order_id,@order.table_id,@order.source)
|
Order.process_order_queue(@order.order_id,@order.table_id,@order.source)
|
||||||
end
|
end
|
||||||
@@ -195,7 +191,7 @@ class Api::OrdersController < Api::ApiController
|
|||||||
#checked checkin and checkout time
|
#checked checkin and checkout time
|
||||||
def checkin_checkout_time(booking_id)
|
def checkin_checkout_time(booking_id)
|
||||||
status = true
|
status = true
|
||||||
if !booking_id.nil?
|
if booking_id.present?
|
||||||
if booking = Booking.find(booking_id)
|
if booking = Booking.find(booking_id)
|
||||||
if booking.checkout_at.present?
|
if booking.checkout_at.present?
|
||||||
if booking.checkout_at.utc <= Time.now.utc
|
if booking.checkout_at.utc <= Time.now.utc
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ class Api::Restaurant::ZonesController < Api::ApiController
|
|||||||
|
|
||||||
def index
|
def index
|
||||||
if (params[:filter] && params[:filter] = "all" )
|
if (params[:filter] && params[:filter] = "all" )
|
||||||
@all_tables = Table.active
|
@all_tables = Table.includes(:zone, :current_checkin_booking, :current_checkout_booking, :current_reserved_booking).active
|
||||||
@all_rooms = Room.active
|
@all_rooms = Room.includes(:zone, :current_checkin_booking, :current_checkout_booking, :current_reserved_booking).active
|
||||||
else
|
else
|
||||||
@zones = Zone.includes([:tables, :rooms]).where("is_active = true")
|
@zones = Zone.includes([:tables, :rooms]).where("is_active = true")
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ module NumberFormattable
|
|||||||
@delimiter = @number_formats.find { |f| f.name.parameterize.underscore == 'delimiter'}.value.gsub(/\\u(\h{4})/) { |m| [$1].pack("H*").unpack("n*").pack("U*") } rescue nil
|
@delimiter = @number_formats.find { |f| f.name.parameterize.underscore == 'delimiter'}.value.gsub(/\\u(\h{4})/) { |m| [$1].pack("H*").unpack("n*").pack("U*") } rescue nil
|
||||||
end
|
end
|
||||||
if @delimiter.nil?
|
if @delimiter.nil?
|
||||||
@print_settings = PrintSetting.get_precision_delimiter if !defined? @number_formats
|
@print_settings = PrintSetting.get_precision_delimiter if !defined? @print_settings
|
||||||
if @print_settings && @print_settings.delimiter
|
if @print_settings && @print_settings.delimiter
|
||||||
@delimiter = ","
|
@delimiter = ","
|
||||||
else
|
else
|
||||||
@@ -42,7 +42,7 @@ module NumberFormattable
|
|||||||
end
|
end
|
||||||
|
|
||||||
def number_format(number, options = {})
|
def number_format(number, options = {})
|
||||||
options[:precision] = options[:precision] || precision
|
options[:precision] = options[:precision] || precision
|
||||||
# options[:delimiter] = options[:delimiter] || delimiter
|
# options[:delimiter] = options[:delimiter] || delimiter
|
||||||
options[:strip_insignificant_zeros] = options[:strip_insignificant_zeros] || strip_insignificant_zeros
|
options[:strip_insignificant_zeros] = options[:strip_insignificant_zeros] || strip_insignificant_zeros
|
||||||
|
|
||||||
|
|||||||
@@ -186,7 +186,6 @@ class Origami::AddordersController < BaseOrigamiController
|
|||||||
result = {:status=> @status, :data => 0 }
|
result = {:status=> @status, :data => 0 }
|
||||||
render :json => result.to_json
|
render :json => result.to_json
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# render json for http status code
|
# render json for http status code
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ class Origami::HomeController < BaseOrigamiController
|
|||||||
|
|
||||||
def index
|
def index
|
||||||
@webview = check_mobile
|
@webview = check_mobile
|
||||||
@tables = Table.unscope(:order).includes(:zone, :current_checkin_booking, :current_checkout_booking, :current_reserved_booking).all.active.order('status desc')
|
@tables = Table.unscope(:order).includes(:zone, :current_checkin_booking, :current_checkout_booking, :current_reserved_booking).active.order('status desc')
|
||||||
@rooms = Room.unscope(:order).includes(:zone, :current_checkin_booking, :current_checkout_booking, :current_reserved_booking).all.active.order('status desc')
|
@rooms = Room.unscope(:order).includes(:zone, :current_checkin_booking, :current_checkout_booking, :current_reserved_booking).active.order('status desc')
|
||||||
@complete = Sale.completed_sale("cashier")
|
@complete = Sale.completed_sale("cashier")
|
||||||
@orders = Order.includes("sale_orders").where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
|
@orders = Order.includes("sale_orders").where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
|
||||||
|
|
||||||
|
|||||||
@@ -18,96 +18,71 @@ class Origami::RequestBillsController < ApplicationController
|
|||||||
else
|
else
|
||||||
table = DiningFacility.find_by(id: booking.dining_facility_id)
|
table = DiningFacility.find_by(id: booking.dining_facility_id)
|
||||||
|
|
||||||
if sale_data = booking.sale
|
if booking.sale.nil?
|
||||||
@status = true
|
if sale_data = Sale.generate_invoice_from_booking(booking, current_login_employee, current_user, order.source, params[:current_checkin_induties_count])
|
||||||
elsif sale_data = Sale.generate_invoice_from_booking(booking, current_login_employee, current_user, order.source, params[:current_checkin_induties_count])
|
# in-duty update
|
||||||
@status = true
|
in_duties = InDuty.where("booking_id=?", booking.id)
|
||||||
# in-duty update
|
if !in_duties.empty?
|
||||||
in_duties = InDuty.where("booking_id=?", booking.id)
|
in_duties.each do |in_duty|
|
||||||
if !in_duties.empty?
|
induty = InDuty.find(in_duty.id)
|
||||||
in_duties.each do |in_duty|
|
induty.sale_id = sale_data.sale_id
|
||||||
induty = InDuty.find(in_duty.id)
|
induty.out_time = Time.now.utc
|
||||||
induty.sale_id = sale_data.sale_id
|
induty.save
|
||||||
induty.out_time = Time.now.utc
|
|
||||||
induty.save
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Bind shift sale id to sale
|
|
||||||
# @sale_data.shift_sale_id = shift.id
|
|
||||||
# @sale_data.save
|
|
||||||
|
|
||||||
action_by = current_user.name
|
|
||||||
type = "REQUEST_BILL"
|
|
||||||
|
|
||||||
remark = "Request bill Receipt No #{sale_data.receipt_no}"
|
|
||||||
sale_audit = SaleAudit.record_audit_sale(sale_data.sale_id,remark,action_by,type )
|
|
||||||
|
|
||||||
# Promotion Activation
|
|
||||||
Promotion.promo_activate(sale_data)
|
|
||||||
|
|
||||||
#bill channel
|
|
||||||
if ENV["SERVER_MODE"] == 'cloud'
|
|
||||||
from = request.subdomain + "." + request.domain
|
|
||||||
else
|
|
||||||
from = ""
|
|
||||||
end
|
|
||||||
|
|
||||||
if order.source == "cashier" || order.source == "quick_service"
|
|
||||||
ActionCable.server.broadcast "bill_channel",table: table, from: from
|
|
||||||
end
|
|
||||||
if order.source == "quick_service" || order.source == "food_court"
|
|
||||||
result = {:status=> @status, :data => sale_data.sale_id }
|
|
||||||
render :json => result.to_json
|
|
||||||
else
|
|
||||||
#check checkInOut pdf print
|
|
||||||
checkout_time = Lookup.collection_of('checkout_time')
|
|
||||||
if !booking.dining_facility_id.nil?
|
|
||||||
terminal = DiningFacility.find_by_id(booking.dining_facility_id)
|
|
||||||
cashier_terminal = CashierTerminal.find_by_id(terminal.zone_id)
|
|
||||||
|
|
||||||
if (!checkout_time.empty?) && (ENV["SERVER_MODE"] != "cloud") #no print in cloud server
|
|
||||||
unique_code = "CheckInOutPdf"
|
|
||||||
printer = PrintSetting.find_by_unique_code(unique_code)
|
|
||||||
|
|
||||||
# print when complete click
|
|
||||||
order_queue_printer = Printer::OrderQueuePrinter.new(printer)
|
|
||||||
|
|
||||||
if !printer.nil?
|
|
||||||
order_queue_printer.print_check_in_out(printer, cashier_terminal, booking, table)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
action_by = current_user.name
|
||||||
|
type = "REQUEST_BILL"
|
||||||
|
|
||||||
|
remark = "Request bill Receipt No #{sale_data.receipt_no}"
|
||||||
|
sale_audit = SaleAudit.record_audit_sale(sale_data.sale_id,remark,action_by,type )
|
||||||
|
|
||||||
|
# Promotion Activation
|
||||||
|
Promotion.promo_activate(sale_data)
|
||||||
|
|
||||||
|
#bill channel
|
||||||
|
if ENV["SERVER_MODE"] == 'cloud'
|
||||||
|
from = request.subdomain + "." + request.domain
|
||||||
|
else
|
||||||
|
from = ""
|
||||||
|
end
|
||||||
|
|
||||||
|
if order.source == "cashier" || order.source == "quick_service"
|
||||||
|
ActionCable.server.broadcast "bill_channel",table: table, from: from
|
||||||
|
end
|
||||||
|
if order.source == "quick_service" || order.source == "food_court"
|
||||||
|
result = {:status=> @status, :data => sale_data.sale_id }
|
||||||
|
render :json => result.to_json
|
||||||
|
else
|
||||||
|
#check checkInOut pdf print
|
||||||
|
checkout_time = Lookup.collection_of('checkout_time')
|
||||||
|
if !booking.dining_facility_id.nil?
|
||||||
|
terminal = DiningFacility.find_by_id(booking.dining_facility_id)
|
||||||
|
cashier_terminal = CashierTerminal.find_by_id(terminal.zone_id)
|
||||||
|
|
||||||
|
if (!checkout_time.empty?) && (ENV["SERVER_MODE"] != "cloud") #no print in cloud server
|
||||||
|
unique_code = "CheckInOutPdf"
|
||||||
|
printer = PrintSetting.find_by_unique_code(unique_code)
|
||||||
|
|
||||||
|
# print when complete click
|
||||||
|
order_queue_printer = Printer::OrderQueuePrinter.new(printer)
|
||||||
|
|
||||||
|
if !printer.nil?
|
||||||
|
order_queue_printer.print_check_in_out(printer, cashier_terminal, booking, table)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@status = true
|
||||||
|
else
|
||||||
|
@status = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@status = true
|
|
||||||
else
|
else
|
||||||
@status = false
|
@status = false
|
||||||
@error_message = "No Current Open Shift for This Employee"
|
@error_message = "No Current Open Shift for This Employee"
|
||||||
end
|
end
|
||||||
|
|
||||||
# Not Use for these printed bill cannot give customer
|
|
||||||
# unique_code = "ReceiptBillPdf"
|
|
||||||
# #shop detail
|
|
||||||
# shop_details = Shop.current_shop
|
|
||||||
# # customer= Customer.where('customer_id=' +.customer_id)
|
|
||||||
# customer= Customer.find(@sale_data.customer_id)
|
|
||||||
# # get member information
|
|
||||||
# member_info = Customer.get_member_account(customer)
|
|
||||||
# # get printer info
|
|
||||||
# print_settings=PrintSetting.find_by_unique_code(unique_code)
|
|
||||||
|
|
||||||
# # find order id by sale id
|
|
||||||
# # sale_order = SaleOrder.find_by_sale_id(@sale_data.sale_id)
|
|
||||||
|
|
||||||
# # Calculate price_by_accounts
|
|
||||||
# item_price_by_accounts = SaleItem.calculate_price_by_accounts(@sale_items)
|
|
||||||
|
|
||||||
# printer = Printer::ReceiptPrinter.new(print_settings)
|
|
||||||
|
|
||||||
|
|
||||||
# printer.print_receipt_bill(print_settings, false, nil,@sale_items,@sale_data,customer.name, item_price_by_accounts,member_info,shop_details)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -23,55 +23,36 @@ class Origami::SalesController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def add_to_existing_invoice
|
def add_to_existing_invoice
|
||||||
dining = params[:dining_id]
|
Sale.transaction do
|
||||||
sale_id = params[:sale_id]
|
dining = params[:dining_id]
|
||||||
tax_type = params[:tax_type]
|
sale_id = params[:sale_id]
|
||||||
sale_data = []
|
tax_type = params[:tax_type]
|
||||||
table = DiningFacility.find(dining)
|
|
||||||
existing_booking = Booking.find_by_sale_id(sale_id)
|
|
||||||
table.bookings.active.where("DATE_FORMAT(created_at,'%Y-%m-%d') = '#{DateTime.now.strftime('%Y-%m-%d')}' OR DATE_FORMAT(created_at,'%Y-%m-%d') = '#{Date.today.prev_day}' ").each do |booking|
|
|
||||||
if booking.sale_id.nil?
|
|
||||||
order_array = []
|
|
||||||
booking.booking_orders.each do |booking_order|
|
|
||||||
|
|
||||||
booking.booking_status = 'moved'
|
table = DiningFacility.find(dining)
|
||||||
order = Order.find(booking_order.order_id)
|
booking = table.current_checkin_booking
|
||||||
order.status = 'billed'
|
|
||||||
order.order_items.each do |item|
|
|
||||||
item.order_item_status = 'billed'
|
|
||||||
end
|
|
||||||
# create sale item
|
|
||||||
saleobj = Sale.find(sale_id)
|
|
||||||
order.order_items.each do |orer_item|
|
|
||||||
saleobj.add_item (orer_item)
|
|
||||||
if !orer_item.set_menu_items.nil?
|
|
||||||
saleobj.add_sub_item(orer_item.set_menu_items)
|
|
||||||
end
|
|
||||||
sale_data.push(orer_item)
|
|
||||||
end
|
|
||||||
|
|
||||||
# Re-compute for add
|
sale = Sale.find(sale_id)
|
||||||
saleobj.compute(order.source,tax_type)
|
existing = sale.booking
|
||||||
saleobj.save
|
|
||||||
order.save
|
|
||||||
booking.save
|
|
||||||
|
|
||||||
order_array.push(order.order_id)
|
sale.sale_items << booking.order_items.to_sale_items
|
||||||
end
|
sale.orders << booking.orders
|
||||||
|
|
||||||
receipt_no = Sale.find(sale_id).receipt_no
|
sale.compute(booking.orders[0].source, tax_type)
|
||||||
action_by = current_user.name
|
|
||||||
type = "ADD_TO_EXISTING"
|
|
||||||
|
|
||||||
remark = "#{action_by} add to existing order #{order_array} to Receipt No=>#{receipt_no} in #{table.name}"
|
type = "ADD_TO_EXISTING"
|
||||||
sale_audit = SaleAudit.record_audit_sale(sale_id,remark,action_by,type )
|
receipt_no = sale.receipt_no
|
||||||
|
action_by = current_user.name
|
||||||
|
order_ids = booking.orders.map(&:order_id)
|
||||||
|
|
||||||
booking_order = BookingOrder.where('booking_id=?',booking)
|
remark = "#{action_by} add to existing order #{order_ids.to_s} to Receipt No=>#{receipt_no} in #{table.name}"
|
||||||
booking_order.each do |bo|
|
sale_audit = SaleAudit.record_audit_sale(sale_id, remark, action_by, type)
|
||||||
bo.booking_id = existing_booking.booking_id
|
|
||||||
bo.save
|
booking.orders.update_all(status: "billed")
|
||||||
end
|
booking.order_items.update_all(order_item_status: "billed")
|
||||||
end
|
BookingOrder.where(booking_id: booking.booking_id).update_all(booking_id: existing)
|
||||||
|
|
||||||
|
booking.booking_status = "moved"
|
||||||
|
booking.save
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,53 @@ class Booking < ApplicationRecord
|
|||||||
belongs_to :sale, :optional => true
|
belongs_to :sale, :optional => true
|
||||||
has_many :booking_orders
|
has_many :booking_orders
|
||||||
has_many :orders, :through => :booking_orders
|
has_many :orders, :through => :booking_orders
|
||||||
has_many :order_items, :through => :orders
|
has_many :order_items, :through => :orders do
|
||||||
|
def to_sale_items
|
||||||
|
sale_items = []
|
||||||
|
proxy_association.load_target.select(&:order_items_id).each do |order_item|
|
||||||
|
menu_category = order_item.menu_category || OpenStruct.new(name: 'Product', code: '') #get menu category for menu items
|
||||||
|
|
||||||
|
sale_items << SaleItem.new({
|
||||||
|
menu_category_name: menu_category.name,
|
||||||
|
menu_category_code: menu_category.code,
|
||||||
|
product_name: order_item.item_name,
|
||||||
|
product_code: order_item.item_code,
|
||||||
|
product_alt_name: order_item.alt_name,
|
||||||
|
account_id: order_item.account_id,
|
||||||
|
is_taxable: order_item.taxable,
|
||||||
|
item_instance_code: order_item.item_instance_code,
|
||||||
|
qty: order_item.qty,
|
||||||
|
unit_price: order_item.price,
|
||||||
|
price: order_item.qty * order_item.price,
|
||||||
|
taxable_price: order_item.qty * order_item.price,
|
||||||
|
status: order_item.remark
|
||||||
|
})
|
||||||
|
|
||||||
|
if order_item.set_menu_items
|
||||||
|
JSON.parse(order_item.set_menu_items).each do |item|
|
||||||
|
instance = MenuItemInstance.find_by_item_instance_code(item["item_instance_code"])
|
||||||
|
menu_item = instance.menu_item
|
||||||
|
menu_category = menu_item.menu_category #get menu category for menu items
|
||||||
|
sale_items << SaleItem.new({
|
||||||
|
menu_category_name: menu_category.name,
|
||||||
|
menu_category_code: menu_category.code,
|
||||||
|
product_name: instance.item_instance_name,
|
||||||
|
product_code: menu_item.item_code,
|
||||||
|
product_alt_name: menu_item.alt_name,
|
||||||
|
account_id: menu_item.account_id,
|
||||||
|
is_taxable: menu_item.taxable,
|
||||||
|
item_instance_code: item["item_instance_code"],
|
||||||
|
qty: item["quantity"],
|
||||||
|
unit_price: item["price"],
|
||||||
|
price: item["quantity"].to_f * item["price"].to_f,
|
||||||
|
taxable_price: item["quantity"].to_f * item["price"].to_f
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
sale_items
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
scope :active, -> {where("booking_status != 'moved'")}
|
scope :active, -> {where("booking_status != 'moved'")}
|
||||||
scope :today, -> {where("created_at >= #{Time.now.utc}")}
|
scope :today, -> {where("created_at >= #{Time.now.utc}")}
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
class CashierTerminal < ApplicationRecord
|
class CashierTerminal < ApplicationRecord
|
||||||
has_many :cashier_terminal_by_zones
|
has_many :cashier_terminal_by_zones
|
||||||
has_many :zones, through: :cashier_terminal_by_zones
|
has_many :zones, through: :cashier_terminal_by_zones
|
||||||
|
has_one :current_shift, -> { where.not(shift_started_at: nil).where(shift_closed_at: nil) }, class_name: "ShiftSale"
|
||||||
|
|
||||||
scope :available, -> {where(is_currently_login: false)}
|
scope :available, -> {where(is_currently_login: false)}
|
||||||
scope :is_active, -> {where(is_active: true)}
|
scope :is_active, -> {where(is_active: true)}
|
||||||
|
|
||||||
# validations
|
# validations
|
||||||
validates_presence_of :name, :printer_name
|
validates_presence_of :name, :printer_name
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ class DiningCharge < ApplicationRecord
|
|||||||
|
|
||||||
def self.amount_calculate(dining_charges_obj, checkin , checkout)
|
def self.amount_calculate(dining_charges_obj, checkin , checkout)
|
||||||
# note :: the first Charge Block will cost all, the Time rounding block will included in 2nd Charge Block
|
# note :: the first Charge Block will cost all, the Time rounding block will included in 2nd Charge Block
|
||||||
if !checkin.nil? && !checkout.nil? && !dining_charges_obj.nil?
|
if !checkin.nil? && !checkout.nil? && !dining_charges_obj.nil?
|
||||||
block_count = 0
|
block_count = 0
|
||||||
price = 0
|
price = 0
|
||||||
minutes = DiningCharge.time_diff(checkout, checkin)
|
minutes = DiningCharge.time_diff(checkout, checkin)
|
||||||
@@ -13,18 +13,17 @@ class DiningCharge < ApplicationRecord
|
|||||||
if dining_minutes <= free_time
|
if dining_minutes <= free_time
|
||||||
price = 0
|
price = 0
|
||||||
else
|
else
|
||||||
charge_type = dining_charges_obj.charge_type
|
charge_type = dining_charges_obj.charge_type
|
||||||
if charge_type == 'hr'
|
if charge_type == 'hr'
|
||||||
block_count, price = DiningCharge.charges(dining_charges_obj, dining_minutes, 'hr')
|
block_count, price = DiningCharge.charges(dining_charges_obj, dining_minutes, 'hr')
|
||||||
elsif charge_type == 'day'
|
elsif charge_type == 'day'
|
||||||
block_count, price = DiningCharge.charges(dining_charges_obj, dining_minutes, 'day')
|
block_count, price = DiningCharge.charges(dining_charges_obj, dining_minutes, 'day')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return block_count, price
|
return block_count, price
|
||||||
else
|
else
|
||||||
puts "<<<<<<<< NO"
|
return 0, 0
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# dining charges calculate
|
# dining charges calculate
|
||||||
@@ -37,7 +36,7 @@ class DiningCharge < ApplicationRecord
|
|||||||
rounding_time = DiningCharge.convert_to_minutes(chargesObj.time_rounding_block.utc.strftime('%H:%M'))
|
rounding_time = DiningCharge.convert_to_minutes(chargesObj.time_rounding_block.utc.strftime('%H:%M'))
|
||||||
if result.to_i < 1
|
if result.to_i < 1
|
||||||
# for dining minute is under charge_block
|
# for dining minute is under charge_block
|
||||||
if dining_minutes > rounding_time
|
if dining_minutes > rounding_time
|
||||||
rounding_block = dining_minutes / rounding_time
|
rounding_block = dining_minutes / rounding_time
|
||||||
|
|
||||||
solid_price = rounding_block * chargesObj.time_rounding_block_price
|
solid_price = rounding_block * chargesObj.time_rounding_block_price
|
||||||
@@ -46,7 +45,7 @@ class DiningCharge < ApplicationRecord
|
|||||||
else
|
else
|
||||||
return 1, result.to_i,chargesObj.unit_price
|
return 1, result.to_i,chargesObj.unit_price
|
||||||
end
|
end
|
||||||
elsif result.to_i >= 1
|
elsif result.to_i >= 1
|
||||||
|
|
||||||
solid_price = result * chargesObj.unit_price
|
solid_price = result * chargesObj.unit_price
|
||||||
|
|
||||||
@@ -64,7 +63,7 @@ class DiningCharge < ApplicationRecord
|
|||||||
else
|
else
|
||||||
solid_price += (roundingblock * chargesObj.time_rounding_block_price)
|
solid_price += (roundingblock * chargesObj.time_rounding_block_price)
|
||||||
|
|
||||||
return result.to_i, DiningCharge.check_rounding(chargesObj, solid_price, extra_minutes)
|
return result.to_i, DiningCharge.check_rounding(chargesObj, solid_price, extra_minutes)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -74,7 +73,7 @@ class DiningCharge < ApplicationRecord
|
|||||||
# rounding_block_remain = roundingblock / 1
|
# rounding_block_remain = roundingblock / 1
|
||||||
free_time = DiningCharge.convert_to_minutes(chargesObj.minimum_free_time.utc.strftime('%H:%M'))
|
free_time = DiningCharge.convert_to_minutes(chargesObj.minimum_free_time.utc.strftime('%H:%M'))
|
||||||
rounding_block_remain = extra_minutes - free_time
|
rounding_block_remain = extra_minutes - free_time
|
||||||
|
|
||||||
if chargesObj.time_rounding == "down"
|
if chargesObj.time_rounding == "down"
|
||||||
return solid_price
|
return solid_price
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
class DiningFacility < ApplicationRecord
|
class DiningFacility < ApplicationRecord
|
||||||
belongs_to :zone
|
belongs_to :zone
|
||||||
has_many :dining_charges
|
|
||||||
has_many :in_juties
|
has_many :in_juties
|
||||||
|
has_one :dining_charge
|
||||||
|
has_one :cashier_terminal_by_zone, foreign_key: "zone_id", primary_key: "zone_id"
|
||||||
|
has_one :cashier_terminal, through: :cashier_terminal_by_zone
|
||||||
|
|
||||||
has_many :bookings
|
has_many :bookings
|
||||||
has_many :current_bookings, -> { left_joins(:sale).assign.within_time_limit.merge(Booking.where(checkout_at: nil).or(Booking.merge(Sale.where(sale_status: ['new', nil])))) }, class_name: "Booking"
|
has_many :current_bookings, -> { left_joins(:sale).assign.within_time_limit.merge(Booking.where(checkout_at: nil).or(Booking.merge(Sale.where(sale_status: ['new', nil])))) }, class_name: "Booking"
|
||||||
has_one :current_checkin_booking, -> { assign.within_time_limit.where(checkout_at: nil) }, class_name: "Booking"
|
has_one :current_checkin_booking, -> { left_joins(:sale).assign.within_time_limit.merge(Sale.where(sale_status: nil)) }, class_name: "Booking"
|
||||||
has_one :current_checkout_booking, -> { left_joins(:sale).assign.within_time_limit.where.not(checkout_at: nil).merge(Sale.where(sale_status: ['new', nil])) }, class_name: "Booking"
|
has_one :current_checkout_booking, -> { left_joins(:sale).assign.within_time_limit.where.not(checkout_at: nil).merge(Sale.where(sale_status: 'new')) }, class_name: "Booking"
|
||||||
has_one :current_reserved_booking, -> { left_joins(:sale).assign.within_time_limit.where.not(reserved_at: nil).merge(Sale.where(sale_status: nil)) }, class_name: "Booking"
|
has_one :current_reserved_booking, -> { left_joins(:sale).assign.within_time_limit.where.not(reserved_at: nil).merge(Sale.where(sale_status: nil)) }, class_name: "Booking"
|
||||||
|
|
||||||
TABLE_TYPE = "Table"
|
TABLE_TYPE = "Table"
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ class Employee < ApplicationRecord
|
|||||||
has_secure_password
|
has_secure_password
|
||||||
has_many :commissioners
|
has_many :commissioners
|
||||||
has_many :shit_sales
|
has_many :shit_sales
|
||||||
|
has_one :current_shift, -> { where.not(shift_started_at: nil).where(shift_closed_at: nil) },class_name: "ShiftSale"
|
||||||
belongs_to :order_queue_station
|
belongs_to :order_queue_station
|
||||||
|
|
||||||
validates_presence_of :name, :role
|
validates_presence_of :name, :role
|
||||||
|
|||||||
@@ -40,8 +40,8 @@ class MenuItem < ApplicationRecord
|
|||||||
account_id: account_id,
|
account_id: account_id,
|
||||||
item_code: item_code,
|
item_code: item_code,
|
||||||
item_instance_code: item_instance_code,
|
item_instance_code: item_instance_code,
|
||||||
name: item_name.to_s + (' - ' + item_instance_name.to_s) || '',
|
name: "#{item_name}#{' - ' + item_instance_name if item_instance_name.present?}",
|
||||||
alt_name: item_alt_name || '',
|
alt_name: "#{item_alt_name}",
|
||||||
price: price,
|
price: price,
|
||||||
promotion_price: promotion_price,
|
promotion_price: promotion_price,
|
||||||
is_on_promotion: is_on_promotion,
|
is_on_promotion: is_on_promotion,
|
||||||
|
|||||||
@@ -145,7 +145,6 @@ class Order < ApplicationRecord
|
|||||||
end
|
end
|
||||||
sub_order_items = sub_order_items.to_json
|
sub_order_items = sub_order_items.to_json
|
||||||
new_order_items << OrderItem.new({
|
new_order_items << OrderItem.new({
|
||||||
order_id: id,
|
|
||||||
item_code: menu_item[:item_code],
|
item_code: menu_item[:item_code],
|
||||||
item_instance_code: order_item[:item_instance_code],
|
item_instance_code: order_item[:item_instance_code],
|
||||||
item_name: menu_item[:name],
|
item_name: menu_item[:name],
|
||||||
@@ -160,17 +159,7 @@ class Order < ApplicationRecord
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
ids = OrderItem.generate_ids(new_order_items.length)
|
self.order_items << new_order_items
|
||||||
new_order_items.each_with_index do |order_item, index|
|
|
||||||
order_item.order_items_id = ids[index]
|
|
||||||
end
|
|
||||||
|
|
||||||
OrderItem.import new_order_items, validate: false
|
|
||||||
|
|
||||||
new_order_items.each do |order_item|
|
|
||||||
order_item.run_callbacks(:save) { true }
|
|
||||||
end
|
|
||||||
|
|
||||||
self.item_count = self.order_items.count
|
self.item_count = self.order_items.count
|
||||||
self.save!
|
self.save!
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ class OrderItem < ApplicationRecord
|
|||||||
|
|
||||||
#Associations
|
#Associations
|
||||||
belongs_to :order, autosave: true
|
belongs_to :order, autosave: true
|
||||||
|
has_one :menu_item, foreign_key: "item_code", primary_key: "item_code"
|
||||||
|
has_one :menu_category, through: :menu_item
|
||||||
# belongs_to :order, counter_cache: true
|
# belongs_to :order, counter_cache: true
|
||||||
|
|
||||||
#Validation
|
#Validation
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ class OrderQueueStation < ApplicationRecord
|
|||||||
validates_presence_of :station_name, :printer_name
|
validates_presence_of :station_name, :printer_name
|
||||||
|
|
||||||
def process_order(order, table_id, order_source = nil, pdf_status = nil ,change_to=nil, current_user=nil)
|
def process_order(order, table_id, order_source = nil, pdf_status = nil ,change_to=nil, current_user=nil)
|
||||||
|
|
||||||
oqs_stations = OrderQueueStation.active
|
oqs_stations = OrderQueueStation.active
|
||||||
order_items = order.order_items
|
order_items = order.order_items
|
||||||
|
|
||||||
@@ -47,14 +46,7 @@ class OrderQueueStation < ApplicationRecord
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if pdf_status.nil?
|
assigned_order_items.each(&:save)
|
||||||
ids = AssignedOrderItem.generate_ids(assigned_order_items.length)
|
|
||||||
assigned_order_items.each_with_index do |assigned_order_item, index|
|
|
||||||
assigned_order_item.assigned_order_item_id = ids[index]
|
|
||||||
end
|
|
||||||
|
|
||||||
AssignedOrderItem.import assigned_order_items, validate: false
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def pay_process_order_queue (order_id, table_id)
|
def pay_process_order_queue (order_id, table_id)
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ class Product < ApplicationRecord
|
|||||||
account_id: account_id,
|
account_id: account_id,
|
||||||
item_code: item_code,
|
item_code: item_code,
|
||||||
item_instance_code: item_code,
|
item_instance_code: item_code,
|
||||||
name: item_name || '',
|
name: "#{item_name}",
|
||||||
alt_name: item_name || '',
|
alt_name: "#{item_name}",
|
||||||
price: price,
|
price: price,
|
||||||
promotion_price: 0,
|
promotion_price: 0,
|
||||||
is_on_promotion: 0,
|
is_on_promotion: 0,
|
||||||
|
|||||||
@@ -5,10 +5,11 @@ class Sale < ApplicationRecord
|
|||||||
#primary key - need to be unique generated for multiple shops
|
#primary key - need to be unique generated for multiple shops
|
||||||
before_create :generate_custom_id
|
before_create :generate_custom_id
|
||||||
before_create :generate_receipt_no
|
before_create :generate_receipt_no
|
||||||
|
|
||||||
belongs_to :cashier, foreign_key: "cashier_id", class_name: "Employee"
|
belongs_to :cashier, foreign_key: "cashier_id", class_name: "Employee"
|
||||||
belongs_to :customer, :optional => true
|
belongs_to :customer, :optional => true
|
||||||
belongs_to :shift_sale
|
belongs_to :shift_sale
|
||||||
has_one :survey, foreign_key: "receipt_no"
|
has_one :survey, foreign_key: "receipt_no"
|
||||||
has_many :sale_audits
|
has_many :sale_audits
|
||||||
has_many :sale_items
|
has_many :sale_items
|
||||||
has_many :sale_discount_items
|
has_many :sale_discount_items
|
||||||
@@ -20,6 +21,7 @@ class Sale < ApplicationRecord
|
|||||||
has_many :orders, through: :sale_orders
|
has_many :orders, through: :sale_orders
|
||||||
has_many :order_items, through: :sale_orders
|
has_many :order_items, through: :sale_orders
|
||||||
has_many :bookings
|
has_many :bookings
|
||||||
|
has_one :booking
|
||||||
has_many :product_commissions
|
has_many :product_commissions
|
||||||
|
|
||||||
before_validation :round_to_precision
|
before_validation :round_to_precision
|
||||||
@@ -79,188 +81,109 @@ class Sale < ApplicationRecord
|
|||||||
Rails.logger.debug '........ Sale data sync completed .......'
|
Rails.logger.debug '........ Sale data sync completed .......'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
def self.generate_invoice_from_booking(booking, requested_by, cashier, order_source = nil, current_checkin_induties_count)
|
|
||||||
if booking
|
|
||||||
Rails.logger.debug "Booking -> " + booking.id.to_s
|
|
||||||
Rails.logger.debug "Booking -> Booking Order Count -> " + booking.booking_orders.count.to_s
|
|
||||||
#get all order attached to this booking and combine into 1 invoice
|
|
||||||
|
|
||||||
unless sale = booking.sale
|
def self.generate_invoice_from_booking(booking, requested_by, cashier, order_source = nil, in_duties_count = 0)
|
||||||
sale = booking.build_sale(
|
Sale.transaction do
|
||||||
|
if booking
|
||||||
|
current = Time.now
|
||||||
|
#get all order attached to this booking and combine into 1 invoice
|
||||||
|
sale = booking.sale || booking.build_sale(
|
||||||
{
|
{
|
||||||
tax_type: "execulive" # Default Tax - Values
|
tax_type: "execulive" # Default Tax - Values
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
end
|
|
||||||
booking.booking_orders.each do |order|
|
|
||||||
sale.generate_invoice_from_order(order.order_id, booking, requested_by, cashier, order_source)
|
|
||||||
# saleObj = Sale.find(sale_id)
|
|
||||||
# order = booking.booking_orders.take.order
|
|
||||||
# link_order_sale(order.order_id)
|
|
||||||
end
|
|
||||||
# InventoryJob.perform_now(self.id)
|
|
||||||
# InventoryDefinition.calculate_product_count(saleObj)
|
|
||||||
|
|
||||||
|
if cashier.role == 'cashier'
|
||||||
# dining charges
|
sale.cashier = cashier
|
||||||
charges = DiningCharge.where('dining_facility_id=?', booking.dining_facility_id).take
|
sale.shift_sale = cashier.current_shift
|
||||||
if !charges.nil?
|
elsif booking.dining_facility_id
|
||||||
block_count, diningprice = DiningCharge.amount_calculate(charges, booking.checkin_at, booking.checkout_at)
|
sale.shift_sale = booking.dining_facility.cashier_terminal.current_shift
|
||||||
if charges.charge_type =='hr'
|
sale.cashier = booking.dining_facility.cashier_terminal.current_shift.employee
|
||||||
dining_time = booking.checkin_at.strftime('%H:%M %p').to_s + " - " + booking.checkout_at.strftime('%H:%M %p').to_s
|
|
||||||
else
|
else
|
||||||
dining_time = booking.checkin_at.strftime('%B %d, %H:%M %p').to_s + " - " + booking.checkout_at.strftime('%B %d, %H:%M %p').to_s
|
sale.cashier = Employee.where(role: 'cashier').where.not(token_session: [nil, '']).first
|
||||||
|
sale.shift_sale = sale.cashier.current_shift
|
||||||
end
|
end
|
||||||
later_time = booking.checkout_at
|
|
||||||
early_time = booking.checkin_at
|
|
||||||
distance_in_minutes = ((later_time - early_time)/60.0).round
|
|
||||||
basic_pay_amount = 0
|
|
||||||
name = ""
|
|
||||||
if current_checkin_induties_count != "0"
|
|
||||||
basic_pay = Commission.where('commission_type=?','Basic Pay')
|
|
||||||
basic_pay.each do |pay|
|
|
||||||
basic_pay_amount = pay.amount
|
|
||||||
name = pay.name
|
|
||||||
end
|
|
||||||
induties_pay_amount = (current_checkin_induties_count.to_i * (distance_in_minutes / 60.0).to_f * basic_pay_amount).to_i
|
|
||||||
sale.create_saleitem_indutycharges(charges, current_checkin_induties_count.to_i, induties_pay_amount, booking.dining_facility.name, dining_time, order_source, basic_pay_amount)
|
|
||||||
end
|
|
||||||
sale.create_saleitem_diningcharges(charges, block_count, diningprice, booking.dining_facility.name, dining_time, order_source)
|
|
||||||
end
|
|
||||||
|
|
||||||
return sale
|
sale.cashier_name = sale.cashier.name
|
||||||
end
|
sale.requested_by = requested_by.name
|
||||||
end
|
sale.requested_at = current
|
||||||
|
|
||||||
def generate_invoice_from_order(order_id, booking, requested_by, cashier = nil, order_source = nil)
|
sale.sale_items << booking.order_items.to_sale_items
|
||||||
taxable = true
|
|
||||||
|
|
||||||
order = Order.find(order_id)
|
if dining_charge = booking.dining_facility.dining_charge
|
||||||
|
block_count, dining_price = DiningCharge.amount_calculate(dining_charge, booking.checkin_at, booking.checkout_at)
|
||||||
|
format = "%I:%M %p" if dining_charge.charge_type == "hr"
|
||||||
|
format ||= "%B %d, %I:%M %p"
|
||||||
|
dining_time = "#{booking.checkin_at.strftime(format)} - #{booking.checkout_at.strftime(format)}"
|
||||||
|
|
||||||
# current cashier login
|
sale.sale_items.build({
|
||||||
open_cashier = Employee.where("role = 'cashier' AND token_session <> ''")
|
menu_category_name: "Dining Charge",
|
||||||
current_shift = ShiftSale.current_shift
|
menu_category_code: "DiningCharge",
|
||||||
# shift with terminal zone
|
product_name: "#{booking.dining_facility.name} ( #{dining_time} )",
|
||||||
|
product_code: dining_charge.item_code,
|
||||||
|
product_alt_name: '-',
|
||||||
|
account_id: 0,
|
||||||
|
is_taxable: dining_charge.taxable,
|
||||||
|
qty: block_count,
|
||||||
|
unit_price: dining_charge.unit_price,
|
||||||
|
price: dining_price,
|
||||||
|
taxable_price: dining_price,
|
||||||
|
})
|
||||||
|
|
||||||
# set cashier
|
if in_duties_count.to_i > 0
|
||||||
if order_source.present? && order_source.downcase == "emenu"
|
basic_pay = Commission.find_by(commission_type: 'Basic Pay')
|
||||||
if !booking.dining_facility_id.nil?
|
in_duties_pay_amount = (in_duties_count.to_i * ((booking.checkout_at - booking.checkin_at) / 1.hours) * basic_pay_amount).to_i
|
||||||
table = DiningFacility.find(booking.dining_facility_id)
|
|
||||||
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
sale.sale_items.build({
|
||||||
shift = ShiftSale.where("shift_started_at is not null and shift_closed_at is null and cashier_terminal_id = #{cashier_zone.cashier_terminal_id}").first
|
menu_category_name: "Induty Charge",
|
||||||
#for multiple zone with terminal
|
menu_category_code: "IndutyCharge",
|
||||||
if shift.nil?
|
product_name: "#{basic_pay.name} ( #{dining_time} )",
|
||||||
multiple_zone = CashierTerminalByZone.where("zone_id = #{table.zone_id}")
|
product_code: "",
|
||||||
multiple_zone.each do |zone|
|
product_alt_name: '-',
|
||||||
shift = ShiftSale.where("shift_started_at is not null and shift_closed_at is null and cashier_terminal_id = #{zone.cashier_terminal_id}").first
|
account_id: 0,
|
||||||
if !shift.nil? then
|
is_taxable: dining_charge.taxable,
|
||||||
break
|
qty: in_duties_count,
|
||||||
end
|
unit_price: basic_pay.amount,
|
||||||
|
price: in_duties_pay_amount,
|
||||||
|
taxable_price: in_duties_pay_amount,
|
||||||
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
else
|
sale.orders << booking.orders
|
||||||
shift = ShiftSale.current_open_shift(cashier.id)
|
sale.customer_id = booking.orders[0].customer_id
|
||||||
end
|
|
||||||
# set cashier
|
sale.compute(booking.orders[0].source)
|
||||||
if shift != nil #if current login employee open shift
|
|
||||||
self.cashier_id = cashier.id
|
booking.orders.update_all(status: "billed")
|
||||||
self.cashier_name = cashier.name
|
booking.order_items.update_all(order_item_status: "billed")
|
||||||
self.shift_sale_id = shift.id
|
|
||||||
else
|
booking.checkout_at = current unless booking.checkout_at && booking.checkout_at > current
|
||||||
if open_cashier.count>0 # if we have two open cashier
|
booking.checkout_by = requested_by.name
|
||||||
# table and terminal in multiple shift
|
|
||||||
self.cashier_id = open_cashier[0].id
|
booking.save
|
||||||
self.cashier_name = open_cashier[0].name
|
return sale
|
||||||
shift_id = ShiftSale.current_open_shift(open_cashier[0].id)
|
|
||||||
if shift_id
|
|
||||||
self.shift_sale_id = shift_id.id
|
|
||||||
else
|
|
||||||
self.shift_sale_id = current_shift.id
|
|
||||||
end
|
|
||||||
else
|
|
||||||
self.cashier_id = current_shift.employee_id
|
|
||||||
self.cashier_name = Employee.find(current_shift.employee_id).name
|
|
||||||
self.shift_sale_id = current_shift.id
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
# set waiter
|
|
||||||
self.requested_by = requested_by.name
|
|
||||||
|
|
||||||
self.requested_at = DateTime.now.utc.getlocal
|
|
||||||
|
|
||||||
Rails.logger.debug "Order -> #{order.id} | order_status -> #{order.status}"
|
|
||||||
if order
|
|
||||||
self.customer_id = order.customer_id
|
|
||||||
Rails.logger.debug "Order -> #{order.id} | Items Count -> #{order.order_items.count}"
|
|
||||||
|
|
||||||
order.order_items.each do |item|
|
|
||||||
self.add_item(item)
|
|
||||||
if !item.set_menu_items.nil?
|
|
||||||
self.add_sub_item(item.set_menu_items)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
self.orders << order
|
|
||||||
end
|
|
||||||
|
|
||||||
#compute sales summary
|
|
||||||
if order_source.nil?
|
|
||||||
order_source = order.source
|
|
||||||
end
|
|
||||||
self.compute(order_source)
|
|
||||||
|
|
||||||
#Update the order items that is billed
|
|
||||||
order.update_items_status_to_billed(nil)
|
|
||||||
order.status = "billed"
|
|
||||||
order.save
|
|
||||||
|
|
||||||
if !booking.checkout_at.nil?
|
|
||||||
if booking.checkout_at.utc < Time.now.utc
|
|
||||||
booking.checkout_at = Time.now.utc.getlocal
|
|
||||||
end
|
|
||||||
else
|
|
||||||
booking.checkout_at = Time.now.utc.getlocal
|
|
||||||
end
|
|
||||||
|
|
||||||
booking.checkout_by = requested_by.name
|
|
||||||
booking.save
|
|
||||||
|
|
||||||
# InventoryJob.perform_now(self.id)
|
|
||||||
# saleObj = Sale.find(self.id)
|
|
||||||
# InventoryDefinition.calculate_product_count(saleObj)
|
|
||||||
|
|
||||||
return self
|
|
||||||
end
|
end
|
||||||
|
|
||||||
#fOR Quick Service pay and create
|
#fOR Quick Service pay and create
|
||||||
def self.request_bill(order,current_user,current_login_employee)
|
def self.request_bill(order, current_user, current_login_employee)
|
||||||
if !ShiftSale.current_shift.nil?
|
if !ShiftSale.current_shift.nil?
|
||||||
order_id = order.order_id # order_id
|
order_id = order.order_id # order_id
|
||||||
bk_order = BookingOrder.find_by_order_id(order_id)
|
booking = order.booking
|
||||||
check_booking = Booking.find_by_booking_id(bk_order.booking_id)
|
|
||||||
|
|
||||||
if @sale_data = check_booking.sale
|
sale_data = Sale.generate_invoice_from_booking(check_booking, current_login_employee, current_user, order.source)
|
||||||
# Create Sale if it doesn't exist
|
|
||||||
# puts "current_login_employee"
|
|
||||||
# puts current_login_employee.name
|
|
||||||
@sale_items = SaleItem.where("sale_id=?",@sale_id)
|
|
||||||
elsif @sale_data = Sale.generate_invoice_from_booking(check_booking,current_login_employee,current_user,order.source)
|
|
||||||
@sale_items = SaleItem.where("sale_id=?",@sale_data.sale_id)
|
|
||||||
end
|
|
||||||
|
|
||||||
# Bind shift sale id to sale
|
# Bind shift sale id to sale
|
||||||
# @sale_data.shift_sale_id = shift.id
|
# @sale_data.shift_sale_id = shift.id
|
||||||
# @sale_data.save
|
# @sale_data.save
|
||||||
|
|
||||||
# Promotion Activation
|
# Promotion Activation
|
||||||
Promotion.promo_activate(@sale_data)
|
Promotion.promo_activate(sale_data)
|
||||||
@status = true
|
return true, sale_data
|
||||||
return @status, @sale_data
|
|
||||||
else
|
else
|
||||||
@status = false
|
return false, "No Current Open Shift for This Employee"
|
||||||
@message = "No Current Open Shift for This Employee"
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
#This is when spilt bill is request - then we cannot link order to invoice
|
#This is when spilt bill is request - then we cannot link order to invoice
|
||||||
|
|||||||
@@ -280,6 +280,11 @@ class SaleItem < ApplicationRecord
|
|||||||
|
|
||||||
# Loader Service SFTP End
|
# Loader Service SFTP End
|
||||||
|
|
||||||
|
protected
|
||||||
|
def self.generate_ids(count = 1)
|
||||||
|
SeedGenerator.generate_ids(self.name, "SLI", count)
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def generate_custom_id
|
def generate_custom_id
|
||||||
if self.sale_item_id.nil?
|
if self.sale_item_id.nil?
|
||||||
|
|||||||
@@ -6,21 +6,21 @@ if item.is_available
|
|||||||
attr_format = []
|
attr_format = []
|
||||||
# Format for attributes json
|
# Format for attributes json
|
||||||
if item.item_attributes.count > 0
|
if item.item_attributes.count > 0
|
||||||
item_attributes = @item_attributes.select{ |x| item.item_attributes.include?(x.id.to_s) }
|
item_attributes = item.item_attributes.map(&:to_s)
|
||||||
attr_format = item_attributes.group_by {|att| att.attribute_type }.map { |type, values| {type: type, values: values.map(&:name)} }
|
attr_format = @item_attributes.select { |x| item_attributes.include?(x.id.to_s) }.group_by {|att| att.attribute_type.strip }.map { |type, values| {type: type, values: values.map { |x| x.name.strip } } }
|
||||||
end
|
end
|
||||||
|
|
||||||
# Format for option json
|
# Format for option json
|
||||||
opt_format = []
|
opt_format = []
|
||||||
# Format for attributes json
|
# Format for attributes json
|
||||||
if item.item_options.count > 0
|
if item.item_options.count > 0
|
||||||
item_options = @item_options.select{ |x| item.item_options.include?(x.id.to_s) }
|
item_options = item.item_options.map(&:to_s)
|
||||||
opt_format = item_options.group_by {|opt| opt.option_type }.map { |type, values| {type: type, values: values.map(&:name)} }
|
opt_format = @item_options.select { |x| item_options.include?(x.id.to_s) }.group_by {|opt| opt.option_type.strip }.map { |type, values| {type: type, values: values.map { |x| x.name.strip } } }
|
||||||
end
|
end
|
||||||
|
|
||||||
#Menu Item Information
|
#Menu Item Information
|
||||||
json.id item.id
|
json.id item.id
|
||||||
json.code item.item_code
|
json.code item.item_code
|
||||||
json.name item.name
|
json.name item.name
|
||||||
json.alt_name item.alt_name
|
json.alt_name item.alt_name
|
||||||
if !request_url.nil? && request_url != '' && !item.image_path.nil?
|
if !request_url.nil? && request_url != '' && !item.image_path.nil?
|
||||||
@@ -44,7 +44,7 @@ if item.is_available
|
|||||||
json.alt_name its.alt_name
|
json.alt_name its.alt_name
|
||||||
json.min_selectable_qty its.min_selectable_qty
|
json.min_selectable_qty its.min_selectable_qty
|
||||||
json.max_selectable_qty its.max_selectable_qty
|
json.max_selectable_qty its.max_selectable_qty
|
||||||
json.instances its.menu_item_instances.map { |i| {id: i.id} }
|
json.instances its.menu_item_instances.map { |i| {id: i.id} }
|
||||||
end
|
end
|
||||||
|
|
||||||
json.attributes attr_format
|
json.attributes attr_format
|
||||||
@@ -64,7 +64,8 @@ if item.is_available
|
|||||||
json.instances item.menu_item_instances do |is|
|
json.instances item.menu_item_instances do |is|
|
||||||
if is.is_available
|
if is.is_available
|
||||||
# Convert id to name for attributes
|
# Convert id to name for attributes
|
||||||
instance_attr = @item_attributes.select{ |x| item.item_attributes.include?(x.id) }.pluck(:name)
|
item_attributes = is.item_attributes.map(&:to_s)
|
||||||
|
instance_attr = @item_attributes.select{ |x| item_attributes.include?(x.id.to_s) }.pluck(:name)
|
||||||
|
|
||||||
json.id is.id
|
json.id is.id
|
||||||
json.code is.item_instance_code
|
json.code is.item_instance_code
|
||||||
|
|||||||
@@ -31,15 +31,13 @@ json.is_sub_item item.is_sub_item
|
|||||||
json.unit item.unit
|
json.unit item.unit
|
||||||
|
|
||||||
# Item Sets of Menu Item
|
# Item Sets of Menu Item
|
||||||
json.item_sets item.item_sets.includes(:menu_item_instances) do |its|
|
json.item_sets item.item_sets do |its|
|
||||||
json.id its.id
|
json.id its.id
|
||||||
json.name its.name
|
json.name its.name
|
||||||
json.alt_name its.alt_name
|
json.alt_name its.alt_name
|
||||||
json.min_selectable_qty its.min_selectable_qty
|
json.min_selectable_qty its.min_selectable_qty
|
||||||
json.max_selectable_qty its.max_selectable_qty
|
json.max_selectable_qty its.max_selectable_qty
|
||||||
json.instances its.menu_item_instances do |i|
|
json.instances its.menu_item_instances.map { |i| {id: i.id} }
|
||||||
json.id i.id
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
json.attributes attr_format
|
json.attributes attr_format
|
||||||
|
|||||||
@@ -41,21 +41,21 @@ if (menu.menu_categories)
|
|||||||
attr_format = []
|
attr_format = []
|
||||||
# Format for attributes json
|
# Format for attributes json
|
||||||
if item.item_attributes.count > 0
|
if item.item_attributes.count > 0
|
||||||
item_attributes = @item_attributes.select{ |x| item.item_attributes.include?(x.id.to_s) }
|
item_attributes = item.item_attributes.map(&:to_s)
|
||||||
attr_format = item_attributes.group_by {|att| att.attribute_type }.map { |type, values| {type: type, values: values.map(&:name)} }
|
attr_format = @item_attributes.select { |x| item_attributes.include?(x.id.to_s) }.group_by {|att| att.attribute_type.strip }.map { |type, values| {type: type, values: values.map { |x| x.name.strip } } }
|
||||||
end
|
end
|
||||||
|
|
||||||
# Format for option json
|
# Format for option json
|
||||||
opt_format = []
|
opt_format = []
|
||||||
# Format for attributes json
|
# Format for attributes json
|
||||||
if item.item_options.count > 0
|
if item.item_options.count > 0
|
||||||
item_options = @item_options.select{ |x| item.item_options.include?(x.id.to_s) }
|
item_options = item.item_options.map(&:to_s)
|
||||||
opt_format = item_options.group_by {|opt| opt.option_type }.map { |type, values| {type: type, values: values.map(&:name)} }
|
opt_format = @item_options.select { |x| item_options.include?(x.id.to_s) }.group_by {|opt| opt.option_type.strip }.map { |type, values| {type: type, values: values.map { |x| x.name.strip } } }
|
||||||
end
|
end
|
||||||
|
|
||||||
#Menu Item Information
|
#Menu Item Information
|
||||||
json.id item.id
|
json.id item.id
|
||||||
json.code item.item_code
|
json.code item.item_code
|
||||||
json.name item.name
|
json.name item.name
|
||||||
json.alt_name item.alt_name
|
json.alt_name item.alt_name
|
||||||
json.image item.image_path.url
|
json.image item.image_path.url
|
||||||
@@ -69,15 +69,14 @@ if (menu.menu_categories)
|
|||||||
json.unit item.unit
|
json.unit item.unit
|
||||||
|
|
||||||
# Item Sets of Menu Item
|
# Item Sets of Menu Item
|
||||||
json.item_sets item.item_sets.map { |its|
|
json.item_sets item.item_sets do |its|
|
||||||
{ id: its.id,
|
json.id its.id
|
||||||
name: its.name,
|
json.name its.name
|
||||||
alt_name: its.alt_name,
|
json.alt_name its.alt_name
|
||||||
min_selectable_qty: its.min_selectable_qty,
|
json.min_selectable_qty its.min_selectable_qty
|
||||||
max_selectable_qty: its.max_selectable_qty,
|
json.max_selectable_qty its.max_selectable_qty
|
||||||
instances: its.menu_item_instances.map { |i| {id: i.id} }
|
json.instances its.menu_item_instances.map { |i| {id: i.id} }
|
||||||
}
|
end
|
||||||
}
|
|
||||||
|
|
||||||
json.attributes attr_format
|
json.attributes attr_format
|
||||||
json.options opt_format
|
json.options opt_format
|
||||||
@@ -85,7 +84,8 @@ if (menu.menu_categories)
|
|||||||
json.instances item.menu_item_instances do |is|
|
json.instances item.menu_item_instances do |is|
|
||||||
if is.is_available
|
if is.is_available
|
||||||
# Convert id to name for attributes
|
# Convert id to name for attributes
|
||||||
instance_attr = @item_attributes.select{ |x| item.item_attributes.include?(x.id) }.pluck(:name)
|
item_attributes = is.item_attributes.map(&:to_s)
|
||||||
|
instance_attr = @item_attributes.select{ |x| item_attributes.include?(x.id.to_s) }.pluck(:name)
|
||||||
|
|
||||||
json.id is.id
|
json.id is.id
|
||||||
json.code is.item_instance_code
|
json.code is.item_instance_code
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<%= f.input :seater %>
|
<%= f.input :seater %>
|
||||||
<%= f.input :order_by %>
|
<%= f.input :order_by %>
|
||||||
<%= f.input :is_active %>
|
<%= f.input :is_active %>
|
||||||
<% if @settings_room.dining_charges.length == 0 %>
|
<% if @settings_room.dining_charge.nil? %>
|
||||||
<% if @settings_room.id != nil %>
|
<% if @settings_room.id != nil %>
|
||||||
<div class="">
|
<div class="">
|
||||||
<div class="">
|
<div class="">
|
||||||
@@ -20,33 +20,31 @@
|
|||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<% @settings_room.dining_charges.each do |dc| %>
|
<% dc = @settings_room.dining_charge %>
|
||||||
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="col-md-">
|
<div class="col-md-">
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<tr><td colspan="2">
|
<tr><td colspan="2">
|
||||||
<div class="col-md-10"><b><u>Dining Charge</u></b></div></td>
|
<div class="col-md-10"><b><u>Dining Charge</u></b></div></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="align-right">Item code :</td>
|
<td class="align-right">Item code :</td>
|
||||||
<td class="align-left"><%= dc.item_code %></td>
|
<td class="align-left"><%= dc.item_code %></td>
|
||||||
<td class="align-right">Unit price : </td>
|
<td class="align-right">Unit price : </td>
|
||||||
<td class="align-left"><%= dc.unit_price %></td>
|
<td class="align-left"><%= dc.unit_price %></td>
|
||||||
<td class="align-right">Charge type : </td>
|
<td class="align-right">Charge type : </td>
|
||||||
<td class="align-left"><%= dc.charge_type %></td>
|
<td class="align-left"><%= dc.charge_type %></td>
|
||||||
<td>
|
<td>
|
||||||
<%= link_to 'Edit Charges', edit_settings_zone_room_dining_charge_path(@zone,@settings_room,dc),:class => 'btn bg-deep-purple' %>
|
<%= link_to 'Edit Charges', edit_settings_zone_room_dining_charge_path(@zone,@settings_room,dc),:class => 'btn bg-deep-purple' %>
|
||||||
<!-- <button class="btn btn-primary" src="<%= edit_settings_zone_room_dining_charge_path(@zone,@settings_room,dc) %>">Edit Charge</button> -->
|
<!-- <button class="btn btn-primary" src="<%= edit_settings_zone_room_dining_charge_path(@zone,@settings_room,dc) %>">Edit Charge</button> -->
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -62,7 +60,7 @@
|
|||||||
<div class="body">
|
<div class="body">
|
||||||
<h5><i class="material-icons md-18">view_headline <%= t("views.right_panel.header.page_detail") %></i></h5>
|
<h5><i class="material-icons md-18">view_headline <%= t("views.right_panel.header.page_detail") %></i></h5>
|
||||||
<p>
|
<p>
|
||||||
1) <%= t("views.right_panel.detail.name") %> - <%= t("views.right_panel.detail.write_txt") %> <%= t("views.right_panel.detail.room_txt") %> <%= t("views.right_panel.detail.name_txt2") %> <br>
|
1) <%= t("views.right_panel.detail.name") %> - <%= t("views.right_panel.detail.write_txt") %> <%= t("views.right_panel.detail.room_txt") %> <%= t("views.right_panel.detail.name_txt2") %> <br>
|
||||||
2) <%= t("views.right_panel.detail.status") %> - <%= t("views.right_panel.detail.write_txt") %> <%= t("views.right_panel.detail.status_txt") %> <br>
|
2) <%= t("views.right_panel.detail.status") %> - <%= t("views.right_panel.detail.write_txt") %> <%= t("views.right_panel.detail.status_txt") %> <br>
|
||||||
3) <%= t("views.right_panel.detail.seater") %> - <%= t("views.right_panel.detail.write_txt") %> <%= t("views.right_panel.detail.seat_txt") %> <%= t("views.right_panel.detail.for") %> <%= t("views.right_panel.detail.room_txt") %> <br>
|
3) <%= t("views.right_panel.detail.seater") %> - <%= t("views.right_panel.detail.write_txt") %> <%= t("views.right_panel.detail.seat_txt") %> <%= t("views.right_panel.detail.for") %> <%= t("views.right_panel.detail.room_txt") %> <br>
|
||||||
4) <%= t("views.right_panel.detail.order_by") %> - <%= t("views.right_panel.detail.write_txt") %> <%= t("views.right_panel.detail.order_txt") %> <%= t("views.right_panel.detail.for") %> <%= t("views.right_panel.detail.room_txt") %> <br>
|
4) <%= t("views.right_panel.detail.order_by") %> - <%= t("views.right_panel.detail.write_txt") %> <%= t("views.right_panel.detail.order_txt") %> <%= t("views.right_panel.detail.for") %> <%= t("views.right_panel.detail.room_txt") %> <br>
|
||||||
@@ -78,7 +76,6 @@
|
|||||||
2) <%= t("views.right_panel.button.back") %> - <%= t("views.right_panel.detail.back_txt") %> <%= t("views.right_panel.detail.zone_txt") %> <%= t("views.right_panel.detail.detail_txt") %> <br>
|
2) <%= t("views.right_panel.button.back") %> - <%= t("views.right_panel.detail.back_txt") %> <%= t("views.right_panel.detail.zone_txt") %> <%= t("views.right_panel.detail.detail_txt") %> <br>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -11,14 +11,14 @@
|
|||||||
<%= f.input :seater %>
|
<%= f.input :seater %>
|
||||||
<%= f.input :order_by %>
|
<%= f.input :order_by %>
|
||||||
<%= f.input :is_active %>
|
<%= f.input :is_active %>
|
||||||
<% if @settings_table.dining_charges.length == 0 %>
|
<% if @settings_table.dining_charge.nil? %>
|
||||||
<% if @settings_table.id != nil %>
|
<% if @settings_table.id != nil %>
|
||||||
<div class="col-md-">
|
<div class="col-md-">
|
||||||
<%= link_to 'Add For Extra Charges', new_settings_zone_table_dining_charge_path(@zone,@settings_table),:class => 'btn bg-deep-purple' %>
|
<%= link_to 'Add For Extra Charges', new_settings_zone_table_dining_charge_path(@zone,@settings_table),:class => 'btn bg-deep-purple' %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<% @settings_table.dining_charges.each do |dc| %>
|
<% dc = @settings_table.dining_charge %>
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="body">
|
<div class="body">
|
||||||
<span class="card-title"><b><u>Dining Charge</u></b></span>
|
<span class="card-title"><b><u>Dining Charge</u></b></span>
|
||||||
@@ -48,7 +48,6 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -64,7 +63,7 @@
|
|||||||
<div class="body">
|
<div class="body">
|
||||||
<h5><i class="material-icons md-18">view_headline <%= t("views.right_panel.header.page_detail") %></i></h5>
|
<h5><i class="material-icons md-18">view_headline <%= t("views.right_panel.header.page_detail") %></i></h5>
|
||||||
<p>
|
<p>
|
||||||
1) <%= t("views.right_panel.detail.name") %> - <%= t("views.right_panel.detail.write_txt") %> <%= t("views.right_panel.detail.table_txt") %> <%= t("views.right_panel.detail.name_txt2") %> <br>
|
1) <%= t("views.right_panel.detail.name") %> - <%= t("views.right_panel.detail.write_txt") %> <%= t("views.right_panel.detail.table_txt") %> <%= t("views.right_panel.detail.name_txt2") %> <br>
|
||||||
2) <%= t("views.right_panel.detail.status") %> - <%= t("views.right_panel.detail.write_txt") %> <%= t("views.right_panel.detail.status_txt") %> <br>
|
2) <%= t("views.right_panel.detail.status") %> - <%= t("views.right_panel.detail.write_txt") %> <%= t("views.right_panel.detail.status_txt") %> <br>
|
||||||
3) <%= t("views.right_panel.detail.seater") %> - <%= t("views.right_panel.detail.write_txt") %> <%= t("views.right_panel.detail.seat_txt") %> <%= t("views.right_panel.detail.for") %> <%= t("views.right_panel.detail.table_txt") %> <br>
|
3) <%= t("views.right_panel.detail.seater") %> - <%= t("views.right_panel.detail.write_txt") %> <%= t("views.right_panel.detail.seat_txt") %> <%= t("views.right_panel.detail.for") %> <%= t("views.right_panel.detail.table_txt") %> <br>
|
||||||
4) <%= t("views.right_panel.detail.order_by") %> - <%= t("views.right_panel.detail.write_txt") %> <%= t("views.right_panel.detail.order_txt") %> <%= t("views.right_panel.detail.for") %> <%= t("views.right_panel.detail.table_txt") %> <br>
|
4) <%= t("views.right_panel.detail.order_by") %> - <%= t("views.right_panel.detail.write_txt") %> <%= t("views.right_panel.detail.order_txt") %> <%= t("views.right_panel.detail.for") %> <%= t("views.right_panel.detail.table_txt") %> <br>
|
||||||
@@ -81,8 +80,6 @@
|
|||||||
2) <%= t("views.right_panel.button.back") %> - <%= t("views.right_panel.detail.back_txt") %> <%= t("views.right_panel.detail.zone_txt") %> <br>
|
2) <%= t("views.right_panel.button.back") %> - <%= t("views.right_panel.detail.back_txt") %> <%= t("views.right_panel.detail.zone_txt") %> <br>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -53,43 +53,42 @@
|
|||||||
|
|
||||||
<span class="hidden" id="delete_text">
|
<span class="hidden" id="delete_text">
|
||||||
<h6>Are you sure you want to delete this row ?</h6>
|
<h6>Are you sure you want to delete this row ?</h6>
|
||||||
<h6>This action can't be undo. </h6>
|
<h6>This action can't be undo. </h6>
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<% @table.dining_charges.each do |dc| %>
|
<% dc = @table.dining_charge %>
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="body">
|
<div class="body">
|
||||||
<h4 class="card-title">Dining Charge</h4>
|
<h4 class="card-title">Dining Charge</h4>
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
<th>Item Code</th>
|
<th>Item Code</th>
|
||||||
<th>Unit Price</th>
|
<th>Unit Price</th>
|
||||||
<th>Charge Type</th>
|
<th>Charge Type</th>
|
||||||
<th>Free Time</th>
|
<th>Free Time</th>
|
||||||
<th>Charges Block</th>
|
<th>Charges Block</th>
|
||||||
<th>Time Rounding</th>
|
<th>Time Rounding</th>
|
||||||
<th>Actions</th>
|
<th>Actions</th>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= dc.item_code %></td>
|
<td><%= dc.item_code %></td>
|
||||||
<td><%= dc.unit_price %></td>
|
<td><%= dc.unit_price %></td>
|
||||||
<td><%= dc.charge_type %></td>
|
<td><%= dc.charge_type %></td>
|
||||||
<td><%= (dc.minimum_free_time).utc.strftime("%H:%M") %></td>
|
<td><%= (dc.minimum_free_time).utc.strftime("%H:%M") %></td>
|
||||||
<td><%= (dc.charge_block).utc.strftime("%H:%M") %></td>
|
<td><%= (dc.charge_block).utc.strftime("%H:%M") %></td>
|
||||||
<td><%= dc.time_rounding %></td>
|
<td><%= dc.time_rounding %></td>
|
||||||
<td><%= link_to 'Edit Charges', edit_settings_zone_table_dining_charge_path(@zone,@settings_table,dc),:class => 'btn bg-deep-purple' %>
|
<td><%= link_to 'Edit Charges', edit_settings_zone_table_dining_charge_path(@zone,@settings_table,dc),:class => 'btn bg-deep-purple' %>
|
||||||
<!-- <button class="btn btn-primary" src="<%= edit_settings_zone_table_dining_charge_path(@zone,@settings_table,dc) %>">Edit Charge</button> -->
|
<!-- <button class="btn btn-primary" src="<%= edit_settings_zone_table_dining_charge_path(@zone,@settings_table,dc) %>">Edit Charge</button> -->
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -98,7 +97,7 @@
|
|||||||
<div class="body">
|
<div class="body">
|
||||||
<h5><i class="material-icons md-18">view_headline <%= t("views.right_panel.header.page_detail") %></i></h5>
|
<h5><i class="material-icons md-18">view_headline <%= t("views.right_panel.header.page_detail") %></i></h5>
|
||||||
<p>
|
<p>
|
||||||
1) <%= t("views.right_panel.detail.name") %> - <%= t("views.right_panel.detail.table_txt") %> <%= t("views.right_panel.detail.name_txt") %> <%= t("views.right_panel.detail.table_txt") %><br>
|
1) <%= t("views.right_panel.detail.name") %> - <%= t("views.right_panel.detail.table_txt") %> <%= t("views.right_panel.detail.name_txt") %> <%= t("views.right_panel.detail.table_txt") %><br>
|
||||||
2) <%= t("views.right_panel.detail.status") %> - <%= t("views.right_panel.detail.table_txt") %> <%= t("views.right_panel.detail.status_txt") %> <br>
|
2) <%= t("views.right_panel.detail.status") %> - <%= t("views.right_panel.detail.table_txt") %> <%= t("views.right_panel.detail.status_txt") %> <br>
|
||||||
3) <%= t("views.right_panel.detail.seater") %> - <%= t("views.right_panel.detail.seat_txt") %> <%= t("views.right_panel.detail.for") %> <%= t("views.right_panel.detail.table_txt") %> <br>
|
3) <%= t("views.right_panel.detail.seater") %> - <%= t("views.right_panel.detail.seat_txt") %> <%= t("views.right_panel.detail.for") %> <%= t("views.right_panel.detail.table_txt") %> <br>
|
||||||
4) <%= t("views.right_panel.detail.order_by") %> - <%= t("views.right_panel.detail.order_txt") %> <%= t("views.right_panel.detail.for") %> <%= t("views.right_panel.detail.table_txt") %> <br>
|
4) <%= t("views.right_panel.detail.order_by") %> - <%= t("views.right_panel.detail.order_txt") %> <%= t("views.right_panel.detail.for") %> <%= t("views.right_panel.detail.table_txt") %> <br>
|
||||||
@@ -118,8 +117,6 @@
|
|||||||
2) <%= t("views.right_panel.button.back") %> - <%= t("views.right_panel.detail.back_txt") %> <%= t("views.right_panel.detail.zone_txt") %> <br>
|
2) <%= t("views.right_panel.button.back") %> - <%= t("views.right_panel.detail.back_txt") %> <%= t("views.right_panel.detail.zone_txt") %> <br>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user