Class MOrderLine

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

public class MOrderLine extends X_C_OrderLine
Order Line Model.
                MOrderLine ol = new MOrderLine(m_order);
                ol.setM_Product_ID(wbl.getM_Product_ID());
                ol.setQtyOrdered(wbl.getQuantity());
                ol.setPrice();
                ol.setPriceActual(wbl.getPrice());
                ol.setTax();
                ol.saveEx();
        
Version:
$Id: MOrderLine.java,v 1.6 2006/10/02 05:18:39 jjanke Exp $
Author:
Jorg Janke, Teo Sarca, SC ARHIPAC SERVICE SRL
  • BF [ 2588043 ] Insufficient message ProductNotOnPriceList
  • See Also:
    • Field Details

      • s_log

        protected static CLogger s_log
        Logger
      • m_M_PriceList_ID

        protected int m_M_PriceList_ID
      • m_IsSOTrx

        protected boolean m_IsSOTrx
      • m_productPrice

        protected IProductPricing m_productPrice
      • m_tax

        protected MTax m_tax
        Tax
      • m_precision

        protected Integer m_precision
        Cached Currency Precision
      • m_product

        protected MProduct m_product
        Product
      • m_charge

        protected MCharge m_charge
        Charge
      • m_parent

        protected MOrder m_parent
        Parent
    • Constructor Details

      • MOrderLine

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

        public MOrderLine(Properties ctx, int C_OrderLine_ID, String trxName)
        Default Constructor
        Parameters:
        ctx - context
        C_OrderLine_ID - order line to load
        trxName - trx name
      • MOrderLine

        public MOrderLine(Properties ctx, int C_OrderLine_ID, String trxName, String... virtualColumns)
        Parameters:
        ctx -
        C_OrderLine_ID -
        trxName -
        virtualColumns -
      • MOrderLine

        public MOrderLine(MOrder order)
        Parent Constructor.
        Parameters:
        order - parent order
      • MOrderLine

        public MOrderLine(Properties ctx, ResultSet rs, String trxName)
        Load Constructor
        Parameters:
        ctx - context
        rs - result set record
        trxName - transaction
    • Method Details

      • getNotReserved

        public static BigDecimal getNotReserved(Properties ctx, int M_Warehouse_ID, int M_Product_ID, int M_AttributeSetInstance_ID, int excludeC_OrderLine_ID)
        Get Order Qty that have not been reserved
        Parameters:
        ctx - context
        M_Warehouse_ID - wh
        M_Product_ID - product
        M_AttributeSetInstance_ID - asi
        excludeC_OrderLine_ID - exclude C_OrderLine_ID
        Returns:
        Order Qty that have not been reserved
      • setOrder

        public void setOrder(MOrder order)
        Set Defaults from Order.
        Parameters:
        order - order
      • setHeaderInfo

        public void setHeaderInfo(MOrder order)
        Set Header Info
        Parameters:
        order - order
      • getParent

        public MOrder getParent()
        Get Parent
        Returns:
        parent
      • setPrice

        public void setPrice(BigDecimal PriceActual)
        Set Price Entered/Actual. Use this Method if the Line UOM is the Product UOM.
        Parameters:
        PriceActual - price
      • setPriceActual

        public void setPriceActual(BigDecimal PriceActual)
        Set Price Actual. (actual price is not updateable)
        Specified by:
        setPriceActual in interface I_C_OrderLine
        Overrides:
        setPriceActual in class X_C_OrderLine
        Parameters:
        PriceActual - actual price
      • setPrice

        public void setPrice()
        Set Price for Product and PriceList.
      • setPrice

        public void setPrice(int M_PriceList_ID)
        Set Price for Product and PriceList
        Parameters:
        M_PriceList_ID - price list
      • getProductPricing

        protected IProductPricing getProductPricing(int M_PriceList_ID)
        Get and calculate Product Pricing
        Parameters:
        M_PriceList_ID - id
        Returns:
        product pricing
      • setTax

        public boolean setTax()
        Set Tax
        Returns:
        true if tax is set
      • setLineNetAmt

        public void setLineNetAmt()
        Calculate Extended Amt. May or may not include tax.
      • getCharge

        public MCharge getCharge()
        Get Charge
        Returns:
        charge or null
      • getTax

        protected MTax getTax()
        Get Tax (immutable)
        Returns:
        tax
      • getPrecision

        public int getPrecision()
        Get Currency Precision from Currency
        Returns:
        precision
      • setProduct

        public void setProduct(MProduct product)
        Set Product
        Parameters:
        product - product
      • setM_Product_ID

        public void setM_Product_ID(int M_Product_ID, boolean setUOM)
        Set M_Product_ID
        Parameters:
        M_Product_ID - product
        setUOM - true to set also UOM
      • setM_Product_ID

        public void setM_Product_ID(int M_Product_ID, int C_UOM_ID)
        Set Product and UOM
        Parameters:
        M_Product_ID - product
        C_UOM_ID - uom
      • getProduct

        public MProduct getProduct()
        Get Product
        Returns:
        product or null
      • setM_AttributeSetInstance_ID

        public void setM_AttributeSetInstance_ID(int M_AttributeSetInstance_ID)
        Set M_AttributeSetInstance_ID
        Specified by:
        setM_AttributeSetInstance_ID in interface I_C_OrderLine
        Overrides:
        setM_AttributeSetInstance_ID in class X_C_OrderLine
        Parameters:
        M_AttributeSetInstance_ID - id
      • setM_Warehouse_ID

        public void setM_Warehouse_ID(int M_Warehouse_ID)
        Set Warehouse
        Specified by:
        setM_Warehouse_ID in interface I_C_OrderLine
        Overrides:
        setM_Warehouse_ID in class X_C_OrderLine
        Parameters:
        M_Warehouse_ID - warehouse
      • canChangeWarehouse

        public boolean canChangeWarehouse()
        Can Change Warehouse
        Returns:
        true if warehouse can be changed
      • getC_Project_ID

        public int getC_Project_ID()
        Get C_Project_ID
        Specified by:
        getC_Project_ID in interface I_C_OrderLine
        Overrides:
        getC_Project_ID in class X_C_OrderLine
        Returns:
        C_Project_ID
      • getC_Activity_ID

        public int getC_Activity_ID()
        Get C_Activity_ID
        Specified by:
        getC_Activity_ID in interface I_C_OrderLine
        Overrides:
        getC_Activity_ID in class X_C_OrderLine
        Returns:
        C_Activity_ID
      • getC_Campaign_ID

        public int getC_Campaign_ID()
        Get C_Campaign_ID
        Specified by:
        getC_Campaign_ID in interface I_C_OrderLine
        Overrides:
        getC_Campaign_ID in class X_C_OrderLine
        Returns:
        C_Campaign_ID
      • getUser1_ID

        public int getUser1_ID()
        Get User1_ID
        Specified by:
        getUser1_ID in interface I_C_OrderLine
        Overrides:
        getUser1_ID in class X_C_OrderLine
        Returns:
        User1_ID
      • getUser2_ID

        public int getUser2_ID()
        Get User2_ID
        Specified by:
        getUser2_ID in interface I_C_OrderLine
        Overrides:
        getUser2_ID in class X_C_OrderLine
        Returns:
        User2_ID
      • getAD_OrgTrx_ID

        public int getAD_OrgTrx_ID()
        Get AD_OrgTrx_ID
        Specified by:
        getAD_OrgTrx_ID in interface I_C_OrderLine
        Overrides:
        getAD_OrgTrx_ID in class X_C_OrderLine
        Returns:
        AD_OrgTrx_ID
      • toString

        public String toString()
        String Representation
        Overrides:
        toString in class X_C_OrderLine
        Returns:
        info
      • addDescription

        public void addDescription(String description)
        Add to Description
        Parameters:
        description - text
      • getDescriptionText

        public String getDescriptionText()
        Get Description Text.
        Returns:
        description
      • getName

        public String getName()
        Get Name
        Returns:
        get the name of the line (from Product or Charge)
      • setC_Charge_ID

        public void setC_Charge_ID(int C_Charge_ID)
        Set C_Charge_ID
        Specified by:
        setC_Charge_ID in interface I_C_OrderLine
        Overrides:
        setC_Charge_ID in class X_C_OrderLine
        Parameters:
        C_Charge_ID - charge
      • setDiscount

        public void setDiscount()
        Calculate discount percentage (actual vs list)
      • isTaxIncluded

        public boolean isTaxIncluded()
        Is Tax Included in Amount
        Returns:
        true if tax calculated
      • setQty

        public void setQty(BigDecimal Qty)
        Set Qty Entered/Ordered. Use this Method if the Line UOM is the Product UOM.
        Parameters:
        Qty - QtyOrdered/Entered
      • setQtyEntered

        public void setQtyEntered(BigDecimal QtyEntered)
        Set Qty Entered - enforce entered UOM precision.
        Specified by:
        setQtyEntered in interface I_C_OrderLine
        Overrides:
        setQtyEntered in class X_C_OrderLine
        Parameters:
        QtyEntered -
      • setQtyOrdered

        public void setQtyOrdered(BigDecimal QtyOrdered)
        Set Qty Ordered - enforce Product UOM precision.
        Specified by:
        setQtyOrdered in interface I_C_OrderLine
        Overrides:
        setQtyOrdered in class X_C_OrderLine
        Parameters:
        QtyOrdered -
      • getBase

        public BigDecimal getBase(String CostDistribution)
        Get Base value for Cost Distribution
        Parameters:
        CostDistribution - cost Distribution (MLandedCost.LANDEDCOSTDISTRIBUTION_*)
        Returns:
        base number
      • beforeSave

        protected boolean beforeSave(boolean newRecord)
        Description copied from class: PO
        Called before Save for Pre-Save Operation.
        Default implementation is nop, to be implemented in sub-classes that needed it.
        Overrides:
        beforeSave in class PO
        Parameters:
        newRecord - true if it is a new record
        Returns:
        true if record can be saved
      • beforeDelete

        protected boolean beforeDelete()
        Description copied from class: PO
        Execute before Delete operations.
        Default implementation is nop, to be implemented in sub-classes that needed it.
        Overrides:
        beforeDelete in class PO
        Returns:
        true if record can be deleted
      • afterSave

        protected boolean afterSave(boolean newRecord, boolean success)
        Description copied from class: PO
        Called after Save for Post-Save Operation.
        Default implementation is nop, to be implemented in sub-classes that needed it.
        Overrides:
        afterSave in class PO
        Parameters:
        newRecord - true if it is a new record
        success - true if save operation was success
        Returns:
        if save was a success
      • afterDelete

        protected boolean afterDelete(boolean success)
        Description copied from class: PO
        Execute after Delete operations.
        Default implementation is nop, to be implemented in sub-classes that needed it.
        Overrides:
        afterDelete in class PO
        Parameters:
        success - true if record deleted
        Returns:
        true if delete is a success
      • updateOrderTax

        public boolean updateOrderTax(boolean oldTax)
        Recalculate order tax
        Parameters:
        oldTax - true if the old C_Tax_ID should be used
        Returns:
        true if success, false otherwise author teo_sarca [ 1583825 ]
      • updateHeaderTax

        public boolean updateHeaderTax()
        Update Tax and Header
        Returns:
        true if header updated
      • clearParent

        public void clearParent()
        Reset m_parent to null
      • getDescriptionStrippingCloseTag

        public String getDescriptionStrippingCloseTag()
        Get the description stripping the Close tag that was created when closing the order
        Returns:
        stripped description text