add total to order pdf, layout changes (closes foodcoops/foodsoft#138)

This commit is contained in:
wvengen 2013-06-21 02:34:56 +02:00
parent 39b3dee050
commit b235592656
3 changed files with 19 additions and 5 deletions

View file

@ -56,21 +56,31 @@ class OrderFax < OrderPdf
end
# Articles
total = 0
data = [I18n.t('documents.order_fax.rows')]
data += @order.order_articles.ordered.all(include: :article).collect do |a|
subtotal = a.units_to_order * a.price.unit_quantity * a.price.price
total += subtotal
[a.article.order_number,
a.units_to_order,
a.article.name,
a.price.unit_quantity,
a.article.unit,
a.price.price]
number_to_currency(a.price.price),
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.header = true
table.cells.border_width = 1
table.cells.border_color = '666666'
table.row(0).border_bottom_width = 2
table.columns(1).align = :right
table.columns(3..5).align = :right
table.columns(3..6).align = :right
table.row(data.length-1).columns(0..5).borders = [:top, :bottom]
table.row(data.length-1).columns(0).borders = [:top, :bottom, :left]
table.row(data.length-1).border_top_width = 2
end
#font_size: 8,
#vertical_padding: 3,

View file

@ -505,6 +505,8 @@ de:
- Gebinde
- Einheit
- Preis/Einheit
- Summe
total: Gesamtpreis
order_matrix:
filename: Bestellung %{name}-%{date} - Sortiermatrix
heading: Artikelübersicht

View file

@ -493,7 +493,7 @@ en:
- Article
- Amount
- Price
- Unit Quantity
- Unit quantity
- Unit
- Sum
sum: Sum
@ -504,16 +504,18 @@ en:
- Order Number
- Amount
- Name
- Barrel
- Unit quantity
- Unit
- Price/Unit
- Subtotal
total: Total
order_matrix:
filename: Order %{name}-%{date} - sorting matrix
heading: Article overview
rows:
- Article
- Unit
- Barrel
- Unit quantity
- FC-Price
- Amount
title: ! 'Order sorting matrix: %{name}, closed at %{date}'