Class MDiscountSchema

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

public class MDiscountSchema extends X_M_DiscountSchema implements ImmutablePOSupport
Discount Schema Model
Version:
$Id: MDiscountSchema.java,v 1.3 2006/07/30 00:51:04 jjanke Exp $
Author:
Jorg Janke
See Also:
  • Constructor Details

    • MDiscountSchema

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

      public MDiscountSchema(Properties ctx, int M_DiscountSchema_ID, String trxName)
      Standard Constructor
      Parameters:
      ctx - context
      M_DiscountSchema_ID - id
      trxName - transaction
    • MDiscountSchema

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

      public MDiscountSchema(MDiscountSchema copy)
      Copy constructor
      Parameters:
      copy -
    • MDiscountSchema

      public MDiscountSchema(Properties ctx, MDiscountSchema copy)
      Copy constructor
      Parameters:
      ctx -
      copy -
    • MDiscountSchema

      public MDiscountSchema(Properties ctx, MDiscountSchema copy, String trxName)
      Copy constructor
      Parameters:
      ctx -
      copy -
      trxName -
  • Method Details

    • get

      public static MDiscountSchema get(int M_DiscountSchema_ID)
      Get Discount Schema from Cache (immutable)
      Parameters:
      M_DiscountSchema_ID - id
      Returns:
      MDiscountSchema
    • get

      public static MDiscountSchema get(Properties ctx, int M_DiscountSchema_ID)
      Get Discount Schema from Cache (immutable)
      Parameters:
      ctx - context
      M_DiscountSchema_ID - id
      Returns:
      MDiscountSchema
    • getBreaks

      public MDiscountSchemaBreak[] getBreaks(boolean reload)
      Get Breaks
      Parameters:
      reload - true to reload from DB
      Returns:
      breaks
    • getLines

      public MDiscountSchemaLine[] getLines(boolean reload)
      Get Lines
      Parameters:
      reload - reload
      Returns:
      lines
    • calculatePrice

      public BigDecimal calculatePrice(BigDecimal Qty, BigDecimal Price, int M_Product_ID, int M_Product_Category_ID, BigDecimal BPartnerFlatDiscount)
      Calculate Discounted Price
      Parameters:
      Qty - quantity
      Price - price
      M_Product_ID - product
      M_Product_Category_ID - category
      BPartnerFlatDiscount - flat discount
      Returns:
      Discounted Price
    • calculateDiscountedPrice

      public static BigDecimal calculateDiscountedPrice(BigDecimal price, BigDecimal discount)
      Calculate discounted price
      Parameters:
      price - input price
      discount - discount percentage, for e.g 5.00 for 5%
      Returns:
      discounted price
    • calculateDiscount

      public BigDecimal calculateDiscount(BigDecimal Qty, BigDecimal Price, int M_Product_ID, int M_Product_Category_ID, BigDecimal BPartnerFlatDiscount)
      Calculate Discount Percentage
      Parameters:
      Qty - quantity
      Price - price
      M_Product_ID - product
      M_Product_Category_ID - category
      BPartnerFlatDiscount - flat discount
      Returns:
      discount or zero
    • 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
    • reSeq

      public int reSeq()
      Renumber SeqNo
      Returns:
      lines updated
    • markImmutable

      public MDiscountSchema markImmutable()
      Description copied from interface: ImmutablePOSupport
      mark PO as immutable
      Specified by:
      markImmutable in interface ImmutablePOSupport
      Returns:
      PO