add pdf configuration options

This commit is contained in:
wvengen 2014-03-19 14:01:51 +01:00
parent 25854f2de7
commit ea8e4ee560
6 changed files with 50 additions and 20 deletions

View file

@ -25,8 +25,8 @@ class OrderByArticles < OrderPdf
rows.unshift I18n.t('documents.order_by_articles.rows') # table header
text "#{order_article.article.name} (#{order_article.article.unit} | #{order_article.price.unit_quantity.to_s} | #{number_with_precision(order_article.price.fc_price, precision: 2)})",
style: :bold, size: 10
table rows, cell_style: {size: 8, overflow: :shrink_to_fit} do |table|
style: :bold, size: fontsize(10)
table rows, cell_style: {size: fontsize(8), overflow: :shrink_to_fit} do |table|
table.column(0).width = 200
table.columns(1..3).align = :right
table.column(2).font_style = :bold
@ -36,7 +36,8 @@ class OrderByArticles < OrderPdf
# dim rows which were ordered but not received
dimrows.each { |ri| table.row(ri).text_color = '999999' }
end
move_down 10
down_or_page
end
end

View file

@ -35,8 +35,8 @@ class OrderByGroups < OrderPdf
rows << [ I18n.t('documents.order_by_groups.sum'), nil, nil, nil, nil, nil, number_with_precision(total, precision: 2)]
rows.unshift I18n.t('documents.order_by_groups.rows') # Table Header
text group_order.ordergroup.name, size: 9, style: :bold
table rows, width: 500, cell_style: {size: 8, overflow: :shrink_to_fit} do |table|
text group_order.ordergroup.name, size: fontsize(9), style: :bold
table rows, width: 500, cell_style: {size: fontsize(8), overflow: :shrink_to_fit} do |table|
# borders
table.cells.borders = []
table.row(0).borders = [:bottom]
@ -54,7 +54,7 @@ class OrderByGroups < OrderPdf
dimrows.each { |ri| table.row(ri).text_color = '999999' }
end
move_down 15
down_or_page 15
end
end

View file

@ -14,22 +14,22 @@ class OrderFax < OrderPdf
# From paragraph
bounding_box [margin_box.right-200,margin_box.top], width: 200 do
text FoodsoftConfig[:name], size: 9, align: :right
text FoodsoftConfig[:name], size: fontsize(9), align: :right
move_down 5
text contact[:street], size: 9, align: :right
text contact[:street], size: fontsize(9), align: :right
move_down 5
text "#{contact[:zip_code]} #{contact[:city]}", size: 9, align: :right
text "#{contact[:zip_code]} #{contact[:city]}", size: fontsize(9), align: :right
move_down 5
unless @order.supplier.try(:customer_number).blank?
text "#{Supplier.human_attribute_name :customer_number}: #{@order.supplier[:customer_number]}", size: 9, align: :right
text "#{Supplier.human_attribute_name :customer_number}: #{@order.supplier[:customer_number]}", size: fontsize(9), align: :right
move_down 5
end
unless contact[:phone].blank?
text "#{Supplier.human_attribute_name :phone}: #{contact[:phone]}", size: 9, align: :right
text "#{Supplier.human_attribute_name :phone}: #{contact[:phone]}", size: fontsize(9), align: :right
move_down 5
end
unless contact[:email].blank?
text "#{Supplier.human_attribute_name :email}: #{contact[:email]}", size: 9, align: :right
text "#{Supplier.human_attribute_name :email}: #{contact[:email]}", size: fontsize(9), align: :right
end
end
@ -70,7 +70,7 @@ class OrderFax < OrderPdf
number_to_currency(subtotal)]
end
data << [I18n.t('documents.order_fax.total'), nil, nil, nil, nil, nil, number_to_currency(total)]
table data, cell_style: {size: 8, overflow: :shrink_to_fit} do |table|
table data, cell_style: {size: fontsize(8), overflow: :shrink_to_fit} do |table|
table.header = true
table.cells.border_width = 1
table.cells.border_color = '666666'
@ -82,7 +82,7 @@ class OrderFax < OrderPdf
table.row(data.length-1).columns(0).borders = [:top, :bottom, :left]
table.row(data.length-1).border_top_width = 2
end
#font_size: 8,
#font_size: fontsize(8),
#vertical_padding: 3,
#border_style: :grid,
#headers: ["BestellNr.", "Menge","Name", "Gebinde", "Einheit","Preis/Einheit"],

View file

@ -17,7 +17,7 @@ class OrderMatrix < OrderPdf
text I18n.t('documents.order_matrix.heading'), style: :bold
move_down 5
text I18n.t('documents.order_matrix.total', :count => order_articles.size), size: 8
text I18n.t('documents.order_matrix.total', :count => order_articles.size), size: fontsize(8)
move_down 10
order_articles_data = [I18n.t('documents.order_matrix.rows')]
@ -30,7 +30,7 @@ class OrderMatrix < OrderPdf
a.units]
end
table order_articles_data, cell_style: {size: 8, overflow: :shrink_to_fit} do |table|
table order_articles_data, cell_style: {size: fontsize(8), overflow: :shrink_to_fit} do |table|
table.cells.border_width = 1
table.cells.border_color = '666666'
end
@ -75,7 +75,7 @@ class OrderMatrix < OrderPdf
# Make table
column_widths = [85]
(MAX_ARTICLES_PER_PAGE + 1).times { |i| column_widths << 41 unless i == 0 }
table groups_data, column_widths: column_widths, cell_style: {size: 8, overflow: :shrink_to_fit} do |table|
table groups_data, column_widths: column_widths, cell_style: {size: fontsize(8), overflow: :shrink_to_fit} do |table|
table.cells.border_width = 1
table.cells.border_color = '666666'
table.row_colors = ['ffffff','ececec']