oqs update

This commit is contained in:
Yan
2017-06-26 18:45:20 +06:30
parent e878275c1b
commit cb77c771b8
5 changed files with 23 additions and 14 deletions

View File

@@ -18,8 +18,8 @@ class OrderItemPdf < Prawn::Document
# font "public/fonts/#{font_name}".to_s + ".ttf".to_s
# font "public/fonts/Zawgyi-One.ttf"
# font "public/fonts/padauk.ttf"
self.header_font_size = 14
self.item_font_size = 12
self.header_font_size = 12
self.item_font_size = 10
text "#{ order_item.type + '-' + order_item.dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
stroke_horizontal_rule

View File

@@ -1,6 +1,6 @@
class OrderSummaryPdf < Prawn::Document
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width
def initialize(order, print_status)
def initialize(order, print_status, order_items = nil)
self.page_width = 210
self.page_height = 1450
self.margin = 5
@@ -28,8 +28,11 @@ class OrderSummaryPdf < Prawn::Document
order_info(order[0].order_id, order[0].order_by,order[0].order_at)
# order items
order_items(order)
if order_items == nil
order_items(order)
else
order_items(order_items)
end
end
# Write Order Information to PDF
@@ -73,6 +76,7 @@ class OrderSummaryPdf < Prawn::Document
#Add Order Item
add_order_items(order_item)
end
# Add order items under order info
@@ -89,11 +93,11 @@ class OrderSummaryPdf < Prawn::Document
# text_box "#{odi.qty}", :at =>[self.item_width,y_position], :width => self.qty_width, :height =>self.item_height, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
# }
bounding_box([0,y_position], :width => self.item_width) do
text "#{odi.item_name}", :size => self.item_font_size,:align => :left, :height => self.item_height
text "#{odi.item_name}", :size => self.item_font_size,:align => :left
end
bounding_box([self.item_width,y_position], :width => self.qty_width) do
text "#{odi.qty}", :size => self.item_font_size,:align => :left, :height => self.item_height
text "#{odi.qty}", :size => self.item_font_size,:align => :left
end
move_down 5
@@ -109,6 +113,10 @@ class OrderSummaryPdf < Prawn::Document
move_down 5
end
dash(1, :space => 1, :phase => 1)
stroke_horizontal_line 0, (self.page_width - self.margin)
move_down 5
end
end