2009-01-07 15:29:23 +01:00
|
|
|
end_date = @order.ends.strftime('%d.%m.%Y')
|
2009-02-05 16:40:02 +01:00
|
|
|
title = "#{@order.name} | beendet am #{end_date}"
|
2009-01-07 15:29:23 +01:00
|
|
|
|
|
|
|
# Define header and footer
|
|
|
|
pdf.header [pdf.margin_box.left,pdf.margin_box.top+30] do
|
|
|
|
pdf.text title, :size => 10, :align => :center
|
|
|
|
end
|
|
|
|
pdf.footer [pdf.margin_box.left, pdf.margin_box.bottom-5] do
|
|
|
|
pdf.stroke_horizontal_rule
|
|
|
|
pdf.text "Seite #{pdf.page_count}", :size => 8
|
|
|
|
end
|
|
|
|
|
|
|
|
# Start rendering
|
|
|
|
|
2009-01-29 01:57:51 +01:00
|
|
|
for order_article in @order.order_articles.ordered
|
|
|
|
pdf.text "#{order_article.article.name} (#{order_article.article.unit} |\
|
|
|
|
#{order_article.price.unit_quantity.to_s} | #{number_to_currency(order_article.price.fc_price)})",
|
2009-01-07 15:29:23 +01:00
|
|
|
:style => :bold, :size => 10
|
|
|
|
pdf.move_down 5
|
|
|
|
data = []
|
2009-01-29 01:57:51 +01:00
|
|
|
for goa in order_article.group_order_articles
|
|
|
|
data << [goa.group_order.ordergroup.name,
|
2009-02-04 16:41:01 +01:00
|
|
|
goa.result,
|
|
|
|
number_with_precision(order_article.price.fc_price * goa.result)]
|
2009-01-07 15:29:23 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
pdf.table data,
|
|
|
|
:font_size => 8,
|
2009-01-08 14:10:51 +01:00
|
|
|
:headers => ["Bestellgruppe", "Menge", "Preis"],
|
2009-01-07 15:29:23 +01:00
|
|
|
:widths => { 0 => 200, 1 => 40, 2 => 40 },
|
2009-01-08 14:10:51 +01:00
|
|
|
:border_style => :grid,
|
|
|
|
:row_colors => ['ffffff','ececec'],
|
2009-01-29 01:57:51 +01:00
|
|
|
:vertical_padding => 3,
|
|
|
|
:align => { 2 => :right }
|
2009-01-07 15:29:23 +01:00
|
|
|
pdf.move_down 10
|
|
|
|
end
|