Merge branch 'quick_service' of bitbucket.org:code2lab/sxrestaurant into split_bill
This commit is contained in:
@@ -5,8 +5,8 @@ class Api::BillController < Api::ApiController
|
||||
def create
|
||||
@status = false
|
||||
@error_message = "Order ID or Booking ID is require to request for a bill."
|
||||
byebug
|
||||
if shift_by_terminal = ShiftSale.current_open_shift(get_cashier[0].id)
|
||||
# if shift_by_terminal = ShiftSale.current_open_shift(get_cashier[0].id)
|
||||
if !ShiftSale.current_shift.nil?
|
||||
#create Bill by Booking ID
|
||||
table = 0
|
||||
if (params[:booking_id])
|
||||
@@ -41,8 +41,8 @@ class Api::BillController < Api::ApiController
|
||||
end
|
||||
|
||||
# Bind shift sale id to sale
|
||||
@sale_data.shift_sale_id = shift_by_terminal.id
|
||||
@sale_data.save
|
||||
# @sale_data.shift_sale_id = shift_by_terminal.id
|
||||
# @sale_data.save
|
||||
|
||||
Promotion.promo_activate(@sale)
|
||||
|
||||
|
||||
@@ -11,8 +11,13 @@ class Origami::OrdersController < BaseOrigamiController
|
||||
|
||||
@booking = Array.new
|
||||
if !booking.nil?
|
||||
dining_facilities = DiningFacility.find_by_id(booking.dining_facility_id)
|
||||
@booking.push({'booking_id' => booking.booking_id, 'dining_facility_id' => booking.dining_facility_id, 'type' => dining_facilities.type})
|
||||
if booking.dining_facility_id.to_i > 0
|
||||
dining_facilities = DiningFacility.find_by_id(booking.dining_facility_id)
|
||||
@booking.push({'booking_id' => booking.booking_id, 'dining_facility_id' => booking.dining_facility_id, 'type' => dining_facilities.type})
|
||||
else
|
||||
@booking.push({'booking_id' => booking.booking_id, 'dining_facility_id' => booking.dining_facility_id, 'type' => nil})
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
#for split bill
|
||||
|
||||
@@ -9,8 +9,6 @@ class Origami::PendingOrderController < BaseOrigamiController
|
||||
@sale = Sale.find(params[:sale_id])
|
||||
@order = SaleOrder.find_by_sale_id(@sale.sale_id).order_id
|
||||
@booking = BookingOrder.find_by_order_id(@order).booking_id
|
||||
puts "sssssssssss"
|
||||
puts @booking
|
||||
if Booking.find(@booking).dining_facility_id.to_i > 0
|
||||
@table_id = Booking.find(@booking).dining_facility_id
|
||||
@dining = DiningFacility.find(@table_id)
|
||||
|
||||
@@ -5,7 +5,6 @@ class Origami::RequestBillsController < ApplicationController
|
||||
@sale = Sale.new
|
||||
sale_order=SaleOrder.new
|
||||
|
||||
# if shift = ShiftSale.current_open_shift(current_user.id)
|
||||
if !ShiftSale.current_shift.nil?
|
||||
order_id = params[:id] # order_id
|
||||
bk_order = BookingOrder.find_by_order_id(order_id)
|
||||
|
||||
@@ -86,18 +86,22 @@ class Origami::SplitBillController < BaseOrigamiController
|
||||
end
|
||||
|
||||
status = false
|
||||
if shift_by_terminal = ShiftSale.current_open_shift(get_cashier[0].id)
|
||||
if !ShiftSale.current_shift.nil?
|
||||
#create Bill by Booking ID
|
||||
table = 0
|
||||
if !params[:booking_id].empty?
|
||||
booking = Booking.find(params[:booking_id])
|
||||
# for Multiple Cashier by Zone
|
||||
table = DiningFacility.find(booking.dining_facility_id)
|
||||
if booking.dining_facility_id.to_i>0
|
||||
table = DiningFacility.find(booking.dining_facility_id)
|
||||
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
||||
else
|
||||
table = nil
|
||||
end
|
||||
|
||||
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
||||
|
||||
shift_by_terminal = ShiftSale.find_by_cashier_terminal_id_and_shift_closed_at(cashier_zone.cashier_terminal_id,nil)
|
||||
get_cashier_by_terminal = Employee.find(shift_by_terminal.employee_id)
|
||||
# shift_by_terminal = ShiftSale.find_by_cashier_terminal_id_and_shift_closed_at(cashier_zone.cashier_terminal_id,nil)
|
||||
# get_cashier_by_terminal = Employee.find(shift_by_terminal.employee_id)
|
||||
get_cashier_by_terminal = current_user
|
||||
|
||||
if booking
|
||||
if booking.sale_id.nil?
|
||||
@@ -320,8 +324,8 @@ class Origami::SplitBillController < BaseOrigamiController
|
||||
end
|
||||
|
||||
# Bind shift sale id to sale
|
||||
sale_data.shift_sale_id = shift_by_terminal.id
|
||||
sale_data.save
|
||||
# sale_data.shift_sale_id = shift_by_terminal.id
|
||||
# sale_data.save
|
||||
|
||||
Promotion.promo_activate(sale)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user