Class MCostDetail

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

public class MCostDetail extends X_M_CostDetail
Cost Detail Model
Version:
$Id: MCostDetail.java,v 1.3 2006/07/30 00:51:05 jjanke Exp $
Author:
Jorg Janke, Armen Rizal, Goodwill Consulting
  • BF: 2431123 Return Trx changes weighted average cost
  • BF: 1568752 Average invoice costing: landed costs incorrectly applied, Armen Rizal and Bayu Cahya
  • BF [ 2129781 ] Cost Detail not created properly for multi acc schema, Teo Sarca
  • BF [ 2847648 ] Manufacture and shipment cost errors https://sourceforge.net/p/adempiere/libero/237/, red1 FR: [ 2214883 ] Remove SQL code and Replace for Query
  • See Also:
    • Field Details

    • Constructor Details

      • MCostDetail

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

        public MCostDetail(Properties ctx, int M_CostDetail_ID, String trxName)
        Standard Constructor
        Parameters:
        ctx - context
        M_CostDetail_ID - id
        trxName - trx
      • MCostDetail

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

        public MCostDetail(MAcctSchema as, int AD_Org_ID, int M_Product_ID, int M_AttributeSetInstance_ID, int M_CostElement_ID, BigDecimal amt, BigDecimal qty, String description, String trxName)
        New Constructor
        Parameters:
        as - accounting schema
        AD_Org_ID - org
        M_Product_ID - product
        M_AttributeSetInstance_ID - asi
        M_CostElement_ID - optional cost element for Freight
        amt - Amount
        qty - Quantity
        description - optional description
        trxName - transaction
    • Method Details

      • createOrder

        public static boolean createOrder(MAcctSchema as, int AD_Org_ID, int M_Product_ID, int M_AttributeSetInstance_ID, int C_OrderLine_ID, int M_CostElement_ID, BigDecimal Amt, BigDecimal Qty, String Description, String trxName)
        Create New Cost Detail record for Purchase Orders. Called from Doc_MatchPO.
        Parameters:
        as - accounting schema
        AD_Org_ID - org
        M_Product_ID - product
        M_AttributeSetInstance_ID - asi
        C_OrderLine_ID - order
        M_CostElement_ID - optional cost element for Freight
        Amt - amt total amount
        Qty - qty
        Description - optional description
        trxName - transaction
        Returns:
        true if created
      • createInvoice

        public static boolean createInvoice(MAcctSchema as, int AD_Org_ID, int M_Product_ID, int M_AttributeSetInstance_ID, int C_InvoiceLine_ID, int M_CostElement_ID, BigDecimal Amt, BigDecimal Qty, String Description, String trxName)
        Create New Cost Detail record for AP Invoices. Called from Doc_Invoice - for Invoice Adjustments.
        Parameters:
        as - accounting schema
        AD_Org_ID - org
        M_Product_ID - product
        M_AttributeSetInstance_ID - asi
        C_InvoiceLine_ID - invoice
        M_CostElement_ID - optional cost element for Freight
        Amt - amt
        Qty - qty
        Description - optional description
        trxName - transaction
        Returns:
        true if created
      • createShipment

        public static boolean createShipment(MAcctSchema as, int AD_Org_ID, int M_Product_ID, int M_AttributeSetInstance_ID, int M_InOutLine_ID, int M_CostElement_ID, BigDecimal Amt, BigDecimal Qty, String Description, boolean IsSOTrx, String trxName)
        Create New Cost Detail record for SO Shipments. Called from Doc_MInOut - for SO Shipments.
        Parameters:
        as - accounting schema
        AD_Org_ID - org
        M_Product_ID - product
        M_AttributeSetInstance_ID - asi
        M_InOutLine_ID - shipment
        M_CostElement_ID - optional cost element for Freight
        Amt - amt
        Qty - qty
        Description - optional description
        IsSOTrx - sales order
        trxName - transaction
        Returns:
        true if no error
      • createInventory

        public static boolean createInventory(MAcctSchema as, int AD_Org_ID, int M_Product_ID, int M_AttributeSetInstance_ID, int M_InventoryLine_ID, int M_CostElement_ID, BigDecimal Amt, BigDecimal Qty, String Description, String trxName)
        Create New Cost Detail record for Physical Inventory. Called from Doc_Inventory.
        Parameters:
        as - accounting schema
        AD_Org_ID - org
        M_Product_ID - product
        M_AttributeSetInstance_ID - asi
        M_InventoryLine_ID - order
        M_CostElement_ID - optional cost element
        Amt - amt total amount
        Qty - qty
        Description - optional description
        trxName - transaction
        Returns:
        true if no error
      • createMovement

        public static boolean createMovement(MAcctSchema as, int AD_Org_ID, int M_Product_ID, int M_AttributeSetInstance_ID, int M_MovementLine_ID, int M_CostElement_ID, BigDecimal Amt, BigDecimal Qty, boolean from, String Description, String trxName)
        Create New Cost Detail record for Inventory Movements. Called from Doc_Movement.
        Parameters:
        as - accounting schema
        AD_Org_ID - org
        M_Product_ID - product
        M_AttributeSetInstance_ID - asi
        M_MovementLine_ID - movement
        M_CostElement_ID - optional cost element for Freight
        Amt - amt total amount
        Qty - qty
        from - if true the from (reduction)
        Description - optional description
        trxName - transaction
        Returns:
        true if no error
      • createProduction

        public static boolean createProduction(MAcctSchema as, int AD_Org_ID, int M_Product_ID, int M_AttributeSetInstance_ID, int M_ProductionLine_ID, int M_CostElement_ID, BigDecimal Amt, BigDecimal Qty, String Description, String trxName)
        Create New Cost Detail record for Production. Called from Doc_Production.
        Parameters:
        as - accounting schema
        AD_Org_ID - org
        M_Product_ID - product
        M_AttributeSetInstance_ID - asi
        M_ProductionLine_ID - production line
        M_CostElement_ID - optional cost element
        Amt - amt total amount
        Qty - qty
        Description - optional description
        trxName - transaction
        Returns:
        true if no error
      • createMatchInvoice

        public static boolean createMatchInvoice(MAcctSchema as, int AD_Org_ID, int M_Product_ID, int M_AttributeSetInstance_ID, int M_MatchInv_ID, int M_CostElement_ID, BigDecimal Amt, BigDecimal Qty, String Description, String trxName)
        Create cost detail record for Match Invoice (M_MatchInv).
        Parameters:
        as -
        AD_Org_ID -
        M_Product_ID -
        M_AttributeSetInstance_ID -
        M_MatchInv_ID -
        M_CostElement_ID -
        Amt -
        Qty -
        Description -
        trxName -
        Returns:
        true if no error
      • createProjectIssue

        public static boolean createProjectIssue(MAcctSchema as, int AD_Org_ID, int M_Product_ID, int M_AttributeSetInstance_ID, int C_ProjectIssue_ID, int M_CostElement_ID, BigDecimal Amt, BigDecimal Qty, String Description, String trxName)
        Create Cost Detail for Project Issue (C_ProjectIssue). Called from Doc_ProjectIssue
        Parameters:
        as - accounting schema
        AD_Org_ID - org
        M_Product_ID - product
        M_AttributeSetInstance_ID - asi
        C_ProjectIssue_ID - project issue line
        M_CostElement_ID - optional cost element
        Amt - amt total amount
        Qty - qty
        Description - optional description
        trxName - transaction
        Returns:
        true if no error
      • get

        @Deprecated public static MCostDetail get(Properties ctx, String whereClause, int ID, int M_AttributeSetInstance_ID, String trxName)
        Deprecated.
        Get Cost Detail
        Parameters:
        ctx - context
        whereClause - where clause
        ID - 1st parameter
        M_AttributeSetInstance_ID - ASI
        trxName - trx
        Returns:
        cost detail
      • get

        public static MCostDetail get(Properties ctx, String whereClause, int ID, int M_AttributeSetInstance_ID, int C_AcctSchema_ID, String trxName)
        Get Cost Detail
        Parameters:
        ctx - context
        whereClause - where clause for record id (1st parameter)
        ID - record id (1st parameter)
        M_AttributeSetInstance_ID - ASI (2nd parameter)
        C_AcctSchema_ID - accounting schema (3rd parameter)
        trxName - trx
        Returns:
        cost detail
      • list

        public static List<MCostDetail> list(Properties ctx, String whereClause, int ID, int M_AttributeSetInstance_ID, int C_AcctSchema_ID, String trxName)
        Get Cost Detail Records
        Parameters:
        ctx - context
        whereClause - where clause for record id (1st parameter)
        ID - record id (1st parameter)
        M_AttributeSetInstance_ID - ASI (2nd parameter)
        C_AcctSchema_ID - accounting schema (3rd parameter)
        trxName - trx
        Returns:
        list of cost detail record
      • processProduct

        public static boolean processProduct(MProduct product, String trxName)
        Process Cost Details for product
        Parameters:
        product - product
        trxName - transaction
        Returns:
        true if no error
      • setAmt

        public void setAmt(BigDecimal Amt)
        Set Amt
        Specified by:
        setAmt in interface I_M_CostDetail
        Overrides:
        setAmt in class X_M_CostDetail
        Parameters:
        Amt - amt
      • setQty

        public void setQty(BigDecimal Qty)
        Set Qty
        Specified by:
        setQty in interface I_M_CostDetail
        Overrides:
        setQty in class X_M_CostDetail
        Parameters:
        Qty - qty
      • isOrder

        public boolean isOrder()
        Is Order
        Returns:
        true if has order line
      • isInvoice

        public boolean isInvoice()
        Is Invoice
        Returns:
        true if has invoice line
      • isShipment

        public boolean isShipment()
        Is Shipment
        Returns:
        true if has sales order shipment line
      • isVendorRMA

        public boolean isVendorRMA()
        Returns:
        true if shipment line belongs to return to vendor (vendor RMA)
      • isDelta

        public boolean isDelta()
        Is this a Delta Record (previously processed)?
        Returns:
        true if delta is not null
      • beforeDelete

        protected boolean beforeDelete()
        Before Delete
        Overrides:
        beforeDelete in class PO
        Returns:
        false if processed
      • toString

        public String toString()
        String Representation
        Overrides:
        toString in class X_M_CostDetail
        Returns:
        info
      • process

        public boolean process()
        Process Cost Detail Record. The record is saved if processed.
        Returns:
        true if processed
      • process

        protected boolean process(MAcctSchema as, MProduct product, MCostElement ce, int Org_ID, int M_ASI_ID)
        Process cost detail record
        Parameters:
        as - accounting schema
        product - product
        ce - cost element
        Org_ID - org - corrected for costing level
        M_ASI_ID - - asi corrected for costing level
        Returns:
        true if cost ok