/******************************************************************************
 * 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.isnov.plugin.model;

import java.math.BigDecimal;
import java.sql.ResultSet;
import java.sql.Timestamp;
import java.util.Properties;
import org.compiere.model.I_Persistent;
import org.compiere.model.MTable;
import org.compiere.model.PO;
import org.compiere.model.POInfo;
import org.compiere.model.X_AD_User;
import org.compiere.model.X_C_BPartner;
import org.compiere.model.X_C_BPartner_Location;
import org.compiere.util.Env;

/**
 * Generated Model for table iNO_SalesRepVisit
 * @author iDempiere (generated)
 * @version Release 7.1 - $Id$
 */
public class X_iNO_SalesRepVisit extends PO implements I_iNO_SalesRepVisit, I_Persistent {

	private static final long serialVersionUID = 20240704L;

	/**
	 * Standard Constructor
	 */
	public X_iNO_SalesRepVisit (Properties ctx, int iNO_SalesRepVisit_ID, String trxName) {
		super (ctx, iNO_SalesRepVisit_ID, trxName);
		/** if (iNO_SalesRepVisit_ID == 0)
		{
			setC_BPartner_ID (0);
			setC_BPartner_Location_ID (0);
			setiNO_SalesRepVisit_ID (0);
			setSalesRep_ID (0);
			setStartDate (new Timestamp( System.currentTimeMillis() ));
		} */
    }

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

	public X_C_BPartner getC_BPartner() throws RuntimeException {
		return (X_C_BPartner)MTable.get(getCtx(), X_C_BPartner.Table_Name)
				.getPO(getC_BPartner_ID(), get_TrxName());
	}

	/**
	 * Set Business Partner .
	 * @param C_BPartner_ID 
	 * Identifies a Business Partner
	 */
	public void setC_BPartner_ID (int bPartnerID) {
		if (bPartnerID < 1) 
			set_Value (COLUMNNAME_C_BPartner_ID, null);
		else 
			set_Value (COLUMNNAME_C_BPartner_ID, Integer.valueOf(bPartnerID));
	}

	/**
	 * Get Business Partner .
	 * @return Identifies a Business Partner
	 */
	public int getC_BPartner_ID () {
		Integer ii = (Integer)get_Value(COLUMNNAME_C_BPartner_ID);
		if (ii == null)
			 return 0;
		return ii.intValue();
	}

	public X_C_BPartner_Location getC_BPartner_Location() throws RuntimeException {
		return (X_C_BPartner_Location)MTable.get(getCtx(), X_C_BPartner_Location.Table_Name)
				.getPO(getC_BPartner_Location_ID(), get_TrxName());
	}

	/**
	 * Set Partner Location.
	 * @param C_BPartner_Location_ID 
	 * Identifies the (ship to) address for this Business Partner
	 */
	public void setC_BPartner_Location_ID (int bPartnerLocationID) {
		if (bPartnerLocationID < 1) 
			set_Value (COLUMNNAME_C_BPartner_Location_ID, null);
		else 
			set_Value (COLUMNNAME_C_BPartner_Location_ID, Integer.valueOf(bPartnerLocationID));
	}

	/**
	 * Get Partner Location.
	 * @return Identifies the (ship to) address for this Business Partner
	 */
	public int getC_BPartner_Location_ID () {
		Integer ii = (Integer)get_Value(COLUMNNAME_C_BPartner_Location_ID);
		if (ii == null)
			 return 0;
		return ii.intValue();
	}

	/**
	 * Set Comments.
	 * @param Comments 
	 * Comments or additional information
	 */
	public void setComments (String comments) {
		set_Value (COLUMNNAME_Comments, comments);
	}

	/**
	 * Get Comments.
	 * @return Comments or additional information
	 */
	public String getComments () {
		return (String)get_Value(COLUMNNAME_Comments);
	}

	/**
	 * Set Description.
	 * @param Description 
	 * Optional short description of the record
	 */
	public void setDescription (String description) {
		set_Value (COLUMNNAME_Description, description);
	}

	/**
	 * Get Description.
	 * @return Optional short description of the record
	 */
	public String getDescription () {
		return (String)get_Value(COLUMNNAME_Description);
	}

	/**
	 * Set Document No.
	 * @param DocumentNo 
	 * Document sequence number of the document
	 */
	public void setDocumentNo (String documentNo) {
		set_ValueNoCheck (COLUMNNAME_DocumentNo, documentNo);
	}

	/**
	 * Get Document No.
	 * @return Document sequence number of the document
	 */
	public String getDocumentNo () {
		return (String)get_Value(COLUMNNAME_DocumentNo);
	}

	/**
	 * Set End Date.
	 * @param EndDate 
	 * Last effective date (inclusive)
	 */
	public void setEndDate (Timestamp endDate) {
		set_Value (COLUMNNAME_EndDate, endDate);
	}

	/**
	 * Get End Date.
	 * @return Last effective date (inclusive)
	 */
	public Timestamp getEndDate () {
		return (Timestamp)get_Value(COLUMNNAME_EndDate);
	}

	/**
	 * Set Needs.
	 * @param iEXT_Needs Needs
	 */
	public void setiEXT_Needs (String needs) {
		set_Value (COLUMNNAME_iEXT_Needs, needs);
	}

