/******************************************************************************
 * 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 C_DunningRunLine
 *  @author iDempiere (generated)
 *  @version Release 11 - $Id$ */
@org.adempiere.base.Model(table="C_DunningRunLine")
public class X_C_DunningRunLine extends PO implements I_C_DunningRunLine, I_Persistent
{

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

    /** Standard Constructor */
    public X_C_DunningRunLine (Properties ctx, int C_DunningRunLine_ID, String trxName)
    {
      super (ctx, C_DunningRunLine_ID, trxName);
      /** if (C_DunningRunLine_ID == 0)
        {
			setAmt (Env.ZERO);
			setC_DunningRunEntry_ID (0);
			setC_DunningRunLine_ID (0);
			setConvertedAmt (Env.ZERO);
			setDaysDue (0);
			setFeeAmt (Env.ZERO);
			setInterestAmt (Env.ZERO);
			setIsInDispute (false);
			setOpenAmt (Env.ZERO);
			setProcessed (false);
			setTimesDunned (0);
			setTotalAmt (Env.ZERO);
        } */
    }

    /** Standard Constructor */
    public X_C_DunningRunLine (Properties ctx, int C_DunningRunLine_ID, String trxName, String ... virtualColumns)
    {
      super (ctx, C_DunningRunLine_ID, trxName, virtualColumns);
      /** if (C_DunningRunLine_ID == 0)
        {
			setAmt (Env.ZERO);
			setC_DunningRunEntry_ID (0);
			setC_DunningRunLine_ID (0);
			setConvertedAmt (Env.ZERO);
			setDaysDue (0);
			setFeeAmt (Env.ZERO);
			setInterestAmt (Env.ZERO);
			setIsInDispute (false);
			setOpenAmt (Env.ZERO);
			setProcessed (false);
			setTimesDunned (0);
			setTotalAmt (Env.ZERO);
        } */
    }

    /** Standard Constructor */
    public X_C_DunningRunLine (Properties ctx, String C_DunningRunLine_UU, String trxName)
    {
      super (ctx, C_DunningRunLine_UU, trxName);
      /** if (C_DunningRunLine_UU == null)
        {
			setAmt (Env.ZERO);
			setC_DunningRunEntry_ID (0);
			setC_DunningRunLine_ID (0);
			setConvertedAmt (Env.ZERO);
			setDaysDue (0);
			setFeeAmt (Env.ZERO);
			setInterestAmt (Env.ZERO);
			setIsInDispute (false);
			setOpenAmt (Env.ZERO);
			setProcessed (false);
			setTimesDunned (0);
			setTotalAmt (Env.ZERO);
        } */
    }

    /** Standard Constructor */
    public X_C_DunningRunLine (Properties ctx, String C_DunningRunLine_UU, String trxName, String ... virtualColumns)
    {
      super (ctx, C_DunningRunLine_UU, trxName, virtualColumns);
      /** if (C_DunningRunLine_UU == null)
        {
			setAmt (Env.ZERO);
			setC_DunningRunEntry_ID (0);
			setC_DunningRunLine_ID (0);
			setConvertedAmt (Env.ZERO);
			setDaysDue (0);
			setFeeAmt (Env.ZERO);
			setInterestAmt (Env.ZERO);
			setIsInDispute (false);
			setOpenAmt (Env.ZERO);
			setProcessed (false);
			setTimesDunned (0);
			setTotalAmt (Env.ZERO);
        } */
    }

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

	/** Set Amount.
		@param Amt Amount
	*/
	public void setAmt (BigDecimal Amt)
	{
		set_Value (COLUMNNAME_Amt, Amt);
	}

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

	public org.compiere.model.I_C_DunningRunEntry getC_DunningRunEntry() throws RuntimeException
	{
		return (org.compiere.model.I_C_DunningRunEntry)MTable.get(getCtx(), org.compiere.model.I_C_DunningRunEntry.Table_ID)
			.getPO(getC_DunningRunEntry_ID(), get_TrxName());
	}

	/** Set Dunning Run Entry.
		@param C_DunningRunEntry_ID Dunning Run Entry
	*/
	public void setC_DunningRunEntry_ID (int C_DunningRunEntry_ID)
	{
		if (C_DunningRunEntry_ID < 1)
			set_ValueNoCheck (COLUMNNAME_C_DunningRunEntry_ID, null);
		else
			set_ValueNoCheck (COLUMNNAME_C_DunningRunEntry_ID, Integer.valueOf(C_DunningRunEntry_ID));
	}

