This commit is contained in:
Nweni
2017-07-01 14:55:37 +06:30
parent 23f8430032
commit abefd1f8f2
3 changed files with 54 additions and 22 deletions

View File

@@ -43,10 +43,10 @@ class OrderItem < ApplicationRecord
def self.get_order_items_details(booking_id)
# booking_orders = BookingOrder.where("booking_id=?",booking.booking_id)
# if booking_orders
# booking_orders.each do |book_order|
# booking_orders.each do |book_order|
# order_details = OrderItem.select("order_items.item_name,order_items.qty,order_items.price,(order_items.qty*order_items.price) as total_price")
# .joins("left join orders on orders.order_id = order_items.order_id")
# .where("order_items.order_id=?",book_order.order)
# .where("order_items.order_id=?",book_order.order)
# return order_details
# end
# else
@@ -57,9 +57,9 @@ class OrderItem < ApplicationRecord
.joins("left join orders on orders.order_id = order_items.order_id")
.joins("left join booking_orders on booking_orders.order_id = order_items.order_id")
.joins("left join bookings on bookings.booking_id = booking_orders.booking_id")
.where("bookings.booking_id=?",booking_id)
.where("bookings.booking_id=?",booking_id)
return order_details
return order_details
end
private

View File

@@ -21,7 +21,7 @@ class ShiftSale < ApplicationRecord
#find open shift where is open today and is not closed and login by current cashier
today_date = DateTime.now.strftime("%Y-%m-%d")
shift = ShiftSale.where("DATE(shift_started_at)= #{ today_date } and shift_started_at is not null and shift_closed_at is null and employee_id = #{current_user}").take
shift = ShiftSale.where("DATE(shift_started_at)=? and shift_started_at is not null and shift_closed_at is null and employee_id = #{current_user}",today_date).take
return shift
#end