Class MCostQueue

    • Constructor Detail

      • 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 Detail

      • 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 - real asi
        as - accounting schema
        AD_Org_ID - real org
        M_CostElement_ID - 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 of 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 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 for qty or null of error
      • setCosts

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