multiple sale and order

This commit is contained in:
Nweni
2017-06-22 14:26:23 +06:30
parent 0ff10f2f32
commit 0ea2b778d1
13 changed files with 134 additions and 72 deletions

View File

@@ -18,6 +18,17 @@ class DiningFacility < ApplicationRecord
self.save
end
def get_booking
booking = self.get_current_booking
if booking
if booking.dining_facility_id.to_i == self.id
if booking.booking_status == 'assign'
return booking
end
end
end
end
def get_current_booking
booking = Booking.where("dining_facility_id = #{self.id} and booking_status ='assign' and checkin_at between '#{DateTime.now.utc - 5.hours}' and '#{DateTime.now.utc}' and checkout_at is null").limit(1)