	/**
	 * Get Needs.
	 * @return Needs
	 */
	public String getiEXT_Needs () {
		return (String)get_Value(COLUMNNAME_iEXT_Needs);
	}

	/**
	 * Set Sales Representative Visit.
	 * @param iNO_SalesRepVisit_ID Sales Representative Visit
	 */
	public void setiNO_SalesRepVisit_ID (int salesRepVisitID) {
		if (salesRepVisitID < 1) 
			set_ValueNoCheck (COLUMNNAME_iNO_SalesRepVisit_ID, null);
		else 
			set_ValueNoCheck (COLUMNNAME_iNO_SalesRepVisit_ID, Integer.valueOf(salesRepVisitID));
	}

	/**
	 * Get Sales Representative Visit.
	 * @return Sales Representative Visit
	 */
	public int getiNO_SalesRepVisit_ID () {
		Integer ii = (Integer)get_Value(COLUMNNAME_iNO_SalesRepVisit_ID);
		if (ii == null)
			 return 0;
		return ii.intValue();
	}

	/**
	 * Set iNO_SalesRepVisit_UU.
	 * @param iNO_SalesRepVisit_UU iNO_SalesRepVisit_UU
	 */
	public void setiNO_SalesRepVisit_UU (String salesRepVisitUU) {
		set_Value (COLUMNNAME_iNO_SalesRepVisit_UU, salesRepVisitUU);
	}

	/**
	 * Get iNO_SalesRepVisit_UU.
	 * @return iNO_SalesRepVisit_UU
	 */
	public String getiNO_SalesRepVisit_UU () {
		return (String)get_Value(COLUMNNAME_iNO_SalesRepVisit_UU);
	}

	/**
	 * Set Latitude.
	 * @param Latitude 
	 * Defines where the center of the map will be when it first opens. 
	 */
	public void setLatitude (BigDecimal latitude) {
		set_Value (COLUMNNAME_Latitude, latitude);
	}

	/**
	 * Get Latitude.
	 * @return Defines where the center of the map will be when it first opens. 
	 */
	public BigDecimal getLatitude () {
		BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Latitude);
		if (bd == null)
			 return Env.ZERO;
		return bd;
	}

	/**
	 * Set Longitude.
	 * @param Longitude 
	 * Defines where the center of the map will be when it first opens. 
	 */
	public void setLongitude (BigDecimal longitude) {
		set_Value (COLUMNNAME_Longitude, longitude);
	}

	/**
	 * Get Longitude.
	 * @return Defines where the center of the map will be when it first opens. 
	 */
	public BigDecimal getLongitude () {
		BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Longitude);
		if (bd == null)
			 return Env.ZERO;
		return bd;
	}

	/**
	 * Set Order Reference.
	 * @param POReference 
	 * Transaction Reference Number (Sales Order, Purchase Order) of your Business Partner
	 */
	public void setPOReference (String pOReference) {
		set_Value (COLUMNNAME_POReference, pOReference);
	}

	/**
	 * Get Order Reference.
	 * @return Transaction Reference Number (Sales Order, Purchase Order) of your Business Partner
	 */
	public String getPOReference () {
		return (String)get_Value(COLUMNNAME_POReference);
	}

	/**
	 * Set Processed.
	 * @param Processed 
	 * The document has been processed
	 */
	public void setProcessed (boolean processed) {
		set_Value (COLUMNNAME_Processed, Boolean.valueOf(processed));
	}

	/**
	 * Get Processed.
	 * @return The document has been processed
	 */
	public boolean isProcessed () {
		Object oo = get_Value(COLUMNNAME_Processed);
		if (oo != null) 
		{
			 if (oo instanceof Boolean) 
				 return ((Boolean)oo).booleanValue(); 
			return "Y".equals(oo);
		}
		return false;
	}

	public X_AD_User getSalesRep() throws RuntimeException {
		return (X_AD_User)MTable.get(getCtx(), X_AD_User.Table_Name)
				.getPO(getSalesRep_ID(), get_TrxName());
	}

	/**
	 * Set Sales Representative.
	 * @param SalesRep_ID 
	 * Sales Representative or Company Agent
	 */
	public void setSalesRep_ID (int iD) {
		if (iD < 1) 
			set_Value (COLUMNNAME_SalesRep_ID, null);
		else 
			set_Value (COLUMNNAME_SalesRep_ID, Integer.valueOf(iD));
	}

	/**
	 * Get Sales Representative.
	 * @return Sales Representative or Company Agent
	 */
	public int getSalesRep_ID () {
		Integer ii = (Integer)get_Value(COLUMNNAME_SalesRep_ID);
		if (ii == null)
			 return 0;
		return ii.intValue();
	}

	/**
	 * Set Start Date.
	 * @param StartDate 
	 * First effective day (inclusive)
	 */
	public void setStartDate (Timestamp startDate) {
		set_Value (COLUMNNAME_StartDate, startDate);
	}

	/**
	 * Get Start Date.
	 * @return First effective day (inclusive)
	 */
	public Timestamp getStartDate () {
		return (Timestamp)get_Value(COLUMNNAME_StartDate);
	}
}