	/** Get Dunning Run Entry.
		@return Dunning Run Entry
	  */
	public int getC_DunningRunEntry_ID()
	{
		Integer ii = (Integer)get_Value(COLUMNNAME_C_DunningRunEntry_ID);
		if (ii == null)
			 return 0;
		return ii.intValue();
	}

	/** Set Dunning Run Line.
		@param C_DunningRunLine_ID Dunning Run Line
	*/
	public void setC_DunningRunLine_ID (int C_DunningRunLine_ID)
	{
		if (C_DunningRunLine_ID < 1)
			set_ValueNoCheck (COLUMNNAME_C_DunningRunLine_ID, null);
		else
			set_ValueNoCheck (COLUMNNAME_C_DunningRunLine_ID, Integer.valueOf(C_DunningRunLine_ID));
	}

	/** Get Dunning Run Line.
		@return Dunning Run Line
	  */
	public int getC_DunningRunLine_ID()
	{
		Integer ii = (Integer)get_Value(COLUMNNAME_C_DunningRunLine_ID);
		if (ii == null)
			 return 0;
		return ii.intValue();
	}

	/** Set C_DunningRunLine_UU.
		@param C_DunningRunLine_UU C_DunningRunLine_UU
	*/
	public void setC_DunningRunLine_UU (String C_DunningRunLine_UU)
	{
		set_Value (COLUMNNAME_C_DunningRunLine_UU, C_DunningRunLine_UU);
	}

	/** Get C_DunningRunLine_UU.
		@return C_DunningRunLine_UU	  */
	public String getC_DunningRunLine_UU()
	{
		return (String)get_Value(COLUMNNAME_C_DunningRunLine_UU);
	}

	public org.compiere.model.I_C_Invoice getC_Invoice() throws RuntimeException
	{
		return (org.compiere.model.I_C_Invoice)MTable.get(getCtx(), org.compiere.model.I_C_Invoice.Table_ID)
			.getPO(getC_Invoice_ID(), get_TrxName());
	}

	/** Set Invoice.
		@param C_Invoice_ID Invoice Identifier
	*/
	public void setC_Invoice_ID (int C_Invoice_ID)
	{
		if (C_Invoice_ID < 1)
			set_Value (COLUMNNAME_C_Invoice_ID, null);
		else
			set_Value (COLUMNNAME_C_Invoice_ID, Integer.valueOf(C_Invoice_ID));
	}

	/** Get Invoice.
		@return Invoice Identifier
	  */
	public int getC_Invoice_ID()
	{
		Integer ii = (Integer)get_Value(COLUMNNAME_C_Invoice_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(getC_Invoice_ID()));
    }

	public org.compiere.model.I_C_InvoicePaySchedule getC_InvoicePaySchedule() throws RuntimeException
	{
		return (org.compiere.model.I_C_InvoicePaySchedule)MTable.get(getCtx(), org.compiere.model.I_C_InvoicePaySchedule.Table_ID)
			.getPO(getC_InvoicePaySchedule_ID(), get_TrxName());
	}

	/** Set Invoice Payment Schedule.
		@param C_InvoicePaySchedule_ID Invoice Payment Schedule
	*/
	public void setC_InvoicePaySchedule_ID (int C_InvoicePaySchedule_ID)
	{
		if (C_InvoicePaySchedule_ID < 1)
			set_Value (COLUMNNAME_C_InvoicePaySchedule_ID, null);
		else
			set_Value (COLUMNNAME_C_InvoicePaySchedule_ID, Integer.valueOf(C_InvoicePaySchedule_ID));
	}

	/** Get Invoice Payment Schedule.
		@return Invoice Payment Schedule
	  */
	public int getC_InvoicePaySchedule_ID()
	{
		Integer ii = (Integer)get_Value(COLUMNNAME_C_InvoicePaySchedule_ID);
		if (ii == null)
			 return 0;
		return ii.intValue();
	}

	/** Set Converted Amount.
		@param ConvertedAmt Converted Amount
	*/
	public void setConvertedAmt (BigDecimal ConvertedAmt)
	{
		set_Value (COLUMNNAME_ConvertedAmt, ConvertedAmt);
	}

