Read NFC
This commit is contained in:
@@ -153,23 +153,36 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
|
||||
# Query for OQS with status
|
||||
def print_query(type, id)
|
||||
query = OrderItem.select("order_items.order_id, order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.options, order_items.item_order_by as order_by, order_items.created_at as order_at, order_items.set_menu_items, cus.name as customer, df.type, df.name as dining,item.alt_name as alt_name")
|
||||
.joins("left join orders ON orders.order_id = order_items.order_id")
|
||||
.joins("left join booking_orders AS bo ON bo.order_id=order_items.order_id")
|
||||
.joins("left join bookings AS b ON b.booking_id = bo.booking_id")
|
||||
.joins("left join dining_facilities AS df ON df.id = b.dining_facility_id")
|
||||
.joins("left join customers as cus ON cus.customer_id = orders.customer_id")
|
||||
.joins("left join menu_items as item ON item.item_code = order_items.item_code")
|
||||
|
||||
if type == "order_item"
|
||||
query.where("order_items.order_items_id = ?", id)
|
||||
.group("order_items.item_code")
|
||||
OrderItem.select("orders.source,cus.contact_no,order_items.order_id, order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.options, order_items.item_order_by as order_by, order_items.created_at as order_at, order_items.set_menu_items, cus.name as customer, df.type, df.name as dining, item.alt_name as alt_name")
|
||||
.joins("left join orders ON orders.order_id = order_items.order_id
|
||||
left join booking_orders AS bo ON bo.order_id=order_items.order_id
|
||||
left join bookings AS b ON b.booking_id = bo.booking_id
|
||||
left join dining_facilities AS df ON df.id = b.dining_facility_id
|
||||
left join customers as cus ON cus.customer_id = orders.customer_id
|
||||
left join menu_items as item ON item.item_code = order_items.item_code")
|
||||
.where("order_items.order_items_id = '#{ id }'")
|
||||
.group("order_items.item_code")
|
||||
elsif type == "order_summary"
|
||||
query.where("orders.order_id = ?", id)
|
||||
.group("order_items.order_items_id")
|
||||
OrderItem.select("orders.source,cus.contact_no,order_items.order_id, order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.options, order_items.item_order_by as order_by, order_items.created_at as order_at, order_items.set_menu_items, cus.name as customer, df.type, df.name as dining, item.alt_name as alt_name")
|
||||
.joins("left join orders ON orders.order_id = order_items.order_id
|
||||
left join booking_orders AS bo ON bo.order_id=order_items.order_id
|
||||
left join bookings AS b ON b.booking_id = bo.booking_id
|
||||
left join dining_facilities AS df ON df.id = b.dining_facility_id
|
||||
left join customers as cus ON cus.customer_id = orders.customer_id
|
||||
left join menu_items as item ON item.item_code = order_items.item_code")
|
||||
.where("orders.order_id = '#{ id }'")
|
||||
.group("order_items.order_items_id")
|
||||
else
|
||||
# order summary for booking
|
||||
query.where("b.booking_id = ?", id)
|
||||
# order summary for booking
|
||||
OrderItem.select("orders.source,cus.contact_no,order_items.order_id, order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.options, order_items.item_order_by as order_by, order_items.created_at as order_at, order_items.set_menu_items, cus.name as customer, df.type, df.name as dining, item.alt_name as alt_name")
|
||||
.joins("left join orders ON orders.order_id = order_items.order_id
|
||||
left join booking_orders AS bo ON bo.order_id=order_items.order_id
|
||||
left join bookings AS b ON b.booking_id = bo.booking_id
|
||||
left join dining_facilities AS df ON df.id = b.dining_facility_id
|
||||
left join customers as cus ON cus.customer_id = orders.customer_id
|
||||
left join menu_items as item ON item.item_code = order_items.item_code")
|
||||
.where("b.booking_id = '#{ id }'")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -42,17 +42,17 @@ class Printer::PrinterWorker
|
||||
end
|
||||
|
||||
def print(file_path, printer_destination = nil )
|
||||
if printer_destination.nil?
|
||||
printer_destination = self.printer_destination
|
||||
end
|
||||
# if printer_destination.nil?
|
||||
# printer_destination = self.printer_destination
|
||||
# end
|
||||
|
||||
copy = self.print_copies
|
||||
#Print only when printer information is not null
|
||||
if !self.printer_destination.nil?
|
||||
(1..copy).each do
|
||||
page = Cups::PrintJob.new(file_path, printer_destination)
|
||||
page.print
|
||||
end
|
||||
end
|
||||
# copy = self.print_copies
|
||||
# #Print only when printer information is not null
|
||||
# if !self.printer_destination.nil?
|
||||
# (1..copy).each do
|
||||
# page = Cups::PrintJob.new(file_path, printer_destination)
|
||||
# page.print
|
||||
# end
|
||||
# end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user