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:
Benjamin Meichsner 2009-01-29 01:57:51 +01:00
parent 80287aeea4
commit 9eb2125f15
98 changed files with 1121 additions and 1717 deletions

View file

@ -1,5 +1,5 @@
end_date = @order.ends.strftime('%d.%m.%Y')
title = "Gruppensortierung für #{@order.name}, beendet am #{end_date}"
title = "Gruppensortierung für #{@order.supplier.name}, beendet am #{end_date}"
# Define header and footer
pdf.header [pdf.margin_box.left,pdf.margin_box.top+20] do
@ -12,28 +12,28 @@ end
# Start rendering
groups = @order.group_order_results.size
groups = @order.group_orders.size
counter = 1
for group_result in @order.group_order_results
pdf.text group_result.group_name, :style => :bold
for group_order in @order.group_orders
pdf.text group_order.ordergroup.name, :style => :bold
pdf.move_down 5
pdf.text "Gruppe #{counter.to_s}/#{groups.to_s}", :size => 8
pdf.move_down 5
total = 0
data = []
group_result.group_order_article_results.each do |result|
price = result.order_article_result.gross_price
quantity = result.quantity
group_order.group_order_articles.each do |goa|
price = goa.order_article.price.fc_price
quantity = goa.quantity
sub_total = price * quantity
total += sub_total
data << [result.order_article_result.name,
quantity, price,
result.order_article_result.unit_quantity,
result.order_article_result.unit,
sub_total]
data << [goa.order_article.article.name,
quantity, number_with_precision(price),
goa.order_article.price.unit_quantity,
goa.order_article.article.unit,
number_with_precision(sub_total)]
end
data << [ {:text => "Summe", :colspan => 5}, total]
data << [ {:text => "Summe", :colspan => 5}, number_with_precision(total)]
pdf.table data,
:font_size => 8,
@ -41,7 +41,8 @@ for group_result in @order.group_order_results
:vertical_padding => 3,
:headers => ["Artikel", "Menge", "Preis", "GebGr", "Einheit", "Summe"],
:widths => { 0 => 250 },
:row_colors => ['ffffff','ececec']
:row_colors => ['ffffff','ececec'],
:align => { 0 => :right, 5 => :right }
counter += 1
pdf.move_down 10