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 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,alt_name)
def initialize(print_settings,order, print_status, order_items = nil,alt_name)
self.page_width = 210
self.page_height = 1450
self.margin = 5
@@ -12,11 +12,11 @@ class OrderSummaryPdf < 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])
# 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
@@ -92,20 +92,26 @@ class OrderSummaryPdf < Prawn::Document
bounding_box([0,y_position], :width => self.item_width) do
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
end
move_down 3
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 "(#{odi.alt_name})", :size => self.item_font_size,:align => :left
end
bounding_box([0,y_position], :width => self.item_width) do
text "#{odi.item_name}", :size => self.item_font_size,:align => :left
end
if alt_name
move_down 4
font("public/fonts/Chinese.ttf") do
text "(#{odi.alt_name})", :size => self.item_font_size,:align => :left, :inline_format => true
end
end
move_down 5
# add option