update search and crm

This commit is contained in:
Aung Myo
2017-06-14 00:09:54 +06:30
parent 713e0a367c
commit 3db6252304
20 changed files with 352 additions and 677 deletions

View File

@@ -292,6 +292,15 @@ class Order < ApplicationRecord
end
def self.search(search)
if search
# find(:all, :conditions => ['name LIKE ? OR contact_no LIKE ?', "%#{search}%", "%#{search}%"])
where("order_id LIKE ?", "%#{search}%")
else
find(:all)
end
end
private
def generate_custom_id

View File

@@ -261,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