Merge branch 'osaka' of bitbucket.org:code2lab/sxrestaurant into osaka

This commit is contained in:
Aung Myo
2017-07-12 19:48:51 +06:30
2 changed files with 418 additions and 10 deletions

View File

@@ -18,15 +18,16 @@ class ShiftSale < ApplicationRecord
def self.current_shift
today_date = DateTime.now.strftime("%Y-%m-%d")
shift = ShiftSale.where("DATE(shift_started_at)=? and shift_started_at is not null and shift_closed_at is null",today_date).take
shift = ShiftSale.where("shift_started_at is not null and shift_closed_at is null").take
return shift
end
def self.current_open_shift(current_user)
#if current_user
#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("DATE(shift_started_at)=? and shift_started_at is not null and shift_closed_at is null and employee_id = #{current_user}",today_date).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