food court and Booking ID for order and receipt
This commit is contained in:
@@ -52,6 +52,15 @@ class OrderItemSlimCustomisePdf < Prawn::Document
|
||||
|
||||
# Write Order Information to PDF
|
||||
def order_info(order_no, order_by, order_at)
|
||||
#booking ID
|
||||
booking_id = get_booking_id(order_no)
|
||||
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "Booking: #{booking_id}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 1
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "OrderNo: #{order_no} ", :size => self.item_slim_font_size,:align => :left
|
||||
@@ -141,4 +150,13 @@ class OrderItemSlimCustomisePdf < Prawn::Document
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def get_booking_id(order_no)
|
||||
booking = Booking.joins(" JOIN booking_orders bo ON bo.booking_id = bookings.booking_id")
|
||||
.joins(" JOIN orders o ON o.order_id=bo.order_id")
|
||||
.where("o.order_id='#{order_no}'")
|
||||
.first()
|
||||
|
||||
return booking.booking_id
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user