class Stockman::Logic::Product::StockLevel

Attributes

sellables[R]
warehouse_id[R]

Public Class Methods

new(sellables, warehouse_id) click to toggle source
# File lib/stockman/logic/product/stock_level.rb, line 7
def initialize(sellables, warehouse_id)
  @sellables    = sellables
  @warehouse_id = warehouse_id.to_i
end

Public Instance Methods

allocated_amount() click to toggle source
# File lib/stockman/logic/product/stock_level.rb, line 16
def allocated_amount
  sellables_stock_levels.sum(&:allocated_amount)
end
available_amount() click to toggle source
# File lib/stockman/logic/product/stock_level.rb, line 20
def available_amount
  sellables_stock_levels.sum(&:available_amount)
end
physical_amount() click to toggle source
# File lib/stockman/logic/product/stock_level.rb, line 12
def physical_amount
  sellables_stock_levels.sum(&:physical_amount)
end
sellables_stock_levels() click to toggle source
# File lib/stockman/logic/product/stock_level.rb, line 24
def sellables_stock_levels
  @sellables_stock_levels ||= sellables.stock_levels.select do |stock_level|
    stock_level.warehouse_id == warehouse_id
  end
end