Merge branch 'quick_service' of bitbucket.org:code2lab/sxrestaurant into split_bill
This commit is contained in:
@@ -113,7 +113,7 @@ $(function() {
|
|||||||
instances = menu_items[field].instances ;
|
instances = menu_items[field].instances ;
|
||||||
|
|
||||||
if (!instances.length > 0) {
|
if (!instances.length > 0) {
|
||||||
swal("Hello Please Check!","doesn't not have instance item in this menu items ("+ menu_items[field].name+")","warning");
|
swal("Hello Please Check!","Does not have instance item in this menu items ("+ menu_items[field].name+")","warning");
|
||||||
}
|
}
|
||||||
if (instances.length > 0) {
|
if (instances.length > 0) {
|
||||||
qty = 1;
|
qty = 1;
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ class Api::BillController < Api::ApiController
|
|||||||
def create
|
def create
|
||||||
@status = false
|
@status = false
|
||||||
@error_message = "Order ID or Booking ID is require to request for a bill."
|
@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
|
#create Bill by Booking ID
|
||||||
table = 0
|
table = 0
|
||||||
if (params[:booking_id])
|
if (params[:booking_id])
|
||||||
@@ -41,8 +41,8 @@ class Api::BillController < Api::ApiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Bind shift sale id to sale
|
# Bind shift sale id to sale
|
||||||
@sale_data.shift_sale_id = shift_by_terminal.id
|
# @sale_data.shift_sale_id = shift_by_terminal.id
|
||||||
@sale_data.save
|
# @sale_data.save
|
||||||
|
|
||||||
Promotion.promo_activate(@sale)
|
Promotion.promo_activate(@sale)
|
||||||
|
|
||||||
|
|||||||
@@ -11,8 +11,13 @@ class Origami::OrdersController < BaseOrigamiController
|
|||||||
|
|
||||||
@booking = Array.new
|
@booking = Array.new
|
||||||
if !booking.nil?
|
if !booking.nil?
|
||||||
dining_facilities = DiningFacility.find_by_id(booking.dining_facility_id)
|
if booking.dining_facility_id.to_i > 0
|
||||||
@booking.push({'booking_id' => booking.booking_id, 'dining_facility_id' => booking.dining_facility_id, 'type' => dining_facilities.type})
|
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
|
end
|
||||||
|
|
||||||
#for split bill
|
#for split bill
|
||||||
|
|||||||
@@ -9,8 +9,6 @@ class Origami::PendingOrderController < BaseOrigamiController
|
|||||||
@sale = Sale.find(params[:sale_id])
|
@sale = Sale.find(params[:sale_id])
|
||||||
@order = SaleOrder.find_by_sale_id(@sale.sale_id).order_id
|
@order = SaleOrder.find_by_sale_id(@sale.sale_id).order_id
|
||||||
@booking = BookingOrder.find_by_order_id(@order).booking_id
|
@booking = BookingOrder.find_by_order_id(@order).booking_id
|
||||||
puts "sssssssssss"
|
|
||||||
puts @booking
|
|
||||||
if Booking.find(@booking).dining_facility_id.to_i > 0
|
if Booking.find(@booking).dining_facility_id.to_i > 0
|
||||||
@table_id = Booking.find(@booking).dining_facility_id
|
@table_id = Booking.find(@booking).dining_facility_id
|
||||||
@dining = DiningFacility.find(@table_id)
|
@dining = DiningFacility.find(@table_id)
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ class Origami::RequestBillsController < ApplicationController
|
|||||||
@sale = Sale.new
|
@sale = Sale.new
|
||||||
sale_order=SaleOrder.new
|
sale_order=SaleOrder.new
|
||||||
|
|
||||||
# if shift = ShiftSale.current_open_shift(current_user.id)
|
|
||||||
if !ShiftSale.current_shift.nil?
|
if !ShiftSale.current_shift.nil?
|
||||||
order_id = params[:id] # order_id
|
order_id = params[:id] # order_id
|
||||||
bk_order = BookingOrder.find_by_order_id(order_id)
|
bk_order = BookingOrder.find_by_order_id(order_id)
|
||||||
|
|||||||
@@ -86,18 +86,22 @@ class Origami::SplitBillController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
status = false
|
status = false
|
||||||
if shift_by_terminal = ShiftSale.current_open_shift(get_cashier[0].id)
|
if !ShiftSale.current_shift.nil?
|
||||||
#create Bill by Booking ID
|
#create Bill by Booking ID
|
||||||
table = 0
|
table = 0
|
||||||
if !params[:booking_id].empty?
|
if !params[:booking_id].empty?
|
||||||
booking = Booking.find(params[:booking_id])
|
booking = Booking.find(params[:booking_id])
|
||||||
# for Multiple Cashier by Zone
|
# 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 = current_user
|
||||||
get_cashier_by_terminal = Employee.find(shift_by_terminal.employee_id)
|
|
||||||
|
|
||||||
if booking
|
if booking
|
||||||
if booking.sale_id.nil?
|
if booking.sale_id.nil?
|
||||||
@@ -320,8 +324,8 @@ class Origami::SplitBillController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Bind shift sale id to sale
|
# Bind shift sale id to sale
|
||||||
sale_data.shift_sale_id = shift_by_terminal.id
|
# sale_data.shift_sale_id = shift_by_terminal.id
|
||||||
sale_data.save
|
# sale_data.save
|
||||||
|
|
||||||
Promotion.promo_activate(sale)
|
Promotion.promo_activate(sale)
|
||||||
|
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ class Sale < ApplicationRecord
|
|||||||
@sale = Sale.new
|
@sale = Sale.new
|
||||||
sale_order=SaleOrder.new
|
sale_order=SaleOrder.new
|
||||||
|
|
||||||
if shift = ShiftSale.current_open_shift(current_user.id)
|
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)
|
bk_order = BookingOrder.find_by_order_id(order_id)
|
||||||
check_booking = Booking.find_by_booking_id(bk_order.booking_id)
|
check_booking = Booking.find_by_booking_id(bk_order.booking_id)
|
||||||
@@ -166,7 +166,7 @@ class Sale < ApplicationRecord
|
|||||||
# Create Sale if it doesn't exist
|
# Create Sale if it doesn't exist
|
||||||
# puts "current_login_employee"
|
# puts "current_login_employee"
|
||||||
# puts current_login_employee.name
|
# puts current_login_employee.name
|
||||||
@status, @sale_id = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee, cashier = nil)
|
@status, @sale_id = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee,current_user)
|
||||||
@sale_data = Sale.find_by_sale_id(@sale_id)
|
@sale_data = Sale.find_by_sale_id(@sale_id)
|
||||||
@sale_items = SaleItem.where("sale_id=?",@sale_id)
|
@sale_items = SaleItem.where("sale_id=?",@sale_id)
|
||||||
else
|
else
|
||||||
@@ -175,8 +175,8 @@ class Sale < ApplicationRecord
|
|||||||
end
|
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)
|
Promotion.promo_activate(@sale)
|
||||||
|
|||||||
@@ -334,11 +334,16 @@
|
|||||||
swal("Information!", result.error_message);
|
swal("Information!", result.error_message);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if(type=='Table'){
|
if (dining_id == 0) {
|
||||||
window.location.href = '/origami/table/' + dining_id;
|
window.location.href = '/origami';
|
||||||
}else{
|
}else{
|
||||||
window.location.href = '/origami/room/' + dining_id;
|
if(type=='Table'){
|
||||||
|
window.location.href = '/origami/table/' + dining_id;
|
||||||
|
}else{
|
||||||
|
window.location.href = '/origami/room/' + dining_id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -497,7 +497,7 @@ console.log("fffffffffffff")
|
|||||||
var othertotal = parseFloat(credit1) + parseFloat(card1) + parseFloat(paypar1) + parseFloat(visa1) + parseFloat(jcb1) + parseFloat(master1) + parseFloat(unionpay1);
|
var othertotal = parseFloat(credit1) + parseFloat(card1) + parseFloat(paypar1) + parseFloat(visa1) + parseFloat(jcb1) + parseFloat(master1) + parseFloat(unionpay1);
|
||||||
var total = $('#amount_due').text();
|
var total = $('#amount_due').text();
|
||||||
var amt = parseFloat(total) - parseFloat(othertotal);
|
var amt = parseFloat(total) - parseFloat(othertotal);
|
||||||
$('#cash').text(parseFloat(amt).toFixed(2));
|
$('#cash').text(parseFloat(amt).toFixed(1));
|
||||||
update_balance();
|
update_balance();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -587,7 +587,7 @@ console.log("fffffffffffff")
|
|||||||
$( "#loading_wrapper" ).hide();
|
$( "#loading_wrapper" ).hide();
|
||||||
if($('#balance').text() < 0){
|
if($('#balance').text() < 0){
|
||||||
swal({
|
swal({
|
||||||
title: "Information!",
|
title: "Payment Successful!",
|
||||||
text: 'Changed amount ' + $('#balance').text() * (-1),
|
text: 'Changed amount ' + $('#balance').text() * (-1),
|
||||||
html: true,
|
html: true,
|
||||||
closeOnConfirm: false,
|
closeOnConfirm: false,
|
||||||
@@ -603,7 +603,7 @@ console.log("fffffffffffff")
|
|||||||
}else{
|
}else{
|
||||||
$('#pay').text("Pay");
|
$('#pay').text("Pay");
|
||||||
swal({
|
swal({
|
||||||
title: "Information!",
|
title: "Payment Successful!",
|
||||||
text: 'Thank You !',
|
text: 'Thank You !',
|
||||||
html: true,
|
html: true,
|
||||||
closeOnConfirm: false,
|
closeOnConfirm: false,
|
||||||
|
|||||||
Reference in New Issue
Block a user