to update
This commit is contained in:
16
Gemfile.lock
16
Gemfile.lock
@@ -47,7 +47,7 @@ GEM
|
|||||||
minitest (~> 5.1)
|
minitest (~> 5.1)
|
||||||
tzinfo (~> 1.1)
|
tzinfo (~> 1.1)
|
||||||
aescrypt (1.0.0)
|
aescrypt (1.0.0)
|
||||||
airbrussh (1.3.4)
|
airbrussh (1.4.0)
|
||||||
sshkit (>= 1.6.1, != 1.7.0)
|
sshkit (>= 1.6.1, != 1.7.0)
|
||||||
arel (8.0.0)
|
arel (8.0.0)
|
||||||
axlsx (2.0.1)
|
axlsx (2.0.1)
|
||||||
@@ -88,7 +88,7 @@ GEM
|
|||||||
coffee-script-source (1.12.2)
|
coffee-script-source (1.12.2)
|
||||||
concurrent-ruby (1.1.5)
|
concurrent-ruby (1.1.5)
|
||||||
connection_pool (2.2.2)
|
connection_pool (2.2.2)
|
||||||
crass (1.0.4)
|
crass (1.0.5)
|
||||||
cups (0.1.10)
|
cups (0.1.10)
|
||||||
database_cleaner (1.7.0)
|
database_cleaner (1.7.0)
|
||||||
diff-lcs (1.3)
|
diff-lcs (1.3)
|
||||||
@@ -110,7 +110,7 @@ GEM
|
|||||||
htmlentities (4.3.4)
|
htmlentities (4.3.4)
|
||||||
httparty (0.15.7)
|
httparty (0.15.7)
|
||||||
multi_xml (>= 0.5.2)
|
multi_xml (>= 0.5.2)
|
||||||
i18n (1.6.0)
|
i18n (1.7.0)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
jbuilder (2.9.1)
|
jbuilder (2.9.1)
|
||||||
activesupport (>= 4.2.0)
|
activesupport (>= 4.2.0)
|
||||||
@@ -150,7 +150,7 @@ GEM
|
|||||||
method_source (0.9.2)
|
method_source (0.9.2)
|
||||||
mime-types (3.3)
|
mime-types (3.3)
|
||||||
mime-types-data (~> 3.2015)
|
mime-types-data (~> 3.2015)
|
||||||
mime-types-data (3.2019.0904)
|
mime-types-data (3.2019.1009)
|
||||||
mini_magick (4.9.5)
|
mini_magick (4.9.5)
|
||||||
mini_mime (1.0.2)
|
mini_mime (1.0.2)
|
||||||
mini_portile2 (2.4.0)
|
mini_portile2 (2.4.0)
|
||||||
@@ -175,9 +175,9 @@ GEM
|
|||||||
prawn (2.2.2)
|
prawn (2.2.2)
|
||||||
pdf-core (~> 0.7.0)
|
pdf-core (~> 0.7.0)
|
||||||
ttfunk (~> 1.5)
|
ttfunk (~> 1.5)
|
||||||
prawn-qrcode (0.3.1)
|
prawn-qrcode (0.4.0)
|
||||||
prawn (>= 1)
|
prawn (>= 1)
|
||||||
rqrcode (>= 0.4.1)
|
rqrcode (>= 1.0.0)
|
||||||
prawn-table (0.2.2)
|
prawn-table (0.2.2)
|
||||||
prawn (>= 1.3.0, < 3.0.0)
|
prawn (>= 1.3.0, < 3.0.0)
|
||||||
puma (3.12.1)
|
puma (3.12.1)
|
||||||
@@ -230,8 +230,8 @@ GEM
|
|||||||
rspec-support (~> 3.8.0)
|
rspec-support (~> 3.8.0)
|
||||||
rspec-mocks (3.8.2)
|
rspec-mocks (3.8.2)
|
||||||
diff-lcs (>= 1.2.0, < 2.0)
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
rspec-support (~> 3.8.0)
|
rspec-support (~> 3.9.0)
|
||||||
rspec-rails (3.8.2)
|
rspec-rails (3.9.0)
|
||||||
actionpack (>= 3.0)
|
actionpack (>= 3.0)
|
||||||
activesupport (>= 3.0)
|
activesupport (>= 3.0)
|
||||||
railties (>= 3.0)
|
railties (>= 3.0)
|
||||||
|
|||||||
@@ -66,6 +66,17 @@ class Api::OrdersController < Api::ApiController
|
|||||||
Rails.logger.debug "Table ID - " + params[:table_id].to_s
|
Rails.logger.debug "Table ID - " + params[:table_id].to_s
|
||||||
|
|
||||||
if checkin_checkout_time(params[:booking_id])
|
if checkin_checkout_time(params[:booking_id])
|
||||||
|
|
||||||
|
if params[:booking_id].present?
|
||||||
|
booking = Booking.find(params[:booking_id])
|
||||||
|
end
|
||||||
|
if params[:table_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
|
||||||
extra_time = ''
|
extra_time = ''
|
||||||
@@ -82,8 +93,7 @@ class Api::OrdersController < Api::ApiController
|
|||||||
end
|
end
|
||||||
}
|
}
|
||||||
#end extra time
|
#end extra time
|
||||||
puts params[:order_items]
|
|
||||||
puts "ORDER ITEMS"
|
|
||||||
# begin
|
# begin
|
||||||
@order = Order.new
|
@order = Order.new
|
||||||
@order.source = params[:order_source]
|
@order.source = params[:order_source]
|
||||||
@@ -98,50 +108,25 @@ class Api::OrdersController < Api::ApiController
|
|||||||
|
|
||||||
@order.is_extra_time = is_extra_time
|
@order.is_extra_time = is_extra_time
|
||||||
@order.extra_time = extra_time
|
@order.extra_time = extra_time
|
||||||
#Create Table Booking or Room Booking
|
|
||||||
if !params["booking_id"].nil?
|
|
||||||
# check booking id is already completed.
|
|
||||||
booking = Booking.find(params[:booking_id])
|
|
||||||
if booking
|
|
||||||
if booking.dining_facility_id.to_i == params[:table_id].to_i && booking.booking_status != 'moved'
|
|
||||||
if !booking.sale_id.nil?
|
|
||||||
sale_status = check_order_with_booking(booking)
|
|
||||||
|
|
||||||
if sale_status
|
#Create Table Booking or Room Booking
|
||||||
return return_json_status_with_code(400, "bill requested")
|
if booking.nil? || booking.sale_id.present? || booking.booking_status == 'moved'
|
||||||
end
|
@order.new_booking = true
|
||||||
else
|
else
|
||||||
@order.new_booking = false
|
@order.new_booking = false
|
||||||
@order.booking_id = params[:booking_id]
|
@order.booking_id = booking.booking_id
|
||||||
end
|
end
|
||||||
else
|
|
||||||
sale_status = check_order_with_table(params[:table_id])
|
|
||||||
|
|
||||||
if sale_status
|
@status, @booking = @order.generate
|
||||||
return return_json_status_with_code(400, "bill requested")
|
if @status && @booking
|
||||||
end
|
Order.process_order_queue(@order.order_id,@order.table_id,@order.source)
|
||||||
end
|
end
|
||||||
end #booking exists
|
if @order.table_id.to_i > 0
|
||||||
else
|
table = DiningFacility.find(@booking.dining_facility_id)
|
||||||
sale_status = check_order_with_table(params[:table_id])
|
type = 'order'
|
||||||
|
from = getCloudDomain #get sub domain in cloud mode
|
||||||
if sale_status
|
ActionCable.server.broadcast "order_channel",table: table,type:type,from:from
|
||||||
# return false , @message = "bill requested"
|
end
|
||||||
return return_json_status_with_code(400, "bill requested")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
@status, @booking = @order.generate
|
|
||||||
if @status && @booking
|
|
||||||
Order.process_order_queue(@order.order_id,@order.table_id,@order.source)
|
|
||||||
end
|
|
||||||
if @order.table_id.to_i > 0
|
|
||||||
table = DiningFacility.find(@booking.dining_facility_id)
|
|
||||||
type = 'order'
|
|
||||||
from = getCloudDomain #get sub domain in cloud mode
|
|
||||||
ActionCable.server.broadcast "order_channel",table: table,type:type,from:from
|
|
||||||
|
|
||||||
end
|
|
||||||
# # for parallel order
|
# # for parallel order
|
||||||
# remoteIP = ""
|
# remoteIP = ""
|
||||||
# begin
|
# begin
|
||||||
@@ -211,12 +196,9 @@ class Api::OrdersController < Api::ApiController
|
|||||||
def checkin_checkout_time(booking_id)
|
def checkin_checkout_time(booking_id)
|
||||||
status = true
|
status = true
|
||||||
if !booking_id.nil?
|
if !booking_id.nil?
|
||||||
today = Time.now.utc
|
if booking = Booking.find(booking_id)
|
||||||
booking = Booking.find(booking_id)
|
if booking.checkout_at.present?
|
||||||
if !booking.nil?
|
if booking.checkout_at.utc <= Time.now.utc
|
||||||
if !booking.checkout_at.nil?
|
|
||||||
checkout_time = booking.checkout_at.utc
|
|
||||||
if checkout_time <= today
|
|
||||||
status = false
|
status = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -303,4 +285,3 @@ class Api::OrdersController < Api::ApiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -38,20 +38,10 @@ class Origami::AddordersController < BaseOrigamiController
|
|||||||
@booking = @table.get_booking
|
@booking = @table.get_booking
|
||||||
if @booking
|
if @booking
|
||||||
@booking_id = @booking.booking_id
|
@booking_id = @booking.booking_id
|
||||||
@order_items = Array.new
|
@obj_order = @booking.orders.first
|
||||||
@booking.booking_orders.each do |booking_order|
|
@customer = @obj_order.customer
|
||||||
order = Order.find(booking_order.order_id)
|
@date = @obj_order.created_at
|
||||||
if (order.status == "new")
|
@order_items = @booking.order_items
|
||||||
@obj_order = order
|
|
||||||
@customer = order.customer
|
|
||||||
@date = order.created_at
|
|
||||||
order.order_items.each do |item|
|
|
||||||
@order_items.push(item)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
@booking = nil
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -102,8 +92,16 @@ class Origami::AddordersController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
# Rails.logger.debug "Order Source - " + params[:order_source].to_s
|
if params[:booking_id].present?
|
||||||
# Rails.logger.debug "Table ID - " + params[:table_id].to_s
|
booking = Booking.find(params[:booking_id])
|
||||||
|
end
|
||||||
|
if params[:table_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
|
||||||
|
|
||||||
is_extra_time = false
|
is_extra_time = false
|
||||||
extra_time = ''
|
extra_time = ''
|
||||||
|
|
||||||
@@ -131,6 +129,7 @@ class Origami::AddordersController < BaseOrigamiController
|
|||||||
else
|
else
|
||||||
customer_id = params[:customer_id] == ""? "CUS-000000000001" : params[:customer_id] # for no customer id from mobile
|
customer_id = params[:customer_id] == ""? "CUS-000000000001" : params[:customer_id] # for no customer id from mobile
|
||||||
end
|
end
|
||||||
|
|
||||||
@order = Order.new
|
@order = Order.new
|
||||||
@order.source = params[:order_source]
|
@order.source = params[:order_source]
|
||||||
@order.order_type = params[:order_type]
|
@order.order_type = params[:order_type]
|
||||||
@@ -144,82 +143,51 @@ class Origami::AddordersController < BaseOrigamiController
|
|||||||
|
|
||||||
@order.is_extra_time = is_extra_time
|
@order.is_extra_time = is_extra_time
|
||||||
@order.extra_time = extra_time
|
@order.extra_time = extra_time
|
||||||
#Create Table Booking or Room Booking
|
|
||||||
if !params["booking_id"].nil?
|
if booking.nil? || booking.sale_id.present? || booking.booking_status == 'moved'
|
||||||
# check booking id is already completed.
|
@order.new_booking = true
|
||||||
booking = Booking.find(params[:booking_id])
|
else
|
||||||
if params[:table_id].to_i > 0
|
@order.new_booking = false
|
||||||
table_status = booking.dining_facility_id.to_i == params[:table_id].to_i
|
@order.booking_id = booking.booking_id
|
||||||
else
|
end
|
||||||
table_status = true
|
|
||||||
end
|
@status, @booking = @order.generate
|
||||||
if booking
|
|
||||||
if table_status && booking.booking_status != 'moved'
|
if @status && @booking
|
||||||
if !booking.sale_id.nil?
|
#send order broadcast to order_channel
|
||||||
sale_status = check_order_with_booking(booking)
|
if @order.table_id.to_i > 0
|
||||||
if sale_status
|
table = DiningFacility.find(@booking.dining_facility_id)
|
||||||
return return_json_status_with_code(400, "bill requested")
|
type = 'order'
|
||||||
end
|
from = getCloudDomain #get sub domain in cloud mode
|
||||||
else
|
ActionCable.server.broadcast "order_channel",table: table,type:type,from:from
|
||||||
@order.new_booking = false
|
|
||||||
@order.booking_id = params[:booking_id]
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if params[:table_id].to_i > 0
|
|
||||||
sale_status = check_order_with_table(params[:table_id])
|
|
||||||
if sale_status
|
|
||||||
return return_json_status_with_code(400, "bill requested")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end #booking exists
|
|
||||||
else
|
|
||||||
if params[:table_id].to_i > 0
|
|
||||||
sale_status = check_order_with_table(params[:table_id])
|
|
||||||
if sale_status
|
|
||||||
# return false , @message = "bill requested"
|
|
||||||
return return_json_status_with_code(400, "bill requested")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@status, @booking = @order.generate
|
if params[:order_source] != "quick_service" && params[:order_source] != "food_court"
|
||||||
|
process_order_queue(@order.order_id,@order.table_id,@order.source)
|
||||||
if @status && @booking
|
|
||||||
#send order broadcast to order_channel
|
|
||||||
if @order.table_id.to_i > 0
|
|
||||||
table = DiningFacility.find(@booking.dining_facility_id)
|
|
||||||
type = 'order'
|
|
||||||
from = getCloudDomain #get sub domain in cloud mode
|
|
||||||
ActionCable.server.broadcast "order_channel",table: table,type:type,from:from
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
if params[:order_source] != "quick_service" && params[:order_source] != "food_court"
|
|
||||||
process_order_queue(@order.order_id,@order.table_id,@order.source)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Order.send_customer_view(@booking)
|
# Order.send_customer_view(@booking)
|
||||||
|
|
||||||
if current_user.role != "waiter" && params[:create_type] == "create_pay"
|
if current_user.role != "waiter" && params[:create_type] == "create_pay"
|
||||||
if @status && @booking && (@order.source == 'quick_service') || (@order.source == 'food_court')
|
if @status && @booking && (@order.source == 'quick_service') || (@order.source == 'food_court')
|
||||||
|
|
||||||
@status, @sale = Sale.request_bill(@order,current_user,current_login_employee)
|
@status, @sale = Sale.request_bill(@order,current_user,current_login_employee)
|
||||||
|
|
||||||
# for second display
|
# for second display
|
||||||
if @order.source == 'quick_service'
|
if @order.source == 'quick_service'
|
||||||
from = getCloudDomain #get sub domain in cloud mode
|
from = getCloudDomain #get sub domain in cloud mode
|
||||||
ActionCable.server.broadcast "second_display_channel",data: @sale,status:"sale",from:from
|
ActionCable.server.broadcast "second_display_channel",data: @sale,status:"sale",from:from
|
||||||
end
|
|
||||||
#end
|
|
||||||
result = {:status=> @status, :data => @sale }
|
|
||||||
render :json => result.to_json
|
|
||||||
end
|
end
|
||||||
else
|
#end
|
||||||
result = {:status=> @status, :data => 0 }
|
result = {:status=> @status, :data => @sale }
|
||||||
render :json => result.to_json
|
render :json => result.to_json
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
result = {:status=> @status, :data => 0 }
|
||||||
|
render :json => result.to_json
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -59,34 +59,29 @@ class Origami::FoodCourtController < ApplicationController
|
|||||||
@booking = @table.get_booking
|
@booking = @table.get_booking
|
||||||
end
|
end
|
||||||
|
|
||||||
@sale_id = params[:sale_id]
|
@sale_id = @booking.sale_id
|
||||||
|
|
||||||
if @booking
|
if @booking
|
||||||
@booking_id = @booking.booking_id
|
@booking_id = @booking.booking_id
|
||||||
@order_items = Array.new
|
@obj_order = @booking.orders.first
|
||||||
@booking.booking_orders.each do |booking_order|
|
@customer = @obj_order.customer
|
||||||
order = Order.find(booking_order.order_id)
|
@date = @obj_order.created_at
|
||||||
if (order.status == "new")
|
@order_items = @booking.order_items
|
||||||
@obj_order = order
|
|
||||||
@customer = order.customer
|
|
||||||
@date = order.created_at
|
|
||||||
order.order_items.each do |item|
|
|
||||||
@order_items.push(item)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
@booking = nil
|
|
||||||
end
|
end
|
||||||
render "origami/addorders/detail"
|
|
||||||
|
render "origami/addorders/detail"
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_modify_order
|
def update_modify_order
|
||||||
Rails.logger.debug "Order Source - " + params[:order_source].to_s
|
booking = Booking.find(params[:booking_id])
|
||||||
Rails.logger.debug "Table ID - " + params[:table_id].to_s
|
sale = booking.sale
|
||||||
|
if sale && sale.sale_status != 'new'
|
||||||
|
render :json => { :status => false }
|
||||||
|
end
|
||||||
|
|
||||||
is_extra_time = false
|
is_extra_time = false
|
||||||
extra_time = ''
|
extra_time = ''
|
||||||
@cashier_type = "food_court"
|
cashier_type = "food_court"
|
||||||
|
|
||||||
items_arr = []
|
items_arr = []
|
||||||
JSON.parse(params[:order_items]).each { |i|
|
JSON.parse(params[:order_items]).each { |i|
|
||||||
@@ -108,82 +103,32 @@ class Origami::FoodCourtController < ApplicationController
|
|||||||
}
|
}
|
||||||
|
|
||||||
# begin
|
# begin
|
||||||
@order = Order.new
|
order = Order.new
|
||||||
@order.source = params[:order_source]
|
order.source = params[:order_source]
|
||||||
@order.order_type = params[:order_type]
|
order.order_type = params[:order_type]
|
||||||
@order.customer_id = params[:customer_id] == ""? "CUS-000000000001" : params[:customer_id] # for no customer id from mobile
|
order.customer_id = params[:customer_id] == ""? "CUS-000000000001" : params[:customer_id] # for no customer id from mobile
|
||||||
@order.items = items_arr
|
order.items = items_arr
|
||||||
@order.guest = params[:guest_info]
|
order.guest = params[:guest_info]
|
||||||
@order.table_id = params[:table_id] # this is dining facilities's id
|
order.table_id = params[:table_id] # this is dining facilities's id
|
||||||
@order.new_booking = true
|
order.waiters = current_login_employee.name
|
||||||
@order.waiters = current_login_employee.name
|
order.employee_name = current_login_employee.name
|
||||||
@order.employee_name = current_login_employee.name
|
|
||||||
|
|
||||||
@order.is_extra_time = is_extra_time
|
order.is_extra_time = is_extra_time
|
||||||
@order.extra_time = extra_time
|
order.extra_time = extra_time
|
||||||
|
|
||||||
#Create Table Booking or Room Booking
|
order.new_booking = false
|
||||||
if !params["booking_id"].nil?
|
order.booking_id = booking.booking_id
|
||||||
# check booking id is already completed.
|
|
||||||
booking = Booking.find(params[:booking_id])
|
if order.generate
|
||||||
if params[:table_id].to_i > 0
|
if sale
|
||||||
table_status = booking.dining_facility_id.to_i == params[:table_id].to_i
|
Sale.add_to_existing_pending_invoice(nil, sale.sale_id, booking)
|
||||||
else
|
render :json => { :status => true, :data => sale }
|
||||||
table_status = true
|
|
||||||
end
|
|
||||||
if booking
|
|
||||||
if table_status && booking.booking_status != 'moved'
|
|
||||||
if !booking.sale_id.nil?
|
|
||||||
sale_status = check_order_with_booking(booking)
|
|
||||||
if sale_status
|
|
||||||
return return_json_status_with_code(400, "bill requested")
|
|
||||||
end
|
|
||||||
else
|
|
||||||
@order.new_booking = false
|
|
||||||
@order.booking_id = params[:booking_id]
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if params[:table_id].to_i > 0
|
|
||||||
sale_status = check_order_with_table(params[:table_id])
|
|
||||||
if sale_status
|
|
||||||
return return_json_status_with_code(400, "bill requested")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end #booking exists
|
|
||||||
else
|
else
|
||||||
if params[:table_id].to_i > 0
|
render :json => { :status => true, :data => 'OK' }
|
||||||
sale_status = check_order_with_table(params[:table_id])
|
|
||||||
if sale_status
|
|
||||||
# return false , @message = "bill requested"
|
|
||||||
return return_json_status_with_code(400, "bill requested")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
@status, @booking = @order.generate
|
|
||||||
if(params[:sale_id][0,3] == "SAL")
|
|
||||||
if @status && @booking && (@order.source == 'quick_service' || @order.source == 'food_court')
|
|
||||||
if params[:sale_id]
|
|
||||||
@sale = Sale.find(params[:sale_id])
|
|
||||||
if @order.table_id.to_i > 0
|
|
||||||
@table_id = @order.table_id
|
|
||||||
else
|
|
||||||
@table_id = nil
|
|
||||||
end
|
|
||||||
update = Sale.add_to_existing_pending_invoice(@table_id,params[:sale_id],@booking)
|
|
||||||
end
|
|
||||||
|
|
||||||
result = {:status=> true, :data => @sale }
|
|
||||||
render :json => result.to_json
|
|
||||||
end
|
|
||||||
elsif (params[:sale_id][0,3] == "BKI")
|
|
||||||
result = {:status=> true, :data => 'OK' }
|
|
||||||
render :json => result.to_json
|
|
||||||
else
|
|
||||||
result = {:status=> true, :data => nil }
|
|
||||||
render :json => result.to_json
|
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
render :json => { :status => false }
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,26 @@ class Origami::PendingOrderController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
id = params[:sale_id]
|
||||||
|
if id.start_with?("SAL")
|
||||||
|
@sale = Sale.find(id)
|
||||||
|
if @sale.sale_status == "new"
|
||||||
|
@bookings = @sale.bookings.first
|
||||||
|
@status = "sale"
|
||||||
|
else
|
||||||
|
redirect_to "/origami/#{params[:type]}" and return
|
||||||
|
end
|
||||||
|
elsif id.start_with?("BKI")
|
||||||
|
@bookings = Booking.find(id)
|
||||||
|
@order = @bookings.orders.where(status: "new").first
|
||||||
|
@order_items = @bookings.order_items
|
||||||
|
@status = "order"
|
||||||
|
end
|
||||||
|
|
||||||
|
if @dining = @bookings.dining_facility
|
||||||
|
@table_id = @dining.id
|
||||||
|
end
|
||||||
|
|
||||||
@cashier_type = params[:type]
|
@cashier_type = params[:type]
|
||||||
@sales = Sale.pending_sale(@cashier_type)
|
@sales = Sale.pending_sale(@cashier_type)
|
||||||
@orders = Sale.pending_order(@cashier_type)
|
@orders = Sale.pending_order(@cashier_type)
|
||||||
@@ -20,38 +40,6 @@ class Origami::PendingOrderController < BaseOrigamiController
|
|||||||
@customers = Customer.pluck("customer_id, name")
|
@customers = Customer.pluck("customer_id, name")
|
||||||
|
|
||||||
@occupied_table = @sales.count.length + @orders.count.length
|
@occupied_table = @sales.count.length + @orders.count.length
|
||||||
|
|
||||||
@id = params[:sale_id]
|
|
||||||
if(@id[0,3] == "SAL")
|
|
||||||
@sale = Sale.find(@id)
|
|
||||||
@order = SaleOrder.find_by_sale_id(@sale.sale_id).order_id
|
|
||||||
@booking = BookingOrder.find_by_order_id(@order).booking_id
|
|
||||||
@bookings = Booking.find(@booking)
|
|
||||||
@status = "sale"
|
|
||||||
else
|
|
||||||
# @booking = BookingOrder.find_by_order_id(@order).booking_id
|
|
||||||
@bookings = Booking.find(@id)
|
|
||||||
@status = "order"
|
|
||||||
|
|
||||||
@order_items = Array.new
|
|
||||||
@bookings.booking_orders.each do |booking_order|
|
|
||||||
@order = Order.find(booking_order.order_id)
|
|
||||||
if (@order.status == "new")
|
|
||||||
@order.order_items.each do |item|
|
|
||||||
@order_items.push(item)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
# puts @status
|
|
||||||
if @bookings.dining_facility_id.to_i > 0
|
|
||||||
@table_id = Booking.find(@bookings.booking_id).dining_facility_id
|
|
||||||
@dining = DiningFacility.find(@table_id)
|
|
||||||
else
|
|
||||||
@table_id = nil
|
|
||||||
@dining = nil
|
|
||||||
end
|
|
||||||
@customers = Customer.pluck("customer_id, name")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def completed_sale
|
def completed_sale
|
||||||
|
|||||||
@@ -10,13 +10,13 @@ class Origami::QuickServiceController < ApplicationController
|
|||||||
def index
|
def index
|
||||||
today = DateTime.now
|
today = DateTime.now
|
||||||
day = Date.today.wday
|
day = Date.today.wday
|
||||||
# if params[:menu] == "true"
|
# if params[:menu] == "true"
|
||||||
@menus = []
|
@menus = []
|
||||||
@menu = []
|
@menu = []
|
||||||
# else
|
# else
|
||||||
# @menus = Menu.all
|
# @menus = Menu.all
|
||||||
# @menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc')
|
# @menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc')
|
||||||
# end
|
# end
|
||||||
@zone = Zone.all
|
@zone = Zone.all
|
||||||
@customer = Customer.all
|
@customer = Customer.all
|
||||||
@tables = Table.all.active.order('status desc')
|
@tables = Table.all.active.order('status desc')
|
||||||
@@ -51,13 +51,13 @@ class Origami::QuickServiceController < ApplicationController
|
|||||||
@cashier_type = "quick_service"
|
@cashier_type = "quick_service"
|
||||||
today = DateTime.now
|
today = DateTime.now
|
||||||
day = Date.today.wday
|
day = Date.today.wday
|
||||||
# if params[:menu] == "true"
|
# if params[:menu] == "true"
|
||||||
@menus = []
|
@menus = []
|
||||||
@menu = []
|
@menu = []
|
||||||
# else
|
# else
|
||||||
# @menus = Menu.all
|
# @menus = Menu.all
|
||||||
# @menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc')
|
# @menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc')
|
||||||
# end
|
# end
|
||||||
if(params[:id][0,3] == "BKI")
|
if(params[:id][0,3] == "BKI")
|
||||||
@table_id = nil
|
@table_id = nil
|
||||||
@table = nil
|
@table = nil
|
||||||
@@ -68,34 +68,29 @@ class Origami::QuickServiceController < ApplicationController
|
|||||||
@booking = @table.get_booking
|
@booking = @table.get_booking
|
||||||
end
|
end
|
||||||
|
|
||||||
@sale_id = params[:sale_id]
|
@sale_id = @booking.sale_id
|
||||||
|
|
||||||
if @booking
|
if @booking
|
||||||
@booking_id = @booking.booking_id
|
@booking_id = @booking.booking_id
|
||||||
@order_items = Array.new
|
@obj_order = @booking.orders.first
|
||||||
@booking.booking_orders.each do |booking_order|
|
@customer = @obj_order.customer
|
||||||
order = Order.find(booking_order.order_id)
|
@date = @obj_order.created_at
|
||||||
if (order.status == "new")
|
@order_items = @booking.order_items
|
||||||
@obj_order = order
|
|
||||||
@customer = order.customer
|
|
||||||
@date = order.created_at
|
|
||||||
order.order_items.each do |item|
|
|
||||||
@order_items.push(item)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
@booking = nil
|
|
||||||
end
|
end
|
||||||
render "origami/addorders/detail"
|
|
||||||
|
render "origami/addorders/detail"
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_modify_order
|
def update_modify_order
|
||||||
Rails.logger.debug "Order Source - " + params[:order_source].to_s
|
booking = Booking.find(params[:booking_id])
|
||||||
Rails.logger.debug "Table ID - " + params[:table_id].to_s
|
sale = booking.sale
|
||||||
|
if sale && sale.sale_status != 'new'
|
||||||
|
render :json => { :status => false }
|
||||||
|
end
|
||||||
|
|
||||||
is_extra_time = false
|
is_extra_time = false
|
||||||
extra_time = ''
|
extra_time = ''
|
||||||
@cashier_type = "quick_service"
|
cashier_type = "quick_service"
|
||||||
|
|
||||||
items_arr = []
|
items_arr = []
|
||||||
JSON.parse(params[:order_items]).each { |i|
|
JSON.parse(params[:order_items]).each { |i|
|
||||||
@@ -117,82 +112,32 @@ class Origami::QuickServiceController < ApplicationController
|
|||||||
}
|
}
|
||||||
|
|
||||||
# begin
|
# begin
|
||||||
@order = Order.new
|
order = Order.new
|
||||||
@order.source = params[:order_source]
|
order.source = params[:order_source]
|
||||||
@order.order_type = params[:order_type]
|
order.order_type = params[:order_type]
|
||||||
@order.customer_id = params[:customer_id] == ""? "CUS-000000000001" : params[:customer_id] # for no customer id from mobile
|
order.customer_id = params[:customer_id] == ""? "CUS-000000000001" : params[:customer_id] # for no customer id from mobile
|
||||||
@order.items = items_arr
|
order.items = items_arr
|
||||||
@order.guest = params[:guest_info]
|
order.guest = params[:guest_info]
|
||||||
@order.table_id = params[:table_id] # this is dining facilities's id
|
order.table_id = params[:table_id] # this is dining facilities's id
|
||||||
@order.new_booking = true
|
order.waiters = current_login_employee.name
|
||||||
@order.waiters = current_login_employee.name
|
order.employee_name = current_login_employee.name
|
||||||
@order.employee_name = current_login_employee.name
|
|
||||||
|
|
||||||
@order.is_extra_time = is_extra_time
|
order.is_extra_time = is_extra_time
|
||||||
@order.extra_time = extra_time
|
order.extra_time = extra_time
|
||||||
|
|
||||||
#Create Table Booking or Room Booking
|
order.new_booking = false
|
||||||
if !params["booking_id"].nil?
|
order.booking_id = booking.booking_id
|
||||||
# check booking id is already completed.
|
|
||||||
booking = Booking.find(params[:booking_id])
|
if order.generate
|
||||||
if params[:table_id].to_i > 0
|
if sale
|
||||||
table_status = booking.dining_facility_id.to_i == params[:table_id].to_i
|
Sale.add_to_existing_pending_invoice(nil, sale.sale_id, booking)
|
||||||
else
|
render :json => { :status => true, :data => sale }
|
||||||
table_status = true
|
|
||||||
end
|
|
||||||
if booking
|
|
||||||
if table_status && booking.booking_status != 'moved'
|
|
||||||
if !booking.sale_id.nil?
|
|
||||||
sale_status = check_order_with_booking(booking)
|
|
||||||
if sale_status
|
|
||||||
return return_json_status_with_code(400, "bill requested")
|
|
||||||
end
|
|
||||||
else
|
|
||||||
@order.new_booking = false
|
|
||||||
@order.booking_id = params[:booking_id]
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if params[:table_id].to_i > 0
|
|
||||||
sale_status = check_order_with_table(params[:table_id])
|
|
||||||
if sale_status
|
|
||||||
return return_json_status_with_code(400, "bill requested")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end #booking exists
|
|
||||||
else
|
else
|
||||||
if params[:table_id].to_i > 0
|
render :json => { :status => true, :data => 'OK' }
|
||||||
sale_status = check_order_with_table(params[:table_id])
|
|
||||||
if sale_status
|
|
||||||
# return false , @message = "bill requested"
|
|
||||||
return return_json_status_with_code(400, "bill requested")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
@status, @booking = @order.generate
|
|
||||||
if(params[:sale_id][0,3] == "SAL")
|
|
||||||
if @status && @booking && @order.source == 'quick_service'
|
|
||||||
if params[:sale_id]
|
|
||||||
@sale = Sale.find(params[:sale_id])
|
|
||||||
if @order.table_id.to_i > 0
|
|
||||||
@table_id = @order.table_id
|
|
||||||
else
|
|
||||||
@table_id = nil
|
|
||||||
end
|
|
||||||
update = Sale.add_to_existing_pending_invoice(@table_id,params[:sale_id],@booking)
|
|
||||||
end
|
|
||||||
|
|
||||||
result = {:status=> true, :data => @sale }
|
|
||||||
render :json => result.to_json
|
|
||||||
end
|
|
||||||
elsif (params[:sale_id][0,3] == "BKI")
|
|
||||||
result = {:status=> true, :data => 'OK' }
|
|
||||||
render :json => result.to_json
|
|
||||||
else
|
|
||||||
result = {:status=> true, :data => nil }
|
|
||||||
render :json => result.to_json
|
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
render :json => { :status => false }
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -234,20 +179,20 @@ class Origami::QuickServiceController < ApplicationController
|
|||||||
def check_order_with_table(table_id)
|
def check_order_with_table(table_id)
|
||||||
table = DiningFacility.find(table_id)
|
table = DiningFacility.find(table_id)
|
||||||
if table
|
if table
|
||||||
booking = table.get_current_booking
|
booking = table.get_current_booking
|
||||||
# puts booking
|
# puts booking
|
||||||
if booking
|
if booking
|
||||||
if !booking.sale_id.nil?
|
if !booking.sale_id.nil?
|
||||||
if booking.sale.sale_status == "completed" || booking.sale.sale_status == "new"
|
if booking.sale.sale_status == "completed" || booking.sale.sale_status == "new"
|
||||||
@order.new_booking = true
|
@order.new_booking = true
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@order.new_booking = false
|
@order.new_booking = false
|
||||||
@order.booking_id = booking.booking_id
|
@order.booking_id = booking.booking_id
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class Origami::RequestBillsController < ApplicationController
|
|||||||
@status = false
|
@status = false
|
||||||
@error_message = "Operation failed, Could not request bill!"
|
@error_message = "Operation failed, Could not request bill!"
|
||||||
else
|
else
|
||||||
table = DiningFacility.find(booking.dining_facility_id)
|
table = DiningFacility.find_by(id: booking.dining_facility_id)
|
||||||
|
|
||||||
if sale_data = booking.sale
|
if sale_data = booking.sale
|
||||||
@status = true
|
@status = true
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ class Reports::DailysaleController < BaseReportController
|
|||||||
@to = to
|
@to = to
|
||||||
@payment_methods = PaymentMethodSetting.where("is_active='1'").pluck("payment_method")
|
@payment_methods = PaymentMethodSetting.where("is_active='1'").pluck("payment_method")
|
||||||
|
|
||||||
|
|
||||||
# get printer info
|
# get printer info
|
||||||
@print_settings = PrintSetting.get_precision_delimiter()
|
@print_settings = PrintSetting.get_precision_delimiter()
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
|||||||
@@ -27,8 +27,6 @@ class Reports::HourlySaleitemController < BaseReportController
|
|||||||
account_type = params[:account_type]
|
account_type = params[:account_type]
|
||||||
@type = params[:sale_type]
|
@type = params[:sale_type]
|
||||||
@sale_data, @other_charges,@product, @discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_by_hourly_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED,@type,account_type)
|
@sale_data, @other_charges,@product, @discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_by_hourly_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED,@type,account_type)
|
||||||
# logger.debug 'product>>>>>>>>>>>>>>>>>>>>>>>>>>'
|
|
||||||
# logger.debug @sale_data.group(:date_format)
|
|
||||||
|
|
||||||
@sale_taxes = Sale.get_separate_tax(shift_sale_range,shift,from,to,nil)
|
@sale_taxes = Sale.get_separate_tax(shift_sale_range,shift,from,to,nil)
|
||||||
|
|
||||||
@@ -59,7 +57,7 @@ class Reports::HourlySaleitemController < BaseReportController
|
|||||||
# @hourly_total_qty = @sale_data.group_by {|s| s.date_format }.collect{|key,qty| {"date" => key , "total_qty" => qty.sum{|d| d.qty.to_i}}}
|
# @hourly_total_qty = @sale_data.group_by {|s| s.date_format }.collect{|key,qty| {"date" => key , "total_qty" => qty.sum{|d| d.qty.to_i}}}
|
||||||
@hourly_total_qty = @sale_data.group_by(&:date_format).map { |k,v|{"date" => k , "total_qty" => v.count }}
|
@hourly_total_qty = @sale_data.group_by(&:date_format).map { |k,v|{"date" => k , "total_qty" => v.count }}
|
||||||
|
|
||||||
puts @hourly_total_qty.to_json
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html
|
||||||
format.xls
|
format.xls
|
||||||
|
|||||||
@@ -57,13 +57,12 @@ class Order < ApplicationRecord
|
|||||||
if self.is_extra_time
|
if self.is_extra_time
|
||||||
if !booking.checkout_at.nil?
|
if !booking.checkout_at.nil?
|
||||||
new_time = booking.checkout_at + self.extra_time.to_i
|
new_time = booking.checkout_at + self.extra_time.to_i
|
||||||
booking.update_attributes(checkout_at: new_time)
|
booking.update(checkout_at: new_time)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
#end extra time
|
#end extra time
|
||||||
end
|
end
|
||||||
|
|
||||||
booking.save!
|
|
||||||
self.default_values
|
self.default_values
|
||||||
|
|
||||||
# cashier already opened?
|
# cashier already opened?
|
||||||
@@ -211,7 +210,6 @@ class Order < ApplicationRecord
|
|||||||
self.customer = Customer.find(1) if self.customer_id.nil?
|
self.customer = Customer.find(1) if self.customer_id.nil?
|
||||||
self.source = "emenu" if self.source.nil?
|
self.source = "emenu" if self.source.nil?
|
||||||
self.order_type = "dine-in" if self.order_type.nil?
|
self.order_type = "dine-in" if self.order_type.nil?
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|||||||
@@ -2533,72 +2533,25 @@ end
|
|||||||
|
|
||||||
def self.add_to_existing_pending_invoice(dining,sale_id,booking)
|
def self.add_to_existing_pending_invoice(dining,sale_id,booking)
|
||||||
|
|
||||||
|
sale = Sale.find(sale_id)
|
||||||
existing_booking = Booking.find_by_sale_id(sale_id)
|
existing_booking = Booking.find_by_sale_id(sale_id)
|
||||||
if dining.to_i > 0
|
|
||||||
table = DiningFacility.find(dining)
|
|
||||||
table.bookings.each do |booking|
|
|
||||||
# if !booking.checkout_at.nil?
|
|
||||||
# existing_booking.update_attributes(checkout_at: checkout_at)
|
|
||||||
# end
|
|
||||||
if booking.sale_id.nil?
|
|
||||||
booking.booking_orders.each do |booking_order|
|
|
||||||
|
|
||||||
booking.booking_status = 'moved'
|
if booking.sale_id.nil? || booking.booking_id != existing_booking.booking_id
|
||||||
order = Order.find(booking_order.order_id)
|
booking.orders.where(status: 'new').update(booking: existing_booking)
|
||||||
order.status = 'billed'
|
booking.update(booking_status: 'moved')
|
||||||
order.order_items.each do |item|
|
end
|
||||||
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)
|
|
||||||
end
|
|
||||||
|
|
||||||
# Re-compute for add
|
existing_booking.orders.where(status: 'new').each do |order|
|
||||||
saleobj.compute(order.source)
|
order.status = 'billed'
|
||||||
saleobj.save
|
order.order_items.each do |item|
|
||||||
order.save
|
item.order_item_status = 'billed'
|
||||||
booking.save
|
sale.add_item(item)
|
||||||
end
|
|
||||||
|
|
||||||
booking_order = BookingOrder.where('booking_id=?',booking)
|
|
||||||
booking_order.each do |bo|
|
|
||||||
bo.booking_id = existing_booking.booking_id
|
|
||||||
bo.save
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if booking.sale_id.nil?
|
|
||||||
booking.booking_orders.each do |booking_order|
|
|
||||||
|
|
||||||
booking.booking_status = 'moved'
|
|
||||||
order = Order.find(booking_order.order_id)
|
|
||||||
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)
|
|
||||||
end
|
|
||||||
|
|
||||||
# Re-compute for add
|
|
||||||
saleobj.compute(order.source)
|
|
||||||
saleobj.save
|
|
||||||
order.save
|
|
||||||
booking.save
|
|
||||||
end
|
|
||||||
|
|
||||||
booking_order = BookingOrder.where('booking_id=?',booking)
|
|
||||||
booking_order.each do |bo|
|
|
||||||
bo.booking_id = existing_booking.booking_id
|
|
||||||
bo.save
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
order.save
|
||||||
|
sale.compute(order.source)
|
||||||
|
sale.orders << order
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.get_shift_sale_items(sh_id)
|
def self.get_shift_sale_items(sh_id)
|
||||||
@@ -2908,16 +2861,17 @@ def self.get_hourly_item_query(type)
|
|||||||
"i.status as status_type,i.remark as remark,"+
|
"i.status as status_type,i.remark as remark,"+
|
||||||
"i.unit_price,i.price as price,i.product_name as product_name, " +
|
"i.unit_price,i.price as price,i.product_name as product_name, " +
|
||||||
"i.menu_category_name,i.menu_category_code as menu_category_id, " +
|
"i.menu_category_name,i.menu_category_code as menu_category_id, " +
|
||||||
"date_format(CONVERT_TZ(receipt_date,'+00:00', '+06:30'), '%I %p')
|
|
||||||
as date_format")
|
"concat(hour(CONVERT_TZ(receipt_date,'+00:00', '+06:30')), ':00 - ', hour(CONVERT_TZ(receipt_date,'+00:00', '+06:30')) + 1, ':00') as date_format," +
|
||||||
|
"hour(CONVERT_TZ(receipt_date,'+00:00', '+06:30')) as hour")
|
||||||
|
|
||||||
query = query.joins("JOIN sale_items i ON i.sale_id = sales.sale_id" +
|
query = query.joins("JOIN sale_items i ON i.sale_id = sales.sale_id" +
|
||||||
" JOIN shift_sales sh ON sh.`id` = sales.shift_sale_id")
|
" JOIN shift_sales sh ON sh.`id` = sales.shift_sale_id")
|
||||||
# "JOIN employee_accesses ea ON ea.`employee_id` = sales.cashier_id ")
|
# "JOIN employee_accesses ea ON ea.`employee_id` = sales.cashier_id ")
|
||||||
query = query.joins(" JOIN accounts acc ON acc.id = i.account_id")
|
query = query.joins(" JOIN accounts acc ON acc.id = i.account_id")
|
||||||
query = query.where("#{sale_type}")
|
query = query.where("#{sale_type}")
|
||||||
query = query.group("acc.title,i.account_id,i.menu_category_code,i.item_instance_code,i.product_name,i.unit_price")
|
query = query.group("acc.title,i.account_id,i.menu_category_code,i.item_instance_code,i.product_name,i.unit_price,hour")
|
||||||
.order("date_format asc")
|
.order("hour asc")
|
||||||
# query = query.order("i.menu_category_name asc, SUM(i.qty) desc")
|
# query = query.order("i.menu_category_name asc, SUM(i.qty) desc")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -26,10 +26,58 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th colspan="18"> <%= 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 '-'%></th>
|
<th colspan="18"> <%= 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 '-'%></th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<% @payment_methods.each_slice(10) do |slice| %>
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<th></th>
|
||||||
|
<% alph = "A" %>
|
||||||
|
<% @count = 1 %>
|
||||||
|
<% slice.each do |payment_method| %>
|
||||||
|
<th style="text-align:center;">
|
||||||
|
<%= alph %>
|
||||||
|
</th>
|
||||||
|
<% alph = alph.ord.next.chr %>
|
||||||
|
<% @count += 1 %>
|
||||||
|
<% end %>
|
||||||
|
<th style="text-align:center;" ><%= alph %></th>
|
||||||
|
<th style="text-align:center;"><%= alph = alph.ord.next.chr %></th>
|
||||||
|
<th style="text-align:center;"><%= alph = alph.ord.next.chr %></th>
|
||||||
|
<th style="text-align:center;"><%= alph = alph.ord.next.chr %></th>
|
||||||
|
<th style="text-align:center;"><%= alph = alph.ord.next.chr %></th>
|
||||||
|
<th style="text-align:center;"><%= alph = alph.ord.next.chr %></th>
|
||||||
|
<th style="text-align:center;"><%= alph = alph.ord.next.chr %></th>
|
||||||
|
</tr>
|
||||||
|
<!-- <tr>
|
||||||
|
<th style='text-align:center;'><%= t("views.right_panel.detail.sr") %></th>
|
||||||
|
<th style='text-align:center;'><%= t("views.right_panel.detail.date") %></th>
|
||||||
|
<% slice.each do |payment_method| %>
|
||||||
|
<th style="text-align:center;">
|
||||||
|
<%= payment_method %>
|
||||||
|
</th>
|
||||||
|
<% end %>
|
||||||
|
<th style='text-align:center;'><%= t("views.right_panel.detail.cash_sales") %></th>
|
||||||
|
<th style='text-align:center;'><%= t("views.right_panel.detail.credit_sales") %></th>
|
||||||
|
<th style='text-align:center;'><%= t("views.right_panel.detail.void_amount") %></th>
|
||||||
|
<th style='text-align:center;'><%= t("views.right_panel.detail.foc_sales") %></th>
|
||||||
|
<% if @payment_methods.include? ("GiftVoucher") %>
|
||||||
|
<th style='text-align:center;'><%= t("views.right_panel.detail.giftvoucher_sales") %></th>
|
||||||
|
<% end %>
|
||||||
|
<th style='text-align:center;'>(<%= t("views.right_panel.detail.discount") %>)</th>
|
||||||
|
<!-- <th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %> + <br/> <%= t("views.right_panel.detail.rnd_adj_sh") %></th> -->
|
||||||
|
<!-- <th style='text-align:center;'><%= t("views.right_panel.detail.rnd_adj_sh") %></th>
|
||||||
|
<th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %></th>
|
||||||
|
</tr> -->
|
||||||
|
<% end %>
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<th></th>
|
||||||
|
<th colspan="<%= @count + 1 %>" style='text-align:center;'>Income</th>
|
||||||
|
<th colspan=4 style='text-align:center;'>Outgoing</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.sr") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.sr") %></th>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.date") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.date") %></th>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.void_amount") %></th>
|
|
||||||
<% if @payment_methods.include? ("MPU") %>
|
<% if @payment_methods.include? ("MPU") %>
|
||||||
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.mpu_sales") %></th>
|
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.mpu_sales") %></th>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -63,16 +111,18 @@
|
|||||||
<% if @payment_methods.include? ("Redeem") %>
|
<% if @payment_methods.include? ("Redeem") %>
|
||||||
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.redeem_sales") %></th>
|
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.redeem_sales") %></th>
|
||||||
<% end %>
|
<% end %>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.cash_sales") %></th>
|
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.credit_sales") %></th>
|
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.foc_sales") %></th>
|
|
||||||
<% if @payment_methods.include? ("GiftVoucher") %>
|
<% if @payment_methods.include? ("GiftVoucher") %>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.giftvoucher_sales") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.giftvoucher_sales") %></th>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<th style='text-align:center;'><%= t("views.right_panel.detail.cash_sales") %></th>
|
||||||
|
<th style='text-align:center;'><%= t("views.right_panel.detail.credit_sales") %></th>
|
||||||
|
<th style='text-align:center;'><%= t("views.right_panel.detail.void_amount") %></th>
|
||||||
|
<th style='text-align:center;'><%= t("views.right_panel.detail.foc_sales") %></th>
|
||||||
|
|
||||||
<th style='text-align:center;'>(<%= t("views.right_panel.detail.discount") %>)</th>
|
<th style='text-align:center;'>(<%= t("views.right_panel.detail.discount") %>)</th>
|
||||||
<!-- <th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %> + <br/> <%= t("views.right_panel.detail.rnd_adj_sh") %></th> -->
|
<!-- <th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %> + <br/> <%= t("views.right_panel.detail.rnd_adj_sh") %></th> -->
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %></th>
|
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.rnd_adj_sh") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.rnd_adj_sh") %></th>
|
||||||
|
<th style='text-align:center;'><%= t("views.right_panel.detail.grand_total") %></th>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -137,7 +187,6 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td style='text-align:right;'><%= count %></td>
|
<td style='text-align:right;'><%= count %></td>
|
||||||
<td><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %></td>
|
<td><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %></td>
|
||||||
<td style='color:red;text-align:right;'><%= number_with_precision(sale[:void_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
|
||||||
<% if @payment_methods.include? ("MPU") %>
|
<% if @payment_methods.include? ("MPU") %>
|
||||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_with_precision(sale[:mpu_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_with_precision(sale[:mpu_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -171,23 +220,25 @@
|
|||||||
<% if @payment_methods.include? ("Redeem") %>
|
<% if @payment_methods.include? ("Redeem") %>
|
||||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_with_precision(sale[:paypar_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_with_precision(sale[:paypar_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
<% end %>
|
<% end %>
|
||||||
<td style='text-align:right;'><%= number_with_precision(sale[:cash_amount]-sale[:total_change_amount], precision:precision.to_i, delimiter: delimiter) rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_precision(sale[:credit_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_precision(sale[:foc_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
|
||||||
<% if @payment_methods.include? ("GiftVoucher") %>
|
<% if @payment_methods.include? ("GiftVoucher") %>
|
||||||
<td style='text-align:right;'><%= number_with_precision(sale[:giftvoucher_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='text-align:right;'><%= number_with_precision(sale[:giftvoucher_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<td style='text-align:right;'><%= number_with_precision(sale[:cash_amount]-sale[:total_change_amount], precision:precision.to_i, delimiter: delimiter) rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_precision(sale[:credit_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
|
<td style='color:red;text-align:right;'><%= number_with_precision(sale[:void_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_precision(sale[:foc_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
|
|
||||||
<td style='text-align:right;'>(<%= number_with_precision(sale[:total_discount], precision:precision,delimiter:delimiter) rescue '-'%>)</td>
|
<td style='text-align:right;'>(<%= number_with_precision(sale[:total_discount], precision:precision,delimiter:delimiter) rescue '-'%>)</td>
|
||||||
<!-- <td style='text-align:right;'><%= number_with_precision(sale[:grand_total].to_f + sale[:rounding_adj].to_f , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td> -->
|
<!-- <td style='text-align:right;'><%= number_with_precision(sale[:grand_total].to_f + sale[:rounding_adj].to_f , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td> -->
|
||||||
<td style='text-align:right;'><%= number_with_precision(sale[:grand_total], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_precision(sale[:rounding_adj].to_f, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='text-align:right;'><%= number_with_precision(sale[:rounding_adj].to_f, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_precision(sale[:grand_total], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
<% count = count + 1 %>
|
<% count = count + 1 %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% colspan = 7 %>
|
<% colspan = 7 %>
|
||||||
<tr style="font-weight:600;">
|
<tr style="font-weight:600;">
|
||||||
<td colspan="3" style='text-align:center;'>Total</td>
|
<td colspan="2" style='text-align:center;'>Total</td>
|
||||||
<% if @payment_methods.include? ("MPU") %>
|
<% if @payment_methods.include? ("MPU") %>
|
||||||
<% if !request.user_agent.include? "Mobile" %>
|
<% if !request.user_agent.include? "Mobile" %>
|
||||||
<% colspan += 1 %>
|
<% colspan += 1 %>
|
||||||
@@ -254,17 +305,19 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_with_precision(paypar, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_with_precision(paypar, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
<% end %>
|
<% end %>
|
||||||
<td style='text-align:right;'><%= number_with_precision(cash, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_precision(credit, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_precision(foc, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
|
||||||
<% if @payment_methods.include? ("GiftVoucher") %>
|
<% if @payment_methods.include? ("GiftVoucher") %>
|
||||||
<% colspan += 1 %>
|
<% colspan += 1 %>
|
||||||
<td style='text-align:right;'><%= number_with_precision(giftvoucher, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='text-align:right;'><%= number_with_precision(giftvoucher, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<td style='text-align:right;'><%= number_with_precision(cash, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_precision(credit, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
|
<td style='color:red;text-align:right;'><%= number_with_precision(void, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_precision(foc, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
|
|
||||||
<td style='text-align:right;'>(<%= number_with_precision(discount, precision:precision.to_i,delimiter:delimiter) rescue '-'%>)</td>
|
<td style='text-align:right;'>(<%= number_with_precision(discount, precision:precision.to_i,delimiter:delimiter) rescue '-'%>)</td>
|
||||||
<!-- <td style='text-align:right;'><%= number_with_precision(total, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td> -->
|
<!-- <td style='text-align:right;'><%= number_with_precision(total, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td> -->
|
||||||
<td style='text-align:right;'><%= number_with_precision(grand_total, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_precision(rounding_adj, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='text-align:right;'><%= number_with_precision(rounding_adj, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
|
<td style='text-align:right;'><%= number_with_precision(grand_total, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
<% total_tax = 0 %>
|
<% total_tax = 0 %>
|
||||||
|
|||||||
@@ -1,9 +1,20 @@
|
|||||||
|
# set :stage, :production
|
||||||
|
# set :server_name, "svr.sxrestaurant.host"
|
||||||
|
|
||||||
|
# set :full_app_name, "#{fetch(:application)}_#{fetch(:stage)}"
|
||||||
|
# server '192.168.1.27', user: 'deploy', roles: %w{web app db}, primary: true
|
||||||
|
|
||||||
|
# set :deploy_to, "/home/#{fetch(:deploy_user)}/apps/#{fetch(:full_app_name)}"
|
||||||
|
# set :rbenv_ruby, '2.4.1'
|
||||||
|
# set :rails_env, :production
|
||||||
|
|
||||||
set :stage, :production
|
set :stage, :production
|
||||||
set :server_name, "svr.sxrestaurant.host"
|
set :server_name, "svr.sxrestaurant.host"
|
||||||
|
|
||||||
set :full_app_name, "#{fetch(:application)}_#{fetch(:stage)}"
|
set :full_app_name, "#{fetch(:application)}_#{fetch(:stage)}"
|
||||||
server '192.168.1.27', user: 'deploy', roles: %w{web app db}, primary: true
|
server '52.77.219.228', user: 'deploy', roles: %w{web app db}, primary: true
|
||||||
|
|
||||||
set :deploy_to, "/home/#{fetch(:deploy_user)}/apps/#{fetch(:full_app_name)}"
|
set :deploy_to, "/home/#{fetch(:deploy_user)}/apps/#{fetch(:full_app_name)}"
|
||||||
set :rbenv_ruby, '2.4.1'
|
set :rbenv_ruby, '2.4.1'
|
||||||
set :rails_env, :production
|
set :rails_env, :production
|
||||||
|
|
||||||
|
|||||||
@@ -20,12 +20,12 @@ class ActionController::Base
|
|||||||
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
# check for license file
|
check for license file
|
||||||
# if check_license
|
if check_license
|
||||||
# current_license(ENV["SX_PROVISION_URL"])
|
current_license(ENV["SX_PROVISION_URL"])
|
||||||
# else
|
else
|
||||||
# redirect_to activate_path
|
redirect_to activate_path
|
||||||
# end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
# application_path="#{File.expand_path("../..", __FILE__)}"
|
application_path="#{File.expand_path("../..", __FILE__)}"
|
||||||
# directory application_path
|
directory application_path
|
||||||
# #environment ENV.fetch("RAILS_ENV") { "production" }
|
#environment ENV.fetch("RAILS_ENV") { "production" }
|
||||||
# environment "production"
|
environment "production"
|
||||||
# pidfile "#{application_path}/tmp/puma/pid"
|
pidfile "#{application_path}/tmp/puma/pid"
|
||||||
# state_path "#{application_path}/tmp/puma/state"
|
state_path "#{application_path}/tmp/puma/state"
|
||||||
# stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log"
|
stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log"
|
||||||
# port ENV.fetch("PORT") { 62158 }
|
port ENV.fetch("PORT") { 62158 }
|
||||||
# workers 2
|
workers 2
|
||||||
# preload_app!
|
preload_app!
|
||||||
# threads 1,1
|
threads 1,1
|
||||||
|
|||||||
Reference in New Issue
Block a user