update pdf and font
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
class OrderItemPdf < 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_item, print_status, options)
|
||||
def initialize(order_item, print_status, options, alt_name)
|
||||
self.page_width = 210
|
||||
self.page_height = 1450
|
||||
self.margin = 5
|
||||
@@ -15,9 +15,9 @@ class OrderItemPdf < Prawn::Document
|
||||
super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
# super(:margin => [10, 5, 30, 5], :page_size => [200,400])
|
||||
|
||||
# font "public/fonts/#{font_name}".to_s + ".ttf".to_s
|
||||
# font "public/fonts/Zawgyi-One.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
# 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 = 12
|
||||
self.item_font_size = 10
|
||||
|
||||
@@ -29,7 +29,7 @@ class OrderItemPdf < Prawn::Document
|
||||
order_info(order_item.order_id, order_item.order_by,order_item.order_at)
|
||||
|
||||
# order items
|
||||
order_items(order_item, options)
|
||||
order_items(order_item, options, alt_name)
|
||||
end
|
||||
|
||||
# Write Order Information to PDF
|
||||
@@ -57,11 +57,11 @@ class OrderItemPdf < Prawn::Document
|
||||
end
|
||||
|
||||
# Write Order items to PDF
|
||||
def order_items(order_item, options)
|
||||
def order_items(order_item, options, alt_name)
|
||||
y_position = cursor
|
||||
|
||||
#Add Order Item
|
||||
add_order_items(order_item, options)
|
||||
add_order_items(order_item, options, alt_name)
|
||||
|
||||
dash(1, :space => 1, :phase => 1)
|
||||
stroke_horizontal_line 0, (self.page_width - self.margin)
|
||||
@@ -69,7 +69,7 @@ class OrderItemPdf < Prawn::Document
|
||||
end
|
||||
|
||||
# Add order items under order info
|
||||
def add_order_items(order_item, options)
|
||||
def add_order_items(order_item, options, alt_name)
|
||||
y_position = cursor
|
||||
|
||||
move_down 5
|
||||
@@ -82,6 +82,14 @@ class OrderItemPdf < Prawn::Document
|
||||
text "[#{order_item.qty.to_i}]", :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 "(#{order_item.alt_name})", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
end
|
||||
|
||||
move_down 5
|
||||
|
||||
# add option
|
||||
|
||||
@@ -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