oqs update
This commit is contained in:
@@ -118,6 +118,6 @@ class Oqs::HomeController < BaseOqsController
|
||||
left join bookings as bk on bk.booking_id = bo.booking_id
|
||||
left join dining_facilities as df on df.id = bk.dining_facility_id")
|
||||
.where("assigned_order_items.delivery_status = #{status}")
|
||||
.group("odt.order_items_id")
|
||||
.group("assigned_order_items.assigned_order_item_id")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -45,7 +45,8 @@ class OrderQueueStation < ApplicationRecord
|
||||
end
|
||||
# Auto Printing
|
||||
# ToDo per item per printer
|
||||
if oqs.auto_print && is_auto_printed == false
|
||||
if oqs.auto_print && is_auto_printed == false
|
||||
puts oqs_order_items.length
|
||||
print_slip(oqs, order, oqs_order_items)
|
||||
is_auto_printed = true
|
||||
end
|
||||
@@ -59,7 +60,7 @@ class OrderQueueStation < ApplicationRecord
|
||||
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||
order_queue_printer.print_order_summary(oqs,order.order_id, print_status="")
|
||||
order_queue_printer.print_order_summary(oqs,order.order_id, order_items, print_status="")
|
||||
|
||||
AssignedOrderItem.where("order_id = '#{ order.order_id }'").find_each do |ai|
|
||||
# update print status for order items
|
||||
|
||||
@@ -22,14 +22,14 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
end
|
||||
|
||||
# Query for per order
|
||||
def print_order_summary(oqs, order_id, print_status)
|
||||
def print_order_summary(oqs, order_id, order_items, print_status)
|
||||
#Use CUPS service
|
||||
#Generate PDF
|
||||
#Print
|
||||
#Print
|
||||
order=print_query('order_summary', order_id)
|
||||
# For Print Per Item
|
||||
if oqs.cut_per_item
|
||||
order.each do|odi|
|
||||
order_items.each do|odi|
|
||||
filename = "tmp/order_item_#{odi.item_name}" + ".pdf"
|
||||
# For Item Options
|
||||
options = odi.options == "[]"? "" : odi.options
|
||||
@@ -46,7 +46,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
# For Print Order Summary
|
||||
else
|
||||
filename = "tmp/order_summary_#{ order_id }" + ".pdf"
|
||||
pdf = OrderSummaryPdf.new(order, print_status)
|
||||
pdf = OrderSummaryPdf.new(order, print_status, order_items)
|
||||
pdf.render_file filename
|
||||
if oqs.print_copy
|
||||
self.print(filename, oqs.printer_name)
|
||||
|
||||
@@ -18,8 +18,8 @@ class OrderItemPdf < Prawn::Document
|
||||
# font "public/fonts/#{font_name}".to_s + ".ttf".to_s
|
||||
# font "public/fonts/Zawgyi-One.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
self.header_font_size = 14
|
||||
self.item_font_size = 12
|
||||
self.header_font_size = 12
|
||||
self.item_font_size = 10
|
||||
|
||||
text "#{ order_item.type + '-' + order_item.dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
stroke_horizontal_rule
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class OrderSummaryPdf < Prawn::Document
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width
|
||||
def initialize(order, print_status)
|
||||
def initialize(order, print_status, order_items = nil)
|
||||
self.page_width = 210
|
||||
self.page_height = 1450
|
||||
self.margin = 5
|
||||
@@ -28,8 +28,11 @@ class OrderSummaryPdf < Prawn::Document
|
||||
order_info(order[0].order_id, order[0].order_by,order[0].order_at)
|
||||
|
||||
# order items
|
||||
order_items(order)
|
||||
|
||||
if order_items == nil
|
||||
order_items(order)
|
||||
else
|
||||
order_items(order_items)
|
||||
end
|
||||
end
|
||||
|
||||
# Write Order Information to PDF
|
||||
@@ -73,6 +76,7 @@ class OrderSummaryPdf < Prawn::Document
|
||||
|
||||
#Add Order Item
|
||||
add_order_items(order_item)
|
||||
|
||||
end
|
||||
|
||||
# Add order items under order info
|
||||
@@ -89,11 +93,11 @@ class OrderSummaryPdf < Prawn::Document
|
||||
# text_box "#{odi.qty}", :at =>[self.item_width,y_position], :width => self.qty_width, :height =>self.item_height, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
||||
# }
|
||||
bounding_box([0,y_position], :width => self.item_width) do
|
||||
text "#{odi.item_name}", :size => self.item_font_size,:align => :left, :height => self.item_height
|
||||
text "#{odi.item_name}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
bounding_box([self.item_width,y_position], :width => self.qty_width) do
|
||||
text "#{odi.qty}", :size => self.item_font_size,:align => :left, :height => self.item_height
|
||||
text "#{odi.qty}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 5
|
||||
@@ -109,6 +113,10 @@ class OrderSummaryPdf < Prawn::Document
|
||||
|
||||
move_down 5
|
||||
end
|
||||
|
||||
dash(1, :space => 1, :phase => 1)
|
||||
stroke_horizontal_line 0, (self.page_width - self.margin)
|
||||
move_down 5
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user