update quick service for split bill

This commit is contained in:
Aung Myo
2018-02-20 15:29:19 +06:30
parent 20103a54a5
commit b0cc934625
4 changed files with 27 additions and 15 deletions

View File

@@ -11,8 +11,13 @@ class Origami::OrdersController < BaseOrigamiController
@booking = Array.new
if !booking.nil?
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

View File

@@ -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)

View File

@@ -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
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
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)

View File

@@ -334,12 +334,17 @@
swal("Information!", result.error_message);
}
else{
if (dining_id == 0) {
window.location.href = '/origami';
}else{
if(type=='Table'){
window.location.href = '/origami/table/' + dining_id;
}else{
window.location.href = '/origami/room/' + dining_id;
}
}
}
}
});
}