Add Change Order PDF

This commit is contained in:
San Wai Lwin
2018-06-19 13:35:11 +06:30
parent 8d1b15f119
commit ec7ee8d675
3 changed files with 30 additions and 31 deletions

View File

@@ -98,7 +98,7 @@ class OrderItemCustomisePdf < Prawn::Document
end end
bounding_box([self.item_width - 10,y_position], :width => self.qty_width) do bounding_box([self.item_width - 10,y_position], :width => self.qty_width) do
text "[#{number_with_precision(order_item.qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left text "[#{number_with_precision(order_item.qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :right
end end
bounding_box([0,y_position], :width => self.item_width) do bounding_box([0,y_position], :width => self.item_width) do
@@ -136,7 +136,7 @@ class OrderItemCustomisePdf < Prawn::Document
# add option # add option
y_position = cursor y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do bounding_box([0,y_position], :width => self.page_width) do
text "* Change quantity [#{number_with_precision(before_updated_qty.to_i, :precision => precision.to_i)}] to [#{number_with_precision(updated_qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left text "* Change quantity [#{number_with_precision(before_updated_qty.to_i, :precision => precision.to_i)}] to [#{number_with_precision(updated_qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left
end end
end end

View File

@@ -99,7 +99,7 @@ class OrderItemSlimCustomisePdf < Prawn::Document
end end
bounding_box([self.item_width - 5,y_position], :width => self.qty_width) do bounding_box([self.item_width - 5,y_position], :width => self.qty_width) do
text "[#{number_with_precision(order_item_slim.qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left text "[#{number_with_precision(order_item_slim.qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :right
end end
bounding_box([0,y_position], :width => self.item_width) do bounding_box([0,y_position], :width => self.item_width) do
@@ -132,14 +132,13 @@ class OrderItemSlimCustomisePdf < Prawn::Document
#add updated qty text #add updated qty text
def add_updated_qty_text(before_updated_qty, updated_qty, precision) def add_updated_qty_text(before_updated_qty, updated_qty, precision)
if before_updated_qty.to_i > 0 && !before_updated_qty.nil? if before_updated_qty.to_i > 0 && !before_updated_qty.nil?
move_down 1 move_down 5
# add option # add option
y_position = cursor y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do bounding_box([0,y_position], :width => self.page_width) do
text "* Change quantity [#{number_with_precision(before_updated_qty.to_i, :precision => precision.to_i)}] to [#{number_with_precision(updated_qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left text "* Change quantity [#{number_with_precision(before_updated_qty.to_i, :precision => precision.to_i)}] to [#{number_with_precision(updated_qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left
end end
end end
end end
end end

View File

@@ -97,7 +97,7 @@ class OrderSetItemCustomisePdf < Prawn::Document
end end
bounding_box([self.item_width - 5,y_position], :width => self.qty_width) do bounding_box([self.item_width - 5,y_position], :width => self.qty_width) do
text "[#{number_with_precision(order_set_item.qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left text "[#{number_with_precision(order_set_item.qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :right
end end
bounding_box([0,y_position], :width => self.item_width) do bounding_box([0,y_position], :width => self.item_width) do
@@ -151,7 +151,7 @@ class OrderSetItemCustomisePdf < Prawn::Document
# add option # add option
y_position = cursor y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do bounding_box([0,y_position], :width => self.page_width) do
text "* Change quantity [#{number_with_precision(before_updated_qty.to_i, :precision => precision.to_i)}] to [#{number_with_precision(updated_qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left text "* Change quantity [#{number_with_precision(before_updated_qty.to_i, :precision => precision.to_i)}] to [#{number_with_precision(updated_qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left
end end
end end