add total to order pdf, layout changes (closes foodcoops/foodsoft#138)
This commit is contained in:
parent
39b3dee050
commit
b235592656
3 changed files with 19 additions and 5 deletions
|
@ -56,21 +56,31 @@ class OrderFax < OrderPdf
|
||||||
end
|
end
|
||||||
|
|
||||||
# Articles
|
# Articles
|
||||||
|
total = 0
|
||||||
data = [I18n.t('documents.order_fax.rows')]
|
data = [I18n.t('documents.order_fax.rows')]
|
||||||
data += @order.order_articles.ordered.all(include: :article).collect do |a|
|
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.article.order_number,
|
||||||
a.units_to_order,
|
a.units_to_order,
|
||||||
a.article.name,
|
a.article.name,
|
||||||
a.price.unit_quantity,
|
a.price.unit_quantity,
|
||||||
a.article.unit,
|
a.article.unit,
|
||||||
a.price.price]
|
number_to_currency(a.price.price),
|
||||||
|
number_to_currency(subtotal)]
|
||||||
end
|
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: 8, overflow: :shrink_to_fit} do |table|
|
||||||
|
table.header = true
|
||||||
table.cells.border_width = 1
|
table.cells.border_width = 1
|
||||||
table.cells.border_color = '666666'
|
table.cells.border_color = '666666'
|
||||||
|
|
||||||
|
table.row(0).border_bottom_width = 2
|
||||||
table.columns(1).align = :right
|
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
|
end
|
||||||
#font_size: 8,
|
#font_size: 8,
|
||||||
#vertical_padding: 3,
|
#vertical_padding: 3,
|
||||||
|
|
|
@ -505,6 +505,8 @@ de:
|
||||||
- Gebinde
|
- Gebinde
|
||||||
- Einheit
|
- Einheit
|
||||||
- Preis/Einheit
|
- Preis/Einheit
|
||||||
|
- Summe
|
||||||
|
total: Gesamtpreis
|
||||||
order_matrix:
|
order_matrix:
|
||||||
filename: Bestellung %{name}-%{date} - Sortiermatrix
|
filename: Bestellung %{name}-%{date} - Sortiermatrix
|
||||||
heading: Artikelübersicht
|
heading: Artikelübersicht
|
||||||
|
|
|
@ -493,7 +493,7 @@ en:
|
||||||
- Article
|
- Article
|
||||||
- Amount
|
- Amount
|
||||||
- Price
|
- Price
|
||||||
- Unit Quantity
|
- Unit quantity
|
||||||
- Unit
|
- Unit
|
||||||
- Sum
|
- Sum
|
||||||
sum: Sum
|
sum: Sum
|
||||||
|
@ -504,16 +504,18 @@ en:
|
||||||
- Order Number
|
- Order Number
|
||||||
- Amount
|
- Amount
|
||||||
- Name
|
- Name
|
||||||
- Barrel
|
- Unit quantity
|
||||||
- Unit
|
- Unit
|
||||||
- Price/Unit
|
- Price/Unit
|
||||||
|
- Subtotal
|
||||||
|
total: Total
|
||||||
order_matrix:
|
order_matrix:
|
||||||
filename: Order %{name}-%{date} - sorting matrix
|
filename: Order %{name}-%{date} - sorting matrix
|
||||||
heading: Article overview
|
heading: Article overview
|
||||||
rows:
|
rows:
|
||||||
- Article
|
- Article
|
||||||
- Unit
|
- Unit
|
||||||
- Barrel
|
- Unit quantity
|
||||||
- FC-Price
|
- FC-Price
|
||||||
- Amount
|
- Amount
|
||||||
title: ! 'Order sorting matrix: %{name}, closed at %{date}'
|
title: ! 'Order sorting matrix: %{name}, closed at %{date}'
|
||||||
|
|
Loading…
Reference in a new issue