add options in oqs
This commit is contained in:
@@ -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)
|
||||
def initialize(order_item, print_status, options)
|
||||
self.page_width = 210
|
||||
self.page_height = 2500
|
||||
self.margin = 5
|
||||
@@ -29,7 +29,7 @@ class OrderItemPdf < Prawn::Document
|
||||
order_info(order_item.order_by,order_item.order_at)
|
||||
|
||||
# order items
|
||||
order_items(order_item)
|
||||
order_items(order_item, options)
|
||||
end
|
||||
|
||||
# Write Order Information to PDF
|
||||
@@ -52,23 +52,11 @@ class OrderItemPdf < Prawn::Document
|
||||
end
|
||||
|
||||
# Write Order items to PDF
|
||||
def order_items(order_item)
|
||||
def order_items(order_item, options)
|
||||
y_position = cursor
|
||||
|
||||
# No Need for Order Item
|
||||
# bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
# text "Item", :size => self.item_font_size,:align => :left
|
||||
# end
|
||||
|
||||
# bounding_box([self.item_width,y_position], :width => self.qty_width, :height => self.item_height) do
|
||||
# text "Qty", :size => self.item_font_size,:align => :right
|
||||
# end
|
||||
|
||||
# stroke_horizontal_rule
|
||||
# move_down 5
|
||||
|
||||
#Add Order Item
|
||||
add_order_items(order_item)
|
||||
add_order_items(order_item, options)
|
||||
|
||||
dash(1, :space => 1, :phase => 1)
|
||||
stroke_horizontal_line 0, (self.page_width - self.margin)
|
||||
@@ -76,7 +64,7 @@ class OrderItemPdf < Prawn::Document
|
||||
end
|
||||
|
||||
# Add order items under order info
|
||||
def add_order_items(order_item)
|
||||
def add_order_items(order_item, options)
|
||||
y_position = cursor
|
||||
|
||||
move_down 5
|
||||
@@ -91,6 +79,14 @@ class OrderItemPdf < Prawn::Document
|
||||
|
||||
move_down 5
|
||||
|
||||
# add option
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "#{options}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 5
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -92,6 +92,18 @@ class OrderSummaryPdf < Prawn::Document
|
||||
end
|
||||
|
||||
move_down 5
|
||||
|
||||
# add option
|
||||
options = odi.options == "[]"? "" : odi.options
|
||||
|
||||
if options != ""
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||
text "#{options}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
move_down 5
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user