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

This commit is contained in:
Yan
2017-06-14 10:16:55 +06:30
52 changed files with 1332 additions and 700 deletions

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)
@@ -260,7 +261,8 @@ class Sale < ApplicationRecord
def self.search(search)
if search
find(:all, :conditions => ['receipt_no LIKE ?', "%#{search}%"])
# find(:all, :conditions => ['name LIKE ? OR contact_no LIKE ?', "%#{search}%", "%#{search}%"])
where("receipt_no LIKE ?", "%#{search}%",)
else
find(:all)
end