fix bugs and improvement
This commit is contained in:
@@ -65,15 +65,7 @@ class Origami::VoidController < BaseOrigamiController
|
|||||||
current_balance = nil
|
current_balance = nil
|
||||||
|
|
||||||
# For Cashier by Zone
|
# For Cashier by Zone
|
||||||
bookings = Booking.where("sale_id='#{sale_id}'")
|
if sale.booking.dining_facility_id.to_i > 0
|
||||||
if bookings.count > 1
|
|
||||||
# for Multiple Booking
|
|
||||||
if bookings[0].dining_facility_id.to_i>0
|
|
||||||
table = DiningFacility.find(bookings[0].dining_facility_id)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if bookings[0].dining_facility_id.to_i > 0
|
|
||||||
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
||||||
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
|
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
|
||||||
else
|
else
|
||||||
@@ -81,7 +73,6 @@ class Origami::VoidController < BaseOrigamiController
|
|||||||
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
|
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
# if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
# if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||||
# get printer info
|
# get printer info
|
||||||
# print_settings = PrintSetting.find_by_unique_code('ReceiptBillPdf') # SaleItemsPdf
|
# print_settings = PrintSetting.find_by_unique_code('ReceiptBillPdf') # SaleItemsPdf
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ class Employee < ApplicationRecord
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
return nil
|
return nil
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.authenticate_by_token(session_token)
|
def self.authenticate_by_token(session_token)
|
||||||
@@ -44,7 +43,7 @@ class Employee < ApplicationRecord
|
|||||||
user = Employee.find_by_token_session(session_token)
|
user = Employee.find_by_token_session(session_token)
|
||||||
expiry_time = login_expiry_time
|
expiry_time = login_expiry_time
|
||||||
|
|
||||||
if user && user.session_expiry.utc > DateTime.now.utc
|
if user && user.session_expiry && user.session_expiry.utc > DateTime.now.utc
|
||||||
#Extend the login time each time authenticatation take place
|
#Extend the login time each time authenticatation take place
|
||||||
user.session_expiry = user.session_expiry.utc + expiry_time.minutes
|
user.session_expiry = user.session_expiry.utc + expiry_time.minutes
|
||||||
user.save
|
user.save
|
||||||
|
|||||||
@@ -684,9 +684,12 @@ class SalePayment < ApplicationRecord
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
sale.save!
|
sale.save!
|
||||||
|
|
||||||
|
if sale.sale_status == 'completed'
|
||||||
table_update_status(sale)
|
table_update_status(sale)
|
||||||
update_shift
|
update_shift
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# update for cashier shift
|
# update for cashier shift
|
||||||
def update_shift
|
def update_shift
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class ShiftSale < ApplicationRecord
|
|||||||
#find open shift where is open today and is not closed and login by current cashier
|
#find open shift where is open today and is not closed and login by current cashier
|
||||||
#DATE(shift_started_at)=? and
|
#DATE(shift_started_at)=? and
|
||||||
today_date = DateTime.now.strftime("%Y-%m-%d")
|
today_date = DateTime.now.strftime("%Y-%m-%d")
|
||||||
shift = ShiftSale.where("shift_started_at is not null and shift_closed_at is null and employee_id = #{current_user}").take
|
shift = ShiftSale.where("shift_started_at is not null and shift_closed_at is null and employee_id = ?", current_user).take
|
||||||
return shift
|
return shift
|
||||||
#end
|
#end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user