Class ProductCost


  • public class ProductCost
    extends Object
    Product Cost Model. Summarizes Info in MCost
    Version:
    $Id: ProductCost.java,v 1.3 2006/07/30 00:51:03 jjanke Exp $
    Author:
    Jorg Janke
    • Field Detail

      • ACCTTYPE_P_Revenue

        public static final int ACCTTYPE_P_Revenue
        Product Revenue Acct
        See Also:
        Constant Field Values
      • ACCTTYPE_P_Expense

        public static final int ACCTTYPE_P_Expense
        Product Expense Acct
        See Also:
        Constant Field Values
      • ACCTTYPE_P_Asset

        public static final int ACCTTYPE_P_Asset
        Product Asset Acct
        See Also:
        Constant Field Values
      • ACCTTYPE_P_Cogs

        public static final int ACCTTYPE_P_Cogs
        Product COGS Acct
        See Also:
        Constant Field Values
      • ACCTTYPE_P_PPV

        public static final int ACCTTYPE_P_PPV
        Purchase Price Variance
        See Also:
        Constant Field Values
      • ACCTTYPE_P_IPV

        public static final int ACCTTYPE_P_IPV
        Invoice Price Variance
        See Also:
        Constant Field Values
      • ACCTTYPE_P_TDiscountRec

        public static final int ACCTTYPE_P_TDiscountRec
        Trade Discount Revenue
        See Also:
        Constant Field Values
      • ACCTTYPE_P_TDiscountGrant

        public static final int ACCTTYPE_P_TDiscountGrant
        Trade Discount Costs
        See Also:
        Constant Field Values
      • ACCTTYPE_P_CostAdjustment

        public static final int ACCTTYPE_P_CostAdjustment
        Cost Adjustment
        See Also:
        Constant Field Values
      • ACCTTYPE_P_InventoryClearing

        public static final int ACCTTYPE_P_InventoryClearing
        Inventory Clearing
        See Also:
        Constant Field Values
      • ACCTTYPE_P_WorkInProcess

        public static final int ACCTTYPE_P_WorkInProcess
        Work in Process
        See Also:
        Constant Field Values
      • ACCTTYPE_P_MethodChangeVariance

        public static final int ACCTTYPE_P_MethodChangeVariance
        Method Change Variance
        See Also:
        Constant Field Values
      • ACCTTYPE_P_UsageVariance

        public static final int ACCTTYPE_P_UsageVariance
        Material Usage Variance
        See Also:
        Constant Field Values
      • ACCTTYPE_P_RateVariance

        public static final int ACCTTYPE_P_RateVariance
        Material Rate Variance
        See Also:
        Constant Field Values
      • ACCTTYPE_P_MixVariance

        public static final int ACCTTYPE_P_MixVariance
        Mix Variance
        See Also:
        Constant Field Values
      • ACCTTYPE_P_FloorStock

        public static final int ACCTTYPE_P_FloorStock
        Floor Stock
        See Also:
        Constant Field Values
      • ACCTTYPE_P_CostOfProduction

        public static final int ACCTTYPE_P_CostOfProduction
        Cost Production
        See Also:
        Constant Field Values
      • ACCTTYPE_P_OutsideProcessing

        public static final int ACCTTYPE_P_OutsideProcessing
        Outside Processing
        See Also:
        Constant Field Values
      • ACCTTYPE_P_Overhead

        public static final int ACCTTYPE_P_Overhead
        Outside Overhead
        See Also:
        Constant Field Values
      • ACCTTYPE_P_Scrap

        public static final int ACCTTYPE_P_Scrap
        Outside Processing
        See Also:
        Constant Field Values
      • ACCTTYPE_P_AverageCostVariance

        public static final int ACCTTYPE_P_AverageCostVariance
        Average costing variance
        See Also:
        Constant Field Values
      • ACCTTYPE_P_LandedCostClearing

        public static final int ACCTTYPE_P_LandedCostClearing
        Landed cost clearing
        See Also:
        Constant Field Values
    • Constructor Detail

      • ProductCost

        public ProductCost​(Properties ctx,
                           int M_Product_ID,
                           int M_AttributeSetInstance_ID,
                           String trxName)
        Constructor
        Parameters:
        ctx - context
        M_Product_ID - product
        M_AttributeSetInstance_ID - asi
        trxName - trx
    • Method Detail

      • getProduct

        public MProduct getProduct()
        Get Product
        Returns:
        Product might be null
      • isService

        public boolean isService()
        Is this a Service
        Returns:
        true if service
      • setQty

        public void setQty​(BigDecimal qty)
        Set Quantity in Storage UOM
        Parameters:
        qty - quantity
      • setQty

        public void setQty​(BigDecimal qty,
                           int C_UOM_ID)
        Set Quantity in UOM
        Parameters:
        qty - quantity
        C_UOM_ID - UOM
      • getAccount

        public MAccount getAccount​(int AcctType,
                                   MAcctSchema as)
        Line Account from Product
        Parameters:
        AcctType - see ACCTTYPE_* (1..8)
        as - Accounting Schema
        Returns:
        Requested Product Account
      • getAccountDefault

        public MAccount getAccountDefault​(int AcctType,
                                          MAcctSchema as)
        Account from Default Product Category
        Parameters:
        AcctType - see ACCTTYPE_* (1..8)
        as - accounting schema
        Returns:
        Requested Product Account
      • getProductCosts

        public BigDecimal getProductCosts​(MAcctSchema as,
                                          int AD_Org_ID,
                                          String costingMethod,
                                          int C_OrderLine_ID,
                                          boolean zeroCostsOK)
        Get Total Costs (amt*qty) in Accounting Schema Currency
        Parameters:
        as - accounting schema
        AD_Org_ID - trx org
        costingMethod - if null uses Accounting Schema - AcctSchema.COSTINGMETHOD_*
        C_OrderLine_ID - optional order line
        zeroCostsOK - zero/no costs are OK
        Returns:
        cost or null, if qty or costs cannot be determined
      • toString

        public String toString()
        String Representation
        Overrides:
        toString in class Object
        Returns:
        info
      • setM_M_AttributeSetInstance_ID

        public void setM_M_AttributeSetInstance_ID​(int M_AttributeSetInstance_ID)
        Parameters:
        M_AttributeSetInstance_ID - the m_M_AttributeSetInstance_ID to set