fixed confilt

This commit is contained in:
NyanLinHtut
2020-03-20 16:19:13 +06:30
17 changed files with 1119 additions and 345 deletions

View File

@@ -67,7 +67,7 @@ class CardSaleTran < ApplicationRecord
shift_closed_at As closing_date,")
.order("shift_sales.id DESC")
return query = query.where("shift_sales.shift_started_at >= ?" , from)
byebug
# byebug
end
end

View File

@@ -64,6 +64,6 @@ class CardSettleTran < ApplicationRecord
shift_closed_at As closing_date,")
.order("shift_sales.id DESC")
return query = query.where("shift_sales.shift_started_at >= ?" , from)
byebug
# byebug
end
end

View File

@@ -673,26 +673,28 @@ class Sale < ApplicationRecord
end
def self.get_mobile_orders
def self.get_foodcourt_current_shift_orders
@current_shift = ShiftSale.current_shift
@bookings = Booking.select("bookings.*,customers.*")
.joins(" JOIN sales ON bookings.sale_id=sales.sale_id")
.joins(" JOIN booking_orders ON booking_orders.booking_id=bookings.booking_id")
.joins("JOIN orders ON orders.order_id=booking_orders.order_id")
.joins("JOIN order_items ON orders.order_id=order_items.order_id")
.joins("JOIN customers ON orders.customer_id=customers.customer_id")
.where("sales.sale_status =? and sales.payment_status =? and orders.source='app' and DATE(bookings.created_at)=?",'completed','paid', Date.today)
.order("bookings.created_at desc").uniq
.where("sales.sale_status =? and sales.payment_status =? and orders.source='app' and sales.shift_sale_id = ?",
'completed','paid', @current_shift.id
).order("bookings.created_at desc").uniq
@competed = []
@completed = []
@assigns = []
@bookings.each do |b|
if b.booking_status == 'completed'
@competed << b
@completed << b
else
@assigns << b
end
end
return @competed, @assigns
return @completed, @assigns
end
#Generate new Receipt No when it is not assigned