/******************************************************************************
 * 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.sql.Timestamp;
import java.util.Properties;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;

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

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

    /** Standard Constructor */
    public X_M_Freight (Properties ctx, int M_Freight_ID, String trxName)
    {
      super (ctx, M_Freight_ID, trxName);
      /** if (M_Freight_ID == 0)
        {
			setC_Currency_ID (0);
			setFreightAmt (Env.ZERO);
			setM_FreightCategory_ID (0);
			setM_Freight_ID (0);
			setM_Shipper_ID (0);
			setValidFrom (new Timestamp( System.currentTimeMillis() ));
        } */
    }

    /** Standard Constructor */
    public X_M_Freight (Properties ctx, int M_Freight_ID, String trxName, String ... virtualColumns)
    {
      super (ctx, M_Freight_ID, trxName, virtualColumns);
      /** if (M_Freight_ID == 0)
        {
			setC_Currency_ID (0);
			setFreightAmt (Env.ZERO);
			setM_FreightCategory_ID (0);
			setM_Freight_ID (0);
			setM_Shipper_ID (0);
			setValidFrom (new Timestamp( System.currentTimeMillis() ));
        } */
    }

    /** Standard Constructor */
    public X_M_Freight (Properties ctx, String M_Freight_UU, String trxName)
    {
      super (ctx, M_Freight_UU, trxName);
      /** if (M_Freight_UU == null)
        {
			setC_Currency_ID (0);
			setFreightAmt (Env.ZERO);
			setM_FreightCategory_ID (0);
			setM_Freight_ID (0);
			setM_Shipper_ID (0);
			setValidFrom (new Timestamp( System.currentTimeMillis() ));
        } */
    }

    /** Standard Constructor */
    public X_M_Freight (Properties ctx, String M_Freight_UU, String trxName, String ... virtualColumns)
    {
      super (ctx, M_Freight_UU, trxName, virtualColumns);
      /** if (M_Freight_UU == null)
        {
			setC_Currency_ID (0);
			setFreightAmt (Env.ZERO);
			setM_FreightCategory_ID (0);
			setM_Freight_ID (0);
			setM_Shipper_ID (0);
			setValidFrom (new Timestamp( System.currentTimeMillis() ));
        } */
    }

    /** Load Constructor */
    public X_M_Freight (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_Freight[")
        .append(get_ID()).append("]");
      return sb.toString();
    }

	public org.compiere.model.I_C_Country getC_Country() throws RuntimeException
	{
		return (org.compiere.model.I_C_Country)MTable.get(getCtx(), org.compiere.model.I_C_Country.Table_ID)
			.getPO(getC_Country_ID(), get_TrxName());
	}

	/** Set Country.
		@param C_Country_ID Country 
	*/
	public void setC_Country_ID (int C_Country_ID)
	{
		if (C_Country_ID < 1)
			set_Value (COLUMNNAME_C_Country_ID, null);
		else
			set_Value (COLUMNNAME_C_Country_ID, Integer.valueOf(C_Country_ID));
	}

	/** Get Country.
		@return Country 
	  */
	public int getC_Country_ID()
	{
		Integer ii = (Integer)get_Value(COLUMNNAME_C_Country_ID);
		if (ii == null)
			 return 0;
		return ii.intValue();
	}

	public org.compiere.model.I_C_Currency getC_Currency() throws RuntimeException
	{
		return (org.compiere.model.I_C_Currency)MTable.get(getCtx(), org.compiere.model.I_C_Currency.Table_ID)
			.getPO(getC_Currency_ID(), get_TrxName());
	}

	/** Set Currency.
		@param C_Currency_ID The Currency for this record
	*/
	public void setC_Currency_ID (int C_Currency_ID)
	{
		if (C_Currency_ID < 1)
			set_Value (COLUMNNAME_C_Currency_ID, null);
		else
			set_Value (COLUMNNAME_C_Currency_ID, Integer.valueOf(C_Currency_ID));
	}

	/** Get Currency.
		@return The Currency for this record
	  */
	public int getC_Currency_ID()
	{
		Integer ii = (Integer)get_Value(COLUMNNAME_C_Currency_ID);
		if (ii == null)
			 return 0;
		return ii.intValue();
	}

	public org.compiere.model.I_C_Region getC_Region() throws RuntimeException
	{
		return (org.compiere.model.I_C_Region)MTable.get(getCtx(), org.compiere.model.I_C_Region.Table_ID)
			.getPO(getC_Region_ID(), get_TrxName());
	}

	/** Set Region.
		@param C_Region_ID Identifies a geographical Region
	*/
	public void setC_Region_ID (int C_Region_ID)
	{
		if (C_Region_ID < 1)
			set_Value (COLUMNNAME_C_Region_ID, null);
		else
			set_Value (COLUMNNAME_C_Region_ID, Integer.valueOf(C_Region_ID));
	}

	/** Get Region.
		@return Identifies a geographical Region
	  */
	public int getC_Region_ID()
	{
		Integer ii = (Integer)get_Value(COLUMNNAME_C_Region_ID);
		if (ii == null)
			 return 0;
		return ii.intValue();
	}

	/** Set Freight Amount.
		@param FreightAmt Freight Amount 
	*/
	public void setFreightAmt (BigDecimal FreightAmt)
	{
		set_Value (COLUMNNAME_FreightAmt, FreightAmt);
	}

	/** Get Freight Amount.
		@return Freight Amount 
	  */
	public BigDecimal getFreightAmt()
	{
		BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_FreightAmt);
		if (bd == null)
			 return Env.ZERO;
		return bd;
	}

	/** Set Max Dimension.
		@param MaxDimension Max Dimension
	*/
	public void setMaxDimension (BigDecimal MaxDimension)
	{
		set_Value (COLUMNNAME_MaxDimension, MaxDimension);
	}

	/** Get Max Dimension.
		@return Max Dimension	  */
	public BigDecimal getMaxDimension()
	{
		BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_MaxDimension);
		if (bd == null)
			 return Env.ZERO;
		return bd;
	}

	/** Set Max Weight.
		@param MaxWeight Max Weight
	*/
	public void setMaxWeight (BigDecimal MaxWeight)
	{
		set_Value (COLUMNNAME_MaxWeight, MaxWeight);
	}

	/** Get Max Weight.
		@return Max Weight	  */
	public BigDecimal getMaxWeight()
	{
		BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_MaxWeight);
		if (bd == null)
			 return Env.ZERO;
		return bd;
	}

	public org.compiere.model.I_M_FreightCategory getM_FreightCategory() throws RuntimeException
	{
		return (org.compiere.model.I_M_FreightCategory)MTable.get(getCtx(), org.compiere.model.I_M_FreightCategory.Table_ID)
			.getPO(getM_FreightCategory_ID(), get_TrxName());
	}

	/** Set Freight Category.
		@param M_FreightCategory_ID Category of the Freight
	*/
	public void setM_FreightCategory_ID (int M_FreightCategory_ID)
	{
		if (M_FreightCategory_ID < 1)
			set_Value (COLUMNNAME_M_FreightCategory_ID, null);
		else
			set_Value (COLUMNNAME_M_FreightCategory_ID, Integer.valueOf(M_FreightCategory_ID));
	}

	/** Get Freight Category.
		@return Category of the Freight
	  */
	public int getM_FreightCategory_ID()
	{
		Integer ii = (Integer)get_Value(COLUMNNAME_M_FreightCategory_ID);
		if (ii == null)
			 return 0;
		return ii.intValue();
	}

	/** Set Freight.
		@param M_Freight_ID Freight Rate
	*/
	public void setM_Freight_ID (int M_Freight_ID)
	{
		if (M_Freight_ID < 1)
			set_ValueNoCheck (COLUMNNAME_M_Freight_ID, null);
		else
			set_ValueNoCheck (COLUMNNAME_M_Freight_ID, Integer.valueOf(M_Freight_ID));
	}

	/** Get Freight.
		@return Freight Rate
	  */
	public int getM_Freight_ID()
	{
		Integer ii = (Integer)get_Value(COLUMNNAME_M_Freight_ID);
		if (ii == null)
			 return 0;
		return ii.intValue();
	}

	/** Set M_Freight_UU.
		@param M_Freight_UU M_Freight_UU
	*/
	public void setM_Freight_UU (String M_Freight_UU)
	{
		set_Value (COLUMNNAME_M_Freight_UU, M_Freight_UU);
	}

	/** Get M_Freight_UU.
		@return M_Freight_UU	  */
	public String getM_Freight_UU()
	{
		return (String)get_Value(COLUMNNAME_M_Freight_UU);
	}

	public org.compiere.model.I_M_Shipper getM_Shipper() throws RuntimeException
	{
		return (org.compiere.model.I_M_Shipper)MTable.get(getCtx(), org.compiere.model.I_M_Shipper.Table_ID)
			.getPO(getM_Shipper_ID(), get_TrxName());
	}

	/** Set Shipper.
		@param M_Shipper_ID Method or manner of product delivery
	*/
	public void setM_Shipper_ID (int M_Shipper_ID)
	{
		if (M_Shipper_ID < 1)
			set_ValueNoCheck (COLUMNNAME_M_Shipper_ID, null);
		else
			set_ValueNoCheck (COLUMNNAME_M_Shipper_ID, Integer.valueOf(M_Shipper_ID));
	}

	/** Get Shipper.
		@return Method or manner of product delivery
	  */
	public int getM_Shipper_ID()
	{
		Integer ii = (Integer)get_Value(COLUMNNAME_M_Shipper_ID);
		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(getM_Shipper_ID()));
    }

	/** Set To.
		@param To_Country_ID Receiving Country
	*/
	public void setTo_Country_ID (int To_Country_ID)
	{
		if (To_Country_ID < 1)
			set_Value (COLUMNNAME_To_Country_ID, null);
		else
			set_Value (COLUMNNAME_To_Country_ID, Integer.valueOf(To_Country_ID));
	}

	/** Get To.
		@return Receiving Country
	  */
	public int getTo_Country_ID()
	{
		Integer ii = (Integer)get_Value(COLUMNNAME_To_Country_ID);
		if (ii == null)
			 return 0;
		return ii.intValue();
	}

	public org.compiere.model.I_C_Region getTo_Region() throws RuntimeException
	{
		return (org.compiere.model.I_C_Region)MTable.get(getCtx(), org.compiere.model.I_C_Region.Table_ID)
			.getPO(getTo_Region_ID(), get_TrxName());
	}

	/** Set To.
		@param To_Region_ID Receiving Region
	*/
	public void setTo_Region_ID (int To_Region_ID)
	{
		if (To_Region_ID < 1)
			set_Value (COLUMNNAME_To_Region_ID, null);
		else
			set_Value (COLUMNNAME_To_Region_ID, Integer.valueOf(To_Region_ID));
	}

	/** Get To.
		@return Receiving Region
	  */
	public int getTo_Region_ID()
	{
		Integer ii = (Integer)get_Value(COLUMNNAME_To_Region_ID);
		if (ii == null)
			 return 0;
		return ii.intValue();
	}

	/** Set Valid from.
		@param ValidFrom Valid from including this date (first day)
	*/
	public void setValidFrom (Timestamp ValidFrom)
	{
		set_Value (COLUMNNAME_ValidFrom, ValidFrom);
	}

	/** Get Valid from.
		@return Valid from including this date (first day)
	  */
	public Timestamp getValidFrom()
	{
		return (Timestamp)get_Value(COLUMNNAME_ValidFrom);
	}
}