add updated qty text in oqs
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
class OrderSetItemPdf < Prawn::Document
|
||||
include ActionView::Helpers::NumberHelper
|
||||
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(print_settings,order_set_item, print_status, options, alt_name)
|
||||
def initialize(print_settings,order_set_item, print_status, options, alt_name, before_updated_qty)
|
||||
self.page_width = print_settings.page_width
|
||||
self.page_height = print_settings.page_height
|
||||
self.margin = 0
|
||||
@@ -46,7 +46,7 @@ class OrderSetItemPdf < Prawn::Document
|
||||
order_info(order_set_item.order_id, order_set_item.order_by,order_set_item.order_at)
|
||||
|
||||
# order items
|
||||
order_set_items(order_set_item, options, alt_name, print_settings.precision)
|
||||
order_set_items(order_set_item, options, alt_name, print_settings.precision, before_updated_qty)
|
||||
end
|
||||
|
||||
# Write Order Information to PDF
|
||||
@@ -74,7 +74,7 @@ class OrderSetItemPdf < Prawn::Document
|
||||
end
|
||||
|
||||
# Write Order items to PDF
|
||||
def order_set_items(order_set_item, options, alt_name, precision)
|
||||
def order_set_items(order_set_item, options, alt_name, precision, before_updated_qty)
|
||||
y_position = cursor
|
||||
|
||||
#Add Order Item
|
||||
@@ -82,6 +82,7 @@ class OrderSetItemPdf < Prawn::Document
|
||||
|
||||
dash(1, :space => 1, :phase => 1)
|
||||
stroke_horizontal_line 0, (self.page_width - self.margin)
|
||||
add_updated_qty_text(before_updated_qty, order_set_item.qty, precision)
|
||||
move_down 5
|
||||
end
|
||||
|
||||
@@ -143,4 +144,17 @@ class OrderSetItemPdf < Prawn::Document
|
||||
|
||||
end
|
||||
|
||||
#add updated qty text
|
||||
def add_updated_qty_text(before_updated_qty, updated_qty, precision)
|
||||
if !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
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user