update show order

This commit is contained in:
wvengen 2013-12-18 21:34:54 +01:00
parent d299fa4870
commit 82d1c41e9f
2 changed files with 18 additions and 9 deletions

View file

@ -134,10 +134,10 @@ table {
}
// ordering
span.used {
.used {
color: green;
}
span.unused {
.unused {
color: red;
}

View file

@ -2,10 +2,12 @@
%thead
%tr
%th= heading_helper Article, :name
%th= heading_helper Article, :unit_quantity
%th= heading_helper Article, :units
%th= t '.prices'
- if order.stockit?
%th= t '.units_ordered'
- unless order.stockit?
- else
%th= 'Members'
%th= t '.units_full'
- total_net, total_gross, counter = 0, 0, 0
%tbody
@ -18,13 +20,14 @@
- order_articles.each do |order_article|
- net_price = order_article.price.price
- gross_price = order_article.price.gross_price
- units = order_article.units_to_order
- unit_quantity = order_article.price.unit_quantity
- units = order_article.units
- total_net += units * unit_quantity * net_price
- total_gross += units * unit_quantity * gross_price
%tr{:class => cycle('even', 'odd', :name => 'articles'), :style => "color: #{units > 0 ? 'green' : 'red'}"}
- cssclass = (units > 0 ? 'used' : (order_article.quantity > 0 ? 'unused' : 'unavailable'))
%tr{:class => cycle('even', 'odd', :name => 'articles') + ' ' + cssclass}
%td=h order_article.article.name
%td= "#{unit_quantity} x #{order_article.article.unit}"
%td #{unit_quantity} × #{order_article.article.unit}
%td= "#{number_to_currency(net_price)} / #{number_to_currency(gross_price)}"
- if order.stockit?
%td= units
@ -33,7 +36,13 @@
%td= "#{order_article.quantity} + #{order_article.tolerance}"
- else
%td= "#{order_article.quantity}"
%td= units
- unless order.open?
- units_info = "#{order_article.units_to_order} ordered"
- units_info += ", #{order_article.units_billed} billed" unless order_article.units_billed.nil?
- units_info += ", #{order_article.units_received} received" unless order_article.units_received.nil?
%td{title: units_info}
= units
%i.package pkg
%p
= t '.prices_sum'
= "#{number_to_currency(total_net)} / #{number_to_currency(total_gross)}"