order controller update

This commit is contained in:
Nweni
2017-06-13 19:06:50 +06:30
parent 9ae4c13f87
commit 0e86b12ecd
3 changed files with 13 additions and 17 deletions

View File

@@ -25,7 +25,7 @@ class Order < ApplicationRecord
booking = nil
if self.new_booking
puts "a"
booking = Booking.create({:dining_facility_id => self.table_id,:type => "TableBooking",
:checkin_at => Time.now.utc, :checkin_by => self.employee_name,
:booking_status => "assign" })

View File

@@ -12,7 +12,8 @@ class Sale < ApplicationRecord
has_many :sale_taxes
has_many :sale_payments
has_many :sale_orders
has_many :bookings
scope :open_invoices, -> { where("sale_status = 'new' and receipt_date BETWEEN '#{DateTime.now.utc.end_of_day}' AND '#{DateTime.now.utc.beginning_of_day}'") }
def generate_invoice_from_booking(booking_id, requested_by)