Headers and table improvements for matrix pdf. Fixed #204
This commit is contained in:
parent
578002501b
commit
de1aa2ac38
1 changed files with 8 additions and 4 deletions
|
@ -35,6 +35,9 @@ while (page_number * max_order_articles_per_page < total_num_order_articles) do
|
||||||
|
|
||||||
page_number += 1
|
page_number += 1
|
||||||
pdf.start_new_page(:layout => :landscape)
|
pdf.start_new_page(:layout => :landscape)
|
||||||
|
pdf.header [pdf.margin_box.left,pdf.margin_box.top+20] do
|
||||||
|
pdf.text title, :size => 10, :align => :center
|
||||||
|
end
|
||||||
|
|
||||||
# Collect order_articles for this page
|
# Collect order_articles for this page
|
||||||
current_order_articles = order_articles.select do |a|
|
current_order_articles = order_articles.select do |a|
|
||||||
|
@ -45,7 +48,7 @@ while (page_number * max_order_articles_per_page < total_num_order_articles) do
|
||||||
# Make order_articles header
|
# Make order_articles header
|
||||||
header = [""]
|
header = [""]
|
||||||
for header_article in current_order_articles
|
for header_article in current_order_articles
|
||||||
name = header_article.article.name.split("-").join(" ").split(".").join(". ").split("/").join(" ")
|
name = header_article.article.name.gsub(/[-\/]/, " ").gsub(".", ". ")
|
||||||
name = name.split.collect { |w| truncate(w, :length => 8, :omission => "..") }.join(" ")
|
name = name.split.collect { |w| truncate(w, :length => 8, :omission => "..") }.join(" ")
|
||||||
header << truncate(name, :length => 30, :omission => " ..")
|
header << truncate(name, :length => 30, :omission => " ..")
|
||||||
end
|
end
|
||||||
|
@ -65,14 +68,15 @@ while (page_number * max_order_articles_per_page < total_num_order_articles) do
|
||||||
end
|
end
|
||||||
|
|
||||||
# Make table
|
# Make table
|
||||||
widths = { } # Generate widths-hash for table layout
|
widths = {0 => 85} # Generate widths-hash for table layout
|
||||||
(max_order_articles_per_page + 1).times { |i| widths.merge!({ i => 40 }) unless i == 0 }
|
(max_order_articles_per_page + 1).times { |i| widths.merge!({ i => 41 }) unless i == 0 }
|
||||||
|
logger.debug "Spaltenbreiten: #{widths.inspect}"
|
||||||
pdf.table groups_data,
|
pdf.table groups_data,
|
||||||
:font_size => 8,
|
:font_size => 8,
|
||||||
:border_style => :grid,
|
:border_style => :grid,
|
||||||
:vertical_padding => 3,
|
:vertical_padding => 3,
|
||||||
:headers => header,
|
:headers => header,
|
||||||
:widths => widths,
|
:column_widths => widths,
|
||||||
:row_colors => ['ffffff','ececec']
|
:row_colors => ['ffffff','ececec']
|
||||||
|
|
||||||
end
|
end
|
Loading…
Reference in a new issue