Show total price of ordered units per article in finance/balancing

* Implement functions total_price and total_gross_price on model
order_article
* Show total_price and total_gross_price in view finance/balancing
 _order_article (Closed #108)
This commit is contained in:
sandoz 2009-03-22 11:58:01 +01:00 committed by sandoz
parent 2e490d1a52
commit cde1fb3525
2 changed files with 18 additions and 2 deletions

View file

@ -77,6 +77,16 @@ class OrderArticle < ActiveRecord::Base
units += ((remainder > 0) && (remainder + tolerance >= unit_size) ? 1 : 0)
end
# Calculate price for ordered quantity.
def total_price
units_to_order * price.price
end
# Calculate gross price for ordered qunatity.
def total_gross_price
units_to_order * price.gross_price
end
def ordered_quantities_equal_to_group_orders?
(units_to_order * price.unit_quantity) == group_orders_sum[:quantity]
end