This commit is contained in:
Yan
2017-06-19 15:55:21 +06:30
parent b826b479cd
commit d8930cb2b5

View File

@@ -32,23 +32,51 @@ class OrderQueueStation < ApplicationRecord
else else
AssignedOrderItem.assigned_order_item(order, order_item.item_code, oqs) AssignedOrderItem.assigned_order_item(order, order_item.item_code, oqs)
end end
puts oqs.station_name
puts oqs.auto_print
puts oqs.cut_per_item
puts oqs.print_copy
if oqs.auto_print
print_slip(oqs, order, order_items)
end
end end
end end
end end
end end
#Print OQS where printing is require #Print OQS where printing is require
end end
private private
#Print order_items in 1 slip #Print order_items in 1 slip
def print_slip def print_slip(oqs, order, items)
unique_code="OrderSummaryPdf"
# print when complete click
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)
# update print status for completed same order items
items.each do |ai|
ai.print_status=true
ai.save
end
end end
#Print order_items in 1 slip per item #Print order_item in 1 slip per item
def print_slip_item def print_slip_item(oqs, item)
unique_code="OrderItemPdf"
# print when complete click
print_settings=PrintSetting.find_by_unique_code(unique_code)
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
order_queue_printer.print_order_item(oqs,item.order_id, item.item_code )
# update print status for completed same order items
item.each do |ai|
ai.print_status=true
ai.save
end
end end
end end