fixed pdf
This commit is contained in:
@@ -1,21 +1,22 @@
|
||||
class MoveTablePdf < 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
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :margin_top, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width
|
||||
def initialize(printer_settings,to,from,shop_detail,date,type,moved_by,order_items)
|
||||
self.page_width = printer_settings.page_width
|
||||
self.page_height = printer_settings.page_height
|
||||
self.header_font_size = printer_settings.header_font_size.to_i
|
||||
self.item_font_size = printer_settings.item_font_size.to_i
|
||||
self.margin = 0
|
||||
self.margin_top = 7
|
||||
self.price_width = 40 # No Need for item
|
||||
self.qty_width = 40
|
||||
self.total_width = 40 # No Need for item
|
||||
self.item_width = self.page_width - (self.qty_width - self.margin)
|
||||
self.item_height = 15
|
||||
self.item_height = 15
|
||||
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
|
||||
self.label_width=90
|
||||
self.label_width=90
|
||||
|
||||
super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
super(:margin => [self.margin_top, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||
|
||||
# db font setup
|
||||
if printer_settings.font != ""
|
||||
@@ -85,7 +86,7 @@ class MoveTablePdf < Prawn::Document
|
||||
move_down 5
|
||||
|
||||
order_items.each do|odi|
|
||||
# check for item not to show
|
||||
# check for item not to show
|
||||
# if odi.price != 0
|
||||
y_position = cursor
|
||||
|
||||
@@ -103,15 +104,15 @@ class MoveTablePdf < Prawn::Document
|
||||
bounding_box([0,y_position], :width => self.item_width) do
|
||||
text "#{odi.item_code} - #{odi.item_name}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
|
||||
|
||||
if !(odi.alt_name).empty?
|
||||
move_down 4
|
||||
# font("public/fonts/NotoSansCJKtc-Regular.ttf") do
|
||||
text "(#{odi.alt_name})", :size => self.item_font_size,:align => :left, :inline_format => true
|
||||
# end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user