FR [ 1804068 ] Make Dunning (More) Usable

FR [ 1799601 ] Dunning Block/Delay
This commit is contained in:
kthiemann 2007-11-01 12:47:59 +00:00
parent 1aeeaeed8d
commit 14ffcb8bf0
10 changed files with 3613 additions and 2599 deletions

View File

@ -5,21 +5,21 @@
* Copyright (C) Trifon Trifonov. *
* Copyright (C) Contributors *
* *
* This program is free software;
* This program is free software;
you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation;
* as published by the Free Software Foundation;
either version 2 *
* of the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY;
* 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;
* along with this program;
if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
@ -30,215 +30,228 @@
* Sponsors: *
* - Company (http://www.site.com) *
**********************************************************************/
package org.compiere.model;
import java.util.*;
import java.sql.Timestamp;
import java.math.*;
import org.compiere.util.*;
package org.compiere.model;
/** Generated Interface for C_DunningRunLine
* @author Trifon Trifonov (generated)
* @version Release 3.3.0 - 2007-08-24 11:39:40.156
*/
public interface I_C_DunningRunLine
{
import java.math.BigDecimal;
import org.compiere.util.KeyNamePair;
/** Generated Interface for C_DunningRunLine
* @author Trifon Trifonov (generated)
* @version Release 3.3.0
*/
public interface I_C_DunningRunLine
{
/** TableName=C_DunningRunLine */
public static final String Table_Name = "C_DunningRunLine";
public static final String Table_Name = "C_DunningRunLine";
/** AD_Table_ID=524 */
public static final int Table_ID = MTable.getTable_ID(Table_Name);
public static final int Table_ID = MTable.getTable_ID(Table_Name);
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
/** AccessLevel = 3 - Client - Org
*/
BigDecimal accessLevel = new BigDecimal(3);
BigDecimal accessLevel = BigDecimal.valueOf(3);
/** Load Meta Data */
/** Column name Amt */
public static final String COLUMNNAME_Amt = "Amt";
public static final String COLUMNNAME_Amt = "Amt";
/** Set Amount.
* Amount
* Amount
*/
public void setAmt (BigDecimal Amt);
public void setAmt (BigDecimal Amt);
/** Get Amount.
* Amount
* Amount
*/
public BigDecimal getAmt();
public BigDecimal getAmt();
/** Column name C_DunningRunEntry_ID */
public static final String COLUMNNAME_C_DunningRunEntry_ID = "C_DunningRunEntry_ID";
public static final String COLUMNNAME_C_DunningRunEntry_ID = "C_DunningRunEntry_ID";
/** Set Dunning Run Entry.
* Dunning Run Entry
* Dunning Run Entry
*/
public void setC_DunningRunEntry_ID (int C_DunningRunEntry_ID);
public void setC_DunningRunEntry_ID (int C_DunningRunEntry_ID);
/** Get Dunning Run Entry.
* Dunning Run Entry
* Dunning Run Entry
*/
public int getC_DunningRunEntry_ID();
public int getC_DunningRunEntry_ID();
public I_C_DunningRunEntry getI_C_DunningRunEntry() throws Exception;
public I_C_DunningRunEntry getC_DunningRunEntry() throws Exception;
/** Column name C_DunningRunLine_ID */
public static final String COLUMNNAME_C_DunningRunLine_ID = "C_DunningRunLine_ID";
public static final String COLUMNNAME_C_DunningRunLine_ID = "C_DunningRunLine_ID";
/** Set Dunning Run Line.
* Dunning Run Line
* Dunning Run Line
*/
public void setC_DunningRunLine_ID (int C_DunningRunLine_ID);
public void setC_DunningRunLine_ID (int C_DunningRunLine_ID);
/** Get Dunning Run Line.
* Dunning Run Line
* Dunning Run Line
*/
public int getC_DunningRunLine_ID();
public int getC_DunningRunLine_ID();
/** Column name C_InvoicePaySchedule_ID */
public static final String COLUMNNAME_C_InvoicePaySchedule_ID = "C_InvoicePaySchedule_ID";
/** Set Invoice Payment Schedule.
* Invoice Payment Schedule
*/
public void setC_InvoicePaySchedule_ID (int C_InvoicePaySchedule_ID);
/** Get Invoice Payment Schedule.
* Invoice Payment Schedule
*/
public int getC_InvoicePaySchedule_ID();
public I_C_InvoicePaySchedule getC_InvoicePaySchedule() throws Exception;
/** Column name C_Invoice_ID */
public static final String COLUMNNAME_C_Invoice_ID = "C_Invoice_ID";
public static final String COLUMNNAME_C_Invoice_ID = "C_Invoice_ID";
/** Set Invoice.
* Invoice Identifier
* Invoice Identifier
*/
public void setC_Invoice_ID (int C_Invoice_ID);
public void setC_Invoice_ID (int C_Invoice_ID);
/** Get Invoice.
* Invoice Identifier
* Invoice Identifier
*/
public int getC_Invoice_ID();
public int getC_Invoice_ID();
/** Column name C_Payment_ID */
public static final String COLUMNNAME_C_Payment_ID = "C_Payment_ID";
public static final String COLUMNNAME_C_Payment_ID = "C_Payment_ID";
/** Set Payment.
* Payment identifier
* Payment identifier
*/
public void setC_Payment_ID (int C_Payment_ID);
public void setC_Payment_ID (int C_Payment_ID);
/** Get Payment.
* Payment identifier
* Payment identifier
*/
public int getC_Payment_ID();
public int getC_Payment_ID();
/** Column name ConvertedAmt */
public static final String COLUMNNAME_ConvertedAmt = "ConvertedAmt";
public static final String COLUMNNAME_ConvertedAmt = "ConvertedAmt";
/** Set Converted Amount.
* Converted Amount
* Converted Amount
*/
public void setConvertedAmt (BigDecimal ConvertedAmt);
public void setConvertedAmt (BigDecimal ConvertedAmt);
/** Get Converted Amount.
* Converted Amount
* Converted Amount
*/
public BigDecimal getConvertedAmt();
public BigDecimal getConvertedAmt();
/** Column name DaysDue */
public static final String COLUMNNAME_DaysDue = "DaysDue";
public static final String COLUMNNAME_DaysDue = "DaysDue";
/** Set Days due.
* Number of days due (negative: due in number of days)
* Number of days due (negative: due in number of days)
*/
public void setDaysDue (int DaysDue);
public void setDaysDue (int DaysDue);
/** Get Days due.
* Number of days due (negative: due in number of days)
* Number of days due (negative: due in number of days)
*/
public int getDaysDue();
public int getDaysDue();
/** Column name FeeAmt */
public static final String COLUMNNAME_FeeAmt = "FeeAmt";
public static final String COLUMNNAME_FeeAmt = "FeeAmt";
/** Set Fee Amount.
* Fee amount in invoice currency
* Fee amount in invoice currency
*/
public void setFeeAmt (BigDecimal FeeAmt);
public void setFeeAmt (BigDecimal FeeAmt);
/** Get Fee Amount.
* Fee amount in invoice currency
* Fee amount in invoice currency
*/
public BigDecimal getFeeAmt();
public BigDecimal getFeeAmt();
/** Column name InterestAmt */
public static final String COLUMNNAME_InterestAmt = "InterestAmt";
public static final String COLUMNNAME_InterestAmt = "InterestAmt";
/** Set Interest Amount.
* Interest Amount
* Interest Amount
*/
public void setInterestAmt (BigDecimal InterestAmt);
public void setInterestAmt (BigDecimal InterestAmt);
/** Get Interest Amount.
* Interest Amount
* Interest Amount
*/
public BigDecimal getInterestAmt();
public BigDecimal getInterestAmt();
/** Column name IsInDispute */
public static final String COLUMNNAME_IsInDispute = "IsInDispute";
public static final String COLUMNNAME_IsInDispute = "IsInDispute";
/** Set In Dispute.
* Document is in dispute
* Document is in dispute
*/
public void setIsInDispute (boolean IsInDispute);
public void setIsInDispute (boolean IsInDispute);
/** Get In Dispute.
* Document is in dispute
* Document is in dispute
*/
public boolean isInDispute();
public boolean isInDispute();
/** Column name OpenAmt */
public static final String COLUMNNAME_OpenAmt = "OpenAmt";
public static final String COLUMNNAME_OpenAmt = "OpenAmt";
/** Set Open Amount.
* Open item amount
* Open item amount
*/
public void setOpenAmt (BigDecimal OpenAmt);
public void setOpenAmt (BigDecimal OpenAmt);
/** Get Open Amount.
* Open item amount
* Open item amount
*/
public BigDecimal getOpenAmt();
public BigDecimal getOpenAmt();
/** Column name Processed */
public static final String COLUMNNAME_Processed = "Processed";
public static final String COLUMNNAME_Processed = "Processed";
/** Set Processed.
* The document has been processed
* The document has been processed
*/
public void setProcessed (boolean Processed);
public void setProcessed (boolean Processed);
/** Get Processed.
* The document has been processed
* The document has been processed
*/
public boolean isProcessed();
public boolean isProcessed();
/** Column name TimesDunned */
public static final String COLUMNNAME_TimesDunned = "TimesDunned";
public static final String COLUMNNAME_TimesDunned = "TimesDunned";
/** Set Times Dunned.
* Number of times dunned previously
* Number of times dunned previously
*/
public void setTimesDunned (int TimesDunned);
public void setTimesDunned (int TimesDunned);
/** Get Times Dunned.
* Number of times dunned previously
* Number of times dunned previously
*/
public int getTimesDunned();
public int getTimesDunned();
/** Column name TotalAmt */
public static final String COLUMNNAME_TotalAmt = "TotalAmt";
public static final String COLUMNNAME_TotalAmt = "TotalAmt";
/** Set Total Amount.
* Total Amount
* Total Amount
*/
public void setTotalAmt (BigDecimal TotalAmt);
public void setTotalAmt (BigDecimal TotalAmt);
/** Get Total Amount.
* Total Amount
* Total Amount
*/
public BigDecimal getTotalAmt();
}
public BigDecimal getTotalAmt();
}

File diff suppressed because it is too large Load Diff

View File

@ -14,403 +14,447 @@
* 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.util.*;
import java.sql.*;
import java.math.*;
import java.lang.reflect.Constructor;
import java.util.logging.Level;
import org.compiere.util.*;
/** Generated Model for C_DunningRunLine
* @author Adempiere (generated)
* @version Release 3.3.0 - $Id$ */
public class X_C_DunningRunLine extends PO implements I_C_DunningRunLine, I_Persistent
{
/**
*
*/
private static final long serialVersionUID = 1L;
/** 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);
} */
}
/** 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);
return poi;
}
public String toString()
{
StringBuffer sb = new StringBuffer ("X_C_DunningRunLine[")
.append(get_ID()).append("]");
return sb.toString();
}
/** Set Amount.
@param Amt
Amount
*/
public void setAmt (BigDecimal Amt)
{
if (Amt == null)
throw new IllegalArgumentException ("Amt is mandatory.");
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 I_C_DunningRunEntry getI_C_DunningRunEntry() throws Exception
{
Class<?> clazz = MTable.getClass(I_C_DunningRunEntry.Table_Name);
I_C_DunningRunEntry result = null;
try {
Constructor<?> constructor = null;
constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class});
result = (I_C_DunningRunEntry)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_DunningRunEntry_ID()), get_TrxName()});
} catch (Exception e) {
log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e);
log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz);
throw e;
}
return result;
}
/** 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)
throw new IllegalArgumentException ("C_DunningRunEntry_ID is mandatory.");
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)
throw new IllegalArgumentException ("C_DunningRunLine_ID is mandatory.");
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 Invoice.
@param C_Invoice_ID
Invoice Identifier
*/
public void setC_Invoice_ID (int C_Invoice_ID)
{
if (C_Invoice_ID <= 0) 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()));
}
/** Set Payment.
@param C_Payment_ID
Payment identifier
*/
public void setC_Payment_ID (int C_Payment_ID)
{
if (C_Payment_ID <= 0) 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 Converted Amount.
@param ConvertedAmt
Converted Amount
*/
public void setConvertedAmt (BigDecimal ConvertedAmt)
{
if (ConvertedAmt == null)
throw new IllegalArgumentException ("ConvertedAmt is mandatory.");
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;
}
/** 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)
{
if (FeeAmt == null)
throw new IllegalArgumentException ("FeeAmt is mandatory.");
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)
{
if (InterestAmt == null)
throw new IllegalArgumentException ("InterestAmt is mandatory.");
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)
{
if (OpenAmt == null)
throw new IllegalArgumentException ("OpenAmt is mandatory.");
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)
{
if (TotalAmt == null)
throw new IllegalArgumentException ("TotalAmt is mandatory.");
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;
}
/** Generated Model - DO NOT CHANGE */
package org.compiere.model;
import java.lang.reflect.Constructor;
import java.math.BigDecimal;
import java.sql.ResultSet;
import java.util.Properties;
import java.util.logging.Level;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
/** Generated Model for C_DunningRunLine
* @author Adempiere (generated)
* @version Release 3.3.0 - $Id$ */
public class X_C_DunningRunLine extends PO implements I_C_DunningRunLine, I_Persistent
{
/**
*
*/
private static final long serialVersionUID = 1L;
/** 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);
} */
}
/** 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);
return poi;
}
public String toString()
{
StringBuffer sb = new StringBuffer ("X_C_DunningRunLine[")
.append(get_ID()).append("]");
return sb.toString();
}
/** Set Amount.
@param Amt
Amount
*/
public void setAmt (BigDecimal Amt)
{
if (Amt == null)
throw new IllegalArgumentException ("Amt is mandatory.");
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 I_C_DunningRunEntry getC_DunningRunEntry() throws Exception
{
Class<?> clazz = MTable.getClass(I_C_DunningRunEntry.Table_Name);
I_C_DunningRunEntry result = null;
try {
Constructor<?> constructor = null;
constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class});
result = (I_C_DunningRunEntry)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_DunningRunEntry_ID()), get_TrxName()});
} catch (Exception e) {
log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e);
log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz);
throw e;
}
return result;
}
/** 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)
throw new IllegalArgumentException ("C_DunningRunEntry_ID is mandatory.");
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)
throw new IllegalArgumentException ("C_DunningRunLine_ID is mandatory.");
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();
}
public I_C_InvoicePaySchedule getC_InvoicePaySchedule() throws Exception
{
Class<?> clazz = MTable.getClass(I_C_InvoicePaySchedule.Table_Name);
I_C_InvoicePaySchedule result = null;
try {
Constructor<?> constructor = null;
constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class});
result = (I_C_InvoicePaySchedule)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_InvoicePaySchedule_ID()), get_TrxName()});
} catch (Exception e) {
log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e);
log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz);
throw e;
}
return result;
}
/** Set Invoice Payment Schedule.
@param C_InvoicePaySchedule_ID
Invoice Payment Schedule
*/
public void setC_InvoicePaySchedule_ID (int C_InvoicePaySchedule_ID)
{
if (C_InvoicePaySchedule_ID <= 0)
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 Invoice.
@param C_Invoice_ID
Invoice Identifier
*/
public void setC_Invoice_ID (int C_Invoice_ID)
{
if (C_Invoice_ID <= 0)
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()));
}
/** Set Payment.
@param C_Payment_ID
Payment identifier
*/
public void setC_Payment_ID (int C_Payment_ID)
{
if (C_Payment_ID <= 0)
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 Converted Amount.
@param ConvertedAmt
Converted Amount
*/
public void setConvertedAmt (BigDecimal ConvertedAmt)
{
if (ConvertedAmt == null)
throw new IllegalArgumentException ("ConvertedAmt is mandatory.");
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;
}
/** 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)
{
if (FeeAmt == null)
throw new IllegalArgumentException ("FeeAmt is mandatory.");
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)
{
if (InterestAmt == null)
throw new IllegalArgumentException ("InterestAmt is mandatory.");
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)
{
if (OpenAmt == null)
throw new IllegalArgumentException ("OpenAmt is mandatory.");
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)
{
if (TotalAmt == null)
throw new IllegalArgumentException ("TotalAmt is mandatory.");
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;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -16,11 +16,24 @@
*****************************************************************************/
package org.compiere.process;
import java.io.*;
import java.util.logging.*;
import org.compiere.model.*;
import org.compiere.print.*;
import org.compiere.util.*;
import java.io.File;
import java.util.logging.Level;
import org.compiere.model.MBPartner;
import org.compiere.model.MClient;
import org.compiere.model.MDunningLevel;
import org.compiere.model.MDunningRun;
import org.compiere.model.MDunningRunEntry;
import org.compiere.model.MMailText;
import org.compiere.model.MQuery;
import org.compiere.model.MUser;
import org.compiere.model.MUserMail;
import org.compiere.model.PrintInfo;
import org.compiere.model.X_C_DunningRunEntry;
import org.compiere.print.MPrintFormat;
import org.compiere.print.ReportEngine;
import org.compiere.util.AdempiereUserError;
import org.compiere.util.EMail;
/**
* Dunning Letter Print
@ -37,7 +50,9 @@ public class DunningPrint extends SvrProcess
/** Dunning Run */
private int p_C_DunningRun_ID = 0;
/** Print only Outstanding */
private boolean p_IsOnlyIfBPBalance = true;
private boolean p_IsOnlyIfBPBalance = true;
/** Print only unprocessed lines */
private boolean p_PrintUnprocessedOnly = true;
/**
@ -58,7 +73,9 @@ public class DunningPrint extends SvrProcess
else if (name.equals("C_DunningRun_ID"))
p_C_DunningRun_ID = para[i].getParameterAsInt();
else if (name.equals("IsOnlyIfBPBalance"))
p_IsOnlyIfBPBalance = "Y".equals(para[i].getParameter());
p_IsOnlyIfBPBalance = "Y".equals(para[i].getParameter());
else if (name.equals("PrintUnprocessedOnly"))
p_PrintUnprocessedOnly = "Y".equals(para[i].getParameter());
else
log.log(Level.SEVERE, "Unknown Parameter: " + name);
}
@ -72,7 +89,8 @@ public class DunningPrint extends SvrProcess
protected String doIt () throws Exception
{
log.info("C_DunningRun_ID=" + p_C_DunningRun_ID + ",R_MailText_ID=" + p_R_MailText_ID
+ ", EmailPDF=" + p_EMailPDF + ",IsOnlyIfBPBalance=" + p_IsOnlyIfBPBalance);
+ ", EmailPDF=" + p_EMailPDF + ",IsOnlyIfBPBalance=" + p_IsOnlyIfBPBalance
+ ",PrintUnprocessedOnly=" + p_PrintUnprocessedOnly);
// Need to have Template
if (p_EMailPDF && p_R_MailText_ID == 0)
@ -103,6 +121,8 @@ public class DunningPrint extends SvrProcess
{
MDunningRunEntry entry = entries[i];
if (p_IsOnlyIfBPBalance && entry.getAmt().signum() <= 0)
continue;
if (p_PrintUnprocessedOnly && entry.isProcessed())
continue;
// To BPartner
MBPartner bp = new MBPartner (getCtx(), entry.getC_BPartner_ID(), get_TrxName());
@ -199,6 +219,10 @@ public class DunningPrint extends SvrProcess
}
} // for all dunning letters
if (errors==0) {
run.setProcessed(true);
run.save();
}
if (p_EMailPDF)
return "@Sent@=" + count + " - @Errors@=" + errors;
return "@Printed@=" + count;

View File

@ -3,33 +3,40 @@
* Copyright (C) 1999-2006 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 *
*****************************************************************************/
package org.compiere.process;
import java.math.*;
import java.sql.*;
import java.util.logging.*;
import org.compiere.model.*;
import org.compiere.util.*;
/**
* Create Dunning Run Entries/Lines
*
* @author Jorg Janke
* @version $Id: DunningRunCreate.java,v 1.2 2006/07/30 00:51:02 jjanke Exp $
*/
public class DunningRunCreate extends SvrProcess
* 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 *
*****************************************************************************/
package org.compiere.process;
import java.math.BigDecimal;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.logging.Level;
import org.compiere.model.MDunningLevel;
import org.compiere.model.MDunningRun;
import org.compiere.model.MDunningRunEntry;
import org.compiere.model.MDunningRunLine;
import org.compiere.model.MInvoice;
import org.compiere.util.DB;
import org.compiere.util.Env;
/**
* Create Dunning Run Entries/Lines
*
* @author Jorg Janke
* @version $Id: DunningRunCreate.java,v 1.2 2006/07/30 00:51:02 jjanke Exp $
*/
public class DunningRunCreate extends SvrProcess
{
private boolean p_IncludeInDispute = false;
private boolean p_OnlySOTrx = false;
@ -37,7 +44,7 @@ public class DunningRunCreate extends SvrProcess
private int p_SalesRep_ID = 0;
private int p_C_Currency_ID = 0;
private int p_C_BPartner_ID = 0;
private int p_C_BP_Group_ID = 0;
private int p_C_BP_Group_ID = 0;
private int p_C_DunningRun_ID = 0;
private MDunningRun m_run = null;
@ -45,16 +52,16 @@ public class DunningRunCreate extends SvrProcess
/**
* Prepare - e.g., get Parameters.
*/
protected void prepare()
{
ProcessInfoParameter[] para = getParameter();
for (int i = 0; i < para.length; i++)
{
String name = para[i].getParameterName();
if (para[i].getParameter() == null)
;
else if (name.equals("IncludeInDispute"))
*/
protected void prepare()
{
ProcessInfoParameter[] para = getParameter();
for (int i = 0; i < para.length; i++)
{
String name = para[i].getParameterName();
if (para[i].getParameter() == null)
;
else if (name.equals("IncludeInDispute"))
p_IncludeInDispute = "Y".equals(para[i].getParameter());
else if (name.equals("OnlySOTrx"))
p_OnlySOTrx = "Y".equals(para[i].getParameter());
@ -63,35 +70,35 @@ public class DunningRunCreate extends SvrProcess
else if (name.equals("SalesRep_ID"))
p_SalesRep_ID = para[i].getParameterAsInt();
else if (name.equals("C_Currency_ID"))
p_C_Currency_ID = para[i].getParameterAsInt();
else if (name.equals("C_BPartner_ID"))
p_C_BPartner_ID = para[i].getParameterAsInt();
else if (name.equals("C_BP_Group_ID"))
p_C_BP_Group_ID = para[i].getParameterAsInt();
else
log.log(Level.SEVERE, "Unknown Parameter: " + name);
}
p_C_DunningRun_ID = getRecord_ID();
} // prepare
/**
* Process
* @return message
* @throws Exception
*/
protected String doIt () throws Exception
{
log.info("C_DunningRun_ID=" + p_C_DunningRun_ID
+ ", Dispute=" + p_IncludeInDispute
+ ", C_BP_Group_ID=" + p_C_BP_Group_ID
+ ", C_BPartner_ID=" + p_C_BPartner_ID);
m_run = new MDunningRun (getCtx(),p_C_DunningRun_ID, get_TrxName());
if (m_run.get_ID() == 0)
throw new IllegalArgumentException ("Not found MDunningRun");
if (!m_run.deleteEntries(true))
throw new IllegalArgumentException ("Cannot delete existing entries");
if (p_SalesRep_ID == 0)
throw new IllegalArgumentException ("No SalesRep");
p_C_Currency_ID = para[i].getParameterAsInt();
else if (name.equals("C_BPartner_ID"))
p_C_BPartner_ID = para[i].getParameterAsInt();
else if (name.equals("C_BP_Group_ID"))
p_C_BP_Group_ID = para[i].getParameterAsInt();
else
log.log(Level.SEVERE, "Unknown Parameter: " + name);
}
p_C_DunningRun_ID = getRecord_ID();
} // prepare
/**
* Process
* @return message
* @throws Exception
*/
protected String doIt () throws Exception
{
log.info("C_DunningRun_ID=" + p_C_DunningRun_ID
+ ", Dispute=" + p_IncludeInDispute
+ ", C_BP_Group_ID=" + p_C_BP_Group_ID
+ ", C_BPartner_ID=" + p_C_BPartner_ID);
m_run = new MDunningRun (getCtx(),p_C_DunningRun_ID, get_TrxName());
if (m_run.get_ID() == 0)
throw new IllegalArgumentException ("Not found MDunningRun");
if (!m_run.deleteEntries(true))
throw new IllegalArgumentException ("Cannot delete existing entries");
if (p_SalesRep_ID == 0)
throw new IllegalArgumentException ("No SalesRep");
if (p_C_Currency_ID == 0)
throw new IllegalArgumentException ("No Currency");
//
@ -106,35 +113,37 @@ public class DunningRunCreate extends SvrProcess
return "@C_Invoice_ID@ #" + inv + " - @C_Payment_ID@=" + pay;
} // doIt
/**************************************************************************
* Add Invoices to Run
* @return no of invoices
*/
private int addInvoices()
{
int count = 0;
String sql = "SELECT i.C_Invoice_ID, i.C_Currency_ID,"
+ " i.GrandTotal*i.MultiplierAP,"
+ " invoiceOpen(i.C_Invoice_ID,i.C_InvoicePaySchedule_ID)*MultiplierAP,"
+ " COALESCE(daysBetween(?,ips.DueDate),paymentTermDueDays(i.C_PaymentTerm_ID,i.DateInvoiced,?))," // ##1/2
+ " i.IsInDispute, i.C_BPartner_ID "
+ "FROM C_Invoice_v i "
+ " LEFT OUTER JOIN C_InvoicePaySchedule ips ON (i.C_InvoicePaySchedule_ID=ips.C_InvoicePaySchedule_ID) "
+ "WHERE i.IsPaid='N' AND i.AD_Client_ID=?" // ##3
+ " AND i.DocStatus IN ('CO','CL')"
// Only BP(Group) with Dunning defined
+ " AND EXISTS (SELECT * FROM C_DunningLevel dl "
+ "WHERE dl.C_DunningLevel_ID=?" // // ##4
+ " AND dl.C_Dunning_ID IN "
+ "(SELECT COALESCE(bp.C_Dunning_ID, bpg.C_Dunning_ID) "
+ "FROM C_BPartner bp"
+ " INNER JOIN C_BP_Group bpg ON (bp.C_BP_Group_ID=bpg.C_BP_Group_ID) "
+ "WHERE i.C_BPartner_ID=bp.C_BPartner_ID))";
if (p_C_BPartner_ID != 0)
sql += " AND i.C_BPartner_ID=?"; // ##5
else if (p_C_BP_Group_ID != 0)
sql += " AND EXISTS (SELECT * FROM C_BPartner bp "
/**************************************************************************
* Add Invoices to Run
* @return no of invoices
*/
private int addInvoices()
{
int count = 0;
String sql = "SELECT i.C_Invoice_ID, i.C_Currency_ID,"
+ " i.GrandTotal*i.MultiplierAP,"
+ " invoiceOpen(i.C_Invoice_ID,i.C_InvoicePaySchedule_ID)*MultiplierAP,"
+ " COALESCE(daysBetween(?,ips.DueDate),paymentTermDueDays(i.C_PaymentTerm_ID,i.DateInvoiced,?))," // ##1/2
+ " i.IsInDispute, i.C_BPartner_ID, i.C_InvoicePaySchedule_ID "
+ "FROM C_Invoice_v i "
+ " LEFT OUTER JOIN C_InvoicePaySchedule ips ON (i.C_InvoicePaySchedule_ID=ips.C_InvoicePaySchedule_ID) "
+ "WHERE i.IsPaid='N' AND i.AD_Client_ID=?" // ##3
+ " AND i.DocStatus IN ('CO','CL')"
+ " AND (i.DunningGrace IS NULL OR i.DunningGrace<?) "
// Only BP(Group) with Dunning defined
+ " AND EXISTS (SELECT * FROM C_DunningLevel dl "
+ "WHERE dl.C_DunningLevel_ID=?" // // ##4
+ " AND dl.C_Dunning_ID IN "
+ "(SELECT COALESCE(bp.C_Dunning_ID, bpg.C_Dunning_ID) "
+ "FROM C_BPartner bp"
+ " INNER JOIN C_BP_Group bpg ON (bp.C_BP_Group_ID=bpg.C_BP_Group_ID) "
+ "WHERE i.C_BPartner_ID=bp.C_BPartner_ID" +
" AND (bp.DunningGrace IS NULL OR bp.DunningGrace<?)))";
if (p_C_BPartner_ID != 0)
sql += " AND i.C_BPartner_ID=?"; // ##5
else if (p_C_BP_Group_ID != 0)
sql += " AND EXISTS (SELECT * FROM C_BPartner bp "
+ "WHERE i.C_BPartner_ID=bp.C_BPartner_ID AND bp.C_BP_Group_ID=?)"; // ##5
if (p_OnlySOTrx)
sql += " AND i.IsSOTrx='Y'";
@ -146,9 +155,10 @@ public class DunningRunCreate extends SvrProcess
// if sequentially we must check for other levels with smaller days for
// which this invoice is not yet included!
MDunningLevel[] previousLevels = null;
if (m_level.getParent ().isCreateLevelsSequentially ()) {
// Build a list of all topmost Dunning Levels
MDunningLevel[] previousLevels = m_level.getPreviousLevels();
previousLevels = m_level.getPreviousLevels();
if (previousLevels!=null && previousLevels.length>0) {
String sqlAppend = "";
for (int i=0; i<previousLevels.length; i++)
@ -161,42 +171,48 @@ public class DunningRunCreate extends SvrProcess
sql += sqlAppend;
}
}
sql2 = "SELECT COUNT(*), COALESCE(TRUNC(SysDate-MAX(dr.DunningDate)),0) "
sql2 = "SELECT COUNT(*), COALESCE(TRUNC(?-MAX(dr.DunningDate)),0) "
+ "FROM C_DunningRun dr"
+ " INNER JOIN C_DunningRunEntry dre ON (dr.C_DunningRun_ID=dre.C_DunningRun_ID)"
+ " INNER JOIN C_DunningRunLine drl ON (dre.C_DunningRunEntry_ID=drl.C_DunningRunEntry_ID) "
+ "WHERE drl.Processed='Y' AND drl.C_Invoice_ID=?";
+ "WHERE drl.Processed='Y' AND drl.C_Invoice_ID=? AND COALESCE(drl.C_InvoicePaySchedule_ID, 0)=?";
BigDecimal DaysAfterDue = m_run.getLevel().getDaysAfterDue();
int DaysBetweenDunning = m_run.getLevel().getDaysBetweenDunning();
PreparedStatement pstmt = null;
PreparedStatement pstmt2 = null;
try
{
pstmt = DB.prepareStatement (sql, get_TrxName());
pstmt.setTimestamp(1, m_run.getDunningDate());
pstmt.setTimestamp(2, m_run.getDunningDate());
pstmt.setInt (3, m_run.getAD_Client_ID());
pstmt.setInt(4, m_run.getC_DunningLevel_ID());
if (p_C_BPartner_ID != 0)
pstmt.setInt (5, p_C_BPartner_ID);
else if (p_C_BP_Group_ID != 0)
pstmt.setInt (5, p_C_BP_Group_ID);
//
pstmt2 = DB.prepareStatement (sql2, get_TrxName());
//
ResultSet rs = pstmt.executeQuery ();
while (rs.next ())
{
int C_Invoice_ID = rs.getInt(1);
int C_Currency_ID = rs.getInt(2);
BigDecimal GrandTotal = rs.getBigDecimal(3);
BigDecimal Open = rs.getBigDecimal(4);
int DaysDue = rs.getInt(5);
boolean IsInDispute = "Y".equals(rs.getString(6));
int C_BPartner_ID = rs.getInt(7);
PreparedStatement pstmt = null;
PreparedStatement pstmt2 = null;
try
{
pstmt = DB.prepareStatement (sql, get_TrxName());
pstmt.setTimestamp(1, m_run.getDunningDate());
pstmt.setTimestamp(2, m_run.getDunningDate());
pstmt.setInt (3, m_run.getAD_Client_ID());
pstmt.setTimestamp(4, m_run.getDunningDate());
pstmt.setInt(5, m_run.getC_DunningLevel_ID());
pstmt.setTimestamp(6, m_run.getDunningDate());
if (p_C_BPartner_ID != 0)
pstmt.setInt (7, p_C_BPartner_ID);
else if (p_C_BP_Group_ID != 0)
pstmt.setInt (7, p_C_BP_Group_ID);
//
pstmt2 = DB.prepareStatement (sql2, get_TrxName());
//
ResultSet rs = pstmt.executeQuery ();
while (rs.next ())
{
int C_Invoice_ID = rs.getInt(1);
int C_Currency_ID = rs.getInt(2);
BigDecimal GrandTotal = rs.getBigDecimal(3);
BigDecimal Open = rs.getBigDecimal(4);
int DaysDue = rs.getInt(5);
boolean IsInDispute = "Y".equals(rs.getString(6));
int C_BPartner_ID = rs.getInt(7);
int C_InvoicePaySchedule_ID = rs.getInt(8);
log.fine("DaysAfterDue: " + DaysAfterDue.intValue() + " isShowAllDue: " + m_level.isShowAllDue());
log.fine("C_Invoice_ID - DaysDue - GrandTotal: " + C_Invoice_ID + " - " + DaysDue + " - " + GrandTotal);
log.fine("C_InvoicePaySchedule_ID: " + C_InvoicePaySchedule_ID);
//
if (!p_IncludeInDispute && IsInDispute)
continue;
@ -204,179 +220,193 @@ public class DunningRunCreate extends SvrProcess
continue;
if (Env.ZERO.compareTo(Open) == 0)
continue;
//
int TimesDunned = 0;
int DaysAfterLast = 0;
// SubQuery
pstmt2.setInt (1, C_Invoice_ID);
ResultSet rs2 = pstmt2.executeQuery ();
if (rs2.next())
{
TimesDunned = rs2.getInt(1);
DaysAfterLast = rs2.getInt(2);
//
int TimesDunned = 0;
int DaysAfterLast = 0;
// SubQuery
pstmt2.setTimestamp(1, m_run.getDunningDate());
pstmt2.setInt (2, C_Invoice_ID);
pstmt2.setInt (3, C_InvoicePaySchedule_ID);
ResultSet rs2 = pstmt2.executeQuery ();
if (rs2.next())
{
TimesDunned = rs2.getInt(1);
DaysAfterLast = rs2.getInt(2);
}
rs2.close();
if(previousLevels != null){
log.fine(TimesDunned + " - " + previousLevels.length);
}
// SubQuery
if (m_level.getParent().isCreateLevelsSequentially() && previousLevels!=null && TimesDunned>previousLevels.length
&& !m_level.isShowAllDue() && !m_level.isShowNotDue()) {
continue;
}
log.fine(DaysBetweenDunning + " - " + DaysAfterLast);
if (DaysBetweenDunning != 0 && DaysAfterLast < DaysBetweenDunning && !m_level.isShowAllDue () && !m_level.isShowNotDue ())
continue;
//
createInvoiceLine (C_Invoice_ID, C_Currency_ID, GrandTotal, Open,
DaysDue, IsInDispute, C_BPartner_ID,
TimesDunned, DaysAfterLast);
count++;
}
rs.close ();
pstmt.close ();
pstmt = null;
pstmt2.close();
pstmt2 = null;
}
catch (Exception e)
{
log.log(Level.SEVERE, "addInvoices", e);
}
try
{
if (pstmt != null)
pstmt.close ();
if (pstmt2 != null)
pstmt2.close ();
pstmt = null;
pstmt2 = null;
}
catch (Exception e)
{
pstmt = null;
pstmt2 = null;
}
return count;
} // addInvoices
/**
* Create Invoice Line
* @param C_Invoice_ID
* @param C_Currency_ID
* @param GrandTotal
* @param Open
* @param DaysDue
* @param IsInDispute
* @param C_BPartner_ID
* @param TimesDunned
* @param DaysAfterLast
*/
private void createInvoiceLine (int C_Invoice_ID, int C_Currency_ID,
BigDecimal GrandTotal, BigDecimal Open,
int DaysDue, boolean IsInDispute,
int C_BPartner_ID, int TimesDunned, int DaysAfterLast)
{
MDunningRunEntry entry = m_run.getEntry (C_BPartner_ID, p_C_Currency_ID, p_SalesRep_ID);
if (entry.get_ID() == 0)
if (!entry.save())
throw new IllegalStateException("Cannot save MDunningRunEntry");
createInvoiceLine (C_Invoice_ID, C_InvoicePaySchedule_ID, C_Currency_ID, GrandTotal, Open,
DaysDue, IsInDispute, C_BPartner_ID,
TimesDunned, DaysAfterLast);
count++;
}
rs.close ();
pstmt.close ();
pstmt = null;
pstmt2.close();
pstmt2 = null;
}
catch (Exception e)
{
log.log(Level.SEVERE, "addInvoices", e);
}
try
{
if (pstmt != null)
pstmt.close ();
if (pstmt2 != null)
pstmt2.close ();
pstmt = null;
pstmt2 = null;
}
catch (Exception e)
{
pstmt = null;
pstmt2 = null;
}
return count;
} // addInvoices
/**
* Create Invoice Line
* @param C_Invoice_ID
* @param C_Currency_ID
* @param GrandTotal
* @param Open
* @param DaysDue
* @param IsInDispute
* @param C_BPartner_ID
* @param TimesDunned
* @param DaysAfterLast
*/
private void createInvoiceLine (int C_Invoice_ID, int C_InvoicePaySchedule_ID, int C_Currency_ID,
BigDecimal GrandTotal, BigDecimal Open,
int DaysDue, boolean IsInDispute,
int C_BPartner_ID, int TimesDunned, int DaysAfterLast)
{
MDunningRunEntry entry = m_run.getEntry (C_BPartner_ID, p_C_Currency_ID, p_SalesRep_ID);
if (entry.get_ID() == 0)
if (!entry.save())
throw new IllegalStateException("Cannot save MDunningRunEntry");
//
MDunningRunLine line = new MDunningRunLine (entry);
line.setInvoice(C_Invoice_ID, C_Currency_ID, GrandTotal, Open,
new BigDecimal(0), DaysDue, IsInDispute, TimesDunned,
DaysAfterLast);
line.setC_InvoicePaySchedule_ID(C_InvoicePaySchedule_ID);
if (!line.save())
throw new IllegalStateException("Cannot save MDunningRunLine");
MInvoice invoice = new MInvoice(getCtx(),C_Invoice_ID, get_TrxName());
invoice.setC_DunningLevel_ID(m_run.getC_DunningLevel_ID());
if (!invoice.save())
throw new IllegalStateException("Cannot update dunning level information in invoice");
} // createInvoiceLine
/**************************************************************************
* Add Payments to Run
* @return no of payments
*/
private int addPayments()
{
String sql = "SELECT C_Payment_ID, C_Currency_ID, PayAmt,"
+ " paymentAvailable(C_Payment_ID), C_BPartner_ID "
+ "FROM C_Payment_v p "
+ "WHERE AD_Client_ID=?" // ##1
+ " AND IsAllocated='N' AND C_BPartner_ID IS NOT NULL"
+ " AND C_Charge_ID IS NULL"
+ " AND DocStatus IN ('CO','CL')"
// Only BP with Dunning defined
+ " AND EXISTS (SELECT * FROM C_BPartner bp "
+ "WHERE p.C_BPartner_ID=bp.C_BPartner_ID"
+ " AND bp.C_Dunning_ID=(SELECT C_Dunning_ID FROM C_DunningLevel WHERE C_DunningLevel_ID=?))"; // ##2
if (p_C_BPartner_ID != 0)
sql += " AND C_BPartner_ID=?"; // ##3
else if (p_C_BP_Group_ID != 0)
sql += " AND EXISTS (SELECT * FROM C_BPartner bp "
+ "WHERE p.C_BPartner_ID=bp.C_BPartner_ID AND bp.C_BP_Group_ID=?)"; // ##3
if (p_OnlySOTrx)
sql += " AND IsReceipt='Y'";
int count = 0;
PreparedStatement pstmt = null;
try
{
pstmt = DB.prepareStatement (sql, get_TrxName());
pstmt.setInt (1, getAD_Client_ID());
pstmt.setInt (2, m_run.getC_DunningLevel_ID());
if (p_C_BPartner_ID != 0)
pstmt.setInt (3, p_C_BPartner_ID);
else if (p_C_BP_Group_ID != 0)
pstmt.setInt (3, p_C_BP_Group_ID);
ResultSet rs = pstmt.executeQuery ();
while (rs.next ())
{
int C_Payment_ID = rs.getInt(1);
int C_Currency_ID = rs.getInt(2);
BigDecimal PayAmt = rs.getBigDecimal(3).negate();
BigDecimal OpenAmt = rs.getBigDecimal(4).negate();
int C_BPartner_ID = rs.getInt(5);
//
if (Env.ZERO.compareTo(OpenAmt) == 0)
continue;
//
createPaymentLine (C_Payment_ID, C_Currency_ID, PayAmt, OpenAmt,
C_BPartner_ID);
count++;
}
rs.close ();
pstmt.close ();
pstmt = null;
}
catch (Exception e)
{
log.log(Level.SEVERE, sql, e);
}
try
{
if (pstmt != null)
pstmt.close ();
pstmt = null;
}
catch (Exception e)
{
pstmt = null;
}
return count;
} // addPayments
/**
* Create Payment Line
* @param C_Payment_ID
* @param C_Currency_ID
* @param PayAmt
* @param OpenAmt
* @param C_BPartner_ID
*/
private void createPaymentLine (int C_Payment_ID, int C_Currency_ID,
BigDecimal PayAmt, BigDecimal OpenAmt, int C_BPartner_ID)
{
MDunningRunEntry entry = m_run.getEntry (C_BPartner_ID, p_C_Currency_ID, p_SalesRep_ID);
if (entry.get_ID() == 0)
if (!entry.save())
throw new IllegalStateException("Cannot save MDunningRunEntry");
//
MDunningRunLine line = new MDunningRunLine (entry);
line.setPayment(C_Payment_ID, C_Currency_ID, PayAmt, OpenAmt);
if (!line.save())
/**************************************************************************
* Add Payments to Run
* @return no of payments
*/
private int addPayments()
{
String sql = "SELECT C_Payment_ID, C_Currency_ID, PayAmt,"
+ " paymentAvailable(C_Payment_ID), C_BPartner_ID "
+ "FROM C_Payment_v p "
+ "WHERE AD_Client_ID=?" // ##1
+ " AND IsAllocated='N' AND C_BPartner_ID IS NOT NULL"
+ " AND C_Charge_ID IS NULL"
+ " AND DocStatus IN ('CO','CL')"
// Only BP with Dunning defined
+ " AND EXISTS (SELECT * FROM C_BPartner bp "
+ "WHERE p.C_BPartner_ID=bp.C_BPartner_ID"
+ " AND bp.C_Dunning_ID=(SELECT C_Dunning_ID FROM C_DunningLevel WHERE C_DunningLevel_ID=?))"; // ##2
if (p_C_BPartner_ID != 0)
sql += " AND C_BPartner_ID=?"; // ##3
else if (p_C_BP_Group_ID != 0)
sql += " AND EXISTS (SELECT * FROM C_BPartner bp "
+ "WHERE p.C_BPartner_ID=bp.C_BPartner_ID AND bp.C_BP_Group_ID=?)"; // ##3
if (p_OnlySOTrx)
sql += " AND IsReceipt='Y'";
int count = 0;
PreparedStatement pstmt = null;
try
{
pstmt = DB.prepareStatement (sql, get_TrxName());
pstmt.setInt (1, getAD_Client_ID());
pstmt.setInt (2, m_run.getC_DunningLevel_ID());
if (p_C_BPartner_ID != 0)
pstmt.setInt (3, p_C_BPartner_ID);
else if (p_C_BP_Group_ID != 0)
pstmt.setInt (3, p_C_BP_Group_ID);
ResultSet rs = pstmt.executeQuery ();
while (rs.next ())
{
int C_Payment_ID = rs.getInt(1);
int C_Currency_ID = rs.getInt(2);
BigDecimal PayAmt = rs.getBigDecimal(3).negate();
BigDecimal OpenAmt = rs.getBigDecimal(4).negate();
int C_BPartner_ID = rs.getInt(5);
//
if (Env.ZERO.compareTo(OpenAmt) == 0)
continue;
//
createPaymentLine (C_Payment_ID, C_Currency_ID, PayAmt, OpenAmt,
C_BPartner_ID);
count++;
}
rs.close ();
pstmt.close ();
pstmt = null;
}
catch (Exception e)
{
log.log(Level.SEVERE, sql, e);
}
try
{
if (pstmt != null)
pstmt.close ();
pstmt = null;
}
catch (Exception e)
{
pstmt = null;
}
return count;
} // addPayments
/**
* Create Payment Line
* @param C_Payment_ID
* @param C_Currency_ID
* @param PayAmt
* @param OpenAmt
* @param C_BPartner_ID
*/
private void createPaymentLine (int C_Payment_ID, int C_Currency_ID,
BigDecimal PayAmt, BigDecimal OpenAmt, int C_BPartner_ID)
{
MDunningRunEntry entry = m_run.getEntry (C_BPartner_ID, p_C_Currency_ID, p_SalesRep_ID);
if (entry.get_ID() == 0)
if (!entry.save())
throw new IllegalStateException("Cannot save MDunningRunEntry");
//
MDunningRunLine line = new MDunningRunLine (entry);
line.setPayment(C_Payment_ID, C_Currency_ID, PayAmt, OpenAmt);
if (!line.save())
throw new IllegalStateException("Cannot save MDunningRunLine");
} // createPaymentLine

View File

@ -0,0 +1,176 @@
SET DEFINE OFF;
INSERT INTO ad_element
(ad_element_id, ad_client_id, ad_org_id, isactive,
created, createdby,
updated, updatedby,
columnname, entitytype, NAME,
printname
)
VALUES (53223, 0, 0, 'Y',
TO_DATE ('09/21/2007 12:30:00', 'MM/DD/YYYY HH24:MI:SS'), 100,
TO_DATE ('09/21/2007 12:30:00', 'MM/DD/YYYY HH24:MI:SS'), 100,
'DunningGrace', 'D', 'Dunning Grace',
'Dunning Grace'
);
INSERT INTO ad_column
(ad_column_id, ad_client_id, ad_org_id, isactive,
created,
updated, createdby,
updatedby, NAME, description,
help, VERSION,
entitytype, columnname, ad_table_id, ad_reference_id,
fieldlength, iskey, isparent, ismandatory, isupdateable,
isidentifier, seqno, istranslated, isencrypted,
isselectioncolumn, ad_element_id, issyncdatabase,
isalwaysupdateable
)
VALUES (53246, 0, 0, 'Y',
TO_DATE ('09/21/2007 12:30:00', 'MM/DD/YYYY HH24:MI:SS'),
TO_DATE ('09/21/2007 12:30:00', 'MM/DD/YYYY HH24:MI:SS'), 100,
100, 'Dunning Grace', 'Delay/block the dunning until this date is reached.',
'Delay/block the dunning until this date is reached.', 1,
'D', 'DunningGrace', 291, 15,
7, 'N', 'N', 'N', 'Y',
'N', 0, 'N', 'N',
'N', 53223, 'N',
'N'
);
INSERT INTO ad_field
(ad_field_id, ad_client_id, ad_org_id, isactive,
created, createdby,
updated, updatedby,
NAME, description,
help,
iscentrallymaintained, seqno, ad_tab_id,
ad_column_id, isdisplayed, displaylength, isreadonly,
issameline, isheading, isfieldonly, isencrypted, entitytype,
displaylogic
)
VALUES (53256, 0, 0, 'Y',
TO_DATE ('09/21/2007 12:30:00', 'MM/DD/YYYY HH24:MI:SS'), 100,
TO_DATE ('09/21/2007 12:30:00', 'MM/DD/YYYY HH24:MI:SS'), 100,
'Dunning Grace', 'Delay/block the dunning until this date is reached.',
'Delay/block the dunning until this date is reached.',
'Y', 260 ,223,
53246, 'Y', 14, 'N',
'N', 'N', 'N', 'N', 'D',
'@IsCustomer@=Y'
);
INSERT INTO ad_column
(ad_column_id, ad_client_id, ad_org_id, isactive,
created,
updated, createdby,
updatedby, NAME, description,
help, VERSION,
entitytype, columnname, ad_table_id, ad_reference_id,
fieldlength, iskey, isparent, ismandatory, isupdateable,
isidentifier, seqno, istranslated, isencrypted,
isselectioncolumn, ad_element_id, issyncdatabase,
isalwaysupdateable
)
VALUES (53247, 0, 0, 'Y',
TO_DATE ('09/21/2007 12:30:00', 'MM/DD/YYYY HH24:MI:SS'),
TO_DATE ('09/21/2007 12:30:00', 'MM/DD/YYYY HH24:MI:SS'), 100,
100, 'Dunning Grace', 'Delay/block the dunning until this date is reached.',
'Delay/block the dunning until this date is reached.', 1,
'D', 'DunningGrace', 318, 15,
7, 'N', 'N', 'N', 'Y',
'N', 0, 'N', 'N',
'N', 53223, 'N',
'Y'
);
INSERT INTO ad_field
(ad_field_id, ad_client_id, ad_org_id, isactive,
created, createdby,
updated, updatedby,
NAME, description,
help,
iscentrallymaintained, seqno, ad_tab_id,
ad_column_id, isdisplayed, displaylength, isreadonly,
issameline, isheading, isfieldonly, isencrypted, entitytype
)
VALUES (53257, 0, 0, 'Y',
TO_DATE ('09/21/2007 12:30:00', 'MM/DD/YYYY HH24:MI:SS'), 100,
TO_DATE ('09/21/2007 12:30:00', 'MM/DD/YYYY HH24:MI:SS'), 100,
'Dunning Grace', 'Delay/block the dunning until this date is reached.',
'Delay/block the dunning until this date is reached.',
'Y', 410 ,263,
53247, 'Y', 14, 'N',
'N', 'N', 'N', 'N', 'D'
);
UPDATE ad_sequence
SET currentnextsys = (SELECT MAX (ad_element_id) + 1
FROM ad_element
WHERE ad_element_id < 1000000)
WHERE NAME = 'AD_Element';
UPDATE ad_sequence
SET currentnextsys = (SELECT MAX (ad_column_id) + 1
FROM ad_column
WHERE ad_column_id < 1000000)
WHERE NAME = 'AD_Column';
UPDATE ad_sequence
SET currentnextsys = (SELECT MAX (ad_field_id) + 1
FROM ad_field
WHERE ad_field_id < 1000000)
WHERE NAME = 'AD_Field';
ALTER TABLE C_BPartner ADD DunningGrace date NULL;
ALTER TABLE C_Invoice ADD DunningGrace date NULL;
CREATE OR REPLACE FORCE VIEW C_INVOICE_V AS
SELECT i.C_Invoice_ID, i.AD_Client_ID, i.AD_Org_ID, i.IsActive, i.Created, i.CreatedBy, i.Updated, i.UpdatedBy,
i.IsSOTrx, i.DocumentNo, i.DocStatus, i.DocAction, i.Processing, i.Processed, i.C_DocType_ID,
i.C_DocTypeTarget_ID, i.C_Order_ID, i.Description, i.IsApproved, i.IsTransferred,
i.SalesRep_ID, i.DateInvoiced, i.DatePrinted, i.DateAcct, i.C_BPartner_ID, i.C_BPartner_Location_ID,
i.AD_User_ID, i.POReference, i.DateOrdered, i.C_Currency_ID, i.C_ConversionType_ID, i.PaymentRule,
i.C_PaymentTerm_ID, i.C_Charge_ID, i.M_PriceList_ID, i.C_Campaign_ID, i.C_Project_ID,
i.C_Activity_ID, i.IsPrinted, i.IsDiscountPrinted, i.IsPaid, i.IsInDispute,
i.IsPayScheduleValid, null AS C_InvoicePaySchedule_ID, i.InvoiceCollectionType,
i.DunningGrace,
CASE WHEN charAt(d.DocBaseType,3)='C' THEN i.ChargeAmt*-1 ELSE i.ChargeAmt END AS ChargeAmt,
CASE WHEN charAt(d.DocBaseType,3)='C' THEN i.TotalLines*-1 ELSE i.TotalLines END AS TotalLines,
CASE WHEN charAt(d.DocBaseType,3)='C' THEN i.GrandTotal*-1 ELSE i.GrandTotal END AS GrandTotal,
CASE WHEN charAt(d.DocBaseType,3)='C' THEN -1 ELSE 1 END AS Multiplier,
CASE WHEN charAt(d.DocBaseType,2)='P' THEN -1 ELSE 1 END AS MultiplierAP,
d.DocBaseType
FROM C_Invoice i
INNER JOIN C_DocType d ON (i.C_DocType_ID=d.C_DocType_ID)
WHERE i.IsPayScheduleValid<>'Y'
UNION
SELECT i.C_Invoice_ID, i.AD_Client_ID, i.AD_Org_ID, i.IsActive, i.Created, i.CreatedBy, i.Updated, i.UpdatedBy,
i.IsSOTrx, i.DocumentNo, i.DocStatus, i.DocAction, i.Processing, i.Processed, i.C_DocType_ID,
i.C_DocTypeTarget_ID, i.C_Order_ID, i.Description, i.IsApproved, i.IsTransferred,
i.SalesRep_ID, i.DateInvoiced, i.DatePrinted, i.DateAcct, i.C_BPartner_ID, i.C_BPartner_Location_ID,
i.AD_User_ID, i.POReference, i.DateOrdered, i.C_Currency_ID, i.C_ConversionType_ID, i.PaymentRule,
i.C_PaymentTerm_ID, i.C_Charge_ID, i.M_PriceList_ID, i.C_Campaign_ID, i.C_Project_ID,
i.C_Activity_ID, i.IsPrinted, i.IsDiscountPrinted, i.IsPaid, i.IsInDispute,
i.IsPayScheduleValid, ips.C_InvoicePaySchedule_ID, i.InvoiceCollectionType,
i.DunningGrace,
null AS ChargeAmt,
null AS TotalLines,
CASE WHEN charAt(d.DocBaseType,3)='C' THEN ips.DueAmt*-1 ELSE ips.DueAmt END AS GrandTotal,
CASE WHEN charAt(d.DocBaseType,3)='C' THEN -1 ELSE 1 END AS Multiplier,
CASE WHEN charAt(d.DocBaseType,2)='P' THEN -1 ELSE 1 END AS MultiplierAP,
d.DocBaseType
FROM C_Invoice i
INNER JOIN C_DocType d ON (i.C_DocType_ID=d.C_DocType_ID)
INNER JOIN C_InvoicePaySchedule ips ON (i.C_Invoice_ID=ips.C_Invoice_ID)
WHERE i.IsPayScheduleValid='Y'
AND ips.IsValid='Y';
COMMIT ;

View File

@ -0,0 +1,183 @@
SET DEFINE OFF;
update AD_Column set IsAlwaysUpdateable='Y' where AD_Column_ID=12569;
update AD_Column set IsAlwaysUpdateable='Y' where AD_Column_ID=12566;
INSERT INTO ad_element
(ad_element_id, ad_client_id, ad_org_id, isactive,
created, createdby,
updated, updatedby,
columnname, entitytype, NAME,
printname
)
VALUES (53224, 0, 0, 'Y',
TO_DATE ('2007-09-28', 'YYYY-MM-DD'), 100,
TO_DATE ('2007-09-28', 'YYYY-MM-DD'), 100,
'PrintUnprocessedOnly', 'D', 'Print Unprocessed Entries Only',
'Print Unprocessed Entries Only'
);
INSERT INTO AD_Process_Para
(AD_Process_Para_ID, AD_Client_ID, AD_Org_ID, IsActive, Created,
CreatedBy, Updated, UpdatedBy, Name,
Description,
Help,
AD_Process_ID, SeqNo, AD_Reference_ID, AD_Reference_Value_ID,
AD_Val_Rule_ID, ColumnName, IsCentrallyMaintained, FieldLength,
IsMandatory, DefaultValue, IsRange, AD_Element_ID, EntityType
)
VALUES
(53011 , 0, 0, 'Y', TO_DATE ('2007-09-28', 'YYYY-MM-DD'),
100, TO_DATE ('2007-09-28', 'YYYY-MM-DD'), 100, 'Print Unprocessed Entries Only',
'Print the unprocessed (unprinted) entries of the dunning run only.',
'Print the unprocessed (unprinted) entries of the dunning run only. This allows you to reprint only certain dunning entries.',
312, 50, 20, NULL,
NULL, 'PrintUnprocessedOnly', 'N', 1,
'Y', 'Y', 'N', 53224, 'D'
);
INSERT INTO AD_VAL_RULE(
AD_VAL_RULE_ID,AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,CREATEDBY,
UPDATED,UPDATEDBY,
NAME,DESCRIPTION,
TYPE,CODE,ENTITYTYPE)
values(51003,0,0,'Y',to_date('2007-09-28','RRRR-MM-DD'),100,
to_date('2007-09-28','RRRR-MM-DD'),100,
'C_DunningRun Unprocessed','Unprocessed Dunning Runs',
'S','C_DunningRun.Processed=''N''','D');
UPDATE AD_Process_Para SET AD_Val_Rule_ID=51003 WHERE AD_Process_Para_ID=578;
INSERT INTO ad_column
(ad_column_id, ad_client_id, ad_org_id, isactive,
created,
updated, createdby,
updatedby, NAME, description,
help, VERSION,
entitytype, columnname, ad_table_id, ad_reference_id,
fieldlength, iskey, isparent, ismandatory, isupdateable,
isidentifier, seqno, istranslated, isencrypted,
isselectioncolumn, ad_element_id, issyncdatabase,
isalwaysupdateable
)
VALUES (53248, 0, 0, 'Y',
TO_DATE ('2007-09-28','RRRR-MM-DD'),
TO_DATE ('2007-09-28','RRRR-MM-DD'), 100,
100, 'Dunning Level', 'Dunning Level',
'Dunning Level', 1,
'D', 'C_DunningLevel_ID', 318, 19,
22, 'N', 'N', 'N', 'Y',
'N', 0, 'N', 'N',
'N', 1075, 'N',
'N'
);
INSERT INTO ad_field
(ad_field_id, ad_client_id, ad_org_id, isactive,
created, createdby,
updated, updatedby,
NAME, description,
help,
iscentrallymaintained, seqno, ad_tab_id,
ad_column_id, isdisplayed, displaylength, isreadonly,
issameline, isheading, isfieldonly, isencrypted, entitytype,
displaylogic
)
VALUES (53258 , 0, 0, 'Y',
TO_DATE ('2007-09-28','RRRR-MM-DD'), 100,
TO_DATE ('2007-09-28','RRRR-MM-DD'), 100,
'Dunning Level', 'Dunning Level',
'Dunning Level',
'Y', 420 ,263,
53248, 'Y', 14, 'Y',
'Y', 'N', 'N', 'N', 'D',
'@Processed@=Y'
);
ALTER TABLE C_Invoice ADD C_DunningLevel_ID NUMBER(10,0) NULL;
INSERT INTO ad_column
(ad_column_id, ad_client_id, ad_org_id, isactive,
created,
updated, createdby,
updatedby, NAME, description,
help, VERSION,
entitytype, columnname, ad_table_id, ad_reference_id,
fieldlength, iskey, isparent, ismandatory, isupdateable,
isidentifier, seqno, istranslated, isencrypted,
isselectioncolumn, ad_element_id, issyncdatabase,
isalwaysupdateable
)
VALUES (53249, 0, 0, 'Y',
TO_DATE ('2007-09-28','RRRR-MM-DD'),
TO_DATE ('2007-09-28','RRRR-MM-DD'), 100,
100, 'Invoice Payment Schedule', 'Invoice Payment Schedule',
'Invoice Payment Schedule', 1,
'D', 'C_InvoicePaySchedule_ID', 524, 19,
22, 'N', 'N', 'N', 'Y',
'N', 0, 'N', 'N',
'N', 1995, 'N',
'N'
);
INSERT INTO ad_field
(ad_field_id, ad_client_id, ad_org_id, isactive,
created, createdby,
updated, updatedby,
NAME, description,
help,
iscentrallymaintained, seqno, ad_tab_id,
ad_column_id, isdisplayed, displaylength, isreadonly,
issameline, isheading, isfieldonly, isencrypted, entitytype
)
VALUES (53259 , 0, 0, 'Y',
TO_DATE ('2007-09-28','RRRR-MM-DD'), 100,
TO_DATE ('2007-09-28','RRRR-MM-DD'), 100,
'Invoice Payment Schedule', 'Invoice Payment Schedule',
'Invoice Payment Schedule',
'Y', 65 ,635,
53249, 'Y', 26, 'Y',
'N', 'N', 'N', 'N', 'D'
);
ALTER TABLE C_DunningRunLine ADD C_InvoicePaySchedule_ID NUMBER(10,0) NULL;
COMMIT;
UPDATE AD_SEQUENCE
SET currentnextsys = (SELECT MAX (ad_process_para_id) + 1
FROM AD_Process_Para
WHERE AD_Process_Para_ID < 1000000)
WHERE NAME = 'AD_Process_Para';
UPDATE AD_SEQUENCE
SET currentnextsys = (SELECT MAX (AD_Val_Rule_id) + 1
FROM AD_Val_Rule
WHERE AD_Val_Rule_ID < 1000000)
WHERE NAME = 'AD_Val_Rule';
UPDATE ad_sequence
SET currentnextsys = (SELECT MAX (ad_element_id) + 1
FROM ad_element
WHERE ad_element_id < 1000000)
WHERE NAME = 'AD_Element';
UPDATE ad_sequence
SET currentnextsys = (SELECT MAX (ad_column_id) + 1
FROM ad_column
WHERE ad_column_id < 1000000)
WHERE NAME = 'AD_Column';
UPDATE ad_sequence
SET currentnextsys = (SELECT MAX (ad_field_id) + 1
FROM ad_field
WHERE ad_field_id < 1000000)
WHERE NAME = 'AD_Field';
COMMIT;

View File

@ -0,0 +1,211 @@
INSERT INTO ad_element
(ad_element_id, ad_client_id, ad_org_id, isactive,
created, createdby,
updated, updatedby,
columnname, entitytype, NAME,
printname
)
VALUES (53223, 0, 0, 'Y',
TO_DATE ('09/21/2007 12:30:00', 'MM/DD/YYYY HH24:MI:SS'), 100,
TO_DATE ('09/21/2007 12:30:00', 'MM/DD/YYYY HH24:MI:SS'), 100,
'DunningGrace', 'D', 'Dunning Grace',
'Dunning Grace'
);
INSERT INTO ad_column
(ad_column_id, ad_client_id, ad_org_id, isactive,
created,
updated, createdby,
updatedby, NAME, description,
help, VERSION,
entitytype, columnname, ad_table_id, ad_reference_id,
fieldlength, iskey, isparent, ismandatory, isupdateable,
isidentifier, seqno, istranslated, isencrypted,
isselectioncolumn, ad_element_id, issyncdatabase,
isalwaysupdateable
)
VALUES (53246, 0, 0, 'Y',
TO_DATE ('09/21/2007 12:30:00', 'MM/DD/YYYY HH24:MI:SS'),
TO_DATE ('09/21/2007 12:30:00', 'MM/DD/YYYY HH24:MI:SS'), 100,
100, 'Dunning Grace', 'Delay/block the dunning until this date is reached.',
'Delay/block the dunning until this date is reached.', 1,
'D', 'DunningGrace', 291, 15,
7, 'N', 'N', 'N', 'Y',
'N', 0, 'N', 'N',
'N', 53223, 'N',
'N'
);
INSERT INTO ad_field
(ad_field_id, ad_client_id, ad_org_id, isactive,
created, createdby,
updated, updatedby,
NAME, description,
help,
iscentrallymaintained, seqno, ad_tab_id,
ad_column_id, isdisplayed, displaylength, isreadonly,
issameline, isheading, isfieldonly, isencrypted, entitytype,
displaylogic
)
VALUES (53256, 0, 0, 'Y',
TO_DATE ('09/21/2007 12:30:00', 'MM/DD/YYYY HH24:MI:SS'), 100,
TO_DATE ('09/21/2007 12:30:00', 'MM/DD/YYYY HH24:MI:SS'), 100,
'Dunning Grace', 'Delay/block the dunning until this date is reached.',
'Delay/block the dunning until this date is reached.',
'Y', 260 ,223,
53246, 'Y', 14, 'N',
'N', 'N', 'N', 'N', 'D',
'@IsCustomer@=Y'
);
INSERT INTO ad_column
(ad_column_id, ad_client_id, ad_org_id, isactive,
created,
updated, createdby,
updatedby, NAME, description,
help, VERSION,
entitytype, columnname, ad_table_id, ad_reference_id,
fieldlength, iskey, isparent, ismandatory, isupdateable,
isidentifier, seqno, istranslated, isencrypted,
isselectioncolumn, ad_element_id, issyncdatabase,
isalwaysupdateable
)
VALUES (53247, 0, 0, 'Y',
TO_DATE ('09/21/2007 12:30:00', 'MM/DD/YYYY HH24:MI:SS'),
TO_DATE ('09/21/2007 12:30:00', 'MM/DD/YYYY HH24:MI:SS'), 100,
100, 'Dunning Grace', 'Delay/block the dunning until this date is reached.',
'Delay/block the dunning until this date is reached.', 1,
'D', 'DunningGrace', 318, 15,
7, 'N', 'N', 'N', 'Y',
'N', 0, 'N', 'N',
'N', 53223, 'N',
'Y'
);
INSERT INTO ad_field
(ad_field_id, ad_client_id, ad_org_id, isactive,
created, createdby,
updated, updatedby,
NAME, description,
help,
iscentrallymaintained, seqno, ad_tab_id,
ad_column_id, isdisplayed, displaylength, isreadonly,
issameline, isheading, isfieldonly, isencrypted, entitytype
)
VALUES (53257, 0, 0, 'Y',
TO_DATE ('09/21/2007 12:30:00', 'MM/DD/YYYY HH24:MI:SS'), 100,
TO_DATE ('09/21/2007 12:30:00', 'MM/DD/YYYY HH24:MI:SS'), 100,
'Dunning Grace', 'Delay/block the dunning until this date is reached.',
'Delay/block the dunning until this date is reached.',
'Y', 410 ,263,
53247, 'Y', 14, 'N',
'N', 'N', 'N', 'N', 'D'
);
UPDATE ad_sequence
SET currentnextsys = (SELECT MAX (ad_element_id) + 1
FROM ad_element
WHERE ad_element_id < 1000000)
WHERE NAME = 'AD_Element';
UPDATE ad_sequence
SET currentnextsys = (SELECT MAX (ad_column_id) + 1
FROM ad_column
WHERE ad_column_id < 1000000)
WHERE NAME = 'AD_Column';
UPDATE ad_sequence
SET currentnextsys = (SELECT MAX (ad_field_id) + 1
FROM ad_field
WHERE ad_field_id < 1000000)
WHERE NAME = 'AD_Field';
ALTER TABLE C_BPartner ADD DunningGrace date NULL;
ALTER TABLE C_Invoice ADD DunningGrace date NULL;
DROP VIEW c_invoiceline_v;
DROP VIEW rv_bpartneropen;
DROP VIEW c_invoice_v;
CREATE OR REPLACE VIEW c_invoice_v AS
SELECT i.c_invoice_id, i.ad_client_id, i.ad_org_id, i.isactive, i.created, i.createdby, i.updated, i.updatedby, i.issotrx, i.documentno, i.docstatus, i.docaction, i.processing, i.processed, i.c_doctype_id, i.c_doctypetarget_id, i.c_order_id,
i.description, i.isapproved, i.istransferred, i.salesrep_id, i.dateinvoiced, i.dateprinted, i.dateacct, i.c_bpartner_id, i.c_bpartner_location_id, i.ad_user_id, i.poreference, i.dateordered, i.c_currency_id, i.c_conversiontype_id, i.paymentrule,
i.c_paymentterm_id, i.c_charge_id, i.m_pricelist_id, i.c_campaign_id, i.c_project_id, i.c_activity_id, i.isprinted, i.isdiscountprinted, i.ispaid, i.isindispute, i.ispayschedulevalid, NULL::numeric AS c_invoicepayschedule_id, i.invoicecollectiontype, i.dunninggrace,
CASE
WHEN charat(d.docbasetype::character varying, 3)::text = 'C'::text THEN i.chargeamt * -1::numeric
ELSE i.chargeamt
END AS chargeamt,
CASE
WHEN charat(d.docbasetype::character varying, 3)::text = 'C'::text THEN i.totallines * -1::numeric
ELSE i.totallines
END AS totallines,
CASE
WHEN charat(d.docbasetype::character varying, 3)::text = 'C'::text THEN i.grandtotal * -1::numeric
ELSE i.grandtotal
END AS grandtotal,
CASE
WHEN charat(d.docbasetype::character varying, 3)::text = 'C'::text THEN -1
ELSE 1
END::numeric AS multiplier,
CASE
WHEN charat(d.docbasetype::character varying, 2)::text = 'P'::text THEN -1
ELSE 1
END::numeric AS multiplierap, d.docbasetype
FROM c_invoice i
JOIN c_doctype d ON i.c_doctype_id = d.c_doctype_id
WHERE i.ispayschedulevalid <> 'Y'::bpchar
UNION
SELECT i.c_invoice_id, i.ad_client_id, i.ad_org_id, i.isactive, i.created, i.createdby, i.updated, i.updatedby, i.issotrx, i.documentno, i.docstatus, i.docaction, i.processing, i.processed, i.c_doctype_id, i.c_doctypetarget_id, i.c_order_id,
i.description, i.isapproved, i.istransferred, i.salesrep_id, i.dateinvoiced, i.dateprinted, i.dateacct, i.c_bpartner_id, i.c_bpartner_location_id, i.ad_user_id, i.poreference, i.dateordered, i.c_currency_id, i.c_conversiontype_id, i.paymentrule,
i.c_paymentterm_id, i.c_charge_id, i.m_pricelist_id, i.c_campaign_id, i.c_project_id, i.c_activity_id, i.isprinted, i.isdiscountprinted, i.ispaid, i.isindispute, i.ispayschedulevalid, ips.c_invoicepayschedule_id, i.invoicecollectiontype, i.dunninggrace,
NULL::"unknown" AS chargeamt, NULL::"unknown" AS totallines,
CASE
WHEN charat(d.docbasetype::character varying, 3)::text = 'C'::text THEN ips.dueamt * -1::numeric
ELSE ips.dueamt
END AS grandtotal,
CASE
WHEN charat(d.docbasetype::character varying, 3)::text = 'C'::text THEN -1
ELSE 1
END AS multiplier,
CASE
WHEN charat(d.docbasetype::character varying, 2)::text = 'P'::text THEN -1
ELSE 1
END AS multiplierap, d.docbasetype
FROM c_invoice i
JOIN c_doctype d ON i.c_doctype_id = d.c_doctype_id
JOIN c_invoicepayschedule ips ON i.c_invoice_id = ips.c_invoice_id
WHERE i.ispayschedulevalid = 'Y'::bpchar AND ips.isvalid = 'Y'::bpchar;
CREATE OR REPLACE VIEW c_invoiceline_v AS
SELECT il.ad_client_id, il.ad_org_id, il.c_invoiceline_id, i.c_invoice_id, i.salesrep_id, i.c_bpartner_id, il.m_product_id, i.documentno, i.dateinvoiced, i.dateacct, i.issotrx, i.docstatus, round(i.multiplier * il.linenetamt, 2) AS linenetamt, round(i.multiplier * il.pricelist * il.qtyinvoiced, 2) AS linelistamt,
CASE
WHEN COALESCE(il.pricelimit, 0::numeric) = 0::numeric THEN round(i.multiplier * il.linenetamt, 2)
ELSE round(i.multiplier * il.pricelimit * il.qtyinvoiced, 2)
END AS linelimitamt, round(i.multiplier * il.pricelist * il.qtyinvoiced - il.linenetamt, 2) AS linediscountamt,
CASE
WHEN COALESCE(il.pricelimit, 0::numeric) = 0::numeric THEN 0::numeric
ELSE round(i.multiplier * il.linenetamt - il.pricelimit * il.qtyinvoiced, 2)
END AS lineoverlimitamt, il.qtyinvoiced, il.qtyentered, il.line, il.c_orderline_id, il.c_uom_id, il.c_campaign_id, il.c_project_id, il.c_activity_id, il.c_projectphase_id, il.c_projecttask_id
FROM c_invoice_v i, c_invoiceline il
WHERE i.c_invoice_id = il.c_invoice_id;
CREATE OR REPLACE VIEW rv_bpartneropen AS
SELECT i.ad_client_id, i.ad_org_id, i.isactive, i.created, i.createdby, i.updated, i.updatedby, i.c_bpartner_id, i.c_currency_id, i.grandtotal * i.multiplierap AS amt, invoiceopen(i.c_invoice_id, i.c_invoicepayschedule_id) * i.multiplierap AS openamt, i.dateinvoiced AS datedoc, COALESCE(daysbetween(getdate(), ips.duedate::timestamp with time zone), paymenttermduedays(i.c_paymentterm_id, i.dateinvoiced::timestamp with time zone, getdate())) AS daysdue, i.c_campaign_id, i.c_project_id, i.c_activity_id
FROM c_invoice_v i
LEFT JOIN c_invoicepayschedule ips ON i.c_invoicepayschedule_id = ips.c_invoicepayschedule_id
WHERE i.ispaid = 'N'::bpchar AND (i.docstatus = ANY (ARRAY['CO'::bpchar, 'CL'::bpchar]))
UNION
SELECT p.ad_client_id, p.ad_org_id, p.isactive, p.created, p.createdby, p.updated, p.updatedby, p.c_bpartner_id, p.c_currency_id, p.payamt * p.multiplierap::numeric * -1::numeric AS amt, paymentavailable(p.c_payment_id) * p.multiplierap::numeric * -1::numeric AS openamt, p.datetrx AS datedoc, NULL::"unknown" AS daysdue, p.c_campaign_id, p.c_project_id, p.c_activity_id
FROM c_payment_v p
WHERE p.isallocated = 'N'::bpchar AND p.c_bpartner_id IS NOT NULL AND (p.docstatus = ANY (ARRAY['CO'::bpchar, 'CL'::bpchar]));
COMMIT ;

View File

@ -0,0 +1,179 @@
update AD_Column set IsAlwaysUpdateable='Y' where AD_Column_ID=12569;
update AD_Column set IsAlwaysUpdateable='Y' where AD_Column_ID=12566;
INSERT INTO ad_element
(ad_element_id, ad_client_id, ad_org_id, isactive,
created, createdby,
updated, updatedby,
columnname, entitytype, NAME,
printname
)
VALUES (53224, 0, 0, 'Y',
TO_DATE ('2007-09-28', 'YYYY-MM-DD'), 100,
TO_DATE ('2007-09-28', 'YYYY-MM-DD'), 100,
'PrintUnprocessedOnly', 'D', 'Print Unprocessed Entries Only',
'Print Unprocessed Entries Only'
);
INSERT INTO AD_Process_Para
(AD_Process_Para_ID, AD_Client_ID, AD_Org_ID, IsActive, Created,
CreatedBy, Updated, UpdatedBy, Name,
Description,
Help,
AD_Process_ID, SeqNo, AD_Reference_ID, AD_Reference_Value_ID,
AD_Val_Rule_ID, ColumnName, IsCentrallyMaintained, FieldLength,
IsMandatory, DefaultValue, IsRange, AD_Element_ID, EntityType
)
VALUES
(53011 , 0, 0, 'Y', TO_DATE ('2007-09-28', 'YYYY-MM-DD'),
100, TO_DATE ('2007-09-28', 'YYYY-MM-DD'), 100, 'Print Unprocessed Entries Only',
'Print the unprocessed (unprinted) entries of the dunning run only.',
'Print the unprocessed (unprinted) entries of the dunning run only. This allows you to reprint only certain dunning entries.',
312, 50, 20, NULL,
NULL, 'PrintUnprocessedOnly', 'N', 1,
'Y', 'Y', 'N', 53224, 'D'
);
INSERT INTO AD_VAL_RULE(
AD_VAL_RULE_ID,AD_CLIENT_ID,AD_ORG_ID,ISACTIVE,CREATED,CREATEDBY,
UPDATED,UPDATEDBY,
NAME,DESCRIPTION,
TYPE,CODE,ENTITYTYPE)
values(51003,0,0,'Y',to_date('2007-09-28','RRRR-MM-DD'),100,
to_date('2007-09-28','RRRR-MM-DD'),100,
'C_DunningRun Unprocessed','Unprocessed Dunning Runs',
'S','C_DunningRun.Processed=''N''','D');
UPDATE AD_Process_Para SET AD_Val_Rule_ID=51003 WHERE AD_Process_Para_ID=578;
INSERT INTO ad_column
(ad_column_id, ad_client_id, ad_org_id, isactive,
created,
updated, createdby,
updatedby, NAME, description,
help, VERSION,
entitytype, columnname, ad_table_id, ad_reference_id,
fieldlength, iskey, isparent, ismandatory, isupdateable,
isidentifier, seqno, istranslated, isencrypted,
isselectioncolumn, ad_element_id, issyncdatabase,
isalwaysupdateable
)
VALUES (53248, 0, 0, 'Y',
TO_DATE ('2007-09-28','RRRR-MM-DD'),
TO_DATE ('2007-09-28','RRRR-MM-DD'), 100,
100, 'Dunning Level', 'Dunning Level',
'Dunning Level', 1,
'D', 'C_DunningLevel_ID', 318, 19,
22, 'N', 'N', 'N', 'Y',
'N', 0, 'N', 'N',
'N', 1075, 'N',
'N'
);
INSERT INTO ad_field
(ad_field_id, ad_client_id, ad_org_id, isactive,
created, createdby,
updated, updatedby,
NAME, description,
help,
iscentrallymaintained, seqno, ad_tab_id,
ad_column_id, isdisplayed, displaylength, isreadonly,
issameline, isheading, isfieldonly, isencrypted, entitytype,
displaylogic
)
VALUES (53258 , 0, 0, 'Y',
TO_DATE ('2007-09-28','RRRR-MM-DD'), 100,
TO_DATE ('2007-09-28','RRRR-MM-DD'), 100,
'Dunning Level', 'Dunning Level',
'Dunning Level',
'Y', 420 ,263,
53248, 'Y', 14, 'Y',
'Y', 'N', 'N', 'N', 'D',
'@Processed@=Y'
);
ALTER TABLE C_Invoice ADD C_DunningLevel_ID NUMERIC(10) NULL;
INSERT INTO ad_column
(ad_column_id, ad_client_id, ad_org_id, isactive,
created,
updated, createdby,
updatedby, NAME, description,
help, VERSION,
entitytype, columnname, ad_table_id, ad_reference_id,
fieldlength, iskey, isparent, ismandatory, isupdateable,
isidentifier, seqno, istranslated, isencrypted,
isselectioncolumn, ad_element_id, issyncdatabase,
isalwaysupdateable
)
VALUES (53249, 0, 0, 'Y',
TO_DATE ('2007-09-28','RRRR-MM-DD'),
TO_DATE ('2007-09-28','RRRR-MM-DD'), 100,
100, 'Invoice Payment Schedule', 'Invoice Payment Schedule',
'Invoice Payment Schedule', 1,
'D', 'C_InvoicePaySchedule_ID', 524, 19,
22, 'N', 'N', 'N', 'Y',
'N', 0, 'N', 'N',
'N', 1995, 'N',
'N'
);
INSERT INTO ad_field
(ad_field_id, ad_client_id, ad_org_id, isactive,
created, createdby,
updated, updatedby,
NAME, description,
help,
iscentrallymaintained, seqno, ad_tab_id,
ad_column_id, isdisplayed, displaylength, isreadonly,
issameline, isheading, isfieldonly, isencrypted, entitytype
)
VALUES (53259 , 0, 0, 'Y',
TO_DATE ('2007-09-28','RRRR-MM-DD'), 100,
TO_DATE ('2007-09-28','RRRR-MM-DD'), 100,
'Invoice Payment Schedule', 'Invoice Payment Schedule',
'Invoice Payment Schedule',
'Y', 65 ,635,
53249, 'Y', 26, 'Y',
'N', 'N', 'N', 'N', 'D'
);
ALTER TABLE C_DunningRunLine ADD C_InvoicePaySchedule_ID NUMERIC(10) NULL;
COMMIT;
UPDATE AD_SEQUENCE
SET currentnextsys = (SELECT MAX (ad_process_para_id) + 1
FROM AD_Process_Para
WHERE AD_Process_Para_ID < 1000000)
WHERE NAME = 'AD_Process_Para';
UPDATE AD_SEQUENCE
SET currentnextsys = (SELECT MAX (AD_Val_Rule_id) + 1
FROM AD_Val_Rule
WHERE AD_Val_Rule_ID < 1000000)
WHERE NAME = 'AD_Val_Rule';
UPDATE ad_sequence
SET currentnextsys = (SELECT MAX (ad_element_id) + 1
FROM ad_element
WHERE ad_element_id < 1000000)
WHERE NAME = 'AD_Element';
UPDATE ad_sequence
SET currentnextsys = (SELECT MAX (ad_column_id) + 1
FROM ad_column
WHERE ad_column_id < 1000000)
WHERE NAME = 'AD_Column';
UPDATE ad_sequence
SET currentnextsys = (SELECT MAX (ad_field_id) + 1
FROM ad_field
WHERE ad_field_id < 1000000)
WHERE NAME = 'AD_Field';
COMMIT;