update shift close print

This commit is contained in:
Aung Myo
2017-07-01 20:05:26 +06:30
20 changed files with 379 additions and 141 deletions

View File

@@ -20,16 +20,18 @@ class ShiftSale < ApplicationRecord
#if current_user
#find open shift where is open today and is not closed and login by current cashier
today_date = DateTime.now.strftime("%Y-%m-%d")
puts today_date
shift = ShiftSale.where("DATE(shift_started_at)= #{ today_date } and shift_started_at is not null and shift_closed_at is null and employee_id = #{current_user}").take
# puts today_date
# shift = ShiftSale.where("DATE(shift_started_at)= #{ today_date } and shift_started_at is not null and shift_closed_at is null and employee_id = #{current_user}").take
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
return shift
#end
end
def create(opening_balance,current_user)
self.cashier_terminal_id = CashierTerminal.first.id
def create(opening_balance,cashier_terminal, current_user)
self.cashier_terminal_id = cashier_terminal
self.shift_started_at = DateTime.now
self.employee_id = current_user.id
self.opening_balance = opening_balance