temp remove options in oqs

This commit is contained in:
Yan
2017-06-19 17:36:39 +06:30
parent d8930cb2b5
commit 9089eab196
5 changed files with 39 additions and 29 deletions

View File

@@ -2,9 +2,9 @@ class Oqs::HomeController < BaseOqsController
def index
queue_stations=OrderQueueStation.all
@queue_items_details = queue_items_query(0)
@queue_items_details = queue_items_query(false)
@queue_completed_item = queue_items_query(1)
@queue_completed_item = queue_items_query(true)
@queue_stations_items=Array.new

View File

@@ -16,6 +16,7 @@ class OrderQueueStation < ApplicationRecord
oqpbz = OrderQueueProcessByZone.find_by_zone_id(dining.zone_id)
order_items = order.order_items
#Assign OQS id to order Items
oqs_stations.each do |oqs|
#Get List of items -
@@ -26,16 +27,13 @@ class OrderQueueStation < ApplicationRecord
#Processing through the looping items
order_items.each do |order_item|
if (pq_item == order_item.item_code)
if oqs.id == oqpbz.order_queue_station_id
#Same Order_items can appear in two location.
# if oqs.id == oqpbz.order_queue_station_id
# #Same Order_items can appear in two location.
# AssignedOrderItem.assigned_order_item(order, order_item.item_code, oqs)
# else
AssignedOrderItem.assigned_order_item(order, order_item.item_code, oqs)
else
AssignedOrderItem.assigned_order_item(order, order_item.item_code, oqs)
end
puts oqs.station_name
puts oqs.auto_print
puts oqs.cut_per_item
puts oqs.print_copy
# end
if oqs.auto_print
print_slip(oqs, order, order_items)
end
@@ -43,29 +41,27 @@ class OrderQueueStation < ApplicationRecord
end
end
end
#Print OQS where printing is require
end
private
#Print order_items in 1 slip
def print_slip(oqs, order, items)
def print_slip(oqs, order, 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|
AssignedOrderItem.where("order_id = '#{ order.order_id }'").find_each do |ai|
# update print status for order items
ai.print_status=true
ai.save
end
end
end
#Print order_item in 1 slip per item
def print_slip_item(oqs, item)
def print_slip_item(oqs, assigned_order_item)
unique_code="OrderItemPdf"
# print when complete click
@@ -74,7 +70,7 @@ class OrderQueueStation < ApplicationRecord
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|
assigned_order_item.each do |ai|
ai.print_status=true
ai.save
end

View File

@@ -23,13 +23,15 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
# 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.render_file "tmp/order_item.pdf"
# pdf.render_file "tmp/order_item.pdf"
pdf.render_file filename
if oqs.print_copy
self.print("tmp/order_item.pdf", oqs.printer_name)
self.print("tmp/order_item.pdf", oqs.printer_name)
self.print(filename, oqs.printer_name)
self.print(filename.gsub(".","-copy."), oqs.printer_name)
else
self.print("tmp/order_item.pdf", oqs.printer_name)
self.print(filename, oqs.printer_name)
end
end
# For Print Order Summary
@@ -37,7 +39,12 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
filename = "tmp/order_summary_#{order_id}" + ".pdf"
pdf = OrderSummaryPdf.new(order)
pdf.render_file filename
self.print(filename, oqs.printer_name)
if oqs.print_copy
self.print(filename, oqs.printer_name)
self.print(filename.gsub(".","-copy."), oqs.printer_name)
else
self.print(filename, oqs.printer_name)
end
end
end

View File

@@ -77,6 +77,7 @@ class OrderSummaryPdf < Prawn::Document
move_down 5
order_item.each do|odi|
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
text "#{odi.item_name}", :size => self.item_font_size,:align => :left
end
@@ -84,9 +85,9 @@ class OrderSummaryPdf < Prawn::Document
bounding_box([self.item_width,y_position], :width => self.qty_width, :height => self.item_height) do
text "#{odi.qty}", :size => self.item_font_size,:align => :left
end
end
move_down 5
move_down 5
end
end
end

View File

@@ -49,7 +49,10 @@
<%= qid.qty %>
</span> ]
</h4>
<p class="card-text">Medium, Fries, Salad</p>
<!--
Item Options
<p class="card-text">Medium, Fries, Salad</p>
-->
<p class="card-text">
<small class="text-muted">Order at
<span class="order-at">
@@ -97,7 +100,10 @@
<%= qid.qty %>
</span> ]
</h4>
<p class="card-text">Medium, Fries, Salad</p>
<!--
Item Options
<p class="card-text">Medium, Fries, Salad</p>
-->
<p class="card-text">
<small class="text-muted">Order at
<span class="order-at">