update order queue printer

This commit is contained in:
Aung Myo
2017-06-29 10:52:12 +06:30
parent 173d824c27
commit 557ad06600
5 changed files with 34 additions and 31 deletions

View File

@@ -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, alt_name)
def initialize(print_settings,order_item, print_status, options, alt_name)
self.page_width = 210
self.page_height = 1450
self.margin = 5
@@ -12,7 +12,7 @@ class OrderItemPdf < Prawn::Document
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
self.label_width=100
super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
super(:margin => [print_settings.heading_space, 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
@@ -87,8 +87,9 @@ class OrderItemPdf < Prawn::Document
if alt_name
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
font "public/fonts/Chinese.ttf"
text "(#{order_item.alt_name})", :size => self.item_font_size,:align => :left, :inline_format => true
font("public/fonts/Chinese.ttf", :size => 14) do
text "(#{order_item.alt_name})", :size => self.item_font_size,:align => :left, :inline_format => true
end
end
end