	/** Get Converted Amount.
		@return Converted Amount
	  */
	public BigDecimal getConvertedAmt()
	{
		BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_ConvertedAmt);
		if (bd == null)
			 return Env.ZERO;
		return bd;
	}

	public org.compiere.model.I_C_Payment getC_Payment() throws RuntimeException
	{
		return (org.compiere.model.I_C_Payment)MTable.get(getCtx(), org.compiere.model.I_C_Payment.Table_ID)
			.getPO(getC_Payment_ID(), get_TrxName());
	}

	/** Set Payment.
		@param C_Payment_ID Payment identifier
	*/
	public void setC_Payment_ID (int C_Payment_ID)
	{
		if (C_Payment_ID < 1)
			set_Value (COLUMNNAME_C_Payment_ID, null);
		else
			set_Value (COLUMNNAME_C_Payment_ID, Integer.valueOf(C_Payment_ID));
	}

	/** Get Payment.
		@return Payment identifier
	  */
	public int getC_Payment_ID()
	{
		Integer ii = (Integer)get_Value(COLUMNNAME_C_Payment_ID);
		if (ii == null)
			 return 0;
		return ii.intValue();
	}

	/** Set Days due.
		@param DaysDue Number of days due (negative: due in number of days)
	*/
	public void setDaysDue (int DaysDue)
	{
		set_Value (COLUMNNAME_DaysDue, Integer.valueOf(DaysDue));
	}

	/** Get Days due.
		@return Number of days due (negative: due in number of days)
	  */
	public int getDaysDue()
	{
		Integer ii = (Integer)get_Value(COLUMNNAME_DaysDue);
		if (ii == null)
			 return 0;
		return ii.intValue();
	}

	/** Set Fee Amount.
		@param FeeAmt Fee amount in invoice currency
	*/
	public void setFeeAmt (BigDecimal FeeAmt)
	{
		set_Value (COLUMNNAME_FeeAmt, FeeAmt);
	}

	/** Get Fee Amount.
		@return Fee amount in invoice currency
	  */
	public BigDecimal getFeeAmt()
	{
		BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_FeeAmt);
		if (bd == null)
			 return Env.ZERO;
		return bd;
	}

	/** Set Interest Amount.
		@param InterestAmt Interest Amount
	*/
	public void setInterestAmt (BigDecimal InterestAmt)
	{
		set_Value (COLUMNNAME_InterestAmt, InterestAmt);
	}

	/** Get Interest Amount.
		@return Interest Amount
	  */
	public BigDecimal getInterestAmt()
	{
		BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_InterestAmt);
		if (bd == null)
			 return Env.ZERO;
		return bd;
	}

	/** Set In Dispute.
		@param IsInDispute Document is in dispute
	*/
	public void setIsInDispute (boolean IsInDispute)
	{
		set_Value (COLUMNNAME_IsInDispute, Boolean.valueOf(IsInDispute));
	}

	/** Get In Dispute.
		@return Document is in dispute
	  */
	public boolean isInDispute()
	{
		Object oo = get_Value(COLUMNNAME_IsInDispute);
		if (oo != null)
		{
			 if (oo instanceof Boolean)
				 return ((Boolean)oo).booleanValue();
			return "Y".equals(oo);
		}
		return false;
	}

	/** Set Open Amount.
		@param OpenAmt Open item amount
	*/
	public void setOpenAmt (BigDecimal OpenAmt)
	{
		set_Value (COLUMNNAME_OpenAmt, OpenAmt);
	}

	/** Get Open Amount.
		@return Open item amount
	  */
	public BigDecimal getOpenAmt()
	{
		BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_OpenAmt);
		if (bd == null)
			 return Env.ZERO;
		return bd;
	}

	/** 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;
	}

	/** Set Times Dunned.
		@param TimesDunned Number of times dunned previously
	*/
	public void setTimesDunned (int TimesDunned)
	{
		set_Value (COLUMNNAME_TimesDunned, Integer.valueOf(TimesDunned));
	}

	/** Get Times Dunned.
		@return Number of times dunned previously
	  */
	public int getTimesDunned()
	{
		Integer ii = (Integer)get_Value(COLUMNNAME_TimesDunned);
		if (ii == null)
			 return 0;
		return ii.intValue();
	}

	/** Set Total Amount.
		@param TotalAmt Total Amount
	*/
	public void setTotalAmt (BigDecimal TotalAmt)
	{
		set_Value (COLUMNNAME_TotalAmt, TotalAmt);
	}

	/** Get Total Amount.
		@return Total Amount
	  */
	public BigDecimal getTotalAmt()
	{
		BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_TotalAmt);
		if (bd == null)
			 return Env.ZERO;
		return bd;
	}
}