merge with master
This commit is contained in:
@@ -949,7 +949,7 @@ $(function() {
|
|||||||
$(sub_category).removeClass('hidden');
|
$(sub_category).removeClass('hidden');
|
||||||
for(var i in data) {
|
for(var i in data) {
|
||||||
|
|
||||||
row = '<li class="menu_category" data-id="'+data[i].id+'">'
|
row = '<li class="menu_category fadeInTop animated" data-id="'+data[i].id+'">'
|
||||||
+'<a class="nav-link" data-toggle="tab" href="" role="tab">'+ data[i].name+'</a>'
|
+'<a class="nav-link" data-toggle="tab" href="" role="tab">'+ data[i].name+'</a>'
|
||||||
+'</li>' ;
|
+'</li>' ;
|
||||||
$(sub_category).append(row);
|
$(sub_category).append(row);
|
||||||
|
|||||||
@@ -5,10 +5,15 @@ App.order = App.cable.subscriptions.create('BillChannel', {
|
|||||||
|
|
||||||
disconnected: function() {},
|
disconnected: function() {},
|
||||||
|
|
||||||
received: function(data) {
|
received: function(data) {
|
||||||
$('.table_'+data.table.id).removeClass('blue');
|
if($('.table_'+data.table.id).hasClass('blue')){
|
||||||
$('.table_'+data.table.id).addClass('red');
|
$('.table_'+data.table.id).removeClass('blue');
|
||||||
$('.new_text_'+data.table.id).removeClass('hide')
|
$('.table_'+data.table.id).addClass('red');
|
||||||
|
}else{
|
||||||
|
$('.table_'+data.table.id).removeClass('orange');
|
||||||
|
$('.table_'+data.table.id).addClass('red');
|
||||||
|
}
|
||||||
|
$('.new_text_'+data.table.id).removeClass('hide');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ App.call_waiter = App.cable.subscriptions.create('CallWaiterChannel', {
|
|||||||
table = data.table
|
table = data.table
|
||||||
|
|
||||||
// for Notificaiotn message
|
// for Notificaiotn message
|
||||||
|
var element = "#notify-wrapper"
|
||||||
var placementFrom = "top";
|
var placementFrom = "top";
|
||||||
var placementAlign = "center";
|
var placementAlign = "center";
|
||||||
var animateEnter = "";
|
var animateEnter = "";
|
||||||
@@ -17,21 +18,22 @@ App.call_waiter = App.cable.subscriptions.create('CallWaiterChannel', {
|
|||||||
var text = " Calling Waiter <br> "+table.name ;
|
var text = " Calling Waiter <br> "+table.name ;
|
||||||
|
|
||||||
if (text != null || colorName != null){
|
if (text != null || colorName != null){
|
||||||
showNotification(colorName, text, placementFrom, placementAlign, animateEnter, animateExit);
|
showNotification(element, colorName, text, placementFrom, placementAlign, animateEnter, animateExit);
|
||||||
}
|
}
|
||||||
|
|
||||||
function showNotification(colorName, text, placementFrom, placementAlign, animateEnter, animateExit) {
|
function showNotification(element, colorName, text, placementFrom, placementAlign, animateEnter, animateExit) {
|
||||||
if (colorName === null || colorName === '') { colorName = 'bg-black'; }
|
if (colorName === null || colorName === '') { colorName = 'bg-black'; }
|
||||||
if (animateEnter === null || animateEnter === '') { animateEnter = 'animated fadeInDown'; }
|
if (animateEnter === null || animateEnter === '') { animateEnter = 'animated fadeInDown'; }
|
||||||
if (animateExit === null || animateExit === '') { animateExit = 'animated fadeOutUp'; }
|
if (animateExit === null || animateExit === '') { animateExit = 'animated fadeOutUp'; }
|
||||||
var allowDismiss = true;
|
var allowDismiss = true;
|
||||||
|
|
||||||
$.notify({
|
$.notify({
|
||||||
message: text
|
message: text
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
element: element,
|
||||||
type: colorName,
|
type: colorName,
|
||||||
allow_dismiss: allowDismiss,
|
allow_dismiss: allowDismiss,
|
||||||
newest_on_top: true,
|
|
||||||
timer: 200000000000000,
|
timer: 200000000000000,
|
||||||
placement: {
|
placement: {
|
||||||
from: placementFrom,
|
from: placementFrom,
|
||||||
@@ -41,8 +43,8 @@ App.call_waiter = App.cable.subscriptions.create('CallWaiterChannel', {
|
|||||||
enter: animateEnter,
|
enter: animateEnter,
|
||||||
exit: animateExit
|
exit: animateExit
|
||||||
},
|
},
|
||||||
template: '<div data-notify="container" style="max-width: 180px !important;" class="bootstrap-notify-container alert alert-dismissible {0} ' + (allowDismiss ? "p-r-30" : "") + '" role="alert">' +
|
template: '<div data-notify="container" style="width:180px !important;" class="bootstrap-notify-container alert alert-dismissible {0} ' + (allowDismiss ? "p-r-30" : "") + '" role="alert">' +
|
||||||
'<button type="button" aria-hidden="true" class="close float-right m-l-20 m-t--5" data-notify="dismiss" style="right: -5px;">×</button>' +
|
'<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="icon"></span> ' +
|
||||||
'<span data-notify="title">{1}</span> ' +
|
'<span data-notify="title">{1}</span> ' +
|
||||||
'<span data-notify="message">{2}</span>' +
|
'<span data-notify="message">{2}</span>' +
|
||||||
|
|||||||
14
app/assets/javascripts/channels/check_in_booking.js
Normal file
14
app/assets/javascripts/channels/check_in_booking.js
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
App.checkin = App.cable.subscriptions.create('CheckInBookingChannel', {
|
||||||
|
// App.messages = App.cable.subscriptions.create('MessagesChannel', {
|
||||||
|
|
||||||
|
connected: function() {},
|
||||||
|
|
||||||
|
disconnected: function() {},
|
||||||
|
|
||||||
|
received: function(data) {
|
||||||
|
$('.table_'+data.table.id).removeClass('green');
|
||||||
|
$('.table_'+data.table.id).addClass('blue');
|
||||||
|
$('.new_text_'+data.table.id).removeClass('hide')
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
@@ -5,21 +5,22 @@ App.order = App.cable.subscriptions.create('CheckinChannel', {
|
|||||||
|
|
||||||
disconnected: function() {},
|
disconnected: function() {},
|
||||||
|
|
||||||
received: function(data) {
|
received: function(data) {
|
||||||
if((data.table != undefined) && (data.table.length > 0)){
|
$.each(data.table,function(key,value){
|
||||||
$.each(data.table,function(key,value){
|
if($('.table_'+value.table_id).hasClass('blue')){
|
||||||
if($('.table_'+value.table_id).hasClass('blue')){
|
$('.table_'+value.table_id).removeClass('blue');
|
||||||
$('.table_'+value.table_id).removeClass('blue');
|
$('.table_'+value.table_id).addClass('orange');
|
||||||
$('.table_'+value.table_id).addClass('orange');
|
}
|
||||||
}
|
else if($('.table_'+value.table_id).hasClass('red')){
|
||||||
else if($('.table_'+value.table_id).hasClass('red')){
|
$('.table_'+value.table_id).removeClass('red');
|
||||||
$('.table_'+value.table_id).removeClass('red');
|
$('.table_'+value.table_id).addClass('orange');
|
||||||
$('.table_'+value.table_id).addClass('orange');
|
}
|
||||||
}
|
else {
|
||||||
$('.new_text_'+value.table_id).removeClass('hide');
|
$('.table_'+value.table_id).removeClass('green');
|
||||||
});
|
$('.table_'+value.table_id).addClass('orange');
|
||||||
|
}
|
||||||
}
|
$('.new_text_'+value.table_id).removeClass('hide');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -362,8 +362,31 @@ tr.discount-item-row:hover {
|
|||||||
|
|
||||||
/* End Payment Page */
|
/* End Payment Page */
|
||||||
|
|
||||||
/*Logout Icon*/
|
/* Logout Icon */
|
||||||
|
|
||||||
i.logout_icon{
|
i.logout_icon{
|
||||||
position: relative;
|
position: relative;
|
||||||
top: 5px;
|
top: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* End Logout Icon */
|
||||||
|
|
||||||
|
/* Notify */
|
||||||
|
|
||||||
|
#notify-wrapper {
|
||||||
|
position: absolute;
|
||||||
|
top: 55px;
|
||||||
|
left: 10px;
|
||||||
|
z-index: 9999;
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
|
||||||
|
[data-notify="container"] {
|
||||||
|
margin-bottom: 5px !important;
|
||||||
|
margin-left:5px !important;
|
||||||
|
position:relative !important;
|
||||||
|
top: 25% !important;
|
||||||
|
width: 100% !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End Notify */
|
||||||
|
|||||||
10
app/channels/check_in_booking_channel.rb
Normal file
10
app/channels/check_in_booking_channel.rb
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
class CheckInBookingChannel < ApplicationCable::Channel
|
||||||
|
def subscribed
|
||||||
|
stream_from "check_in_booking_channel"
|
||||||
|
end
|
||||||
|
|
||||||
|
def unsubscribed
|
||||||
|
stop_all_streams
|
||||||
|
# Any cleanup needed when channel is unsubscribed
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -5,8 +5,12 @@ class Api::CheckInProcessController < Api::ApiController
|
|||||||
dining_facility = DiningFacility.find(params[:dining_id])
|
dining_facility = DiningFacility.find(params[:dining_id])
|
||||||
booking = dining_facility.get_current_checkout_booking
|
booking = dining_facility.get_current_checkout_booking
|
||||||
if !booking.nil?
|
if !booking.nil?
|
||||||
|
|
||||||
|
DiningFacility.check_in_booking(params[:dining_id])
|
||||||
|
|
||||||
check_in_time = booking.checkin_at.utc.getlocal.strftime("%Y-%m-%d %H:%M")
|
check_in_time = booking.checkin_at.utc.getlocal.strftime("%Y-%m-%d %H:%M")
|
||||||
check_out_time = booking.checkout_at.utc.getlocal.strftime("%Y-%m-%d %H:%M")
|
check_out_time = booking.checkout_at.utc.getlocal.strftime("%Y-%m-%d %H:%M")
|
||||||
|
|
||||||
render :json => { :status => true, :check_in_time => check_in_time, :check_out_time => check_out_time }
|
render :json => { :status => true, :check_in_time => check_in_time, :check_out_time => check_out_time }
|
||||||
else
|
else
|
||||||
render :json => { :status => false, :error_message => "No current booking!" }
|
render :json => { :status => false, :error_message => "No current booking!" }
|
||||||
@@ -18,20 +22,16 @@ class Api::CheckInProcessController < Api::ApiController
|
|||||||
if params[:dining_id]
|
if params[:dining_id]
|
||||||
dining_facility = DiningFacility.find(params[:dining_id])
|
dining_facility = DiningFacility.find(params[:dining_id])
|
||||||
if dining_facility.status == "available"
|
if dining_facility.status == "available"
|
||||||
dining_charge = DiningCharge.select('charge_type','charge_block')
|
lookup_checkout_time = Lookup.collection_of("checkout_time")
|
||||||
.where('dining_facility_id = ?',params[:dining_id])
|
|
||||||
.first()
|
|
||||||
|
|
||||||
checkout_at = Time.now.utc
|
checkout_at = Time.now.utc
|
||||||
|
|
||||||
if !dining_charge.nil?
|
if !lookup_checkout_time.nil?
|
||||||
hr = (dining_charge.charge_block.utc.strftime("%H").to_i).to_int
|
if lookup_checkout_time[0][0] == 'hr'
|
||||||
min = (dining_charge.charge_block.utc.strftime("%M").to_i).to_int
|
checkout_at = checkout_at + (lookup_checkout_time[0][1]).to_i.hour
|
||||||
# if dining_charge.charge_type == 'hr'
|
else
|
||||||
checkout_at = checkout_at + hr.hour + min.minutes
|
checkout_at = checkout_at + (lookup_checkout_time[0][1]).to_i.minutes
|
||||||
# else
|
end
|
||||||
|
|
||||||
# end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
dining_facility.status = "occupied"
|
dining_facility.status = "occupied"
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ class ApplicationController < ActionController::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def lookup_domain
|
def lookup_domain
|
||||||
|
|
||||||
if request.subdomain.present? && request.subdomain != "www"
|
if request.subdomain.present? && request.subdomain != "www"
|
||||||
from = request.subdomain.downcase + "." + request.domain.downcase
|
from = request.subdomain.downcase + "." + request.domain.downcase
|
||||||
@license = cache_license(ENV["SX_PROVISION_URL"], from) # request.subdomain.downcase
|
@license = cache_license(ENV["SX_PROVISION_URL"], from) # request.subdomain.downcase
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ class BaseOrigamiController < ActionController::Base
|
|||||||
include LoginVerification
|
include LoginVerification
|
||||||
layout "origami"
|
layout "origami"
|
||||||
|
|
||||||
before_action :checkin_process
|
# before_action :checkin_process
|
||||||
|
|
||||||
#before_action :check_installation
|
#before_action :check_installation
|
||||||
protect_from_forgery with: :exception
|
protect_from_forgery with: :exception
|
||||||
@@ -15,7 +15,7 @@ class BaseOrigamiController < ActionController::Base
|
|||||||
@current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token]
|
@current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token]
|
||||||
end
|
end
|
||||||
|
|
||||||
def checkin_process
|
# def checkin_process
|
||||||
CheckinJob.set(wait: 1.minute).perform_later()
|
# CheckinJob.set(wait: 1.minute).perform_later()
|
||||||
end
|
# end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -72,7 +72,8 @@ class HomeController < ApplicationController
|
|||||||
@hourly_sales = Sale.hourly_sales(today).sum(:grand_total)
|
@hourly_sales = Sale.hourly_sales(today).sum(:grand_total)
|
||||||
# .group_by_hour(:created_at, :time_zone => 'Asia/Rangoon',format: '%I:%p')
|
# .group_by_hour(:created_at, :time_zone => 'Asia/Rangoon',format: '%I:%p')
|
||||||
# .sum(:grand_total)
|
# .sum(:grand_total)
|
||||||
@employee_sales = Sale.employee_sales(today).sum('payment_amount')
|
@employee_sales = Sale.employee_sales(today)
|
||||||
|
.sum('(CASE WHEN sp.payment_method="cash" THEN (sp.payment_amount - sales.amount_changed) ELSE sp.payment_amount END)')
|
||||||
@inventories = StockJournal.inventory_balances(today).sum(:balance)
|
@inventories = StockJournal.inventory_balances(today).sum(:balance)
|
||||||
|
|
||||||
@total_sale = Sale.total_sale(today)
|
@total_sale = Sale.total_sale(today)
|
||||||
|
|||||||
@@ -1,20 +1,15 @@
|
|||||||
class Origami::CheckInProcessController < BaseOrigamiController
|
class Origami::CheckInProcessController < BaseOrigamiController
|
||||||
|
|
||||||
def check_in_process
|
def check_in_process
|
||||||
dining_charge = DiningCharge.select('charge_type','charge_block')
|
lookup_checkout_time = Lookup.collection_of("checkout_time")
|
||||||
.where('dining_facility_id = ?',params[:dining_id])
|
|
||||||
.first()
|
|
||||||
|
|
||||||
checkout_at = Time.now.utc
|
checkout_at = Time.now.utc
|
||||||
|
|
||||||
if !dining_charge.nil?
|
if !lookup_checkout_time.nil?
|
||||||
hr = (dining_charge.charge_block.utc.strftime("%H").to_i).to_int
|
if lookup_checkout_time[0][0] == 'hr'
|
||||||
min = (dining_charge.charge_block.utc.strftime("%M").to_i).to_int
|
checkout_at = checkout_at + (lookup_checkout_time[0][1]).to_i.hour
|
||||||
# if dining_charge.charge_type == 'hr'
|
else
|
||||||
checkout_at = checkout_at + hr.hour + min.minutes
|
checkout_at = checkout_at + (lookup_checkout_time[0][1]).to_i.minutes
|
||||||
# else
|
end
|
||||||
|
|
||||||
# end
|
|
||||||
end
|
end
|
||||||
@dining_facility = DiningFacility.find(params[:dining_id])
|
@dining_facility = DiningFacility.find(params[:dining_id])
|
||||||
@dining_facility.status = "occupied"
|
@dining_facility.status = "occupied"
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
|
|
||||||
# printer = Printer::ReceiptPrinter.new(print_settings)
|
# printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
|
|
||||||
# printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_details, "Frt")
|
# printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_details, "Frt")
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@@ -264,8 +264,13 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
# item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items)
|
# 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)
|
# discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
# printer = Printer::ReceiptPrinter.new(print_settings)
|
# printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
# printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "FOC")
|
# printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "FOC")
|
||||||
|
=======
|
||||||
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
|
printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "FOC",nil)
|
||||||
|
>>>>>>> master
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ class Origami::SalesController < BaseOrigamiController
|
|||||||
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
|
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
|
||||||
@orders = Order.all.order('date desc')
|
@orders = Order.all.order('date desc')
|
||||||
@sale = Sale.find(params[:sale_id])
|
@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
|
||||||
|
@table_id = Booking.find(@booking).dining_facility_id
|
||||||
|
@dining = DiningFacility.find(@table_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_to_existing_invoice
|
def add_to_existing_invoice
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class Reports::SaleitemController < BaseReportController
|
|||||||
@sale_data, @other_charges,@discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_by_shift_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED)
|
@sale_data, @other_charges,@discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_by_shift_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED)
|
||||||
|
|
||||||
@sale_taxes = Sale.get_separate_tax(shift_sale_range,shift,from,to,nil)
|
@sale_taxes = Sale.get_separate_tax(shift_sale_range,shift,from,to,nil)
|
||||||
puts @sale_data.to_json
|
|
||||||
@account_cate_count = Hash.new {|hash, key| hash[key] = 0}
|
@account_cate_count = Hash.new {|hash, key| hash[key] = 0}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
9
app/jobs/check_in_booking_job.rb
Normal file
9
app/jobs/check_in_booking_job.rb
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
class CheckInBookingJob < ApplicationJob
|
||||||
|
queue_as :default
|
||||||
|
|
||||||
|
def perform(table)
|
||||||
|
ActionCable.server.broadcast "check_in_booking_channel",table: table
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
class CheckinJob < ApplicationJob
|
class CheckinJob < ApplicationJob
|
||||||
queue_as :default
|
queue_as :default
|
||||||
|
|
||||||
def perform()
|
def self.perform()
|
||||||
table = DiningFacility.get_checkin_booking
|
table = DiningFacility.get_checkin_booking
|
||||||
ActionCable.server.broadcast "checkin_channel",table: table
|
if table.length > 0
|
||||||
|
ActionCable.server.broadcast "checkin_channel",table: table
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -78,8 +78,17 @@ class DiningFacility < ApplicationRecord
|
|||||||
def get_checkout_booking
|
def get_checkout_booking
|
||||||
booking = self.get_current_checkout_booking
|
booking = self.get_current_checkout_booking
|
||||||
if booking
|
if booking
|
||||||
|
lookup_checkout_time = Lookup.collection_of("checkout_alert_time")
|
||||||
|
free_time_min = 0
|
||||||
|
if !lookup_checkout_time.nil?
|
||||||
|
if lookup_checkout_time[0][0] == 'min'
|
||||||
|
free_time_min = (lookup_checkout_time[0][1]).to_i
|
||||||
|
else
|
||||||
|
free_time_min = 15
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
now = Time.now.utc
|
now = Time.now.utc
|
||||||
puts now
|
|
||||||
hr = (now.strftime("%H").to_i).to_int
|
hr = (now.strftime("%H").to_i).to_int
|
||||||
min = (now.strftime("%M").to_i).to_int
|
min = (now.strftime("%M").to_i).to_int
|
||||||
if !booking.checkout_at.nil?
|
if !booking.checkout_at.nil?
|
||||||
@@ -89,7 +98,7 @@ class DiningFacility < ApplicationRecord
|
|||||||
checkout_at_min -= min
|
checkout_at_min -= min
|
||||||
if (checkout_at_hr < hr)
|
if (checkout_at_hr < hr)
|
||||||
return booking
|
return booking
|
||||||
elsif (checkout_at_hr == hr && checkout_at_min <= 15)
|
elsif (checkout_at_hr == hr && checkout_at_min <= free_time_min)
|
||||||
return booking
|
return booking
|
||||||
else
|
else
|
||||||
return nil
|
return nil
|
||||||
@@ -104,18 +113,28 @@ class DiningFacility < ApplicationRecord
|
|||||||
bookings = Booking.where("booking_status ='assign' and checkin_at between '#{DateTime.now.utc - 5.hours}' and '#{DateTime.now.utc}' and reserved_by is not null and checkout_by is null")
|
bookings = Booking.where("booking_status ='assign' and checkin_at between '#{DateTime.now.utc - 5.hours}' and '#{DateTime.now.utc}' and reserved_by is not null and checkout_by is null")
|
||||||
arr_booking = Array.new
|
arr_booking = Array.new
|
||||||
if bookings
|
if bookings
|
||||||
|
lookup_checkout_time = Lookup.collection_of("checkout_alert_time")
|
||||||
|
free_time_min = 0
|
||||||
|
if !lookup_checkout_time.nil?
|
||||||
|
if lookup_checkout_time[0][0] == 'min'
|
||||||
|
free_time_min = (lookup_checkout_time[0][1]).to_i
|
||||||
|
else
|
||||||
|
free_time_min = 15
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
bookings.each do |booking|
|
bookings.each do |booking|
|
||||||
now = Time.now.utc.getlocal
|
now = Time.now.utc
|
||||||
hr = (now.strftime("%H").to_i).to_int
|
hr = (now.strftime("%H").to_i).to_int
|
||||||
min = (now.strftime("%M").to_i).to_int
|
min = (now.strftime("%M").to_i).to_int
|
||||||
if !booking.checkout_at.nil?
|
if !booking.checkout_at.nil?
|
||||||
checkout_at = booking.checkout_at.utc.getlocal
|
checkout_at = booking.checkout_at.utc
|
||||||
checkout_at_hr = (checkout_at.strftime("%H").to_i).to_int
|
checkout_at_hr = (checkout_at.strftime("%H").to_i).to_int
|
||||||
checkout_at_min = (checkout_at.strftime("%M").to_i).to_int
|
checkout_at_min = (checkout_at.strftime("%M").to_i).to_int
|
||||||
checkout_at_min -= min
|
checkout_at_min -= min
|
||||||
if (checkout_at_hr < hr)
|
if (checkout_at_hr < hr)
|
||||||
arr_booking.push({'table_id' => booking.dining_facility_id})
|
arr_booking.push({'table_id' => booking.dining_facility_id})
|
||||||
elsif (checkout_at_hr == hr && checkout_at_min <= 15)
|
elsif (checkout_at_hr == hr && checkout_at_min <= free_time_min)
|
||||||
arr_booking.push({'table_id' => booking.dining_facility_id})
|
arr_booking.push({'table_id' => booking.dining_facility_id})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -123,4 +142,11 @@ class DiningFacility < ApplicationRecord
|
|||||||
end
|
end
|
||||||
return arr_booking
|
return arr_booking
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#send order items and send to order queue
|
||||||
|
def self.check_in_booking(table_id)
|
||||||
|
table = DiningFacility.find(table_id)
|
||||||
|
#Send to background job for processing
|
||||||
|
CheckInBookingJob.perform_later(table)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -984,12 +984,11 @@ end
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.employee_sales(today)
|
def self.employee_sales(today)
|
||||||
query = Sale.select('(CASE WHEN (sp.payment_method="mpu" or sp.payment_method="visa" or sp.payment_method="master" or sp.payment_method="jcb") THEN "card" ELSE sp.payment_method END) as payment_name, (CASE WHEN sp.payment_method="cash" THEN (SUM(sp.payment_amount) - SUM(sales.amount_changed)) ELSE SUM(sp.payment_amount) END) as payment_amount')
|
query = Sale.joins("JOIN employees as e on e.id=sales.cashier_id")
|
||||||
.joins("join employees e on e.id=sales.cashier_id")
|
.joins("JOIN sale_payments as sp on sp.sale_id=sales.sale_id")
|
||||||
.joins("join sale_payments sp on sp.sale_id=sales.sale_id")
|
.where("sales.payment_status='paid' and sales.sale_status = 'completed' and DATE_FORMAT(sales.receipt_date,'%Y-%m-%d') = '#{today}'")
|
||||||
.where("sales.payment_status='paid' and sales.sale_status = 'completed' and DATE_FORMAT(sales.receipt_date,'%Y-%m-%d') = '#{today}'")
|
.group("(CASE WHEN (sp.payment_method='mpu' or sp.payment_method='visa' or sp.payment_method='master' or sp.payment_method='jcb') THEN 'card' ELSE sp.payment_method END)","e.name")
|
||||||
.group('payment_method','e.name')
|
.order("e.name")
|
||||||
.order('e.name')
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.total_sale(today)
|
def self.total_sale(today)
|
||||||
@@ -1043,11 +1042,16 @@ end
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.total_customer(today)
|
def self.total_customer(today)
|
||||||
query = Sale.select("(CASE WHEN (c.customer_type='Dinein' or c.customer_type='Takeaway') THEN count(sales.customer_id) ELSE count(distinct sales.customer_id) END) as total_cus")
|
dinein_cnt = self.total_dinein(today)
|
||||||
.joins("JOIN customers as c ON c.customer_id = sales.customer_id")
|
takeaway_cnt = self.total_takeaway(today)
|
||||||
.where('sales.sale_status = "completed" and DATE_FORMAT(sales.receipt_date,"%Y-%m-%d") = ?',today)
|
membership_cnt = self.total_membership(today)
|
||||||
.order('sales.sale_id ASC')
|
|
||||||
.first()
|
total_cus = 0
|
||||||
|
if !dinein_cnt.nil? || !takeaway_cnt.nil? || !membership_cnt.nil?
|
||||||
|
total_cus = dinein_cnt.total_dinein_cus.to_int + takeaway_cnt.total_take_cus.to_int + membership_cnt.total_memb_cus.to_int
|
||||||
|
end
|
||||||
|
|
||||||
|
return total_cus
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.total_dinein(today)
|
def self.total_dinein(today)
|
||||||
@@ -1067,12 +1071,12 @@ end
|
|||||||
def self.total_membership(today)
|
def self.total_membership(today)
|
||||||
query = Sale.select("count(distinct sales.customer_id) as total_memb_cus")
|
query = Sale.select("count(distinct sales.customer_id) as total_memb_cus")
|
||||||
.joins("JOIN customers as c ON c.customer_id = sales.customer_id")
|
.joins("JOIN customers as c ON c.customer_id = sales.customer_id")
|
||||||
.where('sales.sale_status = "completed" and DATE_FORMAT(sales.receipt_date,"%Y-%m-%d") = ? and c.customer_type = "Takeaway" and c.membership_id is not null',today)
|
.where('sales.sale_status = "completed" and DATE_FORMAT(sales.receipt_date,"%Y-%m-%d") = ? and ((c.customer_type = "Dinein" and c.membership_id is not null) or (c.customer_type = "Takeaway" and c.membership_id is not null))',today)
|
||||||
.first()
|
.first()
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.total_other_customer(today)
|
def self.total_other_customer(today)
|
||||||
query = Sale.select("count(distinct sales.customer_id) as total_cus")
|
query = Sale.select("count(sales.customer_id) as total_cus")
|
||||||
.joins("JOIN customers as c ON c.customer_id = sales.customer_id")
|
.joins("JOIN customers as c ON c.customer_id = sales.customer_id")
|
||||||
.where('sales.sale_status = "completed" and DATE_FORMAT(sales.receipt_date,"%Y-%m-%d") = ? and c.customer_type is null and c.membership_id is null',today)
|
.where('sales.sale_status = "completed" and DATE_FORMAT(sales.receipt_date,"%Y-%m-%d") = ? and c.customer_type is null and c.membership_id is null',today)
|
||||||
.first()
|
.first()
|
||||||
@@ -1111,8 +1115,8 @@ end
|
|||||||
|
|
||||||
def self.total_foc_items(today)
|
def self.total_foc_items(today)
|
||||||
query = Sale.joins("JOIN sale_items as a ON a.sale_id = sales.sale_id")
|
query = Sale.joins("JOIN sale_items as a ON a.sale_id = sales.sale_id")
|
||||||
.where("sales.sale_status = 'completed' and a.remark='foc' and DATE_FORMAT(sales.receipt_date,'%Y-%m-%d') = ?",today)
|
.where("sales.sale_status = 'completed' and a.remark='foc' and a.product_name not like '%FOC%' and DATE_FORMAT(sales.receipt_date,'%Y-%m-%d') = ?",today)
|
||||||
.count()
|
.sum("a.qty")
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
@@ -27,10 +27,14 @@ class SaleItem < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.update_existing_item(qty, item, sale_id, type, item_price, price)
|
def self.update_existing_item(qty, item, sale_id, type, item_price, price)
|
||||||
|
# Original Item to add remark
|
||||||
|
item.remark = type
|
||||||
|
item.save
|
||||||
|
|
||||||
sale_item = SaleItem.new
|
sale_item = SaleItem.new
|
||||||
sale_item.product_code = item.product_code
|
sale_item.product_code = item.product_code
|
||||||
sale_item.item_instance_code = item.item_instance_code
|
sale_item.item_instance_code = item.item_instance_code
|
||||||
sale_item.product_name = item.product_name + "(#{type})"
|
sale_item.product_name = item.product_name + " (#{type.upcase})"
|
||||||
sale_item.product_alt_name = item.product_alt_name
|
sale_item.product_alt_name = item.product_alt_name
|
||||||
sale_item.account_id = item.account_id
|
sale_item.account_id = item.account_id
|
||||||
sale_item.remark = type
|
sale_item.remark = type
|
||||||
|
|||||||
@@ -56,7 +56,7 @@
|
|||||||
|
|
||||||
<% if current_user.role == 'administrator' || current_user.role == 'manager' %>
|
<% if current_user.role == 'administrator' || current_user.role == 'manager' %>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-9 col-sm-9 col-md-9 col-lg-9">
|
<div class="col-xs-8 col-sm-8 col-md-8 col-lg-8">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
|
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
@@ -111,7 +111,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
|
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
|
||||||
<% if !@summ_sale.nil? %>
|
<% if !@summ_sale.nil? %>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
|
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
|
||||||
@@ -185,7 +185,7 @@
|
|||||||
<% if !@total_customer.nil? %>
|
<% if !@total_customer.nil? %>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= t("views.right_panel.detail.total") %> <%= t :customer %> : </td>
|
<td><%= t("views.right_panel.detail.total") %> <%= t :customer %> : </td>
|
||||||
<td align="right"><%= @total_customer.total_cus %></td>
|
<td align="right"><%= @total_customer %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if !@total_dinein.nil? %>
|
<% if !@total_dinein.nil? %>
|
||||||
@@ -254,7 +254,7 @@
|
|||||||
<% if !@total_foc_items.nil? %>
|
<% if !@total_foc_items.nil? %>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="40px"><%= t("views.right_panel.detail.total") %> <%= t("views.btn.foc") %> <%= t("views.right_panel.detail.item") %> : </td>
|
<td width="40px"><%= t("views.right_panel.detail.total") %> <%= t("views.btn.foc") %> <%= t("views.right_panel.detail.item") %> : </td>
|
||||||
<td align="right" width="60px"><%= @total_foc_items %></td>
|
<td align="right" width="60px"><%= @total_foc_items.to_int %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -41,6 +41,10 @@
|
|||||||
<%= render 'layouts/right_sidebar' %>
|
<%= render 'layouts/right_sidebar' %>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<!-- Notify -->
|
||||||
|
<div id="notify-wrapper"></div>
|
||||||
|
<!-- Notify -->
|
||||||
|
|
||||||
<!-- Main Content -->
|
<!-- Main Content -->
|
||||||
<section class="content">
|
<section class="content">
|
||||||
<% flash.each do |type, message| %>
|
<% flash.each do |type, message| %>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<li class="nav-item menu_category sub_click" data-id="<%=menu.id%>">
|
<li class="nav-item menu_category sub_click" data-id="<%=menu.id%>">
|
||||||
<p class="hidden menu-id"><%= menu.id %></p>
|
<p class="hidden menu-id"><%= menu.id %></p>
|
||||||
<a class="nav-link" data-toggle="tab" href="" role="tab"> <%= menu.name%>
|
<a class="nav-link" data-toggle="tab" href="" role="tab"> <%= menu.name%>
|
||||||
<ul class=" sub_category_list hidden" id="sub_category_list">
|
<ul class=" sub_category_list hidden fadeInTop animated" id="sub_category_list">
|
||||||
</ul>
|
</ul>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|||||||
@@ -220,7 +220,7 @@
|
|||||||
<input type="hidden" id="sale_id" value="<%= @sale_array[0].sale_id %>">
|
<input type="hidden" id="sale_id" value="<%= @sale_array[0].sale_id %>">
|
||||||
<%
|
<%
|
||||||
# Can't check for discount
|
# Can't check for discount
|
||||||
unless sale_item.price == 0
|
# unless sale_item.price == 0
|
||||||
count += 1
|
count += 1
|
||||||
%>
|
%>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -231,8 +231,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<%
|
<%
|
||||||
|
# end
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -243,7 +242,7 @@
|
|||||||
count += 1
|
count += 1
|
||||||
sub_total = sub_total + (order_item.price * order_item.qty)
|
sub_total = sub_total + (order_item.price * order_item.qty)
|
||||||
|
|
||||||
unless order_item.price == 0 %>
|
# unless order_item.price == 0 %>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= count %></td>
|
<td><%= count %></td>
|
||||||
<td class='item-name'><%= order_item.item_name %></td>
|
<td class='item-name'><%= order_item.item_name %></td>
|
||||||
@@ -252,7 +251,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<%
|
<%
|
||||||
|
|
||||||
end
|
# end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -215,7 +215,7 @@
|
|||||||
<input type="hidden" id="sale_id" value="<%= @sale_array[0].sale_id %>">
|
<input type="hidden" id="sale_id" value="<%= @sale_array[0].sale_id %>">
|
||||||
<%
|
<%
|
||||||
# Can't check for discount
|
# Can't check for discount
|
||||||
unless sale_item.price == 0
|
# unless sale_item.price == 0
|
||||||
count += 1
|
count += 1
|
||||||
%>
|
%>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -227,7 +227,7 @@
|
|||||||
|
|
||||||
<%
|
<%
|
||||||
|
|
||||||
end
|
# end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -238,7 +238,7 @@
|
|||||||
count += 1
|
count += 1
|
||||||
sub_total = sub_total + (order_item.price * order_item.qty)
|
sub_total = sub_total + (order_item.price * order_item.qty)
|
||||||
|
|
||||||
unless order_item.price == 0 %>
|
# unless order_item.price == 0 %>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= count %></td>
|
<td><%= count %></td>
|
||||||
<td class='item-name'><%= order_item.item_name %></td>
|
<td class='item-name'><%= order_item.item_name %></td>
|
||||||
@@ -247,7 +247,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<%
|
<%
|
||||||
|
|
||||||
end
|
# end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -109,7 +109,7 @@
|
|||||||
<div class="col-lg-5 col-md-5 col-sm-5">
|
<div class="col-lg-5 col-md-5 col-sm-5">
|
||||||
<div class="card" >
|
<div class="card" >
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<div><strong id="order-title">INVOICE DETAILS </strong></div>
|
<div><strong id="order-title">INVOICE DETAILS </strong>| Table <%= @dining.name rescue "" %></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<div class="card-title row p-l-5 p-r-5">
|
<div class="card-title row p-l-5 p-r-5">
|
||||||
@@ -146,7 +146,7 @@
|
|||||||
sub_total = sub_total + sale_item.price
|
sub_total = sub_total + sale_item.price
|
||||||
%>
|
%>
|
||||||
<input type="hidden" id="sale_id" value="<%= @sale.sale_id %>">
|
<input type="hidden" id="sale_id" value="<%= @sale.sale_id %>">
|
||||||
<% unless sale_item.price <= 0 %>
|
<% #unless sale_item.price <= 0 %>
|
||||||
<tr>
|
<tr>
|
||||||
<td class='item-name'><%= sale_item.product_name %></td>
|
<td class='item-name'><%= sale_item.product_name %></td>
|
||||||
<td class='item-attr'><%= sale_item.qty %></td>
|
<td class='item-attr'><%= sale_item.qty %></td>
|
||||||
@@ -154,7 +154,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<%
|
<%
|
||||||
|
|
||||||
end
|
#end
|
||||||
end
|
end
|
||||||
|
|
||||||
%>
|
%>
|
||||||
|
|||||||
@@ -86,6 +86,6 @@ Rails.application.configure do
|
|||||||
config.active_record.dump_schema_after_migration = false
|
config.active_record.dump_schema_after_migration = false
|
||||||
|
|
||||||
# Action Cable Setup
|
# Action Cable Setup
|
||||||
config.action_cable.url = "ws://192.168.1.24:9292/cable"
|
# config.action_cable.url = "ws://192.168.1.24:9292/cable"
|
||||||
config.action_cable.allowed_request_origins = [/http:\/\/*/, /https:\/\/*/]
|
config.action_cable.allowed_request_origins = [/http:\/\/*/, /https:\/\/*/]
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -10,3 +10,7 @@ dbusername: LapN+Geriht8yk866FxNiQ==
|
|||||||
dbpassword: QtboWZ4ATE05vvYw6J+Uqw==
|
dbpassword: QtboWZ4ATE05vvYw6J+Uqw==
|
||||||
api_token: nGyMizHtoVEFYCjSVEFJuzkxuBJwSsH
|
api_token: nGyMizHtoVEFYCjSVEFJuzkxuBJwSsH
|
||||||
app_token: QUdPwSakcsnuVLdfkXgGHhPMiIOcSSfaVwQyA
|
app_token: QUdPwSakcsnuVLdfkXgGHhPMiIOcSSfaVwQyA
|
||||||
|
|
||||||
|
plan_sku: 001
|
||||||
|
renewable_date: 2018-12-14
|
||||||
|
plan_name: Community
|
||||||
|
|||||||
@@ -10,3 +10,6 @@ every 30.minutes do
|
|||||||
runner "Customer.update_membership"
|
runner "Customer.update_membership"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
every 1.minutes do
|
||||||
|
runner "CheckinJob.perform"
|
||||||
|
end
|
||||||
5
spec/jobs/check_in_booking_job_spec.rb
Normal file
5
spec/jobs/check_in_booking_job_spec.rb
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe CheckInBookingJob, type: :job do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user