From ec7ee8d675c649ae86f830803fd64b436c28ca8b Mon Sep 17 00:00:00 2001 From: San Wai Lwin Date: Tue, 19 Jun 2018 13:35:11 +0630 Subject: [PATCH] Add Change Order PDF --- app/pdf/order_item_customise_pdf.rb | 20 ++++++++++---------- app/pdf/order_item_slim_customise_pdf.rb | 21 ++++++++++----------- app/pdf/order_set_item_customise_pdf.rb | 20 ++++++++++---------- 3 files changed, 30 insertions(+), 31 deletions(-) diff --git a/app/pdf/order_item_customise_pdf.rb b/app/pdf/order_item_customise_pdf.rb index 9fd2d3e7..dde79917 100644 --- a/app/pdf/order_item_customise_pdf.rb +++ b/app/pdf/order_item_customise_pdf.rb @@ -98,7 +98,7 @@ class OrderItemCustomisePdf < Prawn::Document end 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 bounding_box([0,y_position], :width => self.item_width) do @@ -129,17 +129,17 @@ class OrderItemCustomisePdf < Prawn::Document end - #add updated qty text - def add_updated_qty_text(before_updated_qty, updated_qty, precision) - if before_updated_qty.to_i > 0 && !before_updated_qty.nil? - move_down 5 + #add updated qty text + def add_updated_qty_text(before_updated_qty, updated_qty, precision) + if before_updated_qty.to_i > 0 && !before_updated_qty.nil? + move_down 5 - # add option - y_position = cursor - bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) 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 + # add option + y_position = cursor + 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 + end end end - end end diff --git a/app/pdf/order_item_slim_customise_pdf.rb b/app/pdf/order_item_slim_customise_pdf.rb index 8c03adf5..a63900a6 100644 --- a/app/pdf/order_item_slim_customise_pdf.rb +++ b/app/pdf/order_item_slim_customise_pdf.rb @@ -99,7 +99,7 @@ class OrderItemSlimCustomisePdf < Prawn::Document end 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 bounding_box([0,y_position], :width => self.item_width) do @@ -129,17 +129,16 @@ class OrderItemSlimCustomisePdf < Prawn::Document end - #add updated qty text - def add_updated_qty_text(before_updated_qty, updated_qty, precision) - if before_updated_qty.to_i > 0 && !before_updated_qty.nil? - move_down 1 + #add updated qty text + def add_updated_qty_text(before_updated_qty, updated_qty, precision) + if before_updated_qty.to_i > 0 && !before_updated_qty.nil? + move_down 5 - # add option - y_position = cursor - bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) 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 + # add option + y_position = cursor + 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 + end end end - end - end diff --git a/app/pdf/order_set_item_customise_pdf.rb b/app/pdf/order_set_item_customise_pdf.rb index a6859189..2f985c5f 100644 --- a/app/pdf/order_set_item_customise_pdf.rb +++ b/app/pdf/order_set_item_customise_pdf.rb @@ -97,7 +97,7 @@ class OrderSetItemCustomisePdf < Prawn::Document end 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 bounding_box([0,y_position], :width => self.item_width) do @@ -144,17 +144,17 @@ class OrderSetItemCustomisePdf < Prawn::Document end - #add updated qty text - def add_updated_qty_text(before_updated_qty, updated_qty, precision) - if before_updated_qty.to_i > 0 && !before_updated_qty.nil? - move_down 5 + #add updated qty text + def add_updated_qty_text(before_updated_qty, updated_qty, precision) + if before_updated_qty.to_i > 0 && !before_updated_qty.nil? + move_down 5 - # add option - y_position = cursor - bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) 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 + # add option + y_position = cursor + 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 + end end end - end end