Show current stock value on stockit page.

This commit is contained in:
Benjamin Meichsner 2009-08-04 13:41:28 +02:00
parent 6761a41048
commit 4d57bd2e73
2 changed files with 7 additions and 0 deletions

View file

@ -48,6 +48,10 @@ class StockArticle < Article
available
end
def self.stock_value
available.collect { |a| a.quantity * a.gross_price }.sum
end
protected
def check_quantity

View file

@ -53,4 +53,7 @@
%td
= link_to icon(:edit), edit_stock_article_path(article)
= link_to icon(:delete), article, :method => :delete, :confirm => "Bist Du sicher?"
%p
Aktueller Lagerwert:
= number_to_currency StockArticle.stock_value