change oqs print

This commit is contained in:
Yan
2017-10-16 18:30:59 +06:30
parent c85ebcff14
commit a7ad3e2476

View File

@@ -21,43 +21,78 @@ class OrderQueueStation < ApplicationRecord
booking = Booking.find_by_dining_facility_id(dining.id)
#Assign OQS id to order Items
oqs_stations.each do |oqs|
is_auto_printed = false
oqs_order_items = []
#Get List of items -
pq_items = JSON.parse(oqs.processing_items)
# oqs_stations.each do |oqs|
# is_auto_printed = false
# oqs_order_items = []
# #Get List of items -
# pq_items = JSON.parse(oqs.processing_items)
#Loop through the processing items
pq_items.each do |pq_item|
#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.
# AssignedOrderItem.assigned_order_item(order, order_item.item_code, oqs)
# else
# #Loop through the processing items
# pq_items.each do |pq_item|
# #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.
# # AssignedOrderItem.assigned_order_item(order, order_item.item_code, oqs)
# # else
if (order_item.price != 0)
AssignedOrderItem.assigned_order_item(order, order_item.item_code, oqs)
oqs_order_items.push(order_item)
end
# end
end
end
end
# Auto Printing
# if (order_item.price != 0)
# AssignedOrderItem.assigned_order_item(order, order_item.item_code, oqs)
# oqs_order_items.push(order_item)
# end
# # end
# end
# end
# end
# ToDo per item per printer
OrderQueueProcessByZone.where("zone_id=#{dining.zone_id}").find_each do |oqpbz|
if oqs.id == oqpbz.order_queue_station_id
oqs = OrderQueueStation.find(oqpbz.order_queue_station_id)
is_auto_printed = false
oqs_order_items = []
if oqs.is_active
#Get List of items -
pq_items = JSON.parse(oqs.processing_items)
#Loop through the processing items
pq_items.each do |pq_item|
#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.
# AssignedOrderItem.assigned_order_item(order, order_item.item_code, oqs)
# else
if (order_item.price != 0)
AssignedOrderItem.assigned_order_item(order, order_item.item_code, oqs)
oqs_order_items.push(order_item)
end
# end
end
end
end
if oqs.auto_print
if oqs_order_items.length > 0
print_slip(oqs, order, oqs_order_items)
is_auto_printed = true
end
end
end
end
# if oqs.id == oqpbz.order_queue_station_id
# # Auto Printing
# if oqs.auto_print
# if oqs_order_items.length > 0
# print_slip(oqs, order, oqs_order_items)
# is_auto_printed = true
# end
# end
# end
end
end
# end
end
private