/******************************************************************************
 * Product: iDempiere ERP & CRM Smart Business Solution                       *
 * Copyright (C) 1999-2012 ComPiere, Inc. All Rights Reserved.                *
 * This program is free software, you can redistribute it and/or modify it    *
 * under the terms version 2 of the GNU General Public License as published   *
 * by the Free Software Foundation. This program is distributed in the hope   *
 * that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.           *
 * See the GNU General Public License for more details.                       *
 * You should have received a copy of the GNU General Public License along    *
 * with this program, if not, write to the Free Software Foundation, Inc.,    *
 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.                     *
 * For the text or an alternative of this public license, you may reach us    *
 * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA        *
 * or via info@compiere.org or http://www.compiere.org/license.html           *
 *****************************************************************************/
/** Generated Model - DO NOT CHANGE */
package org.compiere.model;

import java.math.BigDecimal;
import java.sql.ResultSet;
import java.util.Properties;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;

/** Generated Model for M_DiscountSchemaBreak
 *  @author iDempiere (generated)
 *  @version Release 11 - $Id$ */
@org.adempiere.base.Model(table="M_DiscountSchemaBreak")
public class X_M_DiscountSchemaBreak extends PO implements I_M_DiscountSchemaBreak, I_Persistent
{

	/**
	 *
	 */
	private static final long serialVersionUID = 20231222L;

    /** Standard Constructor */
    public X_M_DiscountSchemaBreak (Properties ctx, int M_DiscountSchemaBreak_ID, String trxName)
    {
      super (ctx, M_DiscountSchemaBreak_ID, trxName);
      /** if (M_DiscountSchemaBreak_ID == 0)
        {
			setBreakDiscount (Env.ZERO);
			setBreakValue (Env.ZERO);
			setIsBPartnerFlatDiscount (false);
// N
			setM_DiscountSchemaBreak_ID (0);
			setM_DiscountSchema_ID (0);
			setSeqNo (0);
// @SQL=SELECT NVL(MAX(SeqNo),0)+10 AS DefaultValue FROM M_DiscountSchemaBreak WHERE M_DiscountSchema_ID=@M_DiscountSchema_ID@
        } */
    }

    /** Standard Constructor */
    public X_M_DiscountSchemaBreak (Properties ctx, int M_DiscountSchemaBreak_ID, String trxName, String ... virtualColumns)
    {
      super (ctx, M_DiscountSchemaBreak_ID, trxName, virtualColumns);
      /** if (M_DiscountSchemaBreak_ID == 0)
        {
			setBreakDiscount (Env.ZERO);
			setBreakValue (Env.ZERO);
			setIsBPartnerFlatDiscount (false);
// N
			setM_DiscountSchemaBreak_ID (0);
			setM_DiscountSchema_ID (0);
			setSeqNo (0);
// @SQL=SELECT NVL(MAX(SeqNo),0)+10 AS DefaultValue FROM M_DiscountSchemaBreak WHERE M_DiscountSchema_ID=@M_DiscountSchema_ID@
        } */
    }

    /** Standard Constructor */
    public X_M_DiscountSchemaBreak (Properties ctx, String M_DiscountSchemaBreak_UU, String trxName)
    {
      super (ctx, M_DiscountSchemaBreak_UU, trxName);
      /** if (M_DiscountSchemaBreak_UU == null)
        {
			setBreakDiscount (Env.ZERO);
			setBreakValue (Env.ZERO);
			setIsBPartnerFlatDiscount (false);
// N
			setM_DiscountSchemaBreak_ID (0);
			setM_DiscountSchema_ID (0);
			setSeqNo (0);
// @SQL=SELECT NVL(MAX(SeqNo),0)+10 AS DefaultValue FROM M_DiscountSchemaBreak WHERE M_DiscountSchema_ID=@M_DiscountSchema_ID@
        } */
    }

    /** Standard Constructor */
    public X_M_DiscountSchemaBreak (Properties ctx, String M_DiscountSchemaBreak_UU, String trxName, String ... virtualColumns)
    {
      super (ctx, M_DiscountSchemaBreak_UU, trxName, virtualColumns);
      /** if (M_DiscountSchemaBreak_UU == null)
        {
			setBreakDiscount (Env.ZERO);
			setBreakValue (Env.ZERO);
			setIsBPartnerFlatDiscount (false);
// N
			setM_DiscountSchemaBreak_ID (0);
			setM_DiscountSchema_ID (0);
			setSeqNo (0);
// @SQL=SELECT NVL(MAX(SeqNo),0)+10 AS DefaultValue FROM M_DiscountSchemaBreak WHERE M_DiscountSchema_ID=@M_DiscountSchema_ID@
        } */
    }

