update pdf and font
This commit is contained in:
@@ -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, order_items = nil)
|
||||
def initialize(order, print_status, order_items = nil,alt_name)
|
||||
self.page_width = 210
|
||||
self.page_height = 1450
|
||||
self.margin = 5
|
||||
@@ -15,8 +15,8 @@ class OrderSummaryPdf < Prawn::Document
|
||||
super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
|
||||
# font "public/fonts/#{font_name}".to_s + ".ttf".to_s
|
||||
# font "public/fonts/Zawgyi-One.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
font "public/fonts/Zawgyi-One.ttf"
|
||||
font "public/fonts/padauk.ttf"
|
||||
self.header_font_size = 12
|
||||
self.item_font_size = 10
|
||||
|
||||
@@ -31,7 +31,7 @@ class OrderSummaryPdf < Prawn::Document
|
||||
if order_items == nil
|
||||
order_items(order)
|
||||
else
|
||||
order_items(order_items)
|
||||
order_items(order_items, alt_name)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -60,7 +60,7 @@ class OrderSummaryPdf < Prawn::Document
|
||||
end
|
||||
|
||||
# Write Order items to PDF
|
||||
def order_items(order_item)
|
||||
def order_items(order_item, alt_name)
|
||||
y_position = cursor
|
||||
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
@@ -75,12 +75,12 @@ class OrderSummaryPdf < Prawn::Document
|
||||
move_down 5
|
||||
|
||||
#Add Order Item
|
||||
add_order_items(order_item)
|
||||
add_order_items(order_item, alt_name)
|
||||
|
||||
end
|
||||
|
||||
# Add order items under order info
|
||||
def add_order_items(order_item)
|
||||
def add_order_items(order_item, alt_name)
|
||||
y_position = cursor
|
||||
|
||||
move_down 5
|
||||
@@ -98,6 +98,13 @@ class OrderSummaryPdf < Prawn::Document
|
||||
text "#{odi.qty}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 3
|
||||
if alt_name
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "(#{odi.alt_name})", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
end
|
||||
move_down 5
|
||||
|
||||
# add option
|
||||
|
||||
Reference in New Issue
Block a user