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:
parent
2e490d1a52
commit
cde1fb3525
2 changed files with 18 additions and 2 deletions
|
@ -77,6 +77,16 @@ class OrderArticle < ActiveRecord::Base
|
||||||
units += ((remainder > 0) && (remainder + tolerance >= unit_size) ? 1 : 0)
|
units += ((remainder > 0) && (remainder + tolerance >= unit_size) ? 1 : 0)
|
||||||
end
|
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?
|
def ordered_quantities_equal_to_group_orders?
|
||||||
(units_to_order * price.unit_quantity) == group_orders_sum[:quantity]
|
(units_to_order * price.unit_quantity) == group_orders_sum[:quantity]
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,8 +8,14 @@
|
||||||
- unless order_article.ordered_quantities_equal_to_group_orders?
|
- unless order_article.ordered_quantities_equal_to_group_orders?
|
||||||
%span{:style => "color:red;font-weight: bold"} !
|
%span{:style => "color:red;font-weight: bold"} !
|
||||||
%td= order_article.price.unit_quantity.to_s + ' * ' + order_article.article.unit.to_s
|
%td= order_article.price.unit_quantity.to_s + ' * ' + order_article.article.unit.to_s
|
||||||
%td= number_to_currency(order_article.price.price, :unit => "")
|
%td
|
||||||
%td= number_to_currency(order_article.price.gross_price, :unit => "")
|
= number_to_currency(order_article.price.price, :unit => ""), |
|
||||||
|
"/ ", |
|
||||||
|
number_to_currency(order_article.total_price, :unit => "") |
|
||||||
|
%td
|
||||||
|
= number_to_currency(order_article.price.gross_price, :unit => ""), |
|
||||||
|
"/ ", |
|
||||||
|
number_to_currency(order_article.total_gross_price, :unit => "") |
|
||||||
%td= order_article.price.tax
|
%td= order_article.price.tax
|
||||||
%td= order_article.price.deposit
|
%td= order_article.price.deposit
|
||||||
%td
|
%td
|
||||||
|
|
Loading…
Reference in a new issue