    /** Load Constructor */
    public X_M_DiscountSchemaBreak (Properties ctx, ResultSet rs, String trxName)
    {
      super (ctx, rs, trxName);
    }

    /** AccessLevel
      * @return 3 - Client - Org
      */
    protected int get_AccessLevel()
    {
      return accessLevel.intValue();
    }

    /** Load Meta Data */
    protected POInfo initPO (Properties ctx)
    {
      POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName());
      return poi;
    }

    public String toString()
    {
      StringBuilder sb = new StringBuilder ("X_M_DiscountSchemaBreak[")
        .append(get_ID()).append("]");
      return sb.toString();
    }

	/** Set Break Discount %.
		@param BreakDiscount Trade Discount in Percent for the break level
	*/
	public void setBreakDiscount (BigDecimal BreakDiscount)
	{
		set_Value (COLUMNNAME_BreakDiscount, BreakDiscount);
	}

	/** Get Break Discount %.
		@return Trade Discount in Percent for the break level
	  */
	public BigDecimal getBreakDiscount()
	{
		BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_BreakDiscount);
		if (bd == null)
			 return Env.ZERO;
		return bd;
	}

	/** Set Break Value.
		@param BreakValue Low Value of trade discount break level
	*/
	public void setBreakValue (BigDecimal BreakValue)
	{
		set_Value (COLUMNNAME_BreakValue, BreakValue);
	}

	/** Get Break Value.
		@return Low Value of trade discount break level
	  */
	public BigDecimal getBreakValue()
	{
		BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_BreakValue);
		if (bd == null)
			 return Env.ZERO;
		return bd;
	}

	/** Set Fixed Price.
		@param FixedPrice Fixed Price for Product
	*/
	public void setFixedPrice (BigDecimal FixedPrice)
	{
		set_Value (COLUMNNAME_FixedPrice, FixedPrice);
	}

	/** Get Fixed Price.
		@return Fixed Price for Product
	  */
	public BigDecimal getFixedPrice()
	{
		BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_FixedPrice);
		if (bd == null)
			 return Env.ZERO;
		return bd;
	}

	/** Set B.Partner Flat Discount.
		@param IsBPartnerFlatDiscount Use flat discount defined on Business Partner Level
	*/
	public void setIsBPartnerFlatDiscount (boolean IsBPartnerFlatDiscount)
	{
		set_Value (COLUMNNAME_IsBPartnerFlatDiscount, Boolean.valueOf(IsBPartnerFlatDiscount));
	}

	/** Get B.Partner Flat Discount.
		@return Use flat discount defined on Business Partner Level
	  */
	public boolean isBPartnerFlatDiscount()
	{
		Object oo = get_Value(COLUMNNAME_IsBPartnerFlatDiscount);
		if (oo != null)
		{
			 if (oo instanceof Boolean)
				 return ((Boolean)oo).booleanValue();
			return "Y".equals(oo);
		}
		return false;
	}

	/** Set Discount Schema Break.
		@param M_DiscountSchemaBreak_ID Trade Discount Break
	*/
	public void setM_DiscountSchemaBreak_ID (int M_DiscountSchemaBreak_ID)
	{
		if (M_DiscountSchemaBreak_ID < 1)
			set_ValueNoCheck (COLUMNNAME_M_DiscountSchemaBreak_ID, null);
		else
			set_ValueNoCheck (COLUMNNAME_M_DiscountSchemaBreak_ID, Integer.valueOf(M_DiscountSchemaBreak_ID));
	}

	/** Get Discount Schema Break.
		@return Trade Discount Break
	  */
	public int getM_DiscountSchemaBreak_ID()
	{
		Integer ii = (Integer)get_Value(COLUMNNAME_M_DiscountSchemaBreak_ID);
		if (ii == null)
			 return 0;
		return ii.intValue();
	}

	/** Set M_DiscountSchemaBreak_UU.
		@param M_DiscountSchemaBreak_UU M_DiscountSchemaBreak_UU
	*/
	public void setM_DiscountSchemaBreak_UU (String M_DiscountSchemaBreak_UU)
	{
		set_Value (COLUMNNAME_M_DiscountSchemaBreak_UU, M_DiscountSchemaBreak_UU);
	}

	/** Get M_DiscountSchemaBreak_UU.
		@return M_DiscountSchemaBreak_UU	  */
	public String getM_DiscountSchemaBreak_UU()
	{
		return (String)get_Value(COLUMNNAME_M_DiscountSchemaBreak_UU);
	}

	public org.compiere.model.I_M_DiscountSchema getM_DiscountSchema() throws RuntimeException
	{
		return (org.compiere.model.I_M_DiscountSchema)MTable.get(getCtx(), org.compiere.model.I_M_DiscountSchema.Table_ID)
			.getPO(getM_DiscountSchema_ID(), get_TrxName());
	}

	/** Set Discount Schema.
		@param M_DiscountSchema_ID Schema to calculate the trade discount percentage
	*/
	public void setM_DiscountSchema_ID (int M_DiscountSchema_ID)
	{
		if (M_DiscountSchema_ID < 1)
			set_ValueNoCheck (COLUMNNAME_M_DiscountSchema_ID, null);
		else
			set_ValueNoCheck (COLUMNNAME_M_DiscountSchema_ID, Integer.valueOf(M_DiscountSchema_ID));
	}

	/** Get Discount Schema.
		@return Schema to calculate the trade discount percentage
	  */
	public int getM_DiscountSchema_ID()
	{
		Integer ii = (Integer)get_Value(COLUMNNAME_M_DiscountSchema_ID);
		if (ii == null)
			 return 0;
		return ii.intValue();
	}

	public org.compiere.model.I_M_Product_Category getM_Product_Category() throws RuntimeException
	{
		return (org.compiere.model.I_M_Product_Category)MTable.get(getCtx(), org.compiere.model.I_M_Product_Category.Table_ID)
			.getPO(getM_Product_Category_ID(), get_TrxName());
	}

	/** Set Product Category.
		@param M_Product_Category_ID Category of a Product
	*/
	public void setM_Product_Category_ID (int M_Product_Category_ID)
	{
		if (M_Product_Category_ID < 1)
			set_Value (COLUMNNAME_M_Product_Category_ID, null);
		else
			set_Value (COLUMNNAME_M_Product_Category_ID, Integer.valueOf(M_Product_Category_ID));
	}

	/** Get Product Category.
		@return Category of a Product
	  */
	public int getM_Product_Category_ID()
	{
		Integer ii = (Integer)get_Value(COLUMNNAME_M_Product_Category_ID);
		if (ii == null)
			 return 0;
		return ii.intValue();
	}

	public org.compiere.model.I_M_Product getM_Product() throws RuntimeException
	{
		return (org.compiere.model.I_M_Product)MTable.get(getCtx(), org.compiere.model.I_M_Product.Table_ID)
			.getPO(getM_Product_ID(), get_TrxName());
	}

	/** Set Product.
		@param M_Product_ID Product, Service, Item
	*/
	public void setM_Product_ID (int M_Product_ID)
	{
		if (M_Product_ID < 1)
			set_Value (COLUMNNAME_M_Product_ID, null);
		else
			set_Value (COLUMNNAME_M_Product_ID, Integer.valueOf(M_Product_ID));
	}

	/** Get Product.
		@return Product, Service, Item
	  */
	public int getM_Product_ID()
	{
		Integer ii = (Integer)get_Value(COLUMNNAME_M_Product_ID);
		if (ii == null)
			 return 0;
		return ii.intValue();
	}

	/** Set Sequence.
		@param SeqNo Method of ordering records; lowest number comes first
	*/
	public void setSeqNo (int SeqNo)
	{
		set_Value (COLUMNNAME_SeqNo, Integer.valueOf(SeqNo));
	}

	/** Get Sequence.
		@return Method of ordering records; lowest number comes first
	  */
	public int getSeqNo()
	{
		Integer ii = (Integer)get_Value(COLUMNNAME_SeqNo);
		if (ii == null)
			 return 0;
		return ii.intValue();
	}

    /** Get Record ID/ColumnName
        @return ID/ColumnName pair
      */
    public KeyNamePair getKeyNamePair()
    {
        return new KeyNamePair(get_ID(), String.valueOf(getSeqNo()));
    }
}