Class MCostQueue

All Implemented Interfaces:
Serializable, Cloneable, Comparator<Object>, I_M_CostQueue, I_Persistent, Evaluatee

public class MCostQueue extends X_M_CostQueue
Cost Queue Model
Version:
$Id: MCostQueue.java,v 1.3 2006/07/30 00:51:05 jjanke Exp $
Author:
Jorg Janke
See Also:
  • Constructor Details

    • MCostQueue

      public MCostQueue(Properties ctx, String M_CostQueue_UU, String trxName)
      UUID based Constructor
      Parameters:
      ctx - Context
      M_CostQueue_UU - UUID key
      trxName - Transaction
    • MCostQueue

      public MCostQueue(Properties ctx, int ignored, String trxName)
      Standard Constructor
      Parameters:
      ctx - context
      ignored - multi-key
      trxName - trx
    • MCostQueue

      public MCostQueue(Properties ctx, ResultSet rs, String trxName)
      Load Constructor
      Parameters:
      ctx - context
      rs - result set
      trxName - trx
    • MCostQueue

      public MCostQueue(MProduct product, int M_AttributeSetInstance_ID, MAcctSchema as, int AD_Org_ID, int M_CostElement_ID, String trxName)
      Parent Constructor
      Parameters:
      product - Product
      M_AttributeSetInstance_ID - asi
      as - Acct Schema
      AD_Org_ID - org
      M_CostElement_ID - cost element
      trxName - transaction
  • Method Details

    • get

      public static MCostQueue get(MProduct product, int M_AttributeSetInstance_ID, MAcctSchema as, int AD_Org_ID, int M_CostElement_ID, String trxName)
      Get/Create Cost Queue Record. CostingLevel is not validated.
      Parameters:
      product - product
      M_AttributeSetInstance_ID - asi
      as - accounting schema
      AD_Org_ID - org
      M_CostElement_ID - cost element
      trxName - transaction
      Returns:
      cost queue or null
    • getQueue

      public static MCostQueue[] getQueue(MProduct product, int M_ASI_ID, MAcctSchema as, int Org_ID, MCostElement ce, String trxName)
      Get Cost Queue Records in Lifo/Fifo order
      Parameters:
      product - product
      M_ASI_ID - costing level ASI
      as - accounting schema
      Org_ID - costing level org
      ce - Cost Element
      trxName - transaction
      Returns:
      cost queue or null
    • adjustQty

      public static BigDecimal adjustQty(MProduct product, int M_ASI_ID, MAcctSchema as, int Org_ID, MCostElement ce, BigDecimal Qty, String trxName)
      Adjust Qty based on in Lifo/Fifo order
      Parameters:
      product - product
      M_ASI_ID - costing level ASI
      as - accounting schema
      Org_ID - costing level org
      ce - Cost Element
      Qty - quantity to be reduced
      trxName - transaction
      Returns:
      cost price reduced or null if error
    • getCosts

      public static BigDecimal getCosts(MProduct product, int M_ASI_ID, MAcctSchema as, int Org_ID, MCostElement ce, BigDecimal Qty, String trxName)
      Calculate Cost based on Qty and in Lifo/Fifo order
      Parameters:
      product - product
      M_ASI_ID - costing level ASI
      as - accounting schema
      Org_ID - costing level org
      ce - Cost Element
      Qty - quantity to be reduced
      trxName - transaction
      Returns:
      cost for qty or null of error
    • setCosts

      public void setCosts(BigDecimal amt, BigDecimal qty, int precision)
      Update current cost price and qty. ((OldAvg*OldQty)+(Price*Qty)) / (OldQty+Qty)
      Parameters:
      amt - total Amount (price * qty)
      qty - quantity
      precision - costing precision