not to show price 0 and 10

This commit is contained in:
Yan
2017-06-27 10:15:22 +06:30
parent 1023f4348a
commit e09dbb095c
6 changed files with 74 additions and 63 deletions

View File

@@ -60,7 +60,7 @@ class OrderItemPdf < Prawn::Document
def order_items(order_item, options)
y_position = cursor
#Add Order Item
#Add Order Item
add_order_items(order_item, options)
dash(1, :space => 1, :phase => 1)

View File

@@ -86,38 +86,36 @@ class OrderSummaryPdf < Prawn::Document
move_down 5
order_item.each do|odi|
y_position = cursor
# pad_top(15) {
# text_box "#{odi.item_name}", :at =>[0,y_position], :width => self.item_width, :height =>self.item_height, :size => self.item_font_size, :overflow => :shrink_to_fix
# text_box "#{odi.qty}", :at =>[self.item_width,y_position], :width => self.qty_width, :height =>self.item_height, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
# }
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 5
# add option
options = odi.options == "[]"? "" : odi.options
if options != ""
# check for item not to show
if odi.price == 0 || odi.price == 10
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
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 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
dash(1, :space => 1, :phase => 1)
stroke_horizontal_line 0, (self.page_width - self.margin)
move_down 5
end
dash(1, :space => 1, :phase => 1)
stroke_horizontal_line 0, (self.page_width - self.margin)
move_down 5
end
end
end