change saleitem query and js for order reservation
This commit is contained in:
@@ -157,3 +157,15 @@ $(document).ready(function() {
|
||||
}
|
||||
//end Notificaiotn message
|
||||
});
|
||||
|
||||
/* start order reservation function */
|
||||
function audioPlayBackground(shop_code,audio){
|
||||
// console.log(shop_code);
|
||||
//audio play
|
||||
var audio = new Audio('/'+audio); // define your audio
|
||||
// setTimeout(function(){
|
||||
// audio.loop = true;
|
||||
audio.play();
|
||||
// },10000);
|
||||
}
|
||||
/* end order reservation function */
|
||||
@@ -1,3 +1,5 @@
|
||||
//= require custom.js
|
||||
|
||||
$(function() {
|
||||
$("#discount").hide();
|
||||
$(".expected_time").hide();
|
||||
@@ -307,8 +309,8 @@ function show_order_detail(url,sr_no){
|
||||
item_price = items[i].unit_price;
|
||||
}
|
||||
var total = items[i].qty * item_price;
|
||||
if(items[i].options!='[]'){
|
||||
row = '<tr>'
|
||||
if(items[i].options!='[]' && items[i].options!="" && items[i].options!=null){
|
||||
row = '<tr>'
|
||||
+'<td width ="70%" class="body-td align-left">'+items[i].item_name
|
||||
+' <br>'
|
||||
+' <i><span class="font-12">'+items[i].options+'</span></i><br>'+
|
||||
@@ -579,16 +581,4 @@ function timeFormat(date){
|
||||
(isPM ? ' PM' : ' AM');
|
||||
return time;
|
||||
}
|
||||
/* end order reservation function */
|
||||
|
||||
/* start order reservation function */
|
||||
function audioPlayBackground(shop_code,audio){
|
||||
// console.log(shop_code);
|
||||
//audio play
|
||||
var audio = new Audio('/'+audio); // define your audio
|
||||
// setTimeout(function(){
|
||||
// audio.loop = true;
|
||||
audio.play();
|
||||
// },10000);
|
||||
}
|
||||
/* end order reservation function */
|
||||
@@ -322,13 +322,10 @@ class OrderReservation < ApplicationRecord
|
||||
if order_reservation.length > 0
|
||||
if ENV["SERVER_MODE"] == 'cloud'
|
||||
from = request.subdomain + "." + request.domain
|
||||
ActionCable.server.broadcast "check_new_order_channel",data: order_reservation, shop_code: shop_code,from:from
|
||||
else
|
||||
from = ""
|
||||
end
|
||||
# if ENV["SERVER_MODE"] == 'cloud'
|
||||
# ActionCable.server.broadcast "check_new_order_channel",data: order_reservation, shop_code: shop_code
|
||||
# end
|
||||
ActionCable.server.broadcast "check_new_order_channel",data: order_reservation, shop_code: shop_code,from:from
|
||||
end
|
||||
end
|
||||
|
||||
@@ -343,13 +340,10 @@ class OrderReservation < ApplicationRecord
|
||||
if order_reservation.length > 0
|
||||
if ENV["SERVER_MODE"] == 'cloud'
|
||||
from = request.subdomain + "." + request.domain
|
||||
ActionCable.server.broadcast "check_order_send_to_kitchen_channel",data: order_reservation, shop_code: shop_code,from:from
|
||||
else
|
||||
from = ""
|
||||
end
|
||||
# if ENV["SERVER_MODE"] == 'cloud'
|
||||
# ActionCable.server.broadcast "check_order_send_to_kitchen_channel",data: order_reservation, shop_code: shop_code
|
||||
# end
|
||||
ActionCable.server.broadcast "check_order_send_to_kitchen_channel",data: order_reservation, shop_code: shop_code,from:from
|
||||
end
|
||||
end
|
||||
|
||||
@@ -364,10 +358,10 @@ class OrderReservation < ApplicationRecord
|
||||
if order_reservation.length > 0
|
||||
if ENV["SERVER_MODE"] == 'cloud'
|
||||
from = request.subdomain + "." + request.domain
|
||||
ActionCable.server.broadcast "check_order_ready_to_delivery_channel",data: order_reservation, shop_code: shop_code,from:from
|
||||
else
|
||||
from = ""
|
||||
end
|
||||
ActionCable.server.broadcast "check_order_ready_to_delivery_channel",data: order_reservation, shop_code: shop_code,from:from
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -870,9 +870,9 @@ def self.get_item_query(type)
|
||||
elsif type == "discount"
|
||||
sale_type = "i.status = 'Discount'"
|
||||
elsif type == "foc"
|
||||
sale_type = "i.status = 'foc' and i.qty > 0"
|
||||
sale_type = "i.status = 'foc' and i.item_instance_code IS NOT NULL and i.qty > 0"
|
||||
elsif type == "void"
|
||||
sale_type = "i.status = 'void' and i.qty > 0"
|
||||
sale_type = "i.status = 'void' and i.item_instance_code IS NOT NULL and i.qty > 0"
|
||||
elsif type == "other"
|
||||
sale_type = "i.item_instance_code IS NULL"
|
||||
end
|
||||
@@ -907,12 +907,8 @@ end
|
||||
|
||||
def self.get_by_shift_items(shift_sale_range, shift, from, to, status,type)
|
||||
# date_type_selection = get_sql_function_for_report_type(report_type)
|
||||
if type == "other"
|
||||
other_charges = self.get_other_charges()
|
||||
query = self.get_item_query(type)
|
||||
else
|
||||
query = self.get_item_query(type)
|
||||
end
|
||||
|
||||
query = self.get_item_query(type)
|
||||
|
||||
discount_query = 0
|
||||
total_card_amount = 0
|
||||
@@ -921,12 +917,16 @@ def self.get_by_shift_items(shift_sale_range, shift, from, to, status,type)
|
||||
total_foc_amount = 0
|
||||
total_grand_total = 0
|
||||
|
||||
other_charges = self.get_other_charges()
|
||||
if type.nil? || type == 'all' || type == "other"
|
||||
other_charges = self.get_other_charges()
|
||||
end
|
||||
product = self.get_product_sale()
|
||||
|
||||
if shift.present?
|
||||
query = query.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift.to_a)
|
||||
other_charges = other_charges.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift.to_a)
|
||||
if type.nil? || type == 'all' || type == "other"
|
||||
other_charges = other_charges.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift.to_a)
|
||||
end
|
||||
product = product.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift.to_a)
|
||||
discount_query = Sale.where("sales.shift_sale_id in (?) and sale_status= 'completed' ", shift.to_a).sum(:total_discount)
|
||||
change_amount = Sale.where("sales.shift_sale_id in (?) and sale_status= 'completed' ", shift.to_a).sum(:amount_changed)
|
||||
@@ -947,7 +947,9 @@ def self.get_by_shift_items(shift_sale_range, shift, from, to, status,type)
|
||||
### => get all sales range in shift_sales
|
||||
elsif shift_sale_range.present?
|
||||
query = query.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift_sale_range.to_a)
|
||||
other_charges = other_charges.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift_sale_range.to_a)
|
||||
if type.nil? || type == 'all' || type == "other"
|
||||
other_charges = other_charges.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift_sale_range.to_a)
|
||||
end
|
||||
product = product.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift_sale_range.to_a)
|
||||
discount_query = Sale.where("sales.shift_sale_id IN (?) and sale_status ='completed'", shift_sale_range.to_a).sum(:total_discount)
|
||||
change_amount = Sale.where("sales.shift_sale_id IN (?) and sale_status ='completed'", shift_sale_range.to_a).sum(:amount_changed)
|
||||
@@ -968,7 +970,9 @@ def self.get_by_shift_items(shift_sale_range, shift, from, to, status,type)
|
||||
|
||||
else
|
||||
query = query.where("sales.receipt_date between ? and ? and sale_status='completed'",from,to)
|
||||
other_charges = other_charges.where("sales.receipt_date between ? and ? and sale_status='completed'",from,to)
|
||||
if type.nil? || type == 'all' || type == "other"
|
||||
other_charges = other_charges.where("sales.receipt_date between ? and ? and sale_status='completed'",from,to)
|
||||
end
|
||||
product = product.where("sales.receipt_date between ? and ? and sale_status='completed'",from,to)
|
||||
discount_query = Sale.where("sales.receipt_date between ? and ? and sale_status ='completed'", from,to).sum(:total_discount)
|
||||
change_amount = Sale.where("sales.receipt_date between ? and ? and sale_status ='completed'", from,to).sum(:amount_changed)
|
||||
|
||||
Reference in New Issue
Block a user