fix bugs and improvement

This commit is contained in:
Thein Lin Kyaw
2020-07-13 12:27:38 +06:30
parent 8f0950f5a1
commit 40ae0cf388
4 changed files with 9 additions and 16 deletions

View File

@@ -65,15 +65,7 @@ class Origami::VoidController < BaseOrigamiController
current_balance = nil
# For Cashier by Zone
bookings = Booking.where("sale_id='#{sale_id}'")
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
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
@@ -81,7 +73,6 @@ class Origami::VoidController < BaseOrigamiController
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
end
# if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
# get printer info
# print_settings = PrintSetting.find_by_unique_code('ReceiptBillPdf') # SaleItemsPdf

View File

@@ -36,7 +36,6 @@ class Employee < ApplicationRecord
end
end
return nil
end
def self.authenticate_by_token(session_token)
@@ -44,7 +43,7 @@ class Employee < ApplicationRecord
user = Employee.find_by_token_session(session_token)
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
user.session_expiry = user.session_expiry.utc + expiry_time.minutes
user.save

View File

@@ -684,8 +684,11 @@ class SalePayment < ApplicationRecord
end
end
sale.save!
table_update_status(sale)
update_shift
if sale.sale_status == 'completed'
table_update_status(sale)
update_shift
end
end
# update for cashier shift

View File

@@ -28,7 +28,7 @@ class ShiftSale < ApplicationRecord
#find open shift where is open today and is not closed and login by current cashier
#DATE(shift_started_at)=? and
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
#end
end
@@ -132,7 +132,7 @@ class ShiftSale < ApplicationRecord
self.commercial_taxes = self.commercial_taxes.to_f - tax.to_f
self.total_rounding = self.total_rounding - saleobj.rounding_adjustment
self.total_void = self.total_void + saleobj.grand_total
if saleobj.customer.customer_type == "Dinein"
self.dining_count = self.dining_count - 1
else