Sha256: 367c4da4695b7deecba01d2f125f295ba4d6a0fb1ffaac1925eb72ebabc57f39
Contents?: true
Size: 782 Bytes
Versions: 2
Compression:
Stored size: 782 Bytes
Contents
module Stockman module Logic class Product class StockLevel attr_reader :sellables, :warehouse_id def initialize(sellables, warehouse_id) @sellables = sellables @warehouse_id = warehouse_id.to_i end def physical_amount sellables_stock_levels.sum(&:physical_amount) end def allocated_amount sellables_stock_levels.sum(&:allocated_amount) end def available_amount sellables_stock_levels.sum(&:available_amount) end def sellables_stock_levels @sellables_stock_levels ||= sellables.stock_levels.select do |stock_level| stock_level.warehouse_id == warehouse_id end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
stockman-logic-0.1.1 | lib/stockman/logic/product/stock_level.rb |
stockman-logic-0.1.0 | lib/stockman/logic/product/stock_level.rb |