fix foodcourt sales transaction
This commit is contained in:
6
Gemfile
6
Gemfile
@@ -42,6 +42,8 @@ gem 'material_icons'
|
||||
gem 'font-awesome-rails', '~> 4.7', '>= 4.7.0.2'
|
||||
gem 'rack-cors'
|
||||
|
||||
gem 'sidekiq'
|
||||
|
||||
# Multi-tenancy for shops
|
||||
gem 'acts_as_tenant'
|
||||
|
||||
@@ -51,7 +53,6 @@ gem 'mini_magick'
|
||||
gem 'jquery-fileupload-rails', '~> 0.4.7'
|
||||
|
||||
#Report and Printing gems
|
||||
|
||||
gem 'cups', '~> 0.0.7'
|
||||
|
||||
gem 'prawn'
|
||||
@@ -82,7 +83,6 @@ gem 'jbuilder', '~> 2.5'
|
||||
gem 'bcrypt', '~> 3.1.7'
|
||||
gem 'aescrypt'
|
||||
|
||||
gem 'sidekiq'
|
||||
gem 'whenever', :require => false
|
||||
|
||||
# XML parser
|
||||
@@ -145,4 +145,4 @@ gem 'momentjs-rails' # for date-range selector
|
||||
# gem 'select2-rails' # for multi-select and auto-complete select box
|
||||
gem "chartkick" #chart lib
|
||||
gem 'myanmar-tools'
|
||||
gem 'rabbit-mm'
|
||||
gem 'rabbit-mm'
|
||||
|
||||
@@ -563,7 +563,7 @@ $(function() {
|
||||
$(document).on('click', '.add_icon', function(event){
|
||||
|
||||
if (window.location.pathname.includes('out_of_stock') == false) {
|
||||
|
||||
|
||||
if($(this).hasClass('product_item')) {
|
||||
$('.sx_item_detailModal').modal('hide');
|
||||
|
||||
@@ -1168,10 +1168,12 @@ $(function() {
|
||||
data: params,
|
||||
dataType: "json",
|
||||
success: function(result){
|
||||
if (type == "quick_service" || type=="food_court") {
|
||||
module_name = window.location.href.includes('foodcourt') ? 'foodcourt' : 'origami'
|
||||
window.location.href = "/"+module_name+"/"+type;
|
||||
}else{
|
||||
booking_id = result.booking_id;
|
||||
if (type == "quick_service") {
|
||||
window.location.href = "/origami/quick_service";
|
||||
} else if (type=="food_court") {
|
||||
window.location.href = "/foodcourt/app_orders?pending_id=" + booking_id;
|
||||
} else {
|
||||
if(table_type == "Table"){
|
||||
window.location.href = "/origami/table/" + table_id;
|
||||
}
|
||||
@@ -1195,7 +1197,7 @@ $(function() {
|
||||
|
||||
// Pay Discount for Payment
|
||||
// $("#create_pay_order").on('click', function(e){
|
||||
|
||||
|
||||
// $(this).prop("disabled", true);
|
||||
// $("#create_order").prop("disabled", true);
|
||||
// $("#read_modal").attr('data-for', 'member');
|
||||
@@ -1716,7 +1718,7 @@ $(function() {
|
||||
menu_insta = '';
|
||||
|
||||
$(instances).each(function(i){
|
||||
if (!instances[i].out_of_stock) { //instances[i].is_default === true &&
|
||||
if (!instances[i].out_of_stock) { //instances[i].is_default === true &&
|
||||
code = instances[i].code;
|
||||
name = instances[i].name;
|
||||
price = parseFloat(instances[i].price).toFixed(2);
|
||||
|
||||
@@ -63,7 +63,8 @@ function member_card(cardNo) {
|
||||
var params = {'order_source': type, 'order_type': "dine_in",
|
||||
'customer_id': customer_id, 'guest_info': "",
|
||||
'table_id': table_id,
|
||||
'order_items': order_items,'sale_id': sale_id,'create_type': "create_pay" };
|
||||
'order_items': order_items, 'sale_id': sale_id, 'create_type': "create_pay" };
|
||||
|
||||
if (booking_id.length > 0) {
|
||||
params.booking_id = booking_id;
|
||||
}
|
||||
@@ -72,20 +73,17 @@ function member_card(cardNo) {
|
||||
url: ajax_url,
|
||||
data: params,
|
||||
dataType: "json",
|
||||
success:function(result){
|
||||
if (result.data == 'OK'){
|
||||
request_bill(g_membership_id, g_customer_id, g_customer_name);
|
||||
}else{
|
||||
if (result.data["sale_id"]){
|
||||
update_sale(g_membership_id, g_customer_id, g_customer_name,result.data["sale_id"]);
|
||||
}
|
||||
success:function(result) {
|
||||
if (result.sale_id) {
|
||||
sale_id = result.sale_id;
|
||||
window.location.href = '/foodcourt/sale/'+sale_id+'/food_court/payment/';
|
||||
}
|
||||
}
|
||||
});
|
||||
}else if($('.btn').is('#pay')){
|
||||
update_sale(g_membership_id, g_customer_id, g_customer_name,$('#sale_id').text());
|
||||
}
|
||||
else{
|
||||
} else if($('.btn').is('#pay')){
|
||||
sale_id = $('#sale_id').text();
|
||||
window.location.href = '/foodcourt/sale/'+sale_id+'/food_court/payment/';
|
||||
} else {
|
||||
request_bill(g_membership_id, g_customer_id, g_customer_name);
|
||||
}
|
||||
}
|
||||
@@ -93,18 +91,20 @@ function member_card(cardNo) {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function request_bill(membership_id,customer_id,customer_name){
|
||||
if (window.location.pathname.includes('foodcourt')) {
|
||||
order_id = $('#order_id').val() || $('#save_order_id').val()
|
||||
data = { 'customer_id': customer_id }
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/foodcourt/food_court/"+order_id+"/request_bill" ,
|
||||
data: {},
|
||||
data: data,
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if(data.status == true)
|
||||
{
|
||||
update_sale(membership_id, customer_id, customer_name, data.sale_id);
|
||||
window.location.href = '/foodcourt/sale/'+data.sale_id+'/food_court/payment/';
|
||||
}else{
|
||||
swal("Alert!", "Error!", "error");
|
||||
location.reload();
|
||||
@@ -113,6 +113,7 @@ function request_bill(membership_id,customer_id,customer_name){
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function update_sale(membership_id, customer_id, customer_name, sale_id) {
|
||||
$("#oqs_loading_wrapper").css("display", "none");
|
||||
var customer="";
|
||||
|
||||
@@ -87,8 +87,6 @@ class Foodcourt::AddordersController < BaseFoodcourtController
|
||||
end
|
||||
|
||||
def create
|
||||
new_booking =true
|
||||
booking_id =nil
|
||||
if params[:booking_id].present?
|
||||
booking = Booking.find(params[:booking_id])
|
||||
end
|
||||
@@ -105,82 +103,64 @@ class Foodcourt::AddordersController < BaseFoodcourtController
|
||||
items_arr = []
|
||||
JSON.parse(params[:order_items]).each { |i|
|
||||
i["item_instance_code"] = i["item_instance_code"].downcase.to_s
|
||||
if i["item_instance_code"].include? "ext"
|
||||
is_extra_time = true
|
||||
arr_exts = i["item_instance_code"].split("_")
|
||||
if arr_exts[1].match(/^(\d)+$/)
|
||||
time = arr_exts[1].to_i*60*i["quantity"].to_i
|
||||
extra_time = Time.at(time)
|
||||
end
|
||||
end
|
||||
if i["parent_order_item_id"];
|
||||
items = {"order_item_id": i["order_item_id"],"item_instance_code": i["item_instance_code"],"quantity": i["quantity"],"parent_order_item_id": i["parent_order_item_id"],"options": JSON.parse(i["options"])}
|
||||
else
|
||||
if i["parent_order_item_id"];
|
||||
items = {"order_item_id": i["order_item_id"],"item_instance_code": i["item_instance_code"],"quantity": i["quantity"],"parent_order_item_id": i["parent_order_item_id"],"options": JSON.parse(i["options"])}
|
||||
else
|
||||
items = {"order_item_id": i["order_item_id"],"item_instance_code": i["item_instance_code"],"quantity": i["quantity"],"options": JSON.parse(i["options"])}
|
||||
end
|
||||
items_arr.push(items)
|
||||
end
|
||||
items_arr.push(items)
|
||||
}
|
||||
|
||||
if params[:order_source] == "quick_service" && params[:table_id].to_i == 0
|
||||
customer_id = takeaway.customer_id # for no customer id from mobile
|
||||
else
|
||||
customer_id = params[:customer_id].present? ? params[:customer_id] : Customer.walkin.customer_id # for no customer id from mobile
|
||||
end
|
||||
if booking.nil? || booking.sale_id.present? || booking.booking_status == 'moved'
|
||||
new_booking = true
|
||||
else
|
||||
new_booking = false
|
||||
booking_id = booking.booking_id
|
||||
end
|
||||
@order =Order.create(source: params[:order_source],
|
||||
order_type: params[:order_type],
|
||||
customer_id: customer_id,
|
||||
items: items_arr,
|
||||
guest: params[:guest_info],
|
||||
table_id: params[:table_id],
|
||||
new_booking: new_booking,
|
||||
waiters: current_login_employee.name,
|
||||
employee_name: current_login_employee.name,
|
||||
is_extra_time: is_extra_time,
|
||||
extra_time: extra_time,
|
||||
booking_id: booking_id
|
||||
)
|
||||
@status, @booking = @order.generate
|
||||
customer_id = params[:customer_id].present? ? params[:customer_id] : Customer.walkin.customer_id
|
||||
|
||||
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
|
||||
Order.transaction do
|
||||
@order = Order.new
|
||||
@order.source = params[:order_source]
|
||||
@order.order_type = params[:order_type]
|
||||
@order.customer_id = customer_id
|
||||
@order.items = items_arr
|
||||
@order.guest = params[:guest_info]
|
||||
@order.table_id = params[:table_id] # this is dining facilities's id
|
||||
@order.new_booking = true
|
||||
@order.waiters = current_login_employee.name
|
||||
@order.employee_name = current_login_employee.name
|
||||
|
||||
@order.is_extra_time = is_extra_time
|
||||
@order.extra_time = extra_time
|
||||
|
||||
if booking.nil? || booking.sale_id.present? || booking.booking_status == 'moved'
|
||||
@order.new_booking = true
|
||||
else
|
||||
@order.new_booking = false
|
||||
@order.booking_id = booking.booking_id
|
||||
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
|
||||
@status, @booking = @order.generate
|
||||
|
||||
if current_user.role != "waiter" && params[:create_type] == "create_pay"
|
||||
if @status && @booking && (@order.source == 'quick_service') || (@order.source == 'food_court')
|
||||
|
||||
@status, @sale = Sale.request_bill(@order,current_user,current_login_employee)
|
||||
|
||||
# for second display
|
||||
if @order.source == 'quick_service'
|
||||
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 "second_display_channel",data: @sale,status:"sale",from:from
|
||||
ActionCable.server.broadcast "order_channel",table: table,type:type,from:from
|
||||
end
|
||||
#end
|
||||
result = {:status=> @status, :data => @sale ,:current_user_role =>current_user.role}
|
||||
render :json => result.to_json
|
||||
end
|
||||
else
|
||||
result = {:status=> @status, :data => 0 }
|
||||
render :json => result.to_json
|
||||
end
|
||||
|
||||
if current_user.role != "waiter" && params[:create_type] == "create_pay"
|
||||
if @status && @booking && (@order.source == 'quick_service') || (@order.source == 'food_court')
|
||||
|
||||
@status, @sale = Sale.request_bill(@order,current_user,current_login_employee)
|
||||
|
||||
# for second display
|
||||
if @order.source == 'quick_service'
|
||||
from = getCloudDomain #get sub domain in cloud mode
|
||||
ActionCable.server.broadcast "second_display_channel",data: @sale,status:"sale",from:from
|
||||
end
|
||||
#end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# render json for http status code
|
||||
|
||||
@@ -9,51 +9,49 @@ class Foodcourt::FoodCourtController < ApplicationController
|
||||
|
||||
def index
|
||||
if !ShiftSale.current_shift.nil?
|
||||
if params[:sale_id].present?
|
||||
sale =Sale.find(params[:sale_id])
|
||||
if sale
|
||||
@sale_id =sale.sale_id
|
||||
@booking_id =sale.bookings[0].booking_id
|
||||
if params[:sale_id].present?
|
||||
sale =Sale.find(params[:sale_id])
|
||||
if sale
|
||||
@sale_id =sale.sale_id
|
||||
@booking_id =sale.bookings[0].booking_id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@zone = Zone.all
|
||||
@tables = Table.active.order('status desc')
|
||||
@rooms = Room.active.order('status desc')
|
||||
@zone = Zone.all.includes(:tables, :rooms).where("is_active= true")
|
||||
|
||||
today = Time.current
|
||||
day = Date.today.wday
|
||||
@menus = []
|
||||
@menu = []
|
||||
@cashier_type = "food_court"
|
||||
#checked quick_service only
|
||||
today = Time.current
|
||||
day = Date.today.wday
|
||||
@menus = []
|
||||
@menu = []
|
||||
@cashier_type = "food_court"
|
||||
#checked quick_service only
|
||||
|
||||
display_type = Lookup.find_by_lookup_type("display_type")
|
||||
if !display_type.nil? && display_type.value.to_i ==2
|
||||
@display_type = display_type.value
|
||||
else
|
||||
@display_type = nil
|
||||
end
|
||||
display_type = Lookup.find_by_lookup_type("display_type")
|
||||
if !display_type.nil? && display_type.value.to_i ==2
|
||||
@display_type = display_type.value
|
||||
else
|
||||
@display_type = nil
|
||||
end
|
||||
|
||||
@quick_service_only = true
|
||||
lookup_dine_in = Lookup.collection_of('dinein_cashier')
|
||||
if !lookup_dine_in.empty?
|
||||
lookup_dine_in.each do |dine_in|
|
||||
if dine_in[0].downcase == "dineincashier"
|
||||
if dine_in[1] == '1'
|
||||
@quick_service_only = false
|
||||
@quick_service_only = true
|
||||
lookup_dine_in = Lookup.collection_of('dinein_cashier')
|
||||
if !lookup_dine_in.empty?
|
||||
lookup_dine_in.each do |dine_in|
|
||||
if dine_in[0].downcase == "dineincashier"
|
||||
if dine_in[1] == '1'
|
||||
@quick_service_only = false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@app_order_new_count = Booking.select("bookings.*,customers.*")
|
||||
@app_order_new_count = Booking.select("bookings.*,customers.*")
|
||||
.joins(" JOIN sales ON bookings.sale_id=sales.sale_id")
|
||||
.joins(" JOIN booking_orders ON booking_orders.booking_id=bookings.booking_id")
|
||||
.joins("JOIN orders ON orders.order_id=booking_orders.order_id")
|
||||
.joins("JOIN order_items ON orders.order_id=order_items.order_id")
|
||||
.joins("JOIN customers ON orders.customer_id=customers.customer_id")
|
||||
.where("bookings.booking_status !=? and sales.sale_status =? and sales.payment_status =? and orders.source='app' and DATE(bookings.created_at)=?",'completed','completed','paid',Date.today).order("bookings.created_at desc").uniq.length
|
||||
render "foodcourt/addorders/detail"
|
||||
render "foodcourt/addorders/detail"
|
||||
else
|
||||
if current_user.role == 'administrator' || current_user.role == 'manager'
|
||||
redirect_to origami_dashboard_path
|
||||
|
||||
@@ -64,7 +64,6 @@ class Foodcourt::OrdersController < BaseFoodcourtController
|
||||
@booking_id =@booking.booking_id
|
||||
@order_id =@booking.order_id
|
||||
@sale_data = Sale.find_by_sale_id(@booking.sale_id)
|
||||
|
||||
elsif params[:pending_id]
|
||||
id = params[:pending_id]
|
||||
if id.include? "SAL"
|
||||
@@ -166,40 +165,46 @@ class Foodcourt::OrdersController < BaseFoodcourtController
|
||||
}
|
||||
|
||||
# begin
|
||||
order = Order.new
|
||||
order.source = params[:order_source]
|
||||
order.order_type = params[:order_type]
|
||||
# order.customer_id = params[:customer_id].present? ? params[:customer_id] : walkin.customer_id # for no customer id from mobile
|
||||
order.items = items_arr
|
||||
order.guest = params[:guest_info]
|
||||
order.table_id = params[:table_id] # this is dining facilities's id
|
||||
order.waiters = current_login_employee.name
|
||||
order.employee_name = current_login_employee.name
|
||||
Order.transaction do
|
||||
order = Order.new
|
||||
order.source = params[:order_source]
|
||||
order.order_type = params[:order_type]
|
||||
# order.customer_id = params[:customer_id].present? ? params[:customer_id] : walkin.customer_id # for no customer id from mobile
|
||||
order.items = items_arr
|
||||
order.guest = params[:guest_info]
|
||||
order.table_id = params[:table_id] # this is dining facilities's id
|
||||
order.waiters = current_login_employee.name
|
||||
order.employee_name = current_login_employee.name
|
||||
|
||||
order.is_extra_time = is_extra_time
|
||||
order.extra_time = extra_time
|
||||
order.is_extra_time = is_extra_time
|
||||
order.extra_time = extra_time
|
||||
|
||||
order.new_booking = false
|
||||
order.booking_id = booking.booking_id
|
||||
order.new_booking = false
|
||||
order.booking_id = booking.booking_id
|
||||
|
||||
if order.generate
|
||||
if sale
|
||||
Sale.add_to_existing_pending_invoice(nil, sale.sale_id, booking)
|
||||
render :json => { :status => true, :data => sale }
|
||||
if order.generate
|
||||
if sale
|
||||
Sale.add_to_existing_pending_invoice(nil, sale.sale_id, booking)
|
||||
render :json => { :status => true, :data => sale }
|
||||
else
|
||||
render :json => { :status => true, :data => 'OK' }
|
||||
end
|
||||
else
|
||||
render :json => { :status => true, :data => 'OK' }
|
||||
render :json => { :status => false }
|
||||
end
|
||||
else
|
||||
render :json => { :status => false }
|
||||
end
|
||||
end
|
||||
|
||||
def request_bill
|
||||
sale_data =[]
|
||||
customer_id = params[:customer_id]
|
||||
if !ShiftSale.current_shift.nil?
|
||||
order_id = params[:order_id] # order_id
|
||||
order_id = params[:order_id]
|
||||
order = Order.find(order_id)
|
||||
booking = order.booking
|
||||
if Customer.exists?(customer_id: customer_id)
|
||||
booking.orders.update_all(customer_id: customer_id)
|
||||
end
|
||||
if booking.checkin_at.utc > Time.now.utc && booking.checkout_at.nil?
|
||||
@status = false
|
||||
@error_message = "Operation failed, Could not request bill!"
|
||||
@@ -295,7 +300,7 @@ class Foodcourt::OrdersController < BaseFoodcourtController
|
||||
|
||||
def cancel_order
|
||||
order_id = params[:order_id]
|
||||
|
||||
|
||||
if order_id.present?
|
||||
order = Order.find(order_id)
|
||||
booking = order.booking
|
||||
@@ -321,5 +326,5 @@ class Foodcourt::OrdersController < BaseFoodcourtController
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
@@ -1,19 +1,37 @@
|
||||
class Foodcourt::PaymalController < BaseFoodcourtController
|
||||
|
||||
def create
|
||||
cash = params[:payment_amount]
|
||||
sale_id = params[:sale_id]
|
||||
transaction_ref = params[:transaction_ref]
|
||||
account_no = params[:account_no]
|
||||
if(Sale.exists?(sale_id))
|
||||
cash = params[:payment_amount]
|
||||
sale_id = params[:sale_id]
|
||||
transaction_ref = params[:transaction_ref]
|
||||
account_no = params[:account_no]
|
||||
if(Sale.exists?(sale_id))
|
||||
Sale.transaction do
|
||||
saleObj = Sale.find(sale_id)
|
||||
booking = saleObj.booking
|
||||
|
||||
sale_payment = SalePayment.new
|
||||
status, @sale, @membership_data = sale_payment.process_payment(saleObj, current_user, cash, "paymal",account_no)
|
||||
status, @sale, @membership_data = sale_payment.process_payment(saleObj, current_user, cash, "paymal", account_no)
|
||||
|
||||
if status == true && @membership_data["status"] == true
|
||||
PrintOrderQueueJob.perform_later(current_shop.shop_code, booking.booking_id)
|
||||
PrintReceiptJob.perform_later(current_shop.shop_code, sale_id)
|
||||
|
||||
@out = true, "Success!"
|
||||
else
|
||||
@out = false, @membership_data["message"]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def getCloudDomain
|
||||
from = ""
|
||||
if ENV["SERVER_MODE"] == 'cloud'
|
||||
from = request.subdomain.to_s + "." + request.domain.to_s
|
||||
end
|
||||
|
||||
return from
|
||||
end
|
||||
end
|
||||
|
||||
@@ -9,19 +9,20 @@ class Foodcourt::SecondDisplayController < BaseFoodcourtController
|
||||
|
||||
def customer_view
|
||||
display_type = Lookup.find_by_lookup_type("display_type")
|
||||
if !display_type.nil? && display_type.value.to_i == 2
|
||||
if params[:status]!= "billed"
|
||||
tax_profiles = TaxProfile.all.order("order_by asc")
|
||||
else
|
||||
tax_profiles = nil
|
||||
end
|
||||
if ENV["SERVER_MODE"] == 'cloud'
|
||||
from = request.host
|
||||
else
|
||||
from = ""
|
||||
end
|
||||
ActionCable.server.broadcast "second_display_view_channel",data: params[:data],tax_profiles: tax_profiles,status:params[:status],from:from
|
||||
end
|
||||
if !display_type.nil? && display_type.value.to_i == 2
|
||||
if params[:status]!= "billed"
|
||||
tax_profiles = TaxProfile.all.order("order_by asc")
|
||||
else
|
||||
tax_profiles = nil
|
||||
end
|
||||
if ENV["SERVER_MODE"] == 'cloud'
|
||||
from = request.host
|
||||
else
|
||||
from = ""
|
||||
end
|
||||
ActionCable.server.broadcast "second_display_view_channel",data: params[:data],tax_profiles: tax_profiles,status:params[:status],from:from
|
||||
end
|
||||
head :no_content
|
||||
# end
|
||||
end
|
||||
#Shop Name in Navbor
|
||||
|
||||
@@ -34,6 +34,15 @@ class Foodcourt::VoidController < BaseFoodcourtController
|
||||
sale.sale_status = 'void'
|
||||
sale.save
|
||||
|
||||
#call paymal to void
|
||||
if !sale.sale_payments.nil?
|
||||
membership_response = sale.paymal_payment_void
|
||||
Rails.logger.debug "---------Paymal Payment Void response in VoidController"
|
||||
Rails.logger.debug membership_response.to_json
|
||||
end
|
||||
|
||||
PrintReceiptJob.perform_later(current_shop.shop_code, sale.sale_id)
|
||||
|
||||
if table = sale.booking.dining_facility
|
||||
unless table.current_bookings.exists?
|
||||
table.update_attributes(status: 'available')
|
||||
@@ -49,73 +58,6 @@ class Foodcourt::VoidController < BaseFoodcourtController
|
||||
# remark = "Void Sale ID #{sale_id} | Receipt No #{sale.receipt_no} | Receipt No #{sale.receipt_no} | Table ->#{table.name}"
|
||||
sale_audit = SaleAudit.record_audit_for_edit(sale_id,current_user.name, action_by,remark,"SALEVOID" )
|
||||
|
||||
#call paymal to void
|
||||
if !sale.sale_payments.nil?
|
||||
membership_response =sale.paymal_payment_void
|
||||
Rails.logger.debug "---------Paymal Payment Void response in VoidController"
|
||||
Rails.logger.debug membership_response.to_json
|
||||
end
|
||||
|
||||
# For Print
|
||||
member_info = nil
|
||||
rebate_amount = nil
|
||||
current_balance = nil
|
||||
|
||||
if sale.booking.dining_facility_id.to_i > 0
|
||||
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
||||
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
|
||||
else
|
||||
shift = ShiftSale.find(sale.shift_sale_id)
|
||||
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
|
||||
end
|
||||
|
||||
customer= Customer.find(sale.customer_id)
|
||||
|
||||
#shop detail
|
||||
shop_details = Shop.current_shop
|
||||
# get member information
|
||||
rebate = MembershipSetting.find_by_rebate(1)
|
||||
if customer.membership_id != nil && rebate
|
||||
member_info = Customer.get_member_account(customer)
|
||||
rebate_amount = Customer.get_membership_transactions(customer,sale.receipt_no)
|
||||
# current_balance = SaleAudit.paymal_search(sale_id)
|
||||
current_balance = 0
|
||||
end
|
||||
|
||||
printer = PrintSetting.all
|
||||
|
||||
unique_code="ReceiptBillPdf"
|
||||
if !printer.empty?
|
||||
printer.each do |printer_setting|
|
||||
if printer_setting.unique_code == 'ReceiptBillPdf'
|
||||
unique_code="ReceiptBillPdf"
|
||||
elsif printer_setting.unique_code == 'ReceiptBillA5Pdf'
|
||||
unique_code="ReceiptBillA5Pdf"
|
||||
elsif printer_setting.unique_code == 'ReceiptBillStarPdf'
|
||||
unique_code="ReceiptBillStarPdf"
|
||||
end
|
||||
end
|
||||
end
|
||||
# get printer info
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
# Calculate Food and Beverage Total
|
||||
item_price_by_accounts = SaleItem.calculate_price_by_accounts(sale.sale_items)
|
||||
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(sale.sale_items)
|
||||
other_amount = SaleItem.calculate_other_charges(sale.sale_items)
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "VOID",current_balance,nil,other_amount,nil,nil,nil)
|
||||
result = {
|
||||
:filepath => filename,
|
||||
:printer_model => print_settings.brand_name,
|
||||
:printer_url => print_settings.api_settings
|
||||
}
|
||||
|
||||
# Mobile Print
|
||||
render :json => result.to_json
|
||||
# end
|
||||
|
||||
#end print
|
||||
|
||||
# update complete order items in oqs
|
||||
SaleOrder.where("sale_id = '#{ sale_id }'").find_each do |sodr|
|
||||
AssignedOrderItem.where("order_id = '#{ sodr.order_id }'").find_each do |aoi|
|
||||
@@ -124,6 +66,6 @@ class Foodcourt::VoidController < BaseFoodcourtController
|
||||
end
|
||||
end
|
||||
end
|
||||
head :no_content
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -3,8 +3,8 @@ class OrderQueueProcessorJob < ApplicationJob
|
||||
|
||||
def perform(order_id, table_id)
|
||||
# Do something later
|
||||
#Order ID
|
||||
order = Order.find(order_id)
|
||||
#Order ID
|
||||
order = Order.find(order_id)
|
||||
|
||||
#Execute orders and send to order stations
|
||||
if order
|
||||
@@ -16,11 +16,11 @@ class OrderQueueProcessorJob < ApplicationJob
|
||||
ActionCable.server.broadcast "order_queue_station_channel",order: assign_order
|
||||
end
|
||||
|
||||
# private
|
||||
# private
|
||||
|
||||
# def render_order(assign_order)
|
||||
# ApplicationController.renderer.render(partial: 'oqs/oqs_test',
|
||||
# locals: { order: assign_order})
|
||||
# def render_order(assign_order)
|
||||
# ApplicationController.renderer.render(partial: 'oqs/oqs_test',
|
||||
# locals: { order: assign_order})
|
||||
# end
|
||||
# Read more at https://www.pluralsight.com/guides/ruby-ruby-on-rails/creating-a-chat-using-rails-action-cable#TehYiuqlHDOXaQQk.99
|
||||
|
||||
|
||||
14
app/jobs/print_order_queue_job.rb
Normal file
14
app/jobs/print_order_queue_job.rb
Normal file
@@ -0,0 +1,14 @@
|
||||
class PrintOrderQueueJob < ApplicationJob
|
||||
queue_as :default
|
||||
|
||||
def perform(shop_code, booking_id)
|
||||
current_shop = Shop.find_by(shop_code: shop_code)
|
||||
ActsAsTenant.with_tenant(current_shop) do
|
||||
booking = Booking.find(booking_id)
|
||||
booking.orders.each do |order|
|
||||
oqs = OrderQueueStation.new
|
||||
oqs.process_order(order, booking.dining_facility_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
49
app/jobs/print_receipt_job.rb
Normal file
49
app/jobs/print_receipt_job.rb
Normal file
@@ -0,0 +1,49 @@
|
||||
class PrintReceiptJob < ApplicationJob
|
||||
queue_as :high_priority
|
||||
|
||||
def perform(shop_code, sale_id)
|
||||
current_shop = Shop.find_by(shop_code: shop_code)
|
||||
ActsAsTenant.with_tenant(current_shop) do
|
||||
saleObj = saleObj = Sale.find(sale_id)
|
||||
sale_items = SaleItem.get_all_sale_items(sale_id)
|
||||
|
||||
booking = saleObj.booking
|
||||
latest_order_no = booking.booking_orders.last.order_id
|
||||
|
||||
cashier_terminal = booking.cashier_terminal_by_dining_facility || saleObj.cashier_terminal_by_shift_sale
|
||||
|
||||
customer = saleObj.customer
|
||||
|
||||
# get member information
|
||||
rebate = MembershipSetting.find_by_rebate(1)
|
||||
credit_data = SalePayment.find_by_sale_id_and_payment_method(sale_id, 'creditnote')
|
||||
|
||||
if customer.membership_id != nil && rebate && credit_data.nil?
|
||||
member_info = Customer.get_member_account(customer)
|
||||
|
||||
if member_info["status"] == true
|
||||
rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
|
||||
current_balance = SaleAudit.paymal_search(sale_id)
|
||||
end
|
||||
end
|
||||
|
||||
card_data = Array.new
|
||||
#card_balance amount for Paymal payment
|
||||
card_balance_amount,transaction_ref = SaleAudit.getCardBalanceAmount(sale_id)
|
||||
|
||||
print_settings = PrintSetting.where("unique_code REGEXP ?", "receipt.*bill.*pdf").first
|
||||
|
||||
item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items)
|
||||
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
|
||||
other_amount = SaleItem.calculate_other_charges(sale_items)
|
||||
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
|
||||
if saleObj.sale_status = 'completed'
|
||||
printer.print_receipt_bill(print_settings, false, nil, cashier_terminal, sale_items, saleObj, customer.paypar_account_no, item_price_by_accounts, discount_price_by_accounts, member_info, rebate_amount, current_shop, 'paid', current_balance, card_data, other_amount, latest_order_no, card_balance_amount, nil, transaction_ref)
|
||||
elsif saleObj.sale_status = 'void'
|
||||
printer.print_receipt_bill(print_settings, false, nil,cashier_terminal, sale_items, saleObj, customer.paypar_account_no, item_price_by_accounts, discount_price_by_accounts, member_info, rebate_amount, current_shop, "VOID", current_balance, card_data, other_amount,nil,nil,nil)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -173,12 +173,7 @@ class Booking < ApplicationRecord
|
||||
end
|
||||
|
||||
def self.get_booking_id(order_no)
|
||||
booking = Booking.joins(" JOIN booking_orders bo ON bo.booking_id = bookings.booking_id")
|
||||
.joins(" JOIN orders o ON o.order_id=bo.order_id")
|
||||
.where("o.order_id='#{order_no}'")
|
||||
.first()
|
||||
|
||||
return booking.booking_id
|
||||
return BookingOrder.where(order_id: order_no).first.booking_id
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -10,11 +10,14 @@ class DiningFacility < ApplicationRecord
|
||||
|
||||
has_many :bookings
|
||||
has_many :current_bookings, -> { left_joins(:sale).assign.merge(Booking.unscoped.where(checkout_at: nil).or(Booking.merge(Sale.unscoped.where(sale_status: ['new', nil])))) }, class_name: "Booking"
|
||||
has_one :current_checkin_booking, -> { left_joins(:sale).assign.merge(Sale.unscoped.where(sale_status: nil)) }, class_name: "Booking"
|
||||
has_one :current_checkin_booking, -> { left_joins(:sale).assign.where(sale_id: nil) }, class_name: "Booking"
|
||||
has_one :current_checkout_booking, -> { left_joins(:sale).assign.where.not(checkout_at: nil).merge(Sale.unscoped.where(sale_status: 'new')) }, class_name: "Booking"
|
||||
has_one :current_reserved_booking, -> { left_joins(:sale).assign.where.not(reserved_at: nil).merge(Sale.unscoped.where(sale_status: nil)) }, class_name: "Booking"
|
||||
|
||||
has_many :current_sales, -> { where(sale_status: 'new').merge(Booking.assign) }, through: :bookings, class_name: "Sale", source: "sale"
|
||||
has_many :current_bookings, -> { left_joins(:sale).assign.merge(Booking.unscoped.where(checkout_at: nil).or(Booking.merge(Sale.unscoped.where(sale_status: ['new', nil])))) }, class_name: "Booking"
|
||||
has_one :current_checkin_booking, -> { left_joins(:sale).assign.where(sale_id: nil) }, class_name: "Booking"
|
||||
has_one :current_checkout_booking, -> { left_joins(:sale).assign.where.not(checkout_at: nil).merge(Sale.unscoped.where(sale_status: 'new')) }, class_name: "Booking"
|
||||
has_one :current_reserved_booking, -> { left_joins(:sale).assign.where.not(reserved_at: nil).merge(Sale.unscoped.where(sale_status: nil)) }, class_name: "Booking"
|
||||
|
||||
TABLE_TYPE = "Table"
|
||||
ROOM_TYPE = "Room"
|
||||
|
||||
@@ -49,99 +49,36 @@ class OrderQueueStation < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
def pay_process_order_queue (order_id, table_id)
|
||||
|
||||
oqs_stations = OrderQueueStation.active
|
||||
|
||||
order = Order.find(order_id)
|
||||
order_items = order.order_items
|
||||
|
||||
# Order.pay_process_order_queue(order_id,table_id)
|
||||
# if order
|
||||
# oqs = OrderQueueStation.new
|
||||
# oqs.process_order(order, table_id)
|
||||
# end
|
||||
# assign_order = AssignedOrderItem.assigned_order_item_by_job(order_id)
|
||||
# if ENV["SERVER_MODE"] == 'cloud'
|
||||
# from = request.subdomain + "." + request.domain
|
||||
# else
|
||||
# from = ""
|
||||
# end
|
||||
# ActionCable.server.broadcast "order_queue_station_channel",order: assign_order,from:from
|
||||
def pay_process_order_queue (order_id, table_id = nil)
|
||||
|
||||
if table_id.to_i > 0
|
||||
# get dining
|
||||
dining = DiningFacility.find(table_id)
|
||||
oqs_by_zones = OrderQueueProcessByZone.where("zone_id=#{dining.zone_id}")
|
||||
booking = Booking.find_by_dining_facility_id(dining.id)
|
||||
|
||||
# ToDo per item per printer
|
||||
|
||||
oqs_by_zones.each do |oqpbz|
|
||||
oqs = OrderQueueStation.find(oqpbz.order_queue_station_id)
|
||||
is_auto_printed = false
|
||||
oqs_order_items = []
|
||||
|
||||
if oqs.is_active
|
||||
#Get List of items -
|
||||
pq_items = JSON.parse(oqs.processing_items)
|
||||
#Loop through the processing items
|
||||
pq_items.each do |pq_item|
|
||||
#Processing through the looping items
|
||||
order_items.each do |order_item|
|
||||
if (pq_item == order_item.item_code)
|
||||
if (order_item.qty > 0)
|
||||
oqs_order_items.push(order_item)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if oqs.auto_print
|
||||
if oqs_order_items.length > 0
|
||||
if oqs.cut_per_item
|
||||
print_slip_item(oqs, order, oqs_order_items)
|
||||
else
|
||||
print_slip(oqs, order, oqs_order_items)
|
||||
end
|
||||
is_auto_printed = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
oqs_stations = dining.order_queue_stations
|
||||
else
|
||||
oqs_stations.each do |oqs|
|
||||
is_auto_printed = false
|
||||
oqs_order_items = []
|
||||
oqs_stations = OrderQueueStation.active
|
||||
end
|
||||
|
||||
if oqs.is_active
|
||||
#Get List of items -
|
||||
pq_items = JSON.parse(oqs.processing_items)
|
||||
#Loop through the processing items
|
||||
pq_items.each do |pq_item|
|
||||
#Processing through the looping items
|
||||
order_items.each do |order_item|
|
||||
if (pq_item == order_item.item_code)
|
||||
if (order_item.qty > 0)
|
||||
oqs_order_items.push(order_item)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
order = Order.find(order_id)
|
||||
order_items = order.order_items
|
||||
|
||||
if oqs.auto_print
|
||||
if oqs_order_items.length > 0
|
||||
if oqs.cut_per_item
|
||||
print_slip_item(oqs, order, oqs_order_items)
|
||||
else
|
||||
print_slip(oqs, order, oqs_order_items)
|
||||
end
|
||||
is_auto_printed = true
|
||||
end
|
||||
assigned_order_items = []
|
||||
oqs_order_items_by_zones = []
|
||||
|
||||
oqs_stations.each do |oqs|
|
||||
oqs_order_items = order_items.select { |i| JSON.parse(oqs.processing_items).include? i.item_code }
|
||||
oqs_order_items_by_zones << { oqs: oqs, oqs_order_items: oqs_order_items }
|
||||
|
||||
if oqs.auto_print
|
||||
if oqs_order_items.length > 0
|
||||
if oqs.cut_per_item
|
||||
print_slip_item(oqs, order, oqs_order_items)
|
||||
else
|
||||
print_slip(oqs, order, oqs_order_items)
|
||||
end
|
||||
end
|
||||
end
|
||||
end #end else
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -118,7 +118,6 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
|
||||
if printed_status != 'Paid' || !Lookup.where(lookup_type: "ReceiptPdfView").pluck(:value).include?('1')
|
||||
#no print in cloud server
|
||||
puts "SERVER_MODE #{ENV["SERVER_MODE"]}"
|
||||
if ENV["SERVER_MODE"] != "cloud"
|
||||
self.print(filename, cashier_terminal.printer_name)
|
||||
end
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
if @status == true
|
||||
json.status :success
|
||||
json.id @order.id
|
||||
json.booking_id @booking.id
|
||||
json.order_id @order.id
|
||||
json.order_items do
|
||||
json.array! @order.order_items, :item_code, :item_name, :qty, :options, :remark
|
||||
end
|
||||
if @sale
|
||||
json.sale_id @sale.sale_id
|
||||
end
|
||||
else
|
||||
json.status :error
|
||||
if @error_messages
|
||||
|
||||
@@ -167,7 +167,7 @@
|
||||
Orders
|
||||
</button>
|
||||
<button class="btn btn-lg bg-blue waves-effect select_table col-md-3" data-toggle="modal" data-target="#TableModal">Select</button>
|
||||
|
||||
|
||||
<div class="row ">
|
||||
<div class="col-md-9 col-lg-9 col-sm-9 ">
|
||||
<strong id="order-title" class="font-14 p-l-10">ORDER DETAILS </strong>
|
||||
@@ -432,80 +432,53 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="TableModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header" style="margin-top: -1rem;">
|
||||
<!-- <h4 class="modal-title" id="TableModalLabel">Select Table</h4> -->
|
||||
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;">×</button>
|
||||
</div>
|
||||
<div class="modal-body" style="margin-top: -0.75rem;padding-top:5px">
|
||||
<%@zone.each do |zone| %>
|
||||
<h5>Zone : <%=zone.name%></h5>
|
||||
<div class="card-columns" style="column-count: 7;">
|
||||
<%zone.tables.each do |table| %>
|
||||
<% if table.status == 'occupied' %>
|
||||
<% if table.get_booking.nil? %>
|
||||
<% if table.get_checkout_booking.nil? %>
|
||||
<% color="red"%>
|
||||
<% else %>
|
||||
<% color="orange"%>
|
||||
<% end %>
|
||||
|
||||
<% else %>
|
||||
<% if table.get_checkout_booking.nil? %>
|
||||
<% color="blue"%>
|
||||
<% else %>
|
||||
<% color="orange"%>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% color="green"%>
|
||||
<% end %>
|
||||
<div class="card tables <%=color%> text-white table_<%= table.id %>" data-id="<%= table.id %>" data-type="<%= table.type %>" data-name="<%= table.name %>">
|
||||
<div class="card-block">
|
||||
<%= table.name %>
|
||||
</div>
|
||||
</div>
|
||||
<%end%>
|
||||
|
||||
<%zone.rooms.each do |table| %>
|
||||
<% if table.status == 'occupied' %>
|
||||
<% if table.get_booking.nil? %>
|
||||
<% if table.get_checkout_booking.nil? %>
|
||||
<% color="red"%>
|
||||
<% else %>
|
||||
<% color="orange"%>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% if table.get_checkout_booking.nil? %>
|
||||
<% color="blue"%>
|
||||
<% else %>
|
||||
<% color="orange"%>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% color="green"%>
|
||||
<% end %>
|
||||
<div class="card tables <%=color%> text-white table_<%= table.id %>" data-id="<%= table.id %>" data-type="<%= table.type %>" data-name="<%= table.name %>">
|
||||
<div class="card-block">
|
||||
<%= table.name %>
|
||||
</div>
|
||||
</div>
|
||||
<%end%>
|
||||
</div>
|
||||
<%end%>
|
||||
<div class="modal-footer p-r-30">
|
||||
<button type="button" class="btn btn-link btn-danger waves-effect" data-dismiss="modal">CLOSE</button>
|
||||
|
||||
<button type="button" class="btn btn-link bg-blue waves-effect confirm_table" data-dismiss="modal">Confirm</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal fade" id="TableModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header" style="margin-top: -1rem;">
|
||||
<!-- <h4 class="modal-title" id="TableModalLabel">Select Table</h4> -->
|
||||
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;">×</button>
|
||||
</div>
|
||||
<div class="modal-body" style="margin-top: -0.75rem;padding-top:5px">
|
||||
<%@zone.each do |zone| %>
|
||||
<h5>Zone : <%=zone.name%></h5>
|
||||
<div class="card-columns" style="column-count: 7;">
|
||||
<%zone.tables.each do |table| %>
|
||||
<% if table.status == 'occupied' %>
|
||||
<% color="red"%>
|
||||
<% else %>
|
||||
<% color="green"%>
|
||||
<% end %>
|
||||
<div class="card tables <%=color%> text-white table_<%= table.id %>" data-id="<%= table.id %>" data-type="<%= table.type %>" data-name="<%= table.name %>">
|
||||
<div class="card-block">
|
||||
<%= table.name %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%end%>
|
||||
|
||||
<%zone.rooms.each do |table| %>
|
||||
<% if table.status == 'occupied' %>
|
||||
<% color="red"%>
|
||||
<% else %>
|
||||
<% color="green"%>
|
||||
<% end %>
|
||||
<div class="card tables <%=color%> text-white table_<%= table.id %>" data-id="<%= table.id %>" data-type="<%= table.type %>" data-name="<%= table.name %>">
|
||||
<div class="card-block">
|
||||
<%= table.name %>
|
||||
</div>
|
||||
</div>
|
||||
<%end%>
|
||||
</div>
|
||||
<%end%>
|
||||
<div class="modal-footer p-r-30">
|
||||
<button type="button" class="btn btn-link btn-danger waves-effect" data-dismiss="modal">CLOSE</button>
|
||||
|
||||
<button type="button" class="btn btn-link bg-blue waves-effect confirm_table" data-dismiss="modal">Confirm</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="server_mode" value="<%=ENV["SERVER_MODE"]%>" id="server_mode">
|
||||
</div>
|
||||
@@ -555,7 +528,7 @@ $(document).ready(function () {
|
||||
$('#table_type').text(type);
|
||||
$('.select_table').text(name);
|
||||
});
|
||||
$('#app_order').on('click', function () {
|
||||
$('#app_order').on('click', function () {
|
||||
window.location.href = '/en/foodcourt/app_orders';
|
||||
});
|
||||
|
||||
@@ -574,7 +547,7 @@ $(document).ready(function () {
|
||||
show_menu_cat_list(name, url);
|
||||
}
|
||||
});
|
||||
//End menu category Click
|
||||
//End menu category Click
|
||||
|
||||
function getAllMenu(){
|
||||
$.ajax({
|
||||
|
||||
@@ -201,7 +201,7 @@
|
||||
<div class="card-block h-100 d-flex flex-column">
|
||||
<div>
|
||||
<span class="font-14 float-left d-inline"><b>Booking</b> - <%=@booking.booking_id%></span>
|
||||
<span class="font-14 float-right d-inline"><b>Order No</b> - <%=@booking.order_id%></span>
|
||||
<span class="font-14 float-right d-inline"><b>Order No</b> - <%=@booking.order_id%></span>
|
||||
</div>
|
||||
<div class="card-text h-100" id="foodcourt-table-slimscroll" style="overflow-y: auto">
|
||||
<table class="table table-striped summary-items fixed-header">
|
||||
@@ -271,12 +271,17 @@
|
||||
<div class="card" style="height: 100%; margin-bottom: 10px;">
|
||||
<div class="card-header">
|
||||
<div>
|
||||
<strong id="order-title">INVOICE DETAILS </strong>| Table - <%= @pending.dining_facility.name rescue "" %>
|
||||
<% if @status == 'sale' %>
|
||||
<% table_name = @pending.try(:booking).try(:dining_facility).try(:name) %>
|
||||
<% elsif @status == 'order' %>
|
||||
<% table_name = @pending.try(:dining_facility).try(:name) %>
|
||||
<% end %>
|
||||
<strong id="order-title">INVOICE DETAILS </strong>| Table - <%= table_name %>
|
||||
</div>
|
||||
<div class="row p-l-5 p-r-5">
|
||||
<% if @status == 'sale' || @pending.try(:sale_status) == 'completed' || @pending.try(:sale_status) == 'void' %>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
Receipt No:
|
||||
Receipt No:
|
||||
<span id="receipt_no">
|
||||
<%= @pending.receipt_no rescue '' %>
|
||||
</span>
|
||||
@@ -380,7 +385,7 @@
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
||||
@@ -440,7 +445,7 @@
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="modal fade" id="voidModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
|
||||
@@ -757,53 +757,32 @@ $(document).ready(function(){
|
||||
var sale_id = $('#sale_id').text();
|
||||
// var item_row = $('.is_card');
|
||||
|
||||
// payment
|
||||
var cash = $('#cash').text();
|
||||
var credit = $('#credit').text();
|
||||
var card = $('#card').text();
|
||||
var kbz_amt = "<%= @kbz_pay_amount %>";
|
||||
var is_kbz = false;
|
||||
if (kbz_amt > 0) {
|
||||
is_kbz = true
|
||||
}
|
||||
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
|
||||
var receipt_no = ($("#receipt_no").html()).trim();
|
||||
deleteReceiptNoInFirstBillData(receipt_no);
|
||||
}
|
||||
|
||||
var tax_type = localStorage.getItem("tax_type") ? localStorage.getItem("tax_type") : 'all';
|
||||
// calculate_member_discount(sale_id,tax_type);
|
||||
/* check credit payment or not*/
|
||||
var url = "<%= foodcourt_payment_cash_path %>";
|
||||
$.ajax({type: "POST",
|
||||
url: url,
|
||||
data: "cash="+ cash + "&sale_id=" + sale_id + "&type=" + cashier_type + "&tax_type=" + tax_type + "&is_kbz=" + is_kbz+"&account_no="+customer_mamber_card_no,
|
||||
success:function(result) {
|
||||
/* start delete receipt no in first bill*/
|
||||
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
|
||||
var receipt_no = ($("#receipt_no").html()).trim();
|
||||
deleteReceiptNoInFirstBillData(receipt_no);
|
||||
}
|
||||
/* end delete receipt no in first bill*/
|
||||
localStorage.removeItem("cash");
|
||||
swal({
|
||||
title: "Payment Successful!",
|
||||
text: "Thank You !",
|
||||
type: 'success',
|
||||
html: true,
|
||||
closeOnConfirm: true,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
},
|
||||
function (isConfirm) {
|
||||
$("#loading_wrapper").show();
|
||||
$('.confirm').attr("disabled","disabled");
|
||||
window.location.href = "<%= foodcourt_food_court_path %>";
|
||||
});
|
||||
$("#loading_wrapper").hide();
|
||||
}
|
||||
});
|
||||
$("#loading_wrapper").hide();
|
||||
|
||||
var second_display_lookup = $("#display_type").val();
|
||||
if ($('#server_mode').val() != "cloud" && second_display_lookup == 2){
|
||||
customer_display_view(null,"reload");
|
||||
}
|
||||
|
||||
swal({
|
||||
title: "Payment Successful!",
|
||||
text: "Thank You !",
|
||||
type: 'success',
|
||||
html: true,
|
||||
closeOnConfirm: true,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
},
|
||||
function (isConfirm) {
|
||||
$("#loading_wrapper").show();
|
||||
$('.confirm').attr("disabled","disabled");
|
||||
window.location.href = "<%= foodcourt_food_court_path %>";
|
||||
});
|
||||
} else {
|
||||
var insufficient_message = result.message + '<br> Card balance : ' + customer_card_balance
|
||||
swal({
|
||||
@@ -815,7 +794,7 @@ $(document).ready(function(){
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
location.reload();
|
||||
window.location.href = '/foodcourt/food_court';
|
||||
});
|
||||
$("#loading_wrapper").hide();
|
||||
}
|
||||
|
||||
@@ -14,4 +14,3 @@
|
||||
- default
|
||||
- [high_priority, 2]
|
||||
:demon: true
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class AddIndexSaleIdOnBookings < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
add_index :bookings, [:shop_code, :sale_id]
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user