Class: Skr::SkuTran

Inherits:
Model
  • Object
show all
Defined in:
lib/skr/models/sku_tran.rb

Overview

In Stockor, inventory related transactions are not performed directly on the model(s)

Instead a SkuTran is created, and it is responsible for adjusting either the cost or qty of the inventory. By doing so, all inventory changes is logged and can be referred to in order to audit changes.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#allocate_after_saveObject

Returns the value of attribute allocate_after_save.



36
37
38
# File 'lib/skr/models/sku_tran.rb', line 36

def allocate_after_save
  @allocate_after_save
end

#credit_gl_accountObject

Returns the value of attribute credit_gl_account.



28
29
30
# File 'lib/skr/models/sku_tran.rb', line 28

def 
  @credit_gl_account
end

#debit_gl_accountObject

Returns the value of attribute debit_gl_account.



29
30
31
# File 'lib/skr/models/sku_tran.rb', line 29

def 
  @debit_gl_account
end

#gl_tran_description_textObject

Returns the value of attribute gl_tran_description_text.



30
31
32
# File 'lib/skr/models/sku_tran.rb', line 30

def gl_tran_description_text
  @gl_tran_description_text
end

Instance Method Details

#ea_qtyFixnum

Returns #qty expressed in terms of single UOM.

Returns:

  • (Fixnum)

    #qty expressed in terms of single UOM



46
47
48
# File 'lib/skr/models/sku_tran.rb', line 46

def ea_qty
    self.qty * ( self.uom_size || 1 )
end

#sku_loc=(sl) ⇒ Object

Parameters:

  • sl (SkuLoc)

    set’s the sku loc and also sets #prior_qty and #prior_mac



39
40
41
42
43
# File 'lib/skr/models/sku_tran.rb', line 39

def sku_loc=(sl)
    super
    self.prior_qty = sl.qty
    self.prior_mac = sl.mac
end