From a525babf9a5f7fbc113be6fde3f0fa4f052a3cd7 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Tue, 26 Dec 2017 16:19:25 +0630 Subject: [PATCH] update order queue printer for bitp k5 problem --- app/controllers/oqs/print_controller.rb | 2 +- app/models/printer/order_queue_printer.rb | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/controllers/oqs/print_controller.rb b/app/controllers/oqs/print_controller.rb index 0ff94403..f432ad29 100755 --- a/app/controllers/oqs/print_controller.rb +++ b/app/controllers/oqs/print_controller.rb @@ -4,7 +4,7 @@ class Oqs::PrintController < ApplicationController unique_code="OrderItemPdf" assigned_item_id = params[:id] options = params[:options] - assigned_item = AssignedOrderItem.find(assigned_item_id) + assigned_item = AssignedOrderItem.find(assigned_item_id) assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'"); # order queue stations diff --git a/app/models/printer/order_queue_printer.rb b/app/models/printer/order_queue_printer.rb index 499c718d..cc08f9ba 100755 --- a/app/models/printer/order_queue_printer.rb +++ b/app/models/printer/order_queue_printer.rb @@ -46,14 +46,16 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker 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| + odi_item=print_query('order_item', odi.order_items_id) filename = "tmp/order_item_#{order_id}" + ".pdf" # For Item Options options = odi.options == "[]"? "" : odi.options # check for item not to show #if odi.price != 0 - pdf = OrderItemPdf.new(print_settings,odi, print_status, options, oqs.use_alternate_name) + pdf = OrderItemPdf.new(print_settings,odi_item[0], print_status, options, oqs.use_alternate_name) # pdf.render_file "tmp/order_item.pdf" pdf.render_file filename if oqs.print_copy