Merge branch 'quick_service' of bitbucket.org:code2lab/sxrestaurant into split_bill
This commit is contained in:
@@ -164,7 +164,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
end
|
||||
|
||||
booking.booking_orders.each do |order|
|
||||
Order.pay_process_order_queue(order.order_id,table_id,sale_id)
|
||||
Order.pay_process_order_queue(order.order_id,table_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class OrderQueueProcessorJob < ApplicationJob
|
||||
queue_as :default
|
||||
|
||||
def perform(order_id, table_id,sale_id=nil)
|
||||
def perform(order_id, table_id)
|
||||
# Do something later
|
||||
#Order ID
|
||||
order = Order.find(order_id)
|
||||
@@ -9,7 +9,7 @@ class OrderQueueProcessorJob < ApplicationJob
|
||||
#Execute orders and send to order stations
|
||||
if order
|
||||
oqs = OrderQueueStation.new
|
||||
oqs.process_order(order, table_id,sale_id)
|
||||
oqs.process_order(order, table_id)
|
||||
end
|
||||
|
||||
assign_order = AssignedOrderItem.assigned_order_item_by_job(order_id)
|
||||
|
||||
@@ -309,9 +309,9 @@ class Order < ApplicationRecord
|
||||
end
|
||||
|
||||
#Process order items and send to order queue
|
||||
def self.pay_process_order_queue(id,table_id,sale_id=nil)
|
||||
def self.pay_process_order_queue(id,table_id)
|
||||
#Send to background job for processing
|
||||
OrderQueueProcessorJob.perform_later(id, table_id,sale_id)
|
||||
OrderQueueProcessorJob.perform_later(id, table_id)
|
||||
end
|
||||
|
||||
def check_cup_status(status)
|
||||
|
||||
@@ -13,16 +13,16 @@ class OrderQueueStation < ApplicationRecord
|
||||
# validations
|
||||
validates_presence_of :station_name, :printer_name
|
||||
|
||||
def process_order (order, table_id,sale_id=nil)
|
||||
def process_order (order, table_id)
|
||||
|
||||
oqs_stations = OrderQueueStation.active
|
||||
|
||||
|
||||
order_items = order.order_items
|
||||
|
||||
if table_id > 0
|
||||
if table_id.to_i > 0
|
||||
# get dining
|
||||
dining=DiningFacility.find(table_id)
|
||||
dining = DiningFacility.find(table_id)
|
||||
oqs_by_zones = OrderQueueProcessByZone.where("zone_id=#{dining.zone_id}")
|
||||
booking = Booking.find_by_dining_facility_id(dining.id)
|
||||
|
||||
@@ -64,46 +64,38 @@ class OrderQueueStation < ApplicationRecord
|
||||
end
|
||||
end
|
||||
else
|
||||
# get dining
|
||||
sale = Sale.find(sale_id).shift_sale_id
|
||||
terminal_by_zones = CashierTerminalByZones.where("cashier_terminal_id=#{shift.cashier_terminal_id}")
|
||||
|
||||
# ToDo per item per printer
|
||||
terminal_by_zones.each do |tbz|
|
||||
OrderQueueProcessByZone.where("zone_id=#{tbz.zone_id}").find_each do |oqpbz|
|
||||
oqs = OrderQueueStation.find(oqpbz.order_queue_station_id)
|
||||
is_auto_printed = false
|
||||
oqs_order_items = []
|
||||
oqs_stations.each do |oqs|
|
||||
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, order_item.item_instance_code, oqs)
|
||||
oqs_order_items.push(order_item)
|
||||
# end
|
||||
# end
|
||||
end
|
||||
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, order_item.item_instance_code, oqs)
|
||||
oqs_order_items.push(order_item)
|
||||
# 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
|
||||
|
||||
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 else
|
||||
|
||||
@@ -37,8 +37,12 @@ class OrderItemPdf < Prawn::Document
|
||||
# font "public/fonts/Zawgyi-One.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
#font "public/fonts/Chinese.ttf"
|
||||
|
||||
text "#{ order_item.type + '-' + order_item.dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
if order_item.dining.to_i > 0
|
||||
text "#{ order_item.type + '-' + order_item.dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
else
|
||||
text "#{ print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
end
|
||||
|
||||
stroke_horizontal_rule
|
||||
move_down 3
|
||||
|
||||
|
||||
@@ -37,8 +37,12 @@ class OrderItemSlimPdf < Prawn::Document
|
||||
# font "public/fonts/Zawgyi-One.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
#font "public/fonts/Chinese.ttf"
|
||||
|
||||
text "#{ order_item_slim.type + '-' + order_item_slim.dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
if order_item_slim.dining.to_i > 0
|
||||
text "#{ order_item_slim.type + '-' + order_item_slim.dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
else
|
||||
text "#{ print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
end
|
||||
|
||||
stroke_horizontal_rule
|
||||
move_down 1
|
||||
|
||||
|
||||
@@ -37,8 +37,11 @@ class OrderSetItemPdf < Prawn::Document
|
||||
# font "public/fonts/Zawgyi-One.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
#font "public/fonts/Chinese.ttf"
|
||||
|
||||
text "#{ order_set_item.type + '-' + order_set_item.dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
if order_set_item.dining.to_i > 0
|
||||
text "#{ order_set_item.type + '-' + order_set_item.dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
else
|
||||
text "#{ print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
end
|
||||
stroke_horizontal_rule
|
||||
move_down 3
|
||||
|
||||
|
||||
@@ -36,8 +36,12 @@ class OrderSummaryPdf < Prawn::Document
|
||||
|
||||
# font "public/fonts/Zawgyi-One.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
|
||||
text "#{ order[0].type + '-' + order[0].dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
if order[0].dining.to_i > 0
|
||||
text "#{ order[0].type + '-' + order[0].dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
else
|
||||
text "#{ print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
end
|
||||
|
||||
stroke_horizontal_rule
|
||||
move_down 5
|
||||
|
||||
|
||||
@@ -36,8 +36,12 @@ class OrderSummarySetPdf < Prawn::Document
|
||||
|
||||
# font "public/fonts/Zawgyi-One.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
|
||||
text "#{ order[0].type + '-' + order[0].dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
if order[0].dining.to_i > 0
|
||||
text "#{ order[0].type + '-' + order[0].dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
else
|
||||
text "#{ print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
end
|
||||
|
||||
stroke_horizontal_rule
|
||||
move_down 5
|
||||
|
||||
|
||||
@@ -36,8 +36,12 @@ class OrderSummarySlimPdf < Prawn::Document
|
||||
|
||||
# font "public/fonts/Zawgyi-One.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
|
||||
text "#{ order[0].type + '-' + order[0].dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
if order[0].dining.to_i > 0
|
||||
text "#{ order[0].type + '-' + order[0].dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
else
|
||||
text "#{ print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
end
|
||||
|
||||
stroke_horizontal_rule
|
||||
move_down 1
|
||||
|
||||
|
||||
@@ -110,9 +110,12 @@ class ReceiptBillA5Pdf < Prawn::Document
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
text "Receipt No: #{sale_data.receipt_no}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_description_width, y_position], :width => self.item_description_width, :height => self.item_height) do
|
||||
text "#{ sale_data.bookings[0].dining_facility.type } - #{ sale_data.bookings[0].dining_facility.name }" , :size => self.item_font_size,:align => :right
|
||||
if sale_data.bookings[0].dining_facility_id.to_i > 0
|
||||
bounding_box([self.item_description_width, y_position], :width => self.item_description_width, :height => self.item_height) do
|
||||
text "#{ sale_data.bookings[0].dining_facility.type } - #{ sale_data.bookings[0].dining_facility.name }" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
|
||||
move_down 10
|
||||
|
||||
y_position = cursor
|
||||
@@ -125,8 +128,13 @@ class ReceiptBillA5Pdf < Prawn::Document
|
||||
move_down 10
|
||||
|
||||
y_position = cursor
|
||||
if sale_data.bookings[0].dining_facility_id.to_i > 0
|
||||
time =sale_data.receipt_date.strftime('%d-%m-%Y') +"("+ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') +"-"+ sale_data.bookings[0].checkout_at.utc.getlocal.strftime('%I:%M %p')+")"
|
||||
else
|
||||
time = time = sale_data.receipt_date.strftime('%d-%m-%Y %H:%M %p')
|
||||
end
|
||||
bounding_box([0,y_position], :width =>self.page_width - 20, :height => self.item_height) do
|
||||
text "Date : #{ sale_data.receipt_date.strftime('%d-%m-%Y') } ( #{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') } - #{ sale_data.bookings[0].checkout_at.utc.getlocal.strftime('%I:%M %p') } )",:size => self.item_font_size,:align => :left
|
||||
text "Date : #{ time }",:size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -129,9 +129,9 @@ class ReceiptBillPdf < Prawn::Document
|
||||
|
||||
y_position = cursor
|
||||
if sale_data.bookings[0].dining_facility_id.to_i > 0
|
||||
time =sale_data.receipt_date.strftime('%d-%m-%Y') +"("+ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') +"-"+ sale_data.bookings[0].checkout_at.utc.getlocal.strftime('%I:%M %p')+")"
|
||||
time = sale_data.receipt_date.strftime('%d-%m-%Y') +"("+ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') +"-"+ sale_data.bookings[0].checkout_at.utc.getlocal.strftime('%I:%M %p')+")"
|
||||
else
|
||||
time = time = sale_data.receipt_date.strftime('%d-%m-%Y %H:%M %p')
|
||||
time = sale_data.receipt_date.strftime('%d-%m-%Y %H:%M %p')
|
||||
end
|
||||
|
||||
bounding_box([0,y_position], :width =>self.page_width - 10, :height => self.item_height) do
|
||||
|
||||
Reference in New Issue
Block a user