Resolve merge conflicts
This commit is contained in:
commit
11117738ce
9 changed files with 126 additions and 122 deletions
|
|
@ -7,11 +7,11 @@ module StockitHelper
|
|||
|
||||
def link_to_stock_change_reason(stock_change)
|
||||
if stock_change.delivery_id
|
||||
link_to t('.delivery'), supplier_delivery_path(stock_change.delivery.supplier, stock_change.delivery)
|
||||
link_to Delivery.model_name.human, supplier_delivery_path(stock_change.delivery.supplier, stock_change.delivery)
|
||||
elsif stock_change.order_id
|
||||
link_to t('.order'), order_path(stock_change.order)
|
||||
link_to Order.model_name.human, order_path(stock_change.order)
|
||||
elsif stock_change.stock_taking_id
|
||||
link_to t('.stock_taking'), stock_taking_path(stock_change.stock_taking)
|
||||
link_to StockTaking.model_name.human, stock_taking_path(stock_change.stock_taking)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -14,10 +14,14 @@ class StockArticle < Article
|
|||
|
||||
# Check for unclosed orders and substract its ordered quantity
|
||||
def quantity_available
|
||||
quantity - OrderArticle.where(article_id: id).
|
||||
quantity - quantity_ordered
|
||||
end
|
||||
|
||||
def quantity_ordered
|
||||
OrderArticle.where(article_id: id).
|
||||
joins(:order).where("orders.state = 'open' OR orders.state = 'finished'").sum(:units_to_order)
|
||||
end
|
||||
|
||||
|
||||
def quantity_history
|
||||
stock_changes.reorder('stock_changes.created_at ASC').map{|s| s.quantity}.cumulative_sum
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
%p
|
||||
= simple_fields_for "stock_taking[stock_change_attributes][]", stock_change do |form|
|
||||
= form.hidden_field :stock_article_id
|
||||
= "Menge (#{stock_change.stock_article.quantity_available})"
|
||||
= t '.amount'
|
||||
(#{stock_change.stock_article.quantity_available})
|
||||
= form.text_field :quantity, :size => 5, :autocomplete => 'off'
|
||||
%span{:data => {:toggle => :tooltip, :title => render(:partial => 'shared/article_price_info', :locals => {:article => stock_change.stock_article})}}
|
||||
%b= stock_change.stock_article.name
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
%tr{:class => stock_article_classes(stock_article), :id => "stockArticle-#{stock_article.id}"}
|
||||
%td= link_to stock_article.name, stock_article
|
||||
%td= stock_article.quantity
|
||||
%td= stock_article.quantity - stock_article.quantity_available
|
||||
%td= stock_article.quantity_ordered
|
||||
%th= stock_article.quantity_available
|
||||
%td= stock_article.unit
|
||||
%td= stock_article.price
|
||||
|
|
|
|||
|
|
@ -56,15 +56,15 @@
|
|||
%table.table.table-hover#articles
|
||||
%thead
|
||||
%tr
|
||||
%th= t '.article.article'
|
||||
%th= t '.article.stock'
|
||||
%th= t '.article.ordered'
|
||||
%th= t '.article.available'
|
||||
%th= t '.article.unit'
|
||||
%th= t '.article.price'
|
||||
%th= t '.article.vat'
|
||||
%th= t '.article.supplier'
|
||||
%th= t '.article.category'
|
||||
%th= Article.model_name.human
|
||||
%th= heading_helper StockArticle, :quantity
|
||||
%th= heading_helper StockArticle, :quantity_ordered
|
||||
%th= heading_helper StockArticle, :available
|
||||
%th= heading_helper StockArticle, :unit
|
||||
%th= heading_helper StockArticle, :price
|
||||
%th= heading_helper StockArticle, :tax
|
||||
%th= heading_helper StockArticle, :supplier
|
||||
%th= heading_helper StockArticle, :article_category
|
||||
%th
|
||||
%tbody#articles-tbody
|
||||
- for stock_article in @stock_articles
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue