add order_slim_pdf in settings/lookups and change order_slim_pdf
This commit is contained in:
13
README.md
13
README.md
@@ -44,11 +44,14 @@ For Extra Time
|
||||
For Order Item & Order Summary Slim
|
||||
*** change OrderItemPdf to OrderItemSlimPdf and OrderSummaryPdf to OrderSummarySlimPdf
|
||||
1) settings/print_settings
|
||||
2) app/controllers/oqs/edit_controller.rb
|
||||
3) app/controllers/oqs/print_controller.rb
|
||||
4) app/models/order_queue_station.rb
|
||||
5) app/models/printer/order_queue_printer.rb
|
||||
6) app/models/printer/receipt_printer.rb
|
||||
2) settings/lookups => { type:order_slim_pdf, name:OrderSlimPdf, value:1 }
|
||||
* no need to change these page
|
||||
{ app/controllers/oqs/edit_controller.rb
|
||||
app/controllers/oqs/print_controller.rb
|
||||
app/models/order_queue_station.rb
|
||||
app/models/printer/order_queue_printer.rb
|
||||
app/models/printer/receipt_printer.rb
|
||||
}
|
||||
|
||||
For Bank Integration setting
|
||||
1) rake db:migrate for card_sale_trans, card_settle_trans
|
||||
|
||||
@@ -21,8 +21,15 @@ class Oqs::EditController < BaseOqsController
|
||||
assigned_item = AssignedOrderItem.find_by_instance_code(order_item.item_instance_code)
|
||||
# order queue stations
|
||||
oqs = assigned_item.order_queue_station
|
||||
|
||||
order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf
|
||||
|
||||
unique_code="OrderItemPdf"
|
||||
unique_code="OrderItemPdf"
|
||||
if !order_slim_pdf.nil?
|
||||
if order_slim_pdf[0][1] == '1'
|
||||
unique_code="OrderItemSlimPdf"
|
||||
end
|
||||
end
|
||||
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||
|
||||
@@ -2,7 +2,14 @@ class Oqs::PrintController < ApplicationController
|
||||
# Print Order Item
|
||||
def print
|
||||
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||
order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf
|
||||
unique_code="OrderItemPdf"
|
||||
if !order_slim_pdf.nil?
|
||||
if order_slim_pdf[0][1] == '1'
|
||||
unique_code="OrderItemSlimPdf"
|
||||
end
|
||||
end
|
||||
|
||||
assigned_item_id = params[:id]
|
||||
options = params[:options]
|
||||
assigned_item = AssignedOrderItem.find(assigned_item_id)
|
||||
@@ -31,7 +38,14 @@ class Oqs::PrintController < ApplicationController
|
||||
# Print Order Details with booking id
|
||||
def print_order_summary
|
||||
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||
order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf
|
||||
unique_code="OrderSummaryPdf"
|
||||
if !order_slim_pdf.nil?
|
||||
if order_slim_pdf[0][1] == '1'
|
||||
unique_code="OrderSummarySlimPdf"
|
||||
end
|
||||
end
|
||||
|
||||
assigned_item_id = params[:id]
|
||||
table_name = params[:table_name]
|
||||
assigned_item = AssignedOrderItem.find(assigned_item_id)
|
||||
|
||||
@@ -101,8 +101,15 @@ class OrderQueueStation < ApplicationRecord
|
||||
|
||||
private
|
||||
#Print order_items in 1 slip
|
||||
def print_slip(oqs, order, order_items)
|
||||
def print_slip(oqs, order, order_items)
|
||||
order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf
|
||||
unique_code="OrderSummaryPdf"
|
||||
if !order_slim_pdf.nil?
|
||||
if order_slim_pdf[0][1] == '1'
|
||||
unique_code="OrderSummarySlimPdf"
|
||||
end
|
||||
end
|
||||
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||
order_queue_printer.print_order_summary(print_settings, oqs,order.order_id, order_items, print_status="")
|
||||
@@ -117,7 +124,14 @@ class OrderQueueStation < ApplicationRecord
|
||||
|
||||
#Print order_item in 1 slip per item
|
||||
def print_slip_item(oqs, assigned_item)
|
||||
unique_code="OrderItemPdf"
|
||||
order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf
|
||||
unique_code="OrderItemPdf"
|
||||
if !order_slim_pdf.nil?
|
||||
if order_slim_pdf[0][1] == '1'
|
||||
unique_code="OrderItemSlimPdf"
|
||||
end
|
||||
end
|
||||
|
||||
order_item = OrderItem.where("order_id='#{assigned_item.order_id}' AND item_instance_code='#{assigned_item.instance_code}'").first()
|
||||
# print when complete click
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
|
||||
@@ -14,9 +14,19 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
|
||||
filename = "tmp/order_item_#{order_id}_#{order_item_id}" + ".pdf"
|
||||
|
||||
order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf
|
||||
|
||||
# check for item not to show
|
||||
# if order_item[0].price != 0
|
||||
pdf = OrderItemPdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name)
|
||||
if !order_slim_pdf.nil?
|
||||
if order_slim_pdf[0][1] == '1'
|
||||
pdf = OrderItemSlimPdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name)
|
||||
else
|
||||
pdf = OrderItemPdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name)
|
||||
end
|
||||
else
|
||||
pdf = OrderItemPdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name)
|
||||
end
|
||||
pdf.render_file filename
|
||||
|
||||
if oqs.print_copy
|
||||
@@ -43,6 +53,8 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
print_settings.save!
|
||||
end
|
||||
|
||||
order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf
|
||||
|
||||
order=print_query('order_summary', order_id)
|
||||
# For Print Per Item
|
||||
if oqs.cut_per_item
|
||||
@@ -55,7 +67,15 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
|
||||
# check for item not to show
|
||||
#if odi.price != 0
|
||||
pdf = OrderItemPdf.new(print_settings,odi_item[0], print_status, options, oqs.use_alternate_name)
|
||||
if !order_slim_pdf.nil?
|
||||
if order_slim_pdf[0][1] == '1'
|
||||
pdf = OrderItemSlimPdf.new(print_settings,odi_item[0], print_status, options, oqs.use_alternate_name)
|
||||
else
|
||||
pdf = OrderItemPdf.new(print_settings,odi_item[0], print_status, options, oqs.use_alternate_name)
|
||||
end
|
||||
else
|
||||
pdf = OrderItemPdf.new(print_settings,odi_item[0], print_status, options, oqs.use_alternate_name)
|
||||
end
|
||||
# pdf.render_file "tmp/order_item.pdf"
|
||||
pdf.render_file filename
|
||||
if oqs.print_copy
|
||||
@@ -71,7 +91,15 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
# For Print Order Summary
|
||||
else
|
||||
filename = "tmp/order_summary_#{order_id}" + ".pdf"
|
||||
pdf = OrderSummaryPdf.new(print_settings,order, print_status, order_items, oqs.use_alternate_name)
|
||||
if !order_slim_pdf.nil?
|
||||
if order_slim_pdf[0][1] == '1'
|
||||
pdf = OrderSummarySlimPdf.new(print_settings,order, print_status, order_items, oqs.use_alternate_name)
|
||||
else
|
||||
pdf = OrderSummaryPdf.new(print_settings,order, print_status, order_items, oqs.use_alternate_name)
|
||||
end
|
||||
else
|
||||
pdf = OrderSummaryPdf.new(print_settings,order, print_status, order_items, oqs.use_alternate_name)
|
||||
end
|
||||
pdf.render_file filename
|
||||
if oqs.print_copy
|
||||
self.print(filename, oqs.printer_name)
|
||||
@@ -94,6 +122,8 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
print_settings.save!
|
||||
end
|
||||
|
||||
order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf
|
||||
|
||||
order=print_query('booking_summary', booking_id)
|
||||
# For Print Per Item
|
||||
if oqs.cut_per_item
|
||||
@@ -104,7 +134,15 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
|
||||
# check for item not to show
|
||||
#if odi.price != 0
|
||||
pdf = OrderItemPdf.new(print_settings,odi, print_status, options,oqs.use_alternate_name)
|
||||
if !order_slim_pdf.nil?
|
||||
if order_slim_pdf[0][1] == '1'
|
||||
pdf = OrderItemSlimPdf.new(print_settings,odi, print_status, options,oqs.use_alternate_name)
|
||||
else
|
||||
pdf = OrderItemPdf.new(print_settings,odi, print_status, options,oqs.use_alternate_name)
|
||||
end
|
||||
else
|
||||
pdf = OrderItemPdf.new(print_settings,odi, print_status, options,oqs.use_alternate_name)
|
||||
end
|
||||
pdf.render_file filename
|
||||
|
||||
if oqs.print_copy
|
||||
@@ -122,8 +160,16 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
end
|
||||
# For Print Order Summary
|
||||
else
|
||||
filename = "tmp/booking_summary_#{booking_id}" + ".pdf"
|
||||
pdf = OrderSummaryPdf.new(print_settings,order, print_status,oqs.use_alternate_name)
|
||||
filename = "tmp/booking_summary_#{booking_id}" + ".pdf"
|
||||
if !order_slim_pdf.nil?
|
||||
if order_slim_pdf[0][1] == '1'
|
||||
pdf = OrderSummarySlimPdf.new(print_settings,order, print_status,oqs.use_alternate_name)
|
||||
else
|
||||
pdf = OrderSummaryPdf.new(print_settings,order, print_status,oqs.use_alternate_name)
|
||||
end
|
||||
else
|
||||
pdf = OrderSummaryPdf.new(print_settings,order, print_status,oqs.use_alternate_name)
|
||||
end
|
||||
pdf.render_file filename
|
||||
if oqs.print_copy
|
||||
self.print(filename, oqs.printer_name)
|
||||
|
||||
@@ -4,7 +4,13 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
#Use CUPS service
|
||||
#Generate PDF
|
||||
#Print
|
||||
order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf
|
||||
pdf = OrderItemPdf.new
|
||||
if !order_slim_pdf.nil?
|
||||
if order_slim_pdf[0][1] == '1'
|
||||
pdf = OrderItemSlimPdf.new
|
||||
end
|
||||
end
|
||||
pdf.render_file "tmp/order_item_queue_#{order_id}_#{order_item_id}" + ".pdf"
|
||||
self.print("tmp/receipt.pdf")
|
||||
end
|
||||
@@ -14,7 +20,13 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
#Generate PDF
|
||||
#Print
|
||||
filename = "tmp/order_summary_#{booking_id}" + ".pdf"
|
||||
order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf
|
||||
pdf = OrderSummaryPdf.new
|
||||
if !order_slim_pdf.nil?
|
||||
if order_slim_pdf[1] == '1'
|
||||
pdf = OrderSummarySlimPdf.new
|
||||
end
|
||||
end
|
||||
pdf.render_file filename
|
||||
|
||||
self.print(filename)
|
||||
@@ -24,8 +36,14 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
#Use CUPS service
|
||||
#Generate PDF
|
||||
#Print
|
||||
order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf
|
||||
filename = "tmp/order_summary_#{booking_id}" + ".pdf"
|
||||
pdf = OrderSummaryPdf.new
|
||||
if !order_slim_pdf.nil?
|
||||
if order_slim_pdf[1] == '1'
|
||||
pdf = OrderSummarySlimPdf.new
|
||||
end
|
||||
end
|
||||
pdf.render_file filename
|
||||
|
||||
self.print(filename)
|
||||
@@ -35,8 +53,14 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
#Use CUPS service
|
||||
#Generate PDF
|
||||
#Print
|
||||
order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf
|
||||
filename = "tmp/order_summary_#{booking_id}" + ".pdf"
|
||||
pdf = OrderSummaryPdf.new
|
||||
if !order_slim_pdf.nil?
|
||||
if order_slim_pdf[1] == '1'
|
||||
pdf = OrderSummarySlimPdf.new
|
||||
end
|
||||
end
|
||||
pdf.render_file filename
|
||||
|
||||
self.print(filename)
|
||||
@@ -46,8 +70,14 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
#Use CUPS service
|
||||
#Generate PDF
|
||||
#Print
|
||||
order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf
|
||||
filename = "tmp/order_summary_#{booking_id}" + ".pdf"
|
||||
pdf = OrderSummaryPdf.new
|
||||
if !order_slim_pdf.nil?
|
||||
if order_slim_pdf[1] == '1'
|
||||
pdf = OrderSummarySlimPdf.new
|
||||
end
|
||||
end
|
||||
pdf.render_file filename
|
||||
|
||||
self.print(filename)
|
||||
@@ -57,8 +87,14 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
#Use CUPS service
|
||||
#Generate PDF
|
||||
#Print
|
||||
order_slim_pdf = Lookup.collection_of("order_slim_pdf") #order_slim_pdf
|
||||
filename = "tmp/order_summary_#{booking_id}" + ".pdf"
|
||||
pdf = OrderSummaryPdf.new
|
||||
if !order_slim_pdf.nil?
|
||||
if order_slim_pdf[1] == '1'
|
||||
pdf = OrderSummarySlimPdf.new
|
||||
end
|
||||
end
|
||||
pdf.render_file filename
|
||||
|
||||
self.print(filename)
|
||||
|
||||
Reference in New Issue
Block a user