Complete refactoring of orders-workflow.
OrderResult tables are removed. Data consistency is now possible through new article.price-history (ArticlePrice). Balancing-workflow needs to be updated.
This commit is contained in:
parent
80287aeea4
commit
9eb2125f15
98 changed files with 1121 additions and 1717 deletions
|
|
@ -1,7 +1,5 @@
|
|||
# Get ActiveRecord objects
|
||||
order_articles = @order.order_article_results
|
||||
end_date = @order.ends.strftime('%d.%m.%Y')
|
||||
title = "#{@order.name} | beendet am #{end_date}"
|
||||
title = "#{@order.supplier.name} | beendet am #{end_date}"
|
||||
|
||||
# Define header and footer
|
||||
pdf.header [pdf.margin_box.left,pdf.margin_box.top+30] do
|
||||
|
|
@ -14,15 +12,16 @@ end
|
|||
|
||||
# Start rendering
|
||||
|
||||
for article in order_articles
|
||||
pdf.text "#{article.name} (#{article.unit} | #{article.unit_quantity.to_s} | #{number_to_currency(article.gross_price)})",
|
||||
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)})",
|
||||
:style => :bold, :size => 10
|
||||
pdf.move_down 5
|
||||
data = []
|
||||
for result in article.group_order_article_results
|
||||
data << [result.group_order_result.group_name,
|
||||
result.quantity,
|
||||
article.gross_price * result.quantity]
|
||||
for goa in order_article.group_order_articles
|
||||
data << [goa.group_order.ordergroup.name,
|
||||
goa.quantity,
|
||||
number_with_precision(order_article.price.fc_price * goa.quantity)]
|
||||
end
|
||||
|
||||
pdf.table data,
|
||||
|
|
@ -31,6 +30,7 @@ for article in order_articles
|
|||
:widths => { 0 => 200, 1 => 40, 2 => 40 },
|
||||
:border_style => :grid,
|
||||
:row_colors => ['ffffff','ececec'],
|
||||
:vertical_padding => 3
|
||||
:vertical_padding => 3,
|
||||
:align => { 2 => :right }
|
||||
pdf.move_down 10
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue