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) Trifon Trifonov. *
* Copyright (C) Contributors * * Copyright (C) Contributors *
* * * *
* This program is free software; * This program is free software;
you can redistribute it and/or * you can redistribute it and/or *
* modify it under the terms of the GNU General Public License * * 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 * either version 2 *
* of the License, or (at your option) any later version. * * of the License, or (at your option) any later version. *
* * * *
* This program is distributed in the hope that it will be useful, * * 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 * without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. * * GNU General Public License for more details. *
* * * *
* You should have received a copy of the GNU General Public License * * 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 * if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. * * MA 02110-1301, USA. *
@ -30,215 +30,228 @@
* Sponsors: * * Sponsors: *
* - Company (http://www.site.com) * * - Company (http://www.site.com) *
**********************************************************************/ **********************************************************************/
package org.compiere.model; package org.compiere.model;
import java.util.*;
import java.sql.Timestamp;
import java.math.*;
import org.compiere.util.*;
/** Generated Interface for C_DunningRunLine import java.math.BigDecimal;
* @author Trifon Trifonov (generated) import org.compiere.util.KeyNamePair;
* @version Release 3.3.0 - 2007-08-24 11:39:40.156
*/ /** Generated Interface for C_DunningRunLine
public interface I_C_DunningRunLine * @author Trifon Trifonov (generated)
{ * @version Release 3.3.0
*/
public interface I_C_DunningRunLine
{
/** TableName=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 */ /** 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 /** AccessLevel = 3 - Client - Org
*/ */
BigDecimal accessLevel = new BigDecimal(3); BigDecimal accessLevel = BigDecimal.valueOf(3);
/** Load Meta Data */ /** Load Meta Data */
/** Column name Amt */ /** Column name Amt */
public static final String COLUMNNAME_Amt = "Amt"; public static final String COLUMNNAME_Amt = "Amt";
/** Set Amount. /** Set Amount.
* Amount * Amount
*/ */
public void setAmt (BigDecimal Amt); public void setAmt (BigDecimal Amt);
/** Get Amount. /** Get Amount.
* Amount * Amount
*/ */
public BigDecimal getAmt(); public BigDecimal getAmt();
/** Column name C_DunningRunEntry_ID */ /** 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. /** 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. /** 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 */ /** 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. /** 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. /** 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 */ /** 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. /** 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. /** Get Invoice.
* Invoice Identifier * Invoice Identifier
*/ */
public int getC_Invoice_ID(); public int getC_Invoice_ID();
/** Column name C_Payment_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. /** 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. /** Get Payment.
* Payment identifier * Payment identifier
*/ */
public int getC_Payment_ID(); public int getC_Payment_ID();
/** Column name ConvertedAmt */ /** Column name ConvertedAmt */
public static final String COLUMNNAME_ConvertedAmt = "ConvertedAmt"; public static final String COLUMNNAME_ConvertedAmt = "ConvertedAmt";
/** Set Converted Amount. /** Set Converted Amount.
* Converted Amount * Converted Amount
*/ */
public void setConvertedAmt (BigDecimal ConvertedAmt); public void setConvertedAmt (BigDecimal ConvertedAmt);
/** Get Converted Amount. /** Get Converted Amount.
* Converted Amount * Converted Amount
*/ */
public BigDecimal getConvertedAmt(); public BigDecimal getConvertedAmt();
/** Column name DaysDue */ /** Column name DaysDue */
public static final String COLUMNNAME_DaysDue = "DaysDue"; public static final String COLUMNNAME_DaysDue = "DaysDue";
/** Set Days due. /** 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. /** 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 */ /** Column name FeeAmt */
public static final String COLUMNNAME_FeeAmt = "FeeAmt"; public static final String COLUMNNAME_FeeAmt = "FeeAmt";
/** Set Fee Amount. /** 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. /** Get Fee Amount.
* Fee amount in invoice currency * Fee amount in invoice currency
*/ */
public BigDecimal getFeeAmt(); public BigDecimal getFeeAmt();
/** Column name InterestAmt */ /** Column name InterestAmt */
public static final String COLUMNNAME_InterestAmt = "InterestAmt"; public static final String COLUMNNAME_InterestAmt = "InterestAmt";
/** Set Interest Amount. /** Set Interest Amount.
* Interest Amount * Interest Amount
*/ */
public void setInterestAmt (BigDecimal InterestAmt); public void setInterestAmt (BigDecimal InterestAmt);
/** Get Interest Amount. /** Get Interest Amount.
* Interest Amount * Interest Amount
*/ */
public BigDecimal getInterestAmt(); public BigDecimal getInterestAmt();
/** Column name IsInDispute */ /** Column name IsInDispute */
public static final String COLUMNNAME_IsInDispute = "IsInDispute"; public static final String COLUMNNAME_IsInDispute = "IsInDispute";
/** Set In Dispute. /** Set In Dispute.
* Document is in dispute * Document is in dispute
*/ */
public void setIsInDispute (boolean IsInDispute); public void setIsInDispute (boolean IsInDispute);
/** Get In Dispute. /** Get In Dispute.
* Document is in dispute * Document is in dispute
*/ */
public boolean isInDispute(); public boolean isInDispute();
/** Column name OpenAmt */ /** Column name OpenAmt */
public static final String COLUMNNAME_OpenAmt = "OpenAmt"; public static final String COLUMNNAME_OpenAmt = "OpenAmt";
/** Set Open Amount. /** Set Open Amount.
* Open item amount * Open item amount
*/ */
public void setOpenAmt (BigDecimal OpenAmt); public void setOpenAmt (BigDecimal OpenAmt);
/** Get Open Amount. /** Get Open Amount.
* Open item amount * Open item amount
*/ */
public BigDecimal getOpenAmt(); public BigDecimal getOpenAmt();
/** Column name Processed */ /** Column name Processed */
public static final String COLUMNNAME_Processed = "Processed"; public static final String COLUMNNAME_Processed = "Processed";
/** Set 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. /** Get Processed.
* The document has been processed * The document has been processed
*/ */
public boolean isProcessed(); public boolean isProcessed();
/** Column name TimesDunned */ /** Column name TimesDunned */
public static final String COLUMNNAME_TimesDunned = "TimesDunned"; public static final String COLUMNNAME_TimesDunned = "TimesDunned";
/** Set Times Dunned. /** 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. /** Get Times Dunned.
* Number of times dunned previously * Number of times dunned previously
*/ */
public int getTimesDunned(); public int getTimesDunned();
/** Column name TotalAmt */ /** Column name TotalAmt */
public static final String COLUMNNAME_TotalAmt = "TotalAmt"; public static final String COLUMNNAME_TotalAmt = "TotalAmt";
/** Set Total Amount. /** Set Total Amount.
* Total Amount * Total Amount
*/ */
public void setTotalAmt (BigDecimal TotalAmt); public void setTotalAmt (BigDecimal TotalAmt);
/** Get Total Amount. /** 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 * * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html * * or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/ *****************************************************************************/
/** Generated Model - DO NOT CHANGE */ /** Generated Model - DO NOT CHANGE */
package org.compiere.model; package org.compiere.model;
import java.util.*; import java.lang.reflect.Constructor;
import java.sql.*; import java.math.BigDecimal;
import java.math.*; import java.sql.ResultSet;
import java.lang.reflect.Constructor; import java.util.Properties;
import java.util.logging.Level; import java.util.logging.Level;
import org.compiere.util.*; import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
/** Generated Model for C_DunningRunLine
* @author Adempiere (generated) /** Generated Model for C_DunningRunLine
* @version Release 3.3.0 - $Id$ */ * @author Adempiere (generated)
public class X_C_DunningRunLine extends PO implements I_C_DunningRunLine, I_Persistent * @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; */
private static final long serialVersionUID = 1L;
/** Standard Constructor */
public X_C_DunningRunLine (Properties ctx, int C_DunningRunLine_ID, String trxName) /** 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); super (ctx, C_DunningRunLine_ID, trxName);
setC_DunningRunEntry_ID (0); /** if (C_DunningRunLine_ID == 0)
setC_DunningRunLine_ID (0); {
setConvertedAmt (Env.ZERO); setAmt (Env.ZERO);
setDaysDue (0); setC_DunningRunEntry_ID (0);
setFeeAmt (Env.ZERO); setC_DunningRunLine_ID (0);
setInterestAmt (Env.ZERO); setConvertedAmt (Env.ZERO);
setIsInDispute (false); setDaysDue (0);
setOpenAmt (Env.ZERO); setFeeAmt (Env.ZERO);
setProcessed (false); setInterestAmt (Env.ZERO);
setTimesDunned (0); setIsInDispute (false);
setTotalAmt (Env.ZERO); 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); /** Load Constructor */
} public X_C_DunningRunLine (Properties ctx, ResultSet rs, String trxName)
{
/** AccessLevel super (ctx, rs, trxName);
* @return 3 - Client - Org }
*/
protected int get_AccessLevel() /** AccessLevel
{ * @return 3 - Client - Org
return accessLevel.intValue(); */
} protected int get_AccessLevel()
{
/** Load Meta Data */ return accessLevel.intValue();
protected POInfo initPO (Properties ctx) }
{
POInfo poi = POInfo.getPOInfo (ctx, Table_ID); /** Load Meta Data */
return poi; protected POInfo initPO (Properties ctx)
} {
POInfo poi = POInfo.getPOInfo (ctx, Table_ID);
public String toString() return poi;
{ }
StringBuffer sb = new StringBuffer ("X_C_DunningRunLine[")
.append(get_ID()).append("]"); public String toString()
return sb.toString(); {
} StringBuffer sb = new StringBuffer ("X_C_DunningRunLine[")
.append(get_ID()).append("]");
/** Set Amount. return sb.toString();
@param Amt }
Amount
*/ /** Set Amount.
public void setAmt (BigDecimal Amt) @param Amt
{ Amount
if (Amt == null) */
throw new IllegalArgumentException ("Amt is mandatory."); public void setAmt (BigDecimal Amt)
set_Value (COLUMNNAME_Amt, Amt); {
} if (Amt == null)
throw new IllegalArgumentException ("Amt is mandatory.");
/** Get Amount. set_Value (COLUMNNAME_Amt, Amt);
@return Amount }
*/
public BigDecimal getAmt () /** Get Amount.
{ @return Amount
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Amt); */
if (bd == null) public BigDecimal getAmt ()
return Env.ZERO; {
return bd; BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Amt);
} if (bd == null)
return Env.ZERO;
public I_C_DunningRunEntry getI_C_DunningRunEntry() throws Exception return bd;
{ }
Class<?> clazz = MTable.getClass(I_C_DunningRunEntry.Table_Name);
I_C_DunningRunEntry result = null; public I_C_DunningRunEntry getC_DunningRunEntry() throws Exception
try { {
Constructor<?> constructor = null; Class<?> clazz = MTable.getClass(I_C_DunningRunEntry.Table_Name);
constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); I_C_DunningRunEntry result = null;
result = (I_C_DunningRunEntry)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_DunningRunEntry_ID()), get_TrxName()}); try {
} catch (Exception e) { Constructor<?> constructor = null;
log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class});
log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); result = (I_C_DunningRunEntry)constructor.newInstance(new Object[] {getCtx(), new Integer(getC_DunningRunEntry_ID()), get_TrxName()});
throw e; } catch (Exception e) {
} log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e);
return result; log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz);
} throw e;
}
/** Set Dunning Run Entry. return result;
@param C_DunningRunEntry_ID }
Dunning Run Entry
*/ /** Set Dunning Run Entry.
public void setC_DunningRunEntry_ID (int C_DunningRunEntry_ID) @param C_DunningRunEntry_ID
{ Dunning Run Entry
if (C_DunningRunEntry_ID < 1) */
throw new IllegalArgumentException ("C_DunningRunEntry_ID is mandatory."); public void setC_DunningRunEntry_ID (int C_DunningRunEntry_ID)
set_ValueNoCheck (COLUMNNAME_C_DunningRunEntry_ID, Integer.valueOf(C_DunningRunEntry_ID)); {
} if (C_DunningRunEntry_ID < 1)
throw new IllegalArgumentException ("C_DunningRunEntry_ID is mandatory.");
/** Get Dunning Run Entry. set_ValueNoCheck (COLUMNNAME_C_DunningRunEntry_ID, Integer.valueOf(C_DunningRunEntry_ID));
@return Dunning Run Entry }
*/
public int getC_DunningRunEntry_ID () /** Get Dunning Run Entry.
{ @return Dunning Run Entry
Integer ii = (Integer)get_Value(COLUMNNAME_C_DunningRunEntry_ID); */
if (ii == null) public int getC_DunningRunEntry_ID ()
return 0; {
return ii.intValue(); Integer ii = (Integer)get_Value(COLUMNNAME_C_DunningRunEntry_ID);
} if (ii == null)
return 0;
/** Set Dunning Run Line. return ii.intValue();
@param C_DunningRunLine_ID }
Dunning Run Line
*/ /** Set Dunning Run Line.
public void setC_DunningRunLine_ID (int C_DunningRunLine_ID) @param C_DunningRunLine_ID
{ Dunning Run Line
if (C_DunningRunLine_ID < 1) */
throw new IllegalArgumentException ("C_DunningRunLine_ID is mandatory."); public void setC_DunningRunLine_ID (int C_DunningRunLine_ID)
set_ValueNoCheck (COLUMNNAME_C_DunningRunLine_ID, Integer.valueOf(C_DunningRunLine_ID)); {
} if (C_DunningRunLine_ID < 1)
throw new IllegalArgumentException ("C_DunningRunLine_ID is mandatory.");
/** Get Dunning Run Line. set_ValueNoCheck (COLUMNNAME_C_DunningRunLine_ID, Integer.valueOf(C_DunningRunLine_ID));
@return Dunning Run Line }
*/
public int getC_DunningRunLine_ID () /** Get Dunning Run Line.
{ @return Dunning Run Line
Integer ii = (Integer)get_Value(COLUMNNAME_C_DunningRunLine_ID); */
if (ii == null) public int getC_DunningRunLine_ID ()
return 0; {
return ii.intValue(); Integer ii = (Integer)get_Value(COLUMNNAME_C_DunningRunLine_ID);
} if (ii == null)
return 0;
/** Set Invoice. return ii.intValue();
@param C_Invoice_ID }
Invoice Identifier
*/ public I_C_InvoicePaySchedule getC_InvoicePaySchedule() throws Exception
public void setC_Invoice_ID (int C_Invoice_ID) {
{ Class<?> clazz = MTable.getClass(I_C_InvoicePaySchedule.Table_Name);
if (C_Invoice_ID <= 0) set_Value (COLUMNNAME_C_Invoice_ID, null); I_C_InvoicePaySchedule result = null;
else try {
set_Value (COLUMNNAME_C_Invoice_ID, Integer.valueOf(C_Invoice_ID)); 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()});
/** Get Invoice. } catch (Exception e) {
@return Invoice Identifier log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e);
*/ log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz);
public int getC_Invoice_ID () throw e;
{ }
Integer ii = (Integer)get_Value(COLUMNNAME_C_Invoice_ID); return result;
if (ii == null) }
return 0;
return ii.intValue(); /** Set Invoice Payment Schedule.
} @param C_InvoicePaySchedule_ID
Invoice Payment Schedule
/** Get Record ID/ColumnName */
@return ID/ColumnName pair public void setC_InvoicePaySchedule_ID (int C_InvoicePaySchedule_ID)
*/ {
public KeyNamePair getKeyNamePair() if (C_InvoicePaySchedule_ID <= 0)
{ set_Value (COLUMNNAME_C_InvoicePaySchedule_ID, null);
return new KeyNamePair(get_ID(), String.valueOf(getC_Invoice_ID())); else
} set_Value (COLUMNNAME_C_InvoicePaySchedule_ID, Integer.valueOf(C_InvoicePaySchedule_ID));
}
/** Set Payment.
@param C_Payment_ID /** Get Invoice Payment Schedule.
Payment identifier @return Invoice Payment Schedule
*/ */
public void setC_Payment_ID (int C_Payment_ID) public int getC_InvoicePaySchedule_ID ()
{ {
if (C_Payment_ID <= 0) set_Value (COLUMNNAME_C_Payment_ID, null); Integer ii = (Integer)get_Value(COLUMNNAME_C_InvoicePaySchedule_ID);
else if (ii == null)
set_Value (COLUMNNAME_C_Payment_ID, Integer.valueOf(C_Payment_ID)); return 0;
} return ii.intValue();
}
/** Get Payment.
@return Payment identifier /** Set Invoice.
*/ @param C_Invoice_ID
public int getC_Payment_ID () Invoice Identifier
{ */
Integer ii = (Integer)get_Value(COLUMNNAME_C_Payment_ID); public void setC_Invoice_ID (int C_Invoice_ID)
if (ii == null) {
return 0; if (C_Invoice_ID <= 0)
return ii.intValue(); set_Value (COLUMNNAME_C_Invoice_ID, null);
} else
set_Value (COLUMNNAME_C_Invoice_ID, Integer.valueOf(C_Invoice_ID));
/** Set Converted Amount. }
@param ConvertedAmt
Converted Amount /** Get Invoice.
*/ @return Invoice Identifier
public void setConvertedAmt (BigDecimal ConvertedAmt) */
{ public int getC_Invoice_ID ()
if (ConvertedAmt == null) {
throw new IllegalArgumentException ("ConvertedAmt is mandatory."); Integer ii = (Integer)get_Value(COLUMNNAME_C_Invoice_ID);
set_Value (COLUMNNAME_ConvertedAmt, ConvertedAmt); if (ii == null)
} return 0;
return ii.intValue();
/** Get Converted Amount. }
@return Converted Amount
*/ /** Get Record ID/ColumnName
public BigDecimal getConvertedAmt () @return ID/ColumnName pair
{ */
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_ConvertedAmt); public KeyNamePair getKeyNamePair()
if (bd == null) {
return Env.ZERO; return new KeyNamePair(get_ID(), String.valueOf(getC_Invoice_ID()));
return bd; }
}
/** Set Payment.
/** Set Days due. @param C_Payment_ID
@param DaysDue Payment identifier
Number of days due (negative: due in number of days) */
*/ public void setC_Payment_ID (int C_Payment_ID)
public void setDaysDue (int DaysDue) {
{ if (C_Payment_ID <= 0)
set_Value (COLUMNNAME_DaysDue, Integer.valueOf(DaysDue)); set_Value (COLUMNNAME_C_Payment_ID, null);
} else
set_Value (COLUMNNAME_C_Payment_ID, Integer.valueOf(C_Payment_ID));
/** Get Days due. }
@return Number of days due (negative: due in number of days)
*/ /** Get Payment.
public int getDaysDue () @return Payment identifier
{ */
Integer ii = (Integer)get_Value(COLUMNNAME_DaysDue); public int getC_Payment_ID ()
if (ii == null) {
return 0; Integer ii = (Integer)get_Value(COLUMNNAME_C_Payment_ID);
return ii.intValue(); if (ii == null)
} return 0;
return ii.intValue();
/** Set Fee Amount. }
@param FeeAmt
Fee amount in invoice currency /** Set Converted Amount.
*/ @param ConvertedAmt
public void setFeeAmt (BigDecimal FeeAmt) Converted Amount
{ */
if (FeeAmt == null) public void setConvertedAmt (BigDecimal ConvertedAmt)
throw new IllegalArgumentException ("FeeAmt is mandatory."); {
set_Value (COLUMNNAME_FeeAmt, FeeAmt); if (ConvertedAmt == null)
} throw new IllegalArgumentException ("ConvertedAmt is mandatory.");
set_Value (COLUMNNAME_ConvertedAmt, ConvertedAmt);
/** Get Fee Amount. }
@return Fee amount in invoice currency
*/ /** Get Converted Amount.
public BigDecimal getFeeAmt () @return Converted Amount
{ */
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_FeeAmt); public BigDecimal getConvertedAmt ()
if (bd == null) {
return Env.ZERO; BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_ConvertedAmt);
return bd; if (bd == null)
} return Env.ZERO;
return bd;
/** Set Interest Amount. }
@param InterestAmt
Interest Amount /** Set Days due.
*/ @param DaysDue
public void setInterestAmt (BigDecimal InterestAmt) Number of days due (negative: due in number of days)
{ */
if (InterestAmt == null) public void setDaysDue (int DaysDue)
throw new IllegalArgumentException ("InterestAmt is mandatory."); {
set_Value (COLUMNNAME_InterestAmt, InterestAmt); set_Value (COLUMNNAME_DaysDue, Integer.valueOf(DaysDue));
} }
/** Get Interest Amount. /** Get Days due.
@return Interest Amount @return Number of days due (negative: due in number of days)
*/ */
public BigDecimal getInterestAmt () public int getDaysDue ()
{ {
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_InterestAmt); Integer ii = (Integer)get_Value(COLUMNNAME_DaysDue);
if (bd == null) if (ii == null)
return Env.ZERO; return 0;
return bd; return ii.intValue();
} }
/** Set In Dispute. /** Set Fee Amount.
@param IsInDispute @param FeeAmt
Document is in dispute Fee amount in invoice currency
*/ */
public void setIsInDispute (boolean IsInDispute) public void setFeeAmt (BigDecimal FeeAmt)
{ {
set_Value (COLUMNNAME_IsInDispute, Boolean.valueOf(IsInDispute)); if (FeeAmt == null)
} throw new IllegalArgumentException ("FeeAmt is mandatory.");
set_Value (COLUMNNAME_FeeAmt, FeeAmt);
/** Get In Dispute. }
@return Document is in dispute
*/ /** Get Fee Amount.
public boolean isInDispute () @return Fee amount in invoice currency
{ */
Object oo = get_Value(COLUMNNAME_IsInDispute); public BigDecimal getFeeAmt ()
if (oo != null) {
{ BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_FeeAmt);
if (oo instanceof Boolean) if (bd == null)
return ((Boolean)oo).booleanValue(); return Env.ZERO;
return "Y".equals(oo); return bd;
} }
return false;
} /** Set Interest Amount.
@param InterestAmt
/** Set Open Amount. Interest Amount
@param OpenAmt */
Open item amount public void setInterestAmt (BigDecimal InterestAmt)
*/ {
public void setOpenAmt (BigDecimal OpenAmt) if (InterestAmt == null)
{ throw new IllegalArgumentException ("InterestAmt is mandatory.");
if (OpenAmt == null) set_Value (COLUMNNAME_InterestAmt, InterestAmt);
throw new IllegalArgumentException ("OpenAmt is mandatory."); }
set_Value (COLUMNNAME_OpenAmt, OpenAmt);
} /** Get Interest Amount.
@return Interest Amount
/** Get Open Amount. */
@return Open item amount public BigDecimal getInterestAmt ()
*/ {
public BigDecimal getOpenAmt () BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_InterestAmt);
{ if (bd == null)
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_OpenAmt); return Env.ZERO;
if (bd == null) return bd;
return Env.ZERO; }
return bd;
} /** Set In Dispute.
@param IsInDispute
/** Set Processed. Document is in dispute
@param Processed */
The document has been processed public void setIsInDispute (boolean IsInDispute)
*/ {
public void setProcessed (boolean Processed) set_Value (COLUMNNAME_IsInDispute, Boolean.valueOf(IsInDispute));
{ }
set_Value (COLUMNNAME_Processed, Boolean.valueOf(Processed));
} /** Get In Dispute.
@return Document is in dispute
/** Get Processed. */
@return The document has been processed public boolean isInDispute ()
*/ {
public boolean isProcessed () Object oo = get_Value(COLUMNNAME_IsInDispute);
{ if (oo != null)
Object oo = get_Value(COLUMNNAME_Processed); {
if (oo != null) if (oo instanceof Boolean)
{ return ((Boolean)oo).booleanValue();
if (oo instanceof Boolean) return "Y".equals(oo);
return ((Boolean)oo).booleanValue(); }
return "Y".equals(oo); return false;
} }
return false;
} /** Set Open Amount.
@param OpenAmt
/** Set Times Dunned. Open item amount
@param TimesDunned */
Number of times dunned previously public void setOpenAmt (BigDecimal OpenAmt)
*/ {
public void setTimesDunned (int TimesDunned) if (OpenAmt == null)
{ throw new IllegalArgumentException ("OpenAmt is mandatory.");
set_Value (COLUMNNAME_TimesDunned, Integer.valueOf(TimesDunned)); set_Value (COLUMNNAME_OpenAmt, OpenAmt);
} }
/** Get Times Dunned. /** Get Open Amount.
@return Number of times dunned previously @return Open item amount
*/ */
public int getTimesDunned () public BigDecimal getOpenAmt ()
{ {
Integer ii = (Integer)get_Value(COLUMNNAME_TimesDunned); BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_OpenAmt);
if (ii == null) if (bd == null)
return 0; return Env.ZERO;
return ii.intValue(); return bd;
} }
/** Set Total Amount. /** Set Processed.
@param TotalAmt @param Processed
Total Amount The document has been processed
*/ */
public void setTotalAmt (BigDecimal TotalAmt) public void setProcessed (boolean Processed)
{ {
if (TotalAmt == null) set_Value (COLUMNNAME_Processed, Boolean.valueOf(Processed));
throw new IllegalArgumentException ("TotalAmt is mandatory."); }
set_Value (COLUMNNAME_TotalAmt, TotalAmt);
} /** Get Processed.
@return The document has been processed
/** Get Total Amount. */
@return Total Amount public boolean isProcessed ()
*/ {
public BigDecimal getTotalAmt () Object oo = get_Value(COLUMNNAME_Processed);
{ if (oo != null)
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_TotalAmt); {
if (bd == null) if (oo instanceof Boolean)
return Env.ZERO; return ((Boolean)oo).booleanValue();
return bd; 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; package org.compiere.process;
import java.io.*; import java.io.File;
import java.util.logging.*; import java.util.logging.Level;
import org.compiere.model.*;
import org.compiere.print.*; import org.compiere.model.MBPartner;
import org.compiere.util.*; 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 * Dunning Letter Print
@ -37,7 +50,9 @@ public class DunningPrint extends SvrProcess
/** Dunning Run */ /** Dunning Run */
private int p_C_DunningRun_ID = 0; private int p_C_DunningRun_ID = 0;
/** Print only Outstanding */ /** 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")) else if (name.equals("C_DunningRun_ID"))
p_C_DunningRun_ID = para[i].getParameterAsInt(); p_C_DunningRun_ID = para[i].getParameterAsInt();
else if (name.equals("IsOnlyIfBPBalance")) 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 else
log.log(Level.SEVERE, "Unknown Parameter: " + name); log.log(Level.SEVERE, "Unknown Parameter: " + name);
} }
@ -72,7 +89,8 @@ public class DunningPrint extends SvrProcess
protected String doIt () throws Exception protected String doIt () throws Exception
{ {
log.info("C_DunningRun_ID=" + p_C_DunningRun_ID + ",R_MailText_ID=" + p_R_MailText_ID 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 // Need to have Template
if (p_EMailPDF && p_R_MailText_ID == 0) if (p_EMailPDF && p_R_MailText_ID == 0)
@ -103,6 +121,8 @@ public class DunningPrint extends SvrProcess
{ {
MDunningRunEntry entry = entries[i]; MDunningRunEntry entry = entries[i];
if (p_IsOnlyIfBPBalance && entry.getAmt().signum() <= 0) if (p_IsOnlyIfBPBalance && entry.getAmt().signum() <= 0)
continue;
if (p_PrintUnprocessedOnly && entry.isProcessed())
continue; continue;
// To BPartner // To BPartner
MBPartner bp = new MBPartner (getCtx(), entry.getC_BPartner_ID(), get_TrxName()); MBPartner bp = new MBPartner (getCtx(), entry.getC_BPartner_ID(), get_TrxName());
@ -199,6 +219,10 @@ public class DunningPrint extends SvrProcess
} }
} // for all dunning letters } // for all dunning letters
if (errors==0) {
run.setProcessed(true);
run.save();
}
if (p_EMailPDF) if (p_EMailPDF)
return "@Sent@=" + count + " - @Errors@=" + errors; return "@Sent@=" + count + " - @Errors@=" + errors;
return "@Printed@=" + count; return "@Printed@=" + count;

View File

@ -3,33 +3,40 @@
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it * * 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 * * 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 * * 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 * * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. * * See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along * * 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., * * with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us * * 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 * * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html * * or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/ *****************************************************************************/
package org.compiere.process; package org.compiere.process;
import java.math.*; import java.math.BigDecimal;
import java.sql.*; import java.sql.PreparedStatement;
import java.util.logging.*; import java.sql.ResultSet;
import org.compiere.model.*; import java.util.logging.Level;
import org.compiere.util.*;
import org.compiere.model.MDunningLevel;
import org.compiere.model.MDunningRun;
/** import org.compiere.model.MDunningRunEntry;
* Create Dunning Run Entries/Lines import org.compiere.model.MDunningRunLine;
* import org.compiere.model.MInvoice;
* @author Jorg Janke import org.compiere.util.DB;
* @version $Id: DunningRunCreate.java,v 1.2 2006/07/30 00:51:02 jjanke Exp $ import org.compiere.util.Env;
*/
public class DunningRunCreate extends SvrProcess
/**
* 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_IncludeInDispute = false;
private boolean p_OnlySOTrx = false; private boolean p_OnlySOTrx = false;
@ -37,7 +44,7 @@ public class DunningRunCreate extends SvrProcess
private int p_SalesRep_ID = 0; private int p_SalesRep_ID = 0;
private int p_C_Currency_ID = 0; private int p_C_Currency_ID = 0;
private int p_C_BPartner_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 int p_C_DunningRun_ID = 0;
private MDunningRun m_run = null; private MDunningRun m_run = null;
@ -45,16 +52,16 @@ public class DunningRunCreate extends SvrProcess
/** /**
* Prepare - e.g., get Parameters. * Prepare - e.g., get Parameters.
*/ */
protected void prepare() protected void prepare()
{ {
ProcessInfoParameter[] para = getParameter(); ProcessInfoParameter[] para = getParameter();
for (int i = 0; i < para.length; i++) for (int i = 0; i < para.length; i++)
{ {
String name = para[i].getParameterName(); String name = para[i].getParameterName();
if (para[i].getParameter() == null) if (para[i].getParameter() == null)
; ;
else if (name.equals("IncludeInDispute")) else if (name.equals("IncludeInDispute"))
p_IncludeInDispute = "Y".equals(para[i].getParameter()); p_IncludeInDispute = "Y".equals(para[i].getParameter());
else if (name.equals("OnlySOTrx")) else if (name.equals("OnlySOTrx"))
p_OnlySOTrx = "Y".equals(para[i].getParameter()); p_OnlySOTrx = "Y".equals(para[i].getParameter());
@ -63,35 +70,35 @@ public class DunningRunCreate extends SvrProcess
else if (name.equals("SalesRep_ID")) else if (name.equals("SalesRep_ID"))
p_SalesRep_ID = para[i].getParameterAsInt(); p_SalesRep_ID = para[i].getParameterAsInt();
else if (name.equals("C_Currency_ID")) else if (name.equals("C_Currency_ID"))
p_C_Currency_ID = para[i].getParameterAsInt(); p_C_Currency_ID = para[i].getParameterAsInt();
else if (name.equals("C_BPartner_ID")) else if (name.equals("C_BPartner_ID"))
p_C_BPartner_ID = para[i].getParameterAsInt(); p_C_BPartner_ID = para[i].getParameterAsInt();
else if (name.equals("C_BP_Group_ID")) else if (name.equals("C_BP_Group_ID"))
p_C_BP_Group_ID = para[i].getParameterAsInt(); p_C_BP_Group_ID = para[i].getParameterAsInt();
else else
log.log(Level.SEVERE, "Unknown Parameter: " + name); log.log(Level.SEVERE, "Unknown Parameter: " + name);
} }
p_C_DunningRun_ID = getRecord_ID(); p_C_DunningRun_ID = getRecord_ID();
} // prepare } // prepare
/** /**
* Process * Process
* @return message * @return message
* @throws Exception * @throws Exception
*/ */
protected String doIt () throws Exception protected String doIt () throws Exception
{ {
log.info("C_DunningRun_ID=" + p_C_DunningRun_ID log.info("C_DunningRun_ID=" + p_C_DunningRun_ID
+ ", Dispute=" + p_IncludeInDispute + ", Dispute=" + p_IncludeInDispute
+ ", C_BP_Group_ID=" + p_C_BP_Group_ID + ", C_BP_Group_ID=" + p_C_BP_Group_ID
+ ", C_BPartner_ID=" + p_C_BPartner_ID); + ", C_BPartner_ID=" + p_C_BPartner_ID);
m_run = new MDunningRun (getCtx(),p_C_DunningRun_ID, get_TrxName()); m_run = new MDunningRun (getCtx(),p_C_DunningRun_ID, get_TrxName());
if (m_run.get_ID() == 0) if (m_run.get_ID() == 0)
throw new IllegalArgumentException ("Not found MDunningRun"); throw new IllegalArgumentException ("Not found MDunningRun");
if (!m_run.deleteEntries(true)) if (!m_run.deleteEntries(true))
throw new IllegalArgumentException ("Cannot delete existing entries"); throw new IllegalArgumentException ("Cannot delete existing entries");
if (p_SalesRep_ID == 0) if (p_SalesRep_ID == 0)
throw new IllegalArgumentException ("No SalesRep"); throw new IllegalArgumentException ("No SalesRep");
if (p_C_Currency_ID == 0) if (p_C_Currency_ID == 0)
throw new IllegalArgumentException ("No Currency"); throw new IllegalArgumentException ("No Currency");
// //
@ -106,35 +113,37 @@ public class DunningRunCreate extends SvrProcess
return "@C_Invoice_ID@ #" + inv + " - @C_Payment_ID@=" + pay; return "@C_Invoice_ID@ #" + inv + " - @C_Payment_ID@=" + pay;
} // doIt } // doIt
/************************************************************************** /**************************************************************************
* Add Invoices to Run * Add Invoices to Run
* @return no of invoices * @return no of invoices
*/ */
private int addInvoices() private int addInvoices()
{ {
int count = 0; int count = 0;
String sql = "SELECT i.C_Invoice_ID, i.C_Currency_ID," String sql = "SELECT i.C_Invoice_ID, i.C_Currency_ID,"
+ " i.GrandTotal*i.MultiplierAP," + " i.GrandTotal*i.MultiplierAP,"
+ " invoiceOpen(i.C_Invoice_ID,i.C_InvoicePaySchedule_ID)*MultiplierAP," + " invoiceOpen(i.C_Invoice_ID,i.C_InvoicePaySchedule_ID)*MultiplierAP,"
+ " COALESCE(daysBetween(?,ips.DueDate),paymentTermDueDays(i.C_PaymentTerm_ID,i.DateInvoiced,?))," // ##1/2 + " COALESCE(daysBetween(?,ips.DueDate),paymentTermDueDays(i.C_PaymentTerm_ID,i.DateInvoiced,?))," // ##1/2
+ " i.IsInDispute, i.C_BPartner_ID " + " i.IsInDispute, i.C_BPartner_ID, i.C_InvoicePaySchedule_ID "
+ "FROM C_Invoice_v i " + "FROM C_Invoice_v i "
+ " LEFT OUTER JOIN C_InvoicePaySchedule ips ON (i.C_InvoicePaySchedule_ID=ips.C_InvoicePaySchedule_ID) " + " 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 + "WHERE i.IsPaid='N' AND i.AD_Client_ID=?" // ##3
+ " AND i.DocStatus IN ('CO','CL')" + " AND i.DocStatus IN ('CO','CL')"
// Only BP(Group) with Dunning defined + " AND (i.DunningGrace IS NULL OR i.DunningGrace<?) "
+ " AND EXISTS (SELECT * FROM C_DunningLevel dl " // Only BP(Group) with Dunning defined
+ "WHERE dl.C_DunningLevel_ID=?" // // ##4 + " AND EXISTS (SELECT * FROM C_DunningLevel dl "
+ " AND dl.C_Dunning_ID IN " + "WHERE dl.C_DunningLevel_ID=?" // // ##4
+ "(SELECT COALESCE(bp.C_Dunning_ID, bpg.C_Dunning_ID) " + " AND dl.C_Dunning_ID IN "
+ "FROM C_BPartner bp" + "(SELECT COALESCE(bp.C_Dunning_ID, bpg.C_Dunning_ID) "
+ " INNER JOIN C_BP_Group bpg ON (bp.C_BP_Group_ID=bpg.C_BP_Group_ID) " + "FROM C_BPartner bp"
+ "WHERE i.C_BPartner_ID=bp.C_BPartner_ID))"; + " INNER JOIN C_BP_Group bpg ON (bp.C_BP_Group_ID=bpg.C_BP_Group_ID) "
if (p_C_BPartner_ID != 0) + "WHERE i.C_BPartner_ID=bp.C_BPartner_ID" +
sql += " AND i.C_BPartner_ID=?"; // ##5 " AND (bp.DunningGrace IS NULL OR bp.DunningGrace<?)))";
else if (p_C_BP_Group_ID != 0) if (p_C_BPartner_ID != 0)
sql += " AND EXISTS (SELECT * FROM C_BPartner bp " 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 + "WHERE i.C_BPartner_ID=bp.C_BPartner_ID AND bp.C_BP_Group_ID=?)"; // ##5
if (p_OnlySOTrx) if (p_OnlySOTrx)
sql += " AND i.IsSOTrx='Y'"; 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 // if sequentially we must check for other levels with smaller days for
// which this invoice is not yet included! // which this invoice is not yet included!
MDunningLevel[] previousLevels = null;
if (m_level.getParent ().isCreateLevelsSequentially ()) { if (m_level.getParent ().isCreateLevelsSequentially ()) {
// Build a list of all topmost Dunning Levels // Build a list of all topmost Dunning Levels
MDunningLevel[] previousLevels = m_level.getPreviousLevels(); previousLevels = m_level.getPreviousLevels();
if (previousLevels!=null && previousLevels.length>0) { if (previousLevels!=null && previousLevels.length>0) {
String sqlAppend = ""; String sqlAppend = "";
for (int i=0; i<previousLevels.length; i++) for (int i=0; i<previousLevels.length; i++)
@ -161,42 +171,48 @@ public class DunningRunCreate extends SvrProcess
sql += sqlAppend; 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" + "FROM C_DunningRun dr"
+ " INNER JOIN C_DunningRunEntry dre ON (dr.C_DunningRun_ID=dre.C_DunningRun_ID)" + " 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) " + " 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(); BigDecimal DaysAfterDue = m_run.getLevel().getDaysAfterDue();
int DaysBetweenDunning = m_run.getLevel().getDaysBetweenDunning(); int DaysBetweenDunning = m_run.getLevel().getDaysBetweenDunning();
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
PreparedStatement pstmt2 = null; PreparedStatement pstmt2 = null;
try try
{ {
pstmt = DB.prepareStatement (sql, get_TrxName()); pstmt = DB.prepareStatement (sql, get_TrxName());
pstmt.setTimestamp(1, m_run.getDunningDate()); pstmt.setTimestamp(1, m_run.getDunningDate());
pstmt.setTimestamp(2, m_run.getDunningDate()); pstmt.setTimestamp(2, m_run.getDunningDate());
pstmt.setInt (3, m_run.getAD_Client_ID()); pstmt.setInt (3, m_run.getAD_Client_ID());
pstmt.setInt(4, m_run.getC_DunningLevel_ID()); pstmt.setTimestamp(4, m_run.getDunningDate());
if (p_C_BPartner_ID != 0) pstmt.setInt(5, m_run.getC_DunningLevel_ID());
pstmt.setInt (5, p_C_BPartner_ID); pstmt.setTimestamp(6, m_run.getDunningDate());
else if (p_C_BP_Group_ID != 0) if (p_C_BPartner_ID != 0)
pstmt.setInt (5, p_C_BP_Group_ID); pstmt.setInt (7, p_C_BPartner_ID);
// else if (p_C_BP_Group_ID != 0)
pstmt2 = DB.prepareStatement (sql2, get_TrxName()); pstmt.setInt (7, p_C_BP_Group_ID);
// //
ResultSet rs = pstmt.executeQuery (); pstmt2 = DB.prepareStatement (sql2, get_TrxName());
while (rs.next ()) //
{ ResultSet rs = pstmt.executeQuery ();
int C_Invoice_ID = rs.getInt(1); while (rs.next ())
int C_Currency_ID = rs.getInt(2); {
BigDecimal GrandTotal = rs.getBigDecimal(3); int C_Invoice_ID = rs.getInt(1);
BigDecimal Open = rs.getBigDecimal(4); int C_Currency_ID = rs.getInt(2);
int DaysDue = rs.getInt(5); BigDecimal GrandTotal = rs.getBigDecimal(3);
boolean IsInDispute = "Y".equals(rs.getString(6)); BigDecimal Open = rs.getBigDecimal(4);
int C_BPartner_ID = rs.getInt(7); 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) if (!p_IncludeInDispute && IsInDispute)
continue; continue;
@ -204,179 +220,193 @@ public class DunningRunCreate extends SvrProcess
continue; continue;
if (Env.ZERO.compareTo(Open) == 0) if (Env.ZERO.compareTo(Open) == 0)
continue; continue;
// //
int TimesDunned = 0; int TimesDunned = 0;
int DaysAfterLast = 0; int DaysAfterLast = 0;
// SubQuery // SubQuery
pstmt2.setInt (1, C_Invoice_ID); pstmt2.setTimestamp(1, m_run.getDunningDate());
ResultSet rs2 = pstmt2.executeQuery (); pstmt2.setInt (2, C_Invoice_ID);
if (rs2.next()) pstmt2.setInt (3, C_InvoicePaySchedule_ID);
{ ResultSet rs2 = pstmt2.executeQuery ();
TimesDunned = rs2.getInt(1); if (rs2.next())
DaysAfterLast = rs2.getInt(2); {
TimesDunned = rs2.getInt(1);
DaysAfterLast = rs2.getInt(2);
} }
rs2.close(); rs2.close();
if(previousLevels != null){
log.fine(TimesDunned + " - " + previousLevels.length);
}
// SubQuery // 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 ()) if (DaysBetweenDunning != 0 && DaysAfterLast < DaysBetweenDunning && !m_level.isShowAllDue () && !m_level.isShowNotDue ())
continue; continue;
// //
createInvoiceLine (C_Invoice_ID, C_Currency_ID, GrandTotal, Open, createInvoiceLine (C_Invoice_ID, C_InvoicePaySchedule_ID, C_Currency_ID, GrandTotal, Open,
DaysDue, IsInDispute, C_BPartner_ID, DaysDue, IsInDispute, C_BPartner_ID,
TimesDunned, DaysAfterLast); TimesDunned, DaysAfterLast);
count++; count++;
} }
rs.close (); rs.close ();
pstmt.close (); pstmt.close ();
pstmt = null; pstmt = null;
pstmt2.close(); pstmt2.close();
pstmt2 = null; pstmt2 = null;
} }
catch (Exception e) catch (Exception e)
{ {
log.log(Level.SEVERE, "addInvoices", e); log.log(Level.SEVERE, "addInvoices", e);
} }
try try
{ {
if (pstmt != null) if (pstmt != null)
pstmt.close (); pstmt.close ();
if (pstmt2 != null) if (pstmt2 != null)
pstmt2.close (); pstmt2.close ();
pstmt = null; pstmt = null;
pstmt2 = null; pstmt2 = null;
} }
catch (Exception e) catch (Exception e)
{ {
pstmt = null; pstmt = null;
pstmt2 = null; pstmt2 = null;
} }
return count; return count;
} // addInvoices } // addInvoices
/** /**
* Create Invoice Line * Create Invoice Line
* @param C_Invoice_ID * @param C_Invoice_ID
* @param C_Currency_ID * @param C_Currency_ID
* @param GrandTotal * @param GrandTotal
* @param Open * @param Open
* @param DaysDue * @param DaysDue
* @param IsInDispute * @param IsInDispute
* @param C_BPartner_ID * @param C_BPartner_ID
* @param TimesDunned * @param TimesDunned
* @param DaysAfterLast * @param DaysAfterLast
*/ */
private void createInvoiceLine (int C_Invoice_ID, int C_Currency_ID, private void createInvoiceLine (int C_Invoice_ID, int C_InvoicePaySchedule_ID, int C_Currency_ID,
BigDecimal GrandTotal, BigDecimal Open, BigDecimal GrandTotal, BigDecimal Open,
int DaysDue, boolean IsInDispute, int DaysDue, boolean IsInDispute,
int C_BPartner_ID, int TimesDunned, int DaysAfterLast) int C_BPartner_ID, int TimesDunned, int DaysAfterLast)
{ {
MDunningRunEntry entry = m_run.getEntry (C_BPartner_ID, p_C_Currency_ID, p_SalesRep_ID); MDunningRunEntry entry = m_run.getEntry (C_BPartner_ID, p_C_Currency_ID, p_SalesRep_ID);
if (entry.get_ID() == 0) if (entry.get_ID() == 0)
if (!entry.save()) if (!entry.save())
throw new IllegalStateException("Cannot save MDunningRunEntry"); throw new IllegalStateException("Cannot save MDunningRunEntry");
// //
MDunningRunLine line = new MDunningRunLine (entry); MDunningRunLine line = new MDunningRunLine (entry);
line.setInvoice(C_Invoice_ID, C_Currency_ID, GrandTotal, Open, line.setInvoice(C_Invoice_ID, C_Currency_ID, GrandTotal, Open,
new BigDecimal(0), DaysDue, IsInDispute, TimesDunned, new BigDecimal(0), DaysDue, IsInDispute, TimesDunned,
DaysAfterLast); DaysAfterLast);
line.setC_InvoicePaySchedule_ID(C_InvoicePaySchedule_ID);
if (!line.save()) if (!line.save())
throw new IllegalStateException("Cannot save MDunningRunLine"); 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 } // createInvoiceLine
/************************************************************************** /**************************************************************************
* Add Payments to Run * Add Payments to Run
* @return no of payments * @return no of payments
*/ */
private int addPayments() private int addPayments()
{ {
String sql = "SELECT C_Payment_ID, C_Currency_ID, PayAmt," String sql = "SELECT C_Payment_ID, C_Currency_ID, PayAmt,"
+ " paymentAvailable(C_Payment_ID), C_BPartner_ID " + " paymentAvailable(C_Payment_ID), C_BPartner_ID "
+ "FROM C_Payment_v p " + "FROM C_Payment_v p "
+ "WHERE AD_Client_ID=?" // ##1 + "WHERE AD_Client_ID=?" // ##1
+ " AND IsAllocated='N' AND C_BPartner_ID IS NOT NULL" + " AND IsAllocated='N' AND C_BPartner_ID IS NOT NULL"
+ " AND C_Charge_ID IS NULL" + " AND C_Charge_ID IS NULL"
+ " AND DocStatus IN ('CO','CL')" + " AND DocStatus IN ('CO','CL')"
// Only BP with Dunning defined // Only BP with Dunning defined
+ " AND EXISTS (SELECT * FROM C_BPartner bp " + " AND EXISTS (SELECT * FROM C_BPartner bp "
+ "WHERE p.C_BPartner_ID=bp.C_BPartner_ID" + "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 + " AND bp.C_Dunning_ID=(SELECT C_Dunning_ID FROM C_DunningLevel WHERE C_DunningLevel_ID=?))"; // ##2
if (p_C_BPartner_ID != 0) if (p_C_BPartner_ID != 0)
sql += " AND C_BPartner_ID=?"; // ##3 sql += " AND C_BPartner_ID=?"; // ##3
else if (p_C_BP_Group_ID != 0) else if (p_C_BP_Group_ID != 0)
sql += " AND EXISTS (SELECT * FROM C_BPartner bp " sql += " AND EXISTS (SELECT * FROM C_BPartner bp "
+ "WHERE p.C_BPartner_ID=bp.C_BPartner_ID AND bp.C_BP_Group_ID=?)"; // ##3 + "WHERE p.C_BPartner_ID=bp.C_BPartner_ID AND bp.C_BP_Group_ID=?)"; // ##3
if (p_OnlySOTrx) if (p_OnlySOTrx)
sql += " AND IsReceipt='Y'"; sql += " AND IsReceipt='Y'";
int count = 0; int count = 0;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
try try
{ {
pstmt = DB.prepareStatement (sql, get_TrxName()); pstmt = DB.prepareStatement (sql, get_TrxName());
pstmt.setInt (1, getAD_Client_ID()); pstmt.setInt (1, getAD_Client_ID());
pstmt.setInt (2, m_run.getC_DunningLevel_ID()); pstmt.setInt (2, m_run.getC_DunningLevel_ID());
if (p_C_BPartner_ID != 0) if (p_C_BPartner_ID != 0)
pstmt.setInt (3, p_C_BPartner_ID); pstmt.setInt (3, p_C_BPartner_ID);
else if (p_C_BP_Group_ID != 0) else if (p_C_BP_Group_ID != 0)
pstmt.setInt (3, p_C_BP_Group_ID); pstmt.setInt (3, p_C_BP_Group_ID);
ResultSet rs = pstmt.executeQuery (); ResultSet rs = pstmt.executeQuery ();
while (rs.next ()) while (rs.next ())
{ {
int C_Payment_ID = rs.getInt(1); int C_Payment_ID = rs.getInt(1);
int C_Currency_ID = rs.getInt(2); int C_Currency_ID = rs.getInt(2);
BigDecimal PayAmt = rs.getBigDecimal(3).negate(); BigDecimal PayAmt = rs.getBigDecimal(3).negate();
BigDecimal OpenAmt = rs.getBigDecimal(4).negate(); BigDecimal OpenAmt = rs.getBigDecimal(4).negate();
int C_BPartner_ID = rs.getInt(5); int C_BPartner_ID = rs.getInt(5);
// //
if (Env.ZERO.compareTo(OpenAmt) == 0) if (Env.ZERO.compareTo(OpenAmt) == 0)
continue; continue;
// //
createPaymentLine (C_Payment_ID, C_Currency_ID, PayAmt, OpenAmt, createPaymentLine (C_Payment_ID, C_Currency_ID, PayAmt, OpenAmt,
C_BPartner_ID); C_BPartner_ID);
count++; count++;
} }
rs.close (); rs.close ();
pstmt.close (); pstmt.close ();
pstmt = null; pstmt = null;
} }
catch (Exception e) catch (Exception e)
{ {
log.log(Level.SEVERE, sql, e); log.log(Level.SEVERE, sql, e);
} }
try try
{ {
if (pstmt != null) if (pstmt != null)
pstmt.close (); pstmt.close ();
pstmt = null; pstmt = null;
} }
catch (Exception e) catch (Exception e)
{ {
pstmt = null; pstmt = null;
} }
return count; return count;
} // addPayments } // addPayments
/** /**
* Create Payment Line * Create Payment Line
* @param C_Payment_ID * @param C_Payment_ID
* @param C_Currency_ID * @param C_Currency_ID
* @param PayAmt * @param PayAmt
* @param OpenAmt * @param OpenAmt
* @param C_BPartner_ID * @param C_BPartner_ID
*/ */
private void createPaymentLine (int C_Payment_ID, int C_Currency_ID, private void createPaymentLine (int C_Payment_ID, int C_Currency_ID,
BigDecimal PayAmt, BigDecimal OpenAmt, int C_BPartner_ID) BigDecimal PayAmt, BigDecimal OpenAmt, int C_BPartner_ID)
{ {
MDunningRunEntry entry = m_run.getEntry (C_BPartner_ID, p_C_Currency_ID, p_SalesRep_ID); MDunningRunEntry entry = m_run.getEntry (C_BPartner_ID, p_C_Currency_ID, p_SalesRep_ID);
if (entry.get_ID() == 0) if (entry.get_ID() == 0)
if (!entry.save()) if (!entry.save())
throw new IllegalStateException("Cannot save MDunningRunEntry"); throw new IllegalStateException("Cannot save MDunningRunEntry");
// //
MDunningRunLine line = new MDunningRunLine (entry); MDunningRunLine line = new MDunningRunLine (entry);
line.setPayment(C_Payment_ID, C_Currency_ID, PayAmt, OpenAmt); line.setPayment(C_Payment_ID, C_Currency_ID, PayAmt, OpenAmt);
if (!line.save()) if (!line.save())
throw new IllegalStateException("Cannot save MDunningRunLine"); throw new IllegalStateException("Cannot save MDunningRunLine");
} // createPaymentLine } // 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;