%table.list %thead %tr %th{:style => "width:40%"} Name %th Gebinde %th Einzelpreis %th %abbr{:title => "Menge + Toleranz"} Bestellt %th %abbr{:title => "Unter Berücksichtigung der anderen Gruppen"} Zugeteilt %th Gesamtpreis %tbody - total = 0 #set counter for order-sum - for category, order_articles in @order.get_articles %tr{:style => "background-color:#EFEFEF"} %td{:style => "text-align:left;"}=h category %td{:colspan => "9"} - for order_article in order_articles - article = order_article.article - # get the order-results for the ordergroup - group_order_article = GroupOrderArticle.find_by_group_order_id_and_order_article_id @group_order.id, order_article.id - if group_order_article - quantity = group_order_article.quantity - tolerance = group_order_article.tolerance - result = group_order_article.orderResult[:quantity] + group_order_article.orderResult[:tolerance] - sub_total = article.gross_price * (quantity + tolerance) - else - quantity, tolerance, result, sub_total = 0, 0, 0, 0 - total += sub_total - # give the article different colors, dependent on order-result - style = "grey" - if (quantity > 0) - style = result > 0 ? 'green' : 'red' %tr{:class => cycle('even', 'odd', :name => 'articles'), :style => "color:#{style}"} %td{:style => "width:40%"} =h order_article.article.name - unless order_article.article.note.empty? = image_tag("lamp_grey.png", {:alt => "Notiz anzeigen", :size => "15x16", :border => "0", :onmouseover => "$('note_#{order_article.id}').show();", :onmouseout => "$('note_#{order_article.id}').hide();"}) %td= "#{article.unit_quantity} x #{order_article.article.unit}" %td= number_to_currency(article.gross_price) %td = quantity = "+ #{tolerance}" if article.unit_quantity > 1 %td= result > 0 ? result : "0" %td= number_to_currency(sub_total) - unless order_article.article.note.empty? %tr{:id => "note_#{order_article.id}", :class => "note even", :style => "display:none"} %td{:colspan => "6"}=h order_article.article.note %tr{:class => cycle('even', 'odd', :name => 'articles')} %th{:colspan => "5"} Summe %th= number_to_currency(total)