add qty precision
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
class OrderItemPdf < 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_item, print_status, options, alt_name)
|
||||
self.page_width = 180
|
||||
@@ -30,7 +31,7 @@ class OrderItemPdf < Prawn::Document
|
||||
order_info(order_item.order_id, order_item.order_by,order_item.order_at)
|
||||
|
||||
# order items
|
||||
order_items(order_item, options, alt_name)
|
||||
order_items(order_item, options, alt_name, print_settings.precision)
|
||||
end
|
||||
|
||||
# Write Order Information to PDF
|
||||
@@ -58,11 +59,11 @@ class OrderItemPdf < Prawn::Document
|
||||
end
|
||||
|
||||
# Write Order items to PDF
|
||||
def order_items(order_item, options, alt_name)
|
||||
def order_items(order_item, options, alt_name, precision)
|
||||
y_position = cursor
|
||||
|
||||
#Add Order Item
|
||||
add_order_items(order_item, options, alt_name)
|
||||
add_order_items(order_item, options, alt_name, precision)
|
||||
|
||||
dash(1, :space => 1, :phase => 1)
|
||||
stroke_horizontal_line 0, (self.page_width - self.margin)
|
||||
@@ -70,7 +71,7 @@ class OrderItemPdf < Prawn::Document
|
||||
end
|
||||
|
||||
# Add order items under order info
|
||||
def add_order_items(order_item, options, alt_name)
|
||||
def add_order_items(order_item, options, alt_name, precision)
|
||||
y_position = cursor
|
||||
|
||||
move_down 5
|
||||
@@ -80,7 +81,7 @@ class OrderItemPdf < Prawn::Document
|
||||
end
|
||||
|
||||
bounding_box([self.item_width,y_position], :width => self.qty_width) do
|
||||
text "[#{order_item.qty.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 => :left
|
||||
end
|
||||
|
||||
bounding_box([0,y_position], :width => self.item_width) do
|
||||
|
||||
Reference in New Issue
Block a user