Edit Precision in Receipt Bill & Recceipt Bill A5 Pdf
This commit is contained in:
@@ -181,6 +181,20 @@ class ReceiptBillPdf < Prawn::Document
|
||||
|
||||
def add_line_item_row(sale_items,precision,delimiter)
|
||||
|
||||
if precision.to_i > 0
|
||||
item_name_width = (self.item_width+self.price_width)
|
||||
item_qty_front_width = (self.item_width+self.price_width) + 5
|
||||
item_qty_end_width = self.qty_width + 4
|
||||
item_total_front_width = item_name_width + 10
|
||||
item_total_end_width = self.total_width + 9
|
||||
else
|
||||
item_name_width = (self.item_width+self.price_width)
|
||||
item_qty_front_width = item_name_width + 8
|
||||
item_qty_end_width = self.qty_width + 7
|
||||
item_total_front_width = item_name_width + 5
|
||||
item_total_end_width = self.total_width + 4
|
||||
end
|
||||
|
||||
y_position = cursor
|
||||
move_down line_move
|
||||
sub_total = 0.0
|
||||
@@ -215,12 +229,8 @@ class ReceiptBillPdf < Prawn::Document
|
||||
bounding_box([0,y_position], :width =>self.item_width + self.price_width, :height => self.item_height) do
|
||||
text "Sub Total", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
bounding_box([self.item_width + self.price_width + 11,y_position], :width =>self.qty_width, :height => self.item_height) do
|
||||
text "#{number_with_precision(total_qty, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :center
|
||||
end
|
||||
bounding_box([self.item_width + self.price_width + 8,y_position], :width =>self.total_width, :height => self.item_height) do
|
||||
text "#{number_with_precision(sub_total, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||
end
|
||||
text_box "#{number_with_precision(total_qty, :precision => precision.to_i)}", :at =>[item_qty_front_width,y_position], :width => item_qty_end_width, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
||||
text_box "#{number_with_precision(sub_total, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[item_total_front_width,y_position], :width =>item_total_end_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
end
|
||||
|
||||
def item_row(item,precision,delimiter,product_name,price,qty ,total_price)
|
||||
|
||||
Reference in New Issue
Block a user