update pdf and font

This commit is contained in:
Aung Myo
2017-06-28 11:50:05 +06:30
parent 53ff3989b5
commit c16d322cea
15 changed files with 9496 additions and 59 deletions

View File

@@ -10,7 +10,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
# check for item not to show
if order_item[0].price != 0
pdf = OrderItemPdf.new(order_item[0], print_status, options)
pdf = OrderItemPdf.new(order_item[0], print_status, options, oqs.use_alternate_name)
pdf.render_file filename
if oqs.print_copy
@@ -31,6 +31,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
#Generate PDF
#Print
order=print_query('order_summary', order_id)
# For Print Per Item
if oqs.cut_per_item
order_items.each do|odi|
@@ -40,7 +41,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
# check for item not to show
if odi.price != 0 || odi.price != 10
pdf = OrderItemPdf.new(odi, print_status, options)
pdf = OrderItemPdf.new(odi, print_status, options, oqs.use_alternate_name)
# pdf.render_file "tmp/order_item.pdf"
pdf.render_file filename
if oqs.print_copy
@@ -54,7 +55,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
# For Print Order Summary
else
filename = "tmp/order_summary_#{ order_id }" + ".pdf"
pdf = OrderSummaryPdf.new(order, print_status, order_items)
pdf = OrderSummaryPdf.new(order, print_status, order_items, oqs.use_alternate_name)
pdf.render_file filename
if oqs.print_copy
self.print(filename, oqs.printer_name)
@@ -80,7 +81,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
# check for item not to show
if odi.price != 0
pdf = OrderItemPdf.new(odi, print_status, options)
pdf = OrderItemPdf.new(odi, print_status, options,oqs.use_alternate_name)
pdf.render_file filename
if oqs.print_copy
@@ -97,7 +98,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
# For Print Order Summary
else
filename = "tmp/booking_summary_#{ booking_id }" + ".pdf"
pdf = OrderSummaryPdf.new(order, print_status)
pdf = OrderSummaryPdf.new(order, print_status,oqs.use_alternate_name)
pdf.render_file filename
if oqs.print_copy
self.print(filename, oqs.printer_name)
@@ -114,31 +115,34 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
# Query for OQS with status
def print_query(type, id)
if type == "order_item"
OrderItem.select("order_items.order_id, order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.options, order_items.item_order_by as order_by, order_items.created_at as order_at, cus.name as customer, df.type, df.name as dining")
OrderItem.select("order_items.order_id, order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.options, order_items.item_order_by as order_by, order_items.created_at as order_at, cus.name as customer, df.type, df.name as dining,item.alt_name as alt_name")
.joins("left join orders ON orders.order_id = order_items.order_id
left join booking_orders AS bo ON bo.order_id=order_items.order_id
left join bookings AS b ON b.booking_id = bo.booking_id
left join dining_facilities AS df ON df.id = b.dining_facility_id
left join customers as cus ON cus.customer_id = orders.customer_id")
left join customers as cus ON cus.customer_id = orders.customer_id
left join menu_items as item ON item.item_code = order_items.item_code")
.where("order_items.item_code = '#{ id }' AND order_items.price != 0")
.group("order_items.item_code")
elsif type == "order_summary"
OrderItem.select("order_items.order_id, order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.options, order_items.item_order_by as order_by, order_items.created_at as order_at, cus.name as customer, df.type, df.name as dining")
OrderItem.select("order_items.order_id, order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.options, order_items.item_order_by as order_by, order_items.created_at as order_at, cus.name as customer, df.type, df.name as dining,item.alt_name as alt_name")
.joins("left join orders ON orders.order_id = order_items.order_id
left join booking_orders AS bo ON bo.order_id=order_items.order_id
left join bookings AS b ON b.booking_id = bo.booking_id
left join dining_facilities AS df ON df.id = b.dining_facility_id
left join customers as cus ON cus.customer_id = orders.customer_id")
left join customers as cus ON cus.customer_id = orders.customer_id
left join menu_items as item ON item.item_code = order_items.item_code")
.where("orders.order_id = '#{ id }' AND order_items.price != 0")
.group("order_items.order_items_id")
else
# order summary for booking
OrderItem.select("order_items.order_id, order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.options, order_items.item_order_by as order_by, order_items.created_at as order_at, cus.name as customer, df.type, df.name as dining")
OrderItem.select("order_items.order_id, order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.options, order_items.item_order_by as order_by, order_items.created_at as order_at, cus.name as customer, df.type, df.name as dining,item.alt_name as alt_name")
.joins("left join orders ON orders.order_id = order_items.order_id
left join booking_orders AS bo ON bo.order_id=order_items.order_id
left join bookings AS b ON b.booking_id = bo.booking_id
left join dining_facilities AS df ON df.id = b.dining_facility_id
left join customers as cus ON cus.customer_id = orders.customer_id")
left join customers as cus ON cus.customer_id = orders.customer_id
left join menu_items as item ON item.item_code = order_items.item_code")
.where("b.booking_id = '#{ id }' AND order_items.price != 0")
end