oqs updated
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
|
||||
def print_order_item(oqs,order_id, item_code)
|
||||
def print_order_item(oqs,order_id, item_code, print_status)
|
||||
#Use CUPS service
|
||||
#Generate PDF
|
||||
#Print
|
||||
order_item= print_query('order_item', item_code) #OrderItem.find_by_item_code(item_code)
|
||||
pdf = OrderItemPdf.new(order_item[0])
|
||||
order_item = print_query('order_item', item_code) #OrderItem.find_by_item_code(item_code)
|
||||
pdf = OrderItemPdf.new(order_item[0], print_status)
|
||||
pdf.render_file "tmp/order_item.pdf"
|
||||
if oqs.print_copy
|
||||
self.print("tmp/order_item.pdf", oqs.printer_name)
|
||||
@@ -15,16 +15,16 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
end
|
||||
end
|
||||
|
||||
def print_order_summary(oqs,order_id)
|
||||
def print_order_summary(oqs,booking, print_status)
|
||||
#Use CUPS service
|
||||
#Generate PDF
|
||||
#Print
|
||||
order=print_query('order_summary',order_id)
|
||||
order=print_query('order_summary',booking.booking_id)
|
||||
# For Print Per Item
|
||||
if oqs.cut_per_item
|
||||
order.each do|odi|
|
||||
filename = "tmp/order_item_#{odi.item_name}" + ".pdf"
|
||||
pdf = OrderItemPdf.new(odi)
|
||||
pdf = OrderItemPdf.new(odi, print_status)
|
||||
# pdf.render_file "tmp/order_item.pdf"
|
||||
pdf.render_file filename
|
||||
if oqs.print_copy
|
||||
@@ -36,8 +36,8 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
end
|
||||
# For Print Order Summary
|
||||
else
|
||||
filename = "tmp/order_summary_#{order_id}" + ".pdf"
|
||||
pdf = OrderSummaryPdf.new(order)
|
||||
filename = "tmp/order_summary_#{booking.booking_id}" + ".pdf"
|
||||
pdf = OrderSummaryPdf.new(order, print_status)
|
||||
pdf.render_file filename
|
||||
if oqs.print_copy
|
||||
self.print(filename, oqs.printer_name)
|
||||
@@ -59,15 +59,15 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
left join customers as cus ON cus.customer_id = orders.customer_id")
|
||||
.where("order_items.item_code='" + code + "'")
|
||||
.group("order_items.item_code")
|
||||
else
|
||||
else
|
||||
OrderItem.select("order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.item_order_by as order_by, order_items.created_at as order_at, cus.name as customer, df.name as dining")
|
||||
.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")
|
||||
.where("orders.order_id='" + code + "'")
|
||||
.group("order_items.item_code")
|
||||
.where("b.booking_id='" + code + "'")
|
||||
# .group("order_items.item_code")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user