conflict file
This commit is contained in:
@@ -1,12 +1,29 @@
|
||||
class Customer < ApplicationRecord
|
||||
self.primary_key = "customer_id"
|
||||
|
||||
#self.primary_key = :customer_id
|
||||
|
||||
before_create :generate_custom_id
|
||||
has_many :orders
|
||||
has_many :sales
|
||||
|
||||
validates_presence_of :name, :contact_no
|
||||
validates_presence_of :name, :contact_no, :email
|
||||
validates :contact_no, uniqueness: true
|
||||
validates :email, uniqueness: true
|
||||
|
||||
def self.get_member_group
|
||||
|
||||
gateway_url = MembershipSetting.find_by_membership_type("smartpay_url")
|
||||
url = gateway_url.gateway_url.to_s + "/api/get_all_member_group".to_s
|
||||
response = HTTParty.get(url)
|
||||
puts response.body, response.code, response.message, response.headers.inspect
|
||||
|
||||
return response;
|
||||
|
||||
end
|
||||
|
||||
# http://192.168.1.47:3006/api/create_membership_customer
|
||||
#get_all_member_group
|
||||
|
||||
|
||||
def lastest_invoices
|
||||
sales.where(:customer_id => self.id).order("created_at desc").limit(5)
|
||||
|
||||
@@ -211,16 +211,17 @@ class Order < ApplicationRecord
|
||||
#Origami: Cashier : to view order type Table
|
||||
|
||||
def self.get_order_table
|
||||
order_table = Order.select("orders.id as order_id,sum(order_items.qty*order_items.price) as total_price,
|
||||
order_items.id as order_items_id,dining_facilities.name as table_name")
|
||||
.joins("left join booking_orders on booking_orders.order_id = orders.id
|
||||
left join bookings on bookings.id = booking_orders.id
|
||||
order_table = Order.select("orders.order_id as order_id,sum(order_items.qty*order_items.price) as total_price,
|
||||
order_items.order_items_id as order_items_id,dining_facilities.name as table_name")
|
||||
.joins("left join booking_orders on booking_orders.order_id = orders.order_id
|
||||
left join bookings on bookings.booking_id = booking_orders.booking_order_id
|
||||
left join dining_facilities on dining_facilities.id = bookings.dining_facility_id
|
||||
left join order_items on order_items.order_id = orders.id")
|
||||
left join order_items on order_items.order_id = orders.order_id")
|
||||
.where("dining_facilities.type=? and orders.order_type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,"dine_in",true)
|
||||
.group("orders.order_id, order_items.order_items_id,dining_facilities.name")
|
||||
end
|
||||
|
||||
|
||||
def self.get_booking_order_table
|
||||
booking_orders = Booking.select("sales.receipt_no,orders.status as order_status,
|
||||
bookings.booking_id,sales.sale_id as sale_id,dining_facilities.name as table_name")
|
||||
|
||||
Reference in New Issue
Block a user