Examples of MCostElement


Examples of org.compiere.model.MCostElement

      || to.equals(TO_AveragePO)
      || to.equals(TO_FiFo)
      || to.equals(TO_LiFo)
      || to.equals(TO_StandardCost))
    {
      MCostElement ce = getCostElement(p_SetFutureCostTo);
      return ce != null;
    }
    return true;
  //  isValid
View Full Code Here

Examples of org.compiere.model.MCostElement

    BigDecimal retValue = null;
   
    //  Average Invoice
    if (to.equals(TO_AverageInvoice))
    {
      MCostElement ce = getCostElement(TO_AverageInvoice);
      if (ce == null)
        throw new AdempiereSystemError("CostElement not found: " + TO_AverageInvoice);
      MCost xCost = MCost.get(getCtx(), cost.getAD_Client_ID(), cost.getAD_Org_ID(), cost.getM_Product_ID(), cost.getM_CostType_ID(), cost.getC_AcctSchema_ID(), ce.getM_CostElement_ID(), cost.getM_AttributeSetInstance_ID());
      if (xCost != null)
        retValue = xCost.getCurrentCostPrice();
    }
    //  Average Invoice History
    else if (to.equals(TO_AverageInvoiceHistory))
    {
      MCostElement ce = getCostElement(TO_AverageInvoice);
      if (ce == null)
        throw new AdempiereSystemError("CostElement not found: " + TO_AverageInvoice);
      MCost xCost = MCost.get(getCtx(), cost.getAD_Client_ID(), cost.getAD_Org_ID(), cost.getM_Product_ID(), cost.getM_CostType_ID(), cost.getC_AcctSchema_ID(), ce.getM_CostElement_ID(), cost.getM_AttributeSetInstance_ID());
      if (xCost != null)
        retValue = xCost.getHistoryAverage();
    }
   
    //  Average PO
    else if (to.equals(TO_AveragePO))
    {
      MCostElement ce = getCostElement(TO_AveragePO);
      if (ce == null)
        throw new AdempiereSystemError("CostElement not found: " + TO_AveragePO);
      MCost xCost = MCost.get(getCtx(), cost.getAD_Client_ID(), cost.getAD_Org_ID(), cost.getM_Product_ID(), cost.getM_CostType_ID(), cost.getC_AcctSchema_ID(), ce.getM_CostElement_ID(), cost.getM_AttributeSetInstance_ID());
      if (xCost != null)
        retValue = xCost.getCurrentCostPrice();
    }
    //  Average PO History
    else if (to.equals(TO_AveragePOHistory))
    {
      MCostElement ce = getCostElement(TO_AveragePO);
      if (ce == null)
        throw new AdempiereSystemError("CostElement not found: " + TO_AveragePO);
      MCost xCost = MCost.get(getCtx(), cost.getAD_Client_ID(), cost.getAD_Org_ID(), cost.getM_Product_ID(), cost.getM_CostType_ID(), cost.getC_AcctSchema_ID(), ce.getM_CostElement_ID(), cost.getM_AttributeSetInstance_ID());
      if (xCost != null)
        retValue = xCost.getHistoryAverage();
    }
   
    //  FiFo
    else if (to.equals(TO_FiFo))
    {
      MCostElement ce = getCostElement(TO_FiFo);
      if (ce == null)
        throw new AdempiereSystemError("CostElement not found: " + TO_FiFo);
      MCost xCost = MCost.get(getCtx(), cost.getAD_Client_ID(), cost.getAD_Org_ID(), cost.getM_Product_ID(), cost.getM_CostType_ID(), cost.getC_AcctSchema_ID(), ce.getM_CostElement_ID(), cost.getM_AttributeSetInstance_ID());
      if (xCost != null)
        retValue = xCost.getCurrentCostPrice();
    }

    //  Future Std Costs
    else if (to.equals(TO_FutureStandardCost))
      retValue = cost.getFutureCostPrice();
   
    //  Last Inv Price
    else if (to.equals(TO_LastInvoicePrice))
    {
      MCostElement ce = getCostElement(TO_LastInvoicePrice);
      if (ce != null)
      {
        MCost xCost = MCost.get(getCtx(), cost.getAD_Client_ID(), cost.getAD_Org_ID(), cost.getM_Product_ID(), cost.getM_CostType_ID(), cost.getC_AcctSchema_ID(), ce.getM_CostElement_ID(), cost.getM_AttributeSetInstance_ID());
        if (xCost != null)
          retValue = xCost.getCurrentCostPrice();
      }
      if (retValue == null)
      {
        MProduct product = MProduct.get(getCtx(), cost.getM_Product_ID());
        MAcctSchema as = MAcctSchema.get(getCtx(), cost.getC_AcctSchema_ID());
        retValue = MCost.getLastInvoicePrice(product,
          cost.getM_AttributeSetInstance_ID(), cost.getAD_Org_ID(), as.getC_Currency_ID());       
      }
    }
   
    //  Last PO Price
    else if (to.equals(TO_LastPOPrice))
    {
      MCostElement ce = getCostElement(TO_LastPOPrice);
      if (ce != null)
      {
        MCost xCost = MCost.get(getCtx(), cost.getAD_Client_ID(), cost.getAD_Org_ID(), cost.getM_Product_ID(), cost.getM_CostType_ID(), cost.getC_AcctSchema_ID(), ce.getM_CostElement_ID(), cost.getM_AttributeSetInstance_ID());
        if (xCost != null)
          retValue = xCost.getCurrentCostPrice();
      }
      if (retValue == null)
      {
        MProduct product = MProduct.get(getCtx(), cost.getM_Product_ID());
        MAcctSchema as = MAcctSchema.get(getCtx(), cost.getC_AcctSchema_ID());
        retValue = MCost.getLastPOPrice(product,
          cost.getM_AttributeSetInstance_ID(), cost.getAD_Org_ID(), as.getC_Currency_ID());       
      }
    }
 
    //  FiFo
    else if (to.equals(TO_LiFo))
    {
      MCostElement ce = getCostElement(TO_LiFo);
      if (ce == null)
        throw new AdempiereSystemError("CostElement not found: " + TO_LiFo);
      MCost xCost = MCost.get(getCtx(), cost.getAD_Client_ID(), cost.getAD_Org_ID(), cost.getM_Product_ID(), cost.getM_CostType_ID(), cost.getC_AcctSchema_ID(), ce.getM_CostElement_ID(), cost.getM_AttributeSetInstance_ID());
      if (xCost != null)
        retValue = xCost.getCurrentCostPrice();
    }
   
    //  Old Std Costs
View Full Code Here

Examples of org.compiere.model.MCostElement

   @param CostingMethod method
   *  @return costing element or null
   */
  private MCostElement getCostElement (String CostingMethod)
  {
    MCostElement ce = m_ces.get(CostingMethod);
    if (ce == null)
    {
      ce = MCostElement.getMaterialCostElement(getCtx(), CostingMethod);
      m_ces.put(CostingMethod, ce);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.