conflict data
This commit is contained in:
@@ -105,6 +105,11 @@ Change type in mysql
|
||||
|
||||
For split bill
|
||||
1) settings/lookups => { type:split_bill, name:SplitBill, value:1 }
|
||||
|
||||
###please open
|
||||
sudo cat /etc/sudoers
|
||||
### cope and parse
|
||||
%superuser ALL=(ALL) NOPASSWD: ALL
|
||||
|
||||
* ToDo list
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ $(document).on('turbolinks:load', function() {
|
||||
$(this).addClass('oqs_active');
|
||||
$(".queue_station").addClass('queue_station_box');
|
||||
var oqs_id = $(this).find(".oqs-id").text();
|
||||
console.log(oqs_id)
|
||||
var url = 'oqs/get_items/'+oqs_id;
|
||||
|
||||
show_details(url);
|
||||
|
||||
@@ -7,15 +7,27 @@ App.call_waiter = App.cable.subscriptions.create('CallWaiterChannel', {
|
||||
|
||||
received: function(data) {
|
||||
table = data.table
|
||||
time = data.time
|
||||
|
||||
// for Notificaiotn message
|
||||
var element = "#notify-wrapper"
|
||||
var placementFrom = "top";
|
||||
var placementAlign = "center";
|
||||
var animateEnter = "";
|
||||
var animateExit = "";
|
||||
var colorName = "alert-warning";
|
||||
var text = " Calling Waiter <br> "+table.name ;
|
||||
|
||||
if (time == 'print_error') {
|
||||
var colorName = "alert-danger";
|
||||
var placementFrom = "center";
|
||||
var placementAlign = "center";
|
||||
var text = " Hello <br> "+table ;
|
||||
style =""
|
||||
}else{
|
||||
var colorName = "alert-warning";
|
||||
var placementFrom = "top";
|
||||
var placementAlign = "center";
|
||||
var text = " Calling Waiter <br> "+table.name ;
|
||||
style ="width:180px !important;"
|
||||
}
|
||||
|
||||
|
||||
if (text != null || colorName != null){
|
||||
showNotification(element, colorName, text, placementFrom, placementAlign, animateEnter, animateExit);
|
||||
@@ -43,7 +55,7 @@ App.call_waiter = App.cable.subscriptions.create('CallWaiterChannel', {
|
||||
enter: animateEnter,
|
||||
exit: animateExit
|
||||
},
|
||||
template: '<div data-notify="container" style="width:180px !important;" class="bootstrap-notify-container alert alert-dismissible {0} ' + (allowDismiss ? "p-r-30" : "") + '" role="alert">' +
|
||||
template: '<div data-notify="container" style="'+style+'" class="bootstrap-notify-container alert alert-dismissible {0} ' + (allowDismiss ? "p-r-30" : "") + '" role="alert">' +
|
||||
'<button type="button" aria-hidden="true" class="close notify-close float-right m-l-5 m-t--5" data-notify="dismiss">×</button>' +
|
||||
'<span data-notify="icon"></span> ' +
|
||||
'<span data-notify="title">{1}</span> ' +
|
||||
|
||||
@@ -46,7 +46,8 @@ class Api::BillController < Api::ApiController
|
||||
|
||||
Promotion.promo_activate(@sale)
|
||||
|
||||
BillBroadcastJob.perform_later(table)
|
||||
#BillBroadcastJob.perform_later(table)
|
||||
ActionCable.server.broadcast "bill_channel",table: table
|
||||
else
|
||||
@status = false
|
||||
@error_message = "No Current Open Shift"
|
||||
|
||||
@@ -5,7 +5,8 @@ class Api::CallWaitersController < ActionController::API
|
||||
@table_id = params[:dining_id]
|
||||
@time = params[:time]
|
||||
@table = DiningFacility.find(@table_id)
|
||||
CallWaiterJob.perform_later(@table,@time)
|
||||
# CallWaiterJob.perform_later(@table,@time)
|
||||
ActionCable.server.broadcast "call_waiter_channel",table: @table,time:@time
|
||||
|
||||
# get printer info
|
||||
@shop = Shop::ShopDetail
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class Oqs::HomeController < BaseOqsController
|
||||
def index
|
||||
|
||||
@queue_stations = OrderQueueStation.all
|
||||
|
||||
|
||||
# Query for OQS with delivery status false
|
||||
# @queue_items_details = queue_items_query(false)
|
||||
@@ -11,6 +11,8 @@ class Oqs::HomeController < BaseOqsController
|
||||
|
||||
@filter = params[:filter]
|
||||
|
||||
@queue_stations = queue_items_count_query(false,@filter)
|
||||
|
||||
@queue_completed_item = completed_order(@filter)
|
||||
if !@queue_completed_item.empty?
|
||||
@queue_completed_item.each do |queue_item|
|
||||
@@ -26,12 +28,12 @@ class Oqs::HomeController < BaseOqsController
|
||||
end
|
||||
end
|
||||
|
||||
if !@filter.nil?
|
||||
@count = queue_items_count_query(false,@filter)
|
||||
# if !@filter.nil?
|
||||
# @count = queue_items_count_query(false,@filter)
|
||||
# @count.each do |count|
|
||||
|
||||
# end
|
||||
end
|
||||
# end
|
||||
|
||||
# @queue_stations_items=Array.new
|
||||
|
||||
@@ -99,7 +101,6 @@ class Oqs::HomeController < BaseOqsController
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
render :json => items.to_json
|
||||
end
|
||||
|
||||
@@ -194,18 +195,38 @@ class Oqs::HomeController < BaseOqsController
|
||||
# completed_order = AssignedOrderItem.group(:order_id).where('delivery_status=true');
|
||||
end
|
||||
|
||||
# def queue_items_count_query(status,filter)
|
||||
# query = AssignedOrderItem.select("count(odt.item_code) as total,oqs.id as station_id")
|
||||
# .joins(" left join order_queue_stations as oqs on oqs.id = assigned_order_items.order_queue_station_id
|
||||
# left join orders as od ON od.order_id = assigned_order_items.order_id
|
||||
# left join order_items as odt ON odt.item_instance_code = assigned_order_items.instance_code AND odt.order_id = assigned_order_items.order_id
|
||||
# left join customers as cus ON cus.customer_id = od.customer_id
|
||||
# left join booking_orders as bo on bo.order_id = assigned_order_items.order_id
|
||||
# left join bookings as bk on bk.booking_id = bo.booking_id
|
||||
# left join dining_facilities as df on df.id = bk.dining_facility_id")
|
||||
# .where("assigned_order_items.delivery_status = #{status} AND assigned_order_items.created_at >= '#{Time.now.beginning_of_day.utc}' ")
|
||||
# query = query.where("df.name LIKE ? OR odt.order_id LIKE ? OR odt.item_name LIKE ? OR cus.name = '#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%",)
|
||||
# .group("oqs.id")
|
||||
|
||||
# end
|
||||
|
||||
def queue_items_count_query(status,filter)
|
||||
query = AssignedOrderItem.select("count(odt.item_code) as total,oqs.id as station_id")
|
||||
.joins(" left join order_queue_stations as oqs on oqs.id = assigned_order_items.order_queue_station_id
|
||||
left join orders as od ON od.order_id = assigned_order_items.order_id
|
||||
left join order_items as odt ON odt.item_instance_code = assigned_order_items.instance_code AND odt.order_id = assigned_order_items.order_id
|
||||
query = OrderQueueStation.select("order_queue_stations.is_active as is_active,
|
||||
order_queue_stations.id as station_id,
|
||||
order_queue_stations.station_name as station_name,
|
||||
order_queue_stations.auto_print as auto_print,
|
||||
order_queue_stations.id as id,
|
||||
count(odt.item_code) as total")
|
||||
.joins(" left join assigned_order_items as aoi on aoi.order_queue_station_id= order_queue_stations.id
|
||||
left join orders as od ON od.order_id = aoi.order_id
|
||||
left join order_items as odt ON odt.item_instance_code = aoi.instance_code AND odt.order_id = aoi.order_id
|
||||
left join customers as cus ON cus.customer_id = od.customer_id
|
||||
left join booking_orders as bo on bo.order_id = assigned_order_items.order_id
|
||||
left join booking_orders as bo on bo.order_id = aoi.order_id
|
||||
left join bookings as bk on bk.booking_id = bo.booking_id
|
||||
left join dining_facilities as df on df.id = bk.dining_facility_id")
|
||||
.where("assigned_order_items.delivery_status = #{status} AND assigned_order_items.created_at >= '#{Time.now.beginning_of_day.utc}' ")
|
||||
.where("aoi.delivery_status = #{status} AND aoi.created_at >= '#{Time.now.beginning_of_day.utc}' ")
|
||||
query = query.where("df.name LIKE ? OR odt.order_id LIKE ? OR odt.item_name LIKE ? OR cus.name = '#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%",)
|
||||
.group("oqs.id")
|
||||
.group("order_queue_stations.id")
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -155,6 +155,14 @@ class DiningFacility < ApplicationRecord
|
||||
def self.check_in_booking(table_id)
|
||||
table = DiningFacility.find(table_id)
|
||||
#Send to background job for processing
|
||||
CheckInBookingJob.perform_later(table)
|
||||
# CheckInBookingJob.perform_later(table)
|
||||
ActionCable.server.broadcast "check_in_booking_channel",table: table
|
||||
end
|
||||
|
||||
def self.checkin_time
|
||||
table = DiningFacility.get_checkin_booking
|
||||
if table.length > 0
|
||||
ActionCable.server.broadcast "checkin_channel",table: table
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -278,16 +278,42 @@ class Order < ApplicationRecord
|
||||
#Process order items and send to order queue
|
||||
def process_order_queue
|
||||
#Send to background job for processing
|
||||
OrderQueueProcessorJob.perform_later(self.id, self.table_id)
|
||||
end
|
||||
|
||||
cup_status = `#{"sudo service cups status"}`
|
||||
print_status = check_cup_status(cup_status)
|
||||
|
||||
if print_status
|
||||
OrderQueueProcessorJob.perform_later(self.id, self.table_id)
|
||||
else
|
||||
cup_start = `#{"sudo service cups start"}`
|
||||
cup_status = `#{"sudo service cups status"}`
|
||||
print_status = check_cup_status(cup_status)
|
||||
|
||||
if print_status
|
||||
OrderQueueProcessorJob.perform_later(self.id, self.table_id)
|
||||
else
|
||||
msg = ' Print Error ! Please contact to service'
|
||||
ActionCable.server.broadcast "call_waiter_channel",table: msg,time:'print_error'
|
||||
OrderQueueProcessorJob.perform_later(self.id, self.table_id)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def check_cup_status(status)
|
||||
if status.include? "Active: active (running)" || "Active: active (exited)" #"Cup Server is already running"
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
#send order items and send to order queue
|
||||
def send_order_broadcast(booking)
|
||||
table = DiningFacility.find(booking.dining_facility_id)
|
||||
type = 'order'
|
||||
#Send to background job for processing
|
||||
OrderBroadcastJob.perform_later(table,type)
|
||||
# OrderBroadcastJob.perform_later(table,type)
|
||||
ActionCable.server.broadcast "order_channel",table: table,type:type
|
||||
end
|
||||
|
||||
#Origami: Cashier : to view order Table
|
||||
|
||||
@@ -128,7 +128,9 @@ class Sale < ApplicationRecord
|
||||
booking.checkout_by = requested_by.name
|
||||
booking.save
|
||||
|
||||
InventoryJob.perform_now(self.id)
|
||||
# InventoryJob.perform_now(self.id)
|
||||
saleObj = Sale.find(self.id)
|
||||
InventoryDefinition.calculate_product_count(saleObj)
|
||||
|
||||
return true, self.id
|
||||
end
|
||||
@@ -137,6 +139,41 @@ class Sale < ApplicationRecord
|
||||
|
||||
end
|
||||
|
||||
#fOR Quick Service pay and create
|
||||
def self.request_bill(order,current_user,current_login_employee)
|
||||
@sale = Sale.new
|
||||
sale_order=SaleOrder.new
|
||||
|
||||
if shift = ShiftSale.current_open_shift(current_user.id)
|
||||
order_id = order.order_id # order_id
|
||||
bk_order = BookingOrder.find_by_order_id(order_id)
|
||||
check_booking = Booking.find_by_booking_id(bk_order.booking_id)
|
||||
|
||||
if check_booking.sale_id.nil?
|
||||
# Create Sale if it doesn't exist
|
||||
# puts "current_login_employee"
|
||||
# puts current_login_employee.name
|
||||
@status, @sale_id = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee, cashier = nil)
|
||||
@sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
@sale_items = SaleItem.where("sale_id=?",@sale_id)
|
||||
else
|
||||
@sale_data = Sale.find_by_sale_id(check_booking.sale_id)
|
||||
@sale_items = SaleItem.where("sale_id=?",@sale_data.sale_id)
|
||||
end
|
||||
|
||||
# Bind shift sale id to sale
|
||||
@sale_data.shift_sale_id = shift.id
|
||||
@sale_data.save
|
||||
|
||||
# Promotion Activation
|
||||
Promotion.promo_activate(@sale)
|
||||
@status = true
|
||||
return @status, @sale
|
||||
else
|
||||
@status = false
|
||||
@message = "No Current Open Shift for This Employee"
|
||||
end
|
||||
end
|
||||
#This is when spilt bill is request - then we cannot link order to invoice
|
||||
#Cos there will be multiple orders - and items are spilt from there.
|
||||
#Unless order is spilt by then it is possible.
|
||||
|
||||
@@ -335,7 +335,7 @@ class SalePayment < ApplicationRecord
|
||||
|
||||
#record an payment in sale-audit
|
||||
remark = "#{response} Rebate- for Customer #{self.sale.customer_id} | Sale Id [#{self.sale.sale_id}]| pay amount -> #{self.received_amount} "
|
||||
sale_audit = SaleAudit.record_paymal(self.sale.sale_id, remark, 1)
|
||||
sale_audit = SaleAudit.record_paymal(sObj.sale_id, remark, 1)
|
||||
|
||||
if !response.nil?
|
||||
if response["status"] == true
|
||||
@@ -409,7 +409,8 @@ class SalePayment < ApplicationRecord
|
||||
|
||||
type = 'payment'
|
||||
#Send to background job for processing
|
||||
OrderBroadcastJob.perform_later(table,type)
|
||||
# OrderBroadcastJob.perform_later(table,type)
|
||||
ActionCable.server.broadcast "order_channel",table: table,type:type
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -36,19 +36,10 @@
|
||||
<p class="hidden oqs-id"><%= qsi.id %></p>
|
||||
<a class="nav-link" data-id="<%= qsi.id %>" data-toggle="tab" href="" role="tab" <%= status %>>
|
||||
<%= qsi.station_name %>
|
||||
<% if @filter.nil? %>
|
||||
<span class="badge bg-blue-grey oqs_count<%= i%> oqs_count" data-id="<%= qsi.id %>" id="completed_count">
|
||||
<!-- <span class="badge badge-pill badge-default oqs_count<%= i%> oqs_count" data-id="<%= qsi.id %>"> --> <%= qsi.assigned_order_items.where("delivery_status=0 AND created_at >= '#{Time.now.beginning_of_day.utc}'").count %>
|
||||
</span>
|
||||
<%else%>
|
||||
<span class="label-count badge bg-blue-grey" data-id="<%= qsi.id %>">
|
||||
<% @count.each do |c|%>
|
||||
<% if qsi.id == c.station_id %>
|
||||
<%= c.total %>
|
||||
<%end %>
|
||||
<%end %>
|
||||
</span>
|
||||
<%end%>
|
||||
<span class="badge bg-blue-grey oqs_count<%= i%> oqs_count" data-id="<%= qsi.id %>" id="completed_count">
|
||||
<!-- <span class="badge badge-pill badge-default oqs_count<%= i%> oqs_count" data-id="<%= qsi.id %>"> --> <%= qsi.total %>
|
||||
</span>
|
||||
|
||||
<% if qsi.auto_print %>
|
||||
<span>(ap)</span>
|
||||
<% end %>
|
||||
|
||||
@@ -214,7 +214,7 @@
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<button type="button" class="btn bg-default btn-block " id='back'><i class="material-icons">reply</i>Back</button>
|
||||
<% if @sale_status != 'completed' %>
|
||||
<button type="button" class="btn bg-blue btn-block" id='move'>MOVE</button>
|
||||
<!-- <button type="button" class="btn bg-blue btn-block" id='move'>MOVE</button> -->
|
||||
<% end %>
|
||||
<!-- <button type="button" id="re-print" class="btn btn-primary btn-block">Re.Print</button> -->
|
||||
</div>
|
||||
|
||||
@@ -11,5 +11,5 @@ every 30.minutes do
|
||||
end
|
||||
|
||||
every 1.minutes do
|
||||
runner "CheckinJob.perform"
|
||||
runner "DiningFacility.checkin_time"
|
||||
end
|
||||
Reference in New Issue
Block a user