Implement [2872010] - Dunning Run for a complete Dunning (not just level)
https://sourceforge.net/tracker/?func=detail&atid=879335&aid=2872010&group_id=176962
This commit is contained in:
parent
b0275724b6
commit
992d0f422a
|
@ -176,10 +176,8 @@ public class ModelClassGenerator
|
|||
.append("\t *").append(NL)
|
||||
.append("\t */").append(NL)
|
||||
.append("\tprivate static final long serialVersionUID = ")
|
||||
.append(Adempiere.DB_VERSION.substring(0,4))
|
||||
.append(Adempiere.DB_VERSION.substring(5,7))
|
||||
.append(Adempiere.DB_VERSION.substring(8))
|
||||
.append("L;").append(NL)
|
||||
.append(String.format("%1$tY%1$tm%1$td", new Timestamp(System.currentTimeMillis())))
|
||||
.append("L;").append(NL)
|
||||
//.append("\tprivate static final long serialVersionUID = 1L;").append(NL)
|
||||
|
||||
// Standard Constructor
|
||||
|
|
|
@ -62,6 +62,21 @@ public interface I_C_DunningRun
|
|||
*/
|
||||
public int getAD_Org_ID();
|
||||
|
||||
/** Column name C_Dunning_ID */
|
||||
public static final String COLUMNNAME_C_Dunning_ID = "C_Dunning_ID";
|
||||
|
||||
/** Set Dunning.
|
||||
* Dunning Rules for overdue invoices
|
||||
*/
|
||||
public void setC_Dunning_ID (int C_Dunning_ID);
|
||||
|
||||
/** Get Dunning.
|
||||
* Dunning Rules for overdue invoices
|
||||
*/
|
||||
public int getC_Dunning_ID();
|
||||
|
||||
public I_C_Dunning getC_Dunning() throws RuntimeException;
|
||||
|
||||
/** Column name C_DunningLevel_ID */
|
||||
public static final String COLUMNNAME_C_DunningLevel_ID = "C_DunningLevel_ID";
|
||||
|
||||
|
|
|
@ -135,6 +135,17 @@ public interface I_C_DunningRunEntry
|
|||
|
||||
public I_C_Currency getC_Currency() throws RuntimeException;
|
||||
|
||||
/** Column name C_DunningLevel_ID */
|
||||
public static final String COLUMNNAME_C_DunningLevel_ID = "C_DunningLevel_ID";
|
||||
|
||||
/** Set Dunning Level */
|
||||
public void setC_DunningLevel_ID (int C_DunningLevel_ID);
|
||||
|
||||
/** Get Dunning Level */
|
||||
public int getC_DunningLevel_ID();
|
||||
|
||||
public I_C_DunningLevel getC_DunningLevel() throws RuntimeException;
|
||||
|
||||
/** Column name C_DunningRunEntry_ID */
|
||||
public static final String COLUMNNAME_C_DunningRunEntry_ID = "C_DunningRunEntry_ID";
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ import java.sql.PreparedStatement;
|
|||
import java.sql.ResultSet;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
|
@ -30,13 +31,15 @@ import org.compiere.util.DB;
|
|||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: MDunningRun.java,v 1.2 2006/07/30 00:51:03 jjanke Exp $
|
||||
*
|
||||
* FR 2872010 - Dunning Run for a complete Dunning (not just level) - Developer: Carlos Ruiz - globalqss - Sponsor: Metas
|
||||
*/
|
||||
public class MDunningRun extends X_C_DunningRun
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 3786948971790998292L;
|
||||
private static final long serialVersionUID = 8450276205229694644L;
|
||||
|
||||
/**
|
||||
* Standard Constructor
|
||||
|
@ -66,19 +69,43 @@ public class MDunningRun extends X_C_DunningRun
|
|||
super(ctx, rs, trxName);
|
||||
} // MDunningRun
|
||||
|
||||
private MDunningLevel m_level = null;
|
||||
private MDunningRunEntry[] m_entries = null;
|
||||
private MDunningLevel[] m_levels = null;
|
||||
|
||||
/**
|
||||
* Get Dunning Level
|
||||
* @return level
|
||||
* Get Dunning Levels
|
||||
* @return array of level
|
||||
*/
|
||||
public MDunningLevel getLevel()
|
||||
{
|
||||
if (m_level == null)
|
||||
m_level = new MDunningLevel (getCtx(), getC_DunningLevel_ID(), get_TrxName());
|
||||
return m_level;
|
||||
} // getLevel
|
||||
public MDunningLevel[] getLevels() {
|
||||
if (m_levels != null)
|
||||
return m_levels;
|
||||
|
||||
List<MDunningLevel> levels;
|
||||
if (getC_DunningLevel_ID() > 0) {
|
||||
// just one level
|
||||
levels = new Query(
|
||||
getCtx(),
|
||||
MDunningLevel.Table_Name,
|
||||
"C_Dunning_ID=? AND C_DunningLevel_ID=?",
|
||||
get_TrxName())
|
||||
.setParameters(new Object[]{getC_Dunning_ID(), getC_DunningLevel_ID()})
|
||||
.setOrderBy("DaysAfterDue DESC, C_DunningLevel_ID")
|
||||
.list();
|
||||
} else {
|
||||
// all levels of the dun
|
||||
levels = new Query(
|
||||
getCtx(),
|
||||
MDunningLevel.Table_Name,
|
||||
"C_Dunning_ID=?",
|
||||
get_TrxName())
|
||||
.setParameters(new Object[]{getC_Dunning_ID()})
|
||||
.setOrderBy("DaysAfterDue DESC, C_DunningLevel_ID")
|
||||
.list();
|
||||
}
|
||||
m_levels = new MDunningLevel[levels.size()];
|
||||
levels.toArray (m_levels);
|
||||
return m_levels;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Entries
|
||||
|
@ -90,7 +117,7 @@ public class MDunningRun extends X_C_DunningRun
|
|||
if (m_entries != null && !requery)
|
||||
return m_entries;
|
||||
|
||||
String sql = "SELECT * FROM C_DunningRunEntry WHERE C_DunningRun_ID=?";
|
||||
String sql = "SELECT * FROM C_DunningRunEntry WHERE C_DunningRun_ID=? ORDER BY C_DunningLevel_ID, C_DunningRunEntry_ID";
|
||||
ArrayList<MDunningRunEntry> list = new ArrayList<MDunningRunEntry>();
|
||||
PreparedStatement pstmt = null;
|
||||
try
|
||||
|
@ -147,9 +174,10 @@ public class MDunningRun extends X_C_DunningRun
|
|||
* @param C_BPartner_ID business partner
|
||||
* @param C_Currency_ID currency
|
||||
* @param SalesRep_ID sales rep
|
||||
* @param C_DunningLevel_ID dunning level
|
||||
* @return entry
|
||||
*/
|
||||
public MDunningRunEntry getEntry (int C_BPartner_ID, int C_Currency_ID, int SalesRep_ID)
|
||||
public MDunningRunEntry getEntry (int C_BPartner_ID, int C_Currency_ID, int SalesRep_ID, int C_DunningLevel_ID)
|
||||
{
|
||||
// TODO: Related BP
|
||||
int C_BPartnerRelated_ID = C_BPartner_ID;
|
||||
|
@ -158,7 +186,7 @@ public class MDunningRun extends X_C_DunningRun
|
|||
for (int i = 0; i < m_entries.length; i++)
|
||||
{
|
||||
MDunningRunEntry entry = m_entries[i];
|
||||
if (entry.getC_BPartner_ID() == C_BPartnerRelated_ID)
|
||||
if (entry.getC_BPartner_ID() == C_BPartnerRelated_ID && entry.getC_DunningLevel_ID() == C_DunningLevel_ID)
|
||||
return entry;
|
||||
}
|
||||
// New Entry
|
||||
|
@ -169,9 +197,10 @@ public class MDunningRun extends X_C_DunningRun
|
|||
if (entry.getSalesRep_ID() == 0)
|
||||
entry.setSalesRep_ID (SalesRep_ID);
|
||||
entry.setC_Currency_ID (C_Currency_ID);
|
||||
entry.setC_DunningLevel_ID(C_DunningLevel_ID);
|
||||
//
|
||||
m_entries = null;
|
||||
return entry;
|
||||
} // getEntry
|
||||
|
||||
|
||||
} // MDunningRun
|
||||
|
|
|
@ -33,7 +33,9 @@ import org.compiere.util.Env;
|
|||
* @author Jorg Janke
|
||||
* @version $Id: MDunningRunEntry.java,v 1.2 2006/07/30 00:51:05 jjanke Exp $
|
||||
*
|
||||
* @author Teo Sarca - BF [ 1739022 ], BF [ 1739096 ]
|
||||
* @author Teo Sarca - BF [ 1739022 ], BF [ 1739096 ]
|
||||
*
|
||||
* FR 2872010 - Dunning Run for a complete Dunning (not just level) - Developer: Carlos Ruiz - globalqss - Sponsor: Metas
|
||||
*/
|
||||
public class MDunningRunEntry extends X_C_DunningRunEntry
|
||||
{
|
||||
|
@ -41,7 +43,7 @@ public class MDunningRunEntry extends X_C_DunningRunEntry
|
|||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 2028055451030209868L;
|
||||
|
||||
|
||||
/** Logger */
|
||||
private static CLogger s_log = CLogger.getCLogger (MPayment.class);
|
||||
|
||||
|
@ -159,7 +161,7 @@ public class MDunningRunEntry extends X_C_DunningRunEntry
|
|||
throw new BPartnerNoAddressException(bp);
|
||||
}
|
||||
// User with location
|
||||
MUser[] users = MUser.getOfBPartner(getCtx(), bp.getC_BPartner_ID(), null);
|
||||
MUser[] users = MUser.getOfBPartner(getCtx(), bp.getC_BPartner_ID(), get_TrxName());
|
||||
if (users.length == 1)
|
||||
setAD_User_ID (users[0].getAD_User_ID());
|
||||
else
|
||||
|
@ -221,7 +223,6 @@ public class MDunningRunEntry extends X_C_DunningRunEntry
|
|||
return retValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get Parent
|
||||
* @return Dunning Run
|
||||
|
@ -236,6 +237,7 @@ public class MDunningRunEntry extends X_C_DunningRunEntry
|
|||
@Override
|
||||
protected boolean beforeSave (boolean newRecord)
|
||||
{
|
||||
I_C_DunningLevel level = getC_DunningLevel();
|
||||
// Set Amt
|
||||
if (isProcessed ())
|
||||
{
|
||||
|
@ -245,20 +247,17 @@ public class MDunningRunEntry extends X_C_DunningRunEntry
|
|||
theseLines[i].setProcessed (true);
|
||||
theseLines[i].save (get_TrxName());
|
||||
}
|
||||
MDunningRun parent = getParent();
|
||||
if (parent.getLevel ().isSetCreditStop () || parent.getLevel ().isSetPaymentTerm ())
|
||||
if (level.isSetCreditStop () || level.isSetPaymentTerm ())
|
||||
{
|
||||
MBPartner thisBPartner = MBPartner.get (getCtx(), getC_BPartner_ID());
|
||||
if (parent.getLevel ().isSetCreditStop ())
|
||||
if (level.isSetCreditStop ())
|
||||
thisBPartner.setSOCreditStatus (X_C_BPartner.SOCREDITSTATUS_CreditStop);
|
||||
if (parent.getLevel ().isSetPaymentTerm ())
|
||||
thisBPartner.setC_PaymentTerm_ID (parent.getLevel().getC_PaymentTerm_ID ());
|
||||
if (level.isSetPaymentTerm ())
|
||||
thisBPartner.setC_PaymentTerm_ID (level.getC_PaymentTerm_ID ());
|
||||
thisBPartner.save ();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} // beforeSave
|
||||
|
||||
|
||||
|
||||
} // MDunningRunEntry
|
||||
|
|
|
@ -31,7 +31,7 @@ public class X_C_DunningRun extends PO implements I_C_DunningRun, I_Persistent
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 20090915L;
|
||||
private static final long serialVersionUID = 20091004L;
|
||||
|
||||
/** Standard Constructor */
|
||||
public X_C_DunningRun (Properties ctx, int C_DunningRun_ID, String trxName)
|
||||
|
@ -39,7 +39,7 @@ public class X_C_DunningRun extends PO implements I_C_DunningRun, I_Persistent
|
|||
super (ctx, C_DunningRun_ID, trxName);
|
||||
/** if (C_DunningRun_ID == 0)
|
||||
{
|
||||
setC_DunningLevel_ID (0);
|
||||
setC_Dunning_ID (0);
|
||||
setC_DunningRun_ID (0);
|
||||
setDunningDate (new Timestamp( System.currentTimeMillis() ));
|
||||
// @#Date@
|
||||
|
@ -75,6 +75,34 @@ public class X_C_DunningRun extends PO implements I_C_DunningRun, I_Persistent
|
|||
return sb.toString();
|
||||
}
|
||||
|
||||
public I_C_Dunning getC_Dunning() throws RuntimeException
|
||||
{
|
||||
return (I_C_Dunning)MTable.get(getCtx(), I_C_Dunning.Table_Name)
|
||||
.getPO(getC_Dunning_ID(), get_TrxName()); }
|
||||
|
||||
/** Set Dunning.
|
||||
@param C_Dunning_ID
|
||||
Dunning Rules for overdue invoices
|
||||
*/
|
||||
public void setC_Dunning_ID (int C_Dunning_ID)
|
||||
{
|
||||
if (C_Dunning_ID < 1)
|
||||
set_ValueNoCheck (COLUMNNAME_C_Dunning_ID, null);
|
||||
else
|
||||
set_ValueNoCheck (COLUMNNAME_C_Dunning_ID, Integer.valueOf(C_Dunning_ID));
|
||||
}
|
||||
|
||||
/** Get Dunning.
|
||||
@return Dunning Rules for overdue invoices
|
||||
*/
|
||||
public int getC_Dunning_ID ()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_C_Dunning_ID);
|
||||
if (ii == null)
|
||||
return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
|
||||
public I_C_DunningLevel getC_DunningLevel() throws RuntimeException
|
||||
{
|
||||
return (I_C_DunningLevel)MTable.get(getCtx(), I_C_DunningLevel.Table_Name)
|
||||
|
|
|
@ -32,7 +32,7 @@ public class X_C_DunningRunEntry extends PO implements I_C_DunningRunEntry, I_Pe
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 20090915L;
|
||||
private static final long serialVersionUID = 20091004L;
|
||||
|
||||
/** Standard Constructor */
|
||||
public X_C_DunningRunEntry (Properties ctx, int C_DunningRunEntry_ID, String trxName)
|
||||
|
@ -44,6 +44,8 @@ public class X_C_DunningRunEntry extends PO implements I_C_DunningRunEntry, I_Pe
|
|||
setC_BPartner_ID (0);
|
||||
setC_BPartner_Location_ID (0);
|
||||
setC_Currency_ID (0);
|
||||
setC_DunningLevel_ID (0);
|
||||
// @C_DunningLevel_ID@
|
||||
setC_DunningRunEntry_ID (0);
|
||||
setC_DunningRun_ID (0);
|
||||
setProcessed (false);
|
||||
|
@ -212,6 +214,31 @@ public class X_C_DunningRunEntry extends PO implements I_C_DunningRunEntry, I_Pe
|
|||
return ii.intValue();
|
||||
}
|
||||
|
||||
public I_C_DunningLevel getC_DunningLevel() throws RuntimeException
|
||||
{
|
||||
return (I_C_DunningLevel)MTable.get(getCtx(), I_C_DunningLevel.Table_Name)
|
||||
.getPO(getC_DunningLevel_ID(), get_TrxName()); }
|
||||
|
||||
/** Set Dunning Level.
|
||||
@param C_DunningLevel_ID Dunning Level */
|
||||
public void setC_DunningLevel_ID (int C_DunningLevel_ID)
|
||||
{
|
||||
if (C_DunningLevel_ID < 1)
|
||||
set_ValueNoCheck (COLUMNNAME_C_DunningLevel_ID, null);
|
||||
else
|
||||
set_ValueNoCheck (COLUMNNAME_C_DunningLevel_ID, Integer.valueOf(C_DunningLevel_ID));
|
||||
}
|
||||
|
||||
/** Get Dunning Level.
|
||||
@return Dunning Level */
|
||||
public int getC_DunningLevel_ID ()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_C_DunningLevel_ID);
|
||||
if (ii == null)
|
||||
return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
|
||||
/** Set Dunning Run Entry.
|
||||
@param C_DunningRunEntry_ID
|
||||
Dunning Run Entry
|
||||
|
|
|
@ -57,15 +57,15 @@ import org.apache.ecs.xhtml.td;
|
|||
import org.apache.ecs.xhtml.th;
|
||||
import org.apache.ecs.xhtml.tr;
|
||||
import org.compiere.model.MClient;
|
||||
import org.compiere.model.MDunningRunEntry;
|
||||
import org.compiere.model.MInOut;
|
||||
import org.compiere.model.MInvoice;
|
||||
import org.compiere.model.MOrder;
|
||||
import org.compiere.model.MPaySelectionCheck;
|
||||
import org.compiere.model.MProject;
|
||||
import org.compiere.model.MQuery;
|
||||
import org.compiere.model.MRfQResponse;
|
||||
import org.compiere.model.PrintInfo;
|
||||
import org.compiere.model.X_C_DunningRunEntry;
|
||||
import org.compiere.model.X_C_Invoice;
|
||||
import org.compiere.model.X_C_Order;
|
||||
import org.compiere.model.X_C_PaySelectionCheck;
|
||||
import org.compiere.model.X_C_Project;
|
||||
import org.compiere.model.X_C_RfQResponse;
|
||||
import org.compiere.model.X_M_InOut;
|
||||
import org.compiere.print.layout.LayoutEngine;
|
||||
import org.compiere.process.ProcessInfo;
|
||||
import org.compiere.util.CLogger;
|
||||
|
@ -75,8 +75,8 @@ import org.compiere.util.Env;
|
|||
import org.compiere.util.Ini;
|
||||
import org.compiere.util.Language;
|
||||
import org.compiere.util.Util;
|
||||
import org.eevolution.model.X_DD_Order;
|
||||
import org.eevolution.model.X_PP_Order;
|
||||
import org.eevolution.model.MDDOrder;
|
||||
import org.eevolution.model.MPPOrder;
|
||||
|
||||
/**
|
||||
* Report Engine.
|
||||
|
@ -99,6 +99,8 @@ import org.eevolution.model.X_PP_Order;
|
|||
* https://sourceforge.net/tracker/?func=detail&aid=2828300&group_id=176962&atid=879332
|
||||
* <li>BF [ 2828886 ] Problem with reports from temporary tables
|
||||
* https://sourceforge.net/tracker/?func=detail&atid=879332&aid=2828886&group_id=176962
|
||||
*
|
||||
* FR 2872010 - Dunning Run for a complete Dunning (not just level) - Developer: Carlos Ruiz - globalqss - Sponsor: Metas
|
||||
*/
|
||||
public class ReportEngine implements PrintServiceAttributeListener
|
||||
{
|
||||
|
@ -1187,10 +1189,10 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
|
|||
"C_PaySelectionCheck_ID", "C_PaySelectionCheck_ID",
|
||||
"C_DunningRunEntry_ID" , "PP_Order_ID" , "DD_Order_ID" };
|
||||
private static final int[] DOC_TABLE_ID = new int[] {
|
||||
X_C_Order.Table_ID, X_M_InOut.Table_ID, X_C_Invoice.Table_ID, X_C_Project.Table_ID,
|
||||
X_C_RfQResponse.Table_ID,
|
||||
X_C_PaySelectionCheck.Table_ID, X_C_PaySelectionCheck.Table_ID,
|
||||
X_C_DunningRunEntry.Table_ID , X_PP_Order.Table_ID ,X_DD_Order.Table_ID };
|
||||
MOrder.Table_ID, MInOut.Table_ID, MInvoice.Table_ID, MProject.Table_ID,
|
||||
MRfQResponse.Table_ID,
|
||||
MPaySelectionCheck.Table_ID, MPaySelectionCheck.Table_ID,
|
||||
MDunningRunEntry.Table_ID, MPPOrder.Table_ID, MDDOrder.Table_ID };
|
||||
|
||||
/**************************************************************************
|
||||
* Get Document Print Engine for Document Type.
|
||||
|
@ -1257,7 +1259,7 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
|
|||
+ " INNER JOIN AD_Client c ON (d.AD_Client_ID=c.AD_Client_ID)"
|
||||
+ " INNER JOIN C_BPartner bp ON (d.C_BPartner_ID=bp.C_BPartner_ID)"
|
||||
+ " INNER JOIN C_DunningRun dr ON (d.C_DunningRun_ID=dr.C_DunningRun_ID)"
|
||||
+ " INNER JOIN C_DunningLevel dl ON (dl.C_DunningLevel_ID=dr.C_DunningLevel_ID) "
|
||||
+ " INNER JOIN C_DunningLevel dl ON (dl.C_DunningLevel_ID=d.C_DunningLevel_ID) "
|
||||
+ "WHERE d.C_DunningRunEntry_ID=?"; // info from Dunning
|
||||
else if (type == REMITTANCE)
|
||||
sql = "SELECT pf.Remittance_PrintFormat_ID,"
|
||||
|
|
|
@ -29,7 +29,6 @@ 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;
|
||||
|
@ -40,6 +39,8 @@ import org.compiere.util.EMail;
|
|||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: DunningPrint.java,v 1.2 2006/07/30 00:51:02 jjanke Exp $
|
||||
*
|
||||
* FR 2872010 - Dunning Run for a complete Dunning (not just level) - Developer: Carlos Ruiz - globalqss - Sponsor: Metas
|
||||
*/
|
||||
public class DunningPrint extends SvrProcess
|
||||
{
|
||||
|
@ -108,10 +109,6 @@ public class DunningPrint extends SvrProcess
|
|||
MDunningRun run = new MDunningRun (getCtx(), p_C_DunningRun_ID, get_TrxName());
|
||||
if (run.get_ID() == 0)
|
||||
throw new AdempiereUserError ("@NotFound@: @C_DunningRun_ID@ - " + p_C_DunningRun_ID);
|
||||
// Print Format on Dunning Level
|
||||
MDunningLevel level = new MDunningLevel (getCtx(), run.getC_DunningLevel_ID(), get_TrxName());
|
||||
MPrintFormat format = MPrintFormat.get (getCtx(), level.getDunning_PrintFormat_ID(), false);
|
||||
|
||||
MClient client = MClient.get(getCtx());
|
||||
|
||||
int count = 0;
|
||||
|
@ -120,6 +117,13 @@ public class DunningPrint extends SvrProcess
|
|||
for (int i = 0; i < entries.length; i++)
|
||||
{
|
||||
MDunningRunEntry entry = entries[i];
|
||||
|
||||
// Print Format on Dunning Level
|
||||
MDunningLevel level = new MDunningLevel (getCtx(), entry.getC_DunningLevel_ID(), get_TrxName());
|
||||
MPrintFormat format = null;
|
||||
if (level.getDunning_PrintFormat_ID() > 0)
|
||||
format = MPrintFormat.get (getCtx(), level.getDunning_PrintFormat_ID(), false);
|
||||
|
||||
if (p_IsOnlyIfBPBalance && entry.getAmt().signum() <= 0)
|
||||
continue;
|
||||
if (p_PrintUnprocessedOnly && entry.isProcessed())
|
||||
|
@ -157,11 +161,13 @@ public class DunningPrint extends SvrProcess
|
|||
// Engine
|
||||
PrintInfo info = new PrintInfo(
|
||||
bp.getName(),
|
||||
X_C_DunningRunEntry.Table_ID,
|
||||
MDunningRunEntry.Table_ID,
|
||||
entry.getC_DunningRunEntry_ID(),
|
||||
entry.getC_BPartner_ID());
|
||||
info.setDescription(bp.getName() + ", Amt=" + entry.getAmt());
|
||||
ReportEngine re = new ReportEngine(getCtx(), format, query, info);
|
||||
ReportEngine re = null;
|
||||
if (format != null)
|
||||
re = new ReportEngine(getCtx(), format, query, info);
|
||||
boolean printed = false;
|
||||
if (p_EMailPDF)
|
||||
{
|
||||
|
@ -185,9 +191,11 @@ public class DunningPrint extends SvrProcess
|
|||
email.setMessageText (message);
|
||||
}
|
||||
//
|
||||
File attachment = re.getPDF(File.createTempFile("Dunning", ".pdf"));
|
||||
log.fine(to + " - " + attachment);
|
||||
email.addAttachment(attachment);
|
||||
if (re != null) {
|
||||
File attachment = re.getPDF(File.createTempFile("Dunning", ".pdf"));
|
||||
log.fine(to + " - " + attachment);
|
||||
email.addAttachment(attachment);
|
||||
}
|
||||
//
|
||||
String msg = email.send();
|
||||
MUserMail um = new MUserMail(mText, entry.getAD_User_ID(), email);
|
||||
|
@ -208,9 +216,11 @@ public class DunningPrint extends SvrProcess
|
|||
}
|
||||
else
|
||||
{
|
||||
re.print ();
|
||||
count++;
|
||||
printed = true;
|
||||
if (re != null) {
|
||||
re.print ();
|
||||
count++;
|
||||
printed = true;
|
||||
}
|
||||
}
|
||||
if (printed)
|
||||
{
|
||||
|
|
|
@ -38,6 +38,8 @@ import org.compiere.util.Env;
|
|||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: DunningRunCreate.java,v 1.2 2006/07/30 00:51:02 jjanke Exp $
|
||||
*
|
||||
* FR 2872010 - Dunning Run for a complete Dunning (not just level) - Developer: Carlos Ruiz - globalqss - Sponsor: Metas
|
||||
*/
|
||||
public class DunningRunCreate extends SvrProcess
|
||||
{
|
||||
|
@ -52,7 +54,6 @@ public class DunningRunCreate extends SvrProcess
|
|||
private int p_AD_Org_ID = 0;
|
||||
|
||||
private MDunningRun m_run = null;
|
||||
private MDunningLevel m_level = null;
|
||||
|
||||
/**
|
||||
* Prepare - e.g., get Parameters.
|
||||
|
@ -108,23 +109,27 @@ public class DunningRunCreate extends SvrProcess
|
|||
if (p_C_Currency_ID == 0)
|
||||
throw new IllegalArgumentException ("No Currency");
|
||||
//
|
||||
m_level = m_run.getLevel ();
|
||||
|
||||
int inv = addInvoices();
|
||||
int pay = addPayments();
|
||||
|
||||
if (m_level.isChargeFee ())
|
||||
addFees();
|
||||
|
||||
int inv = 0;
|
||||
int pay = 0;
|
||||
for (MDunningLevel l_level : m_run.getLevels()) {
|
||||
|
||||
inv += addInvoices(l_level);
|
||||
pay += addPayments(l_level);
|
||||
|
||||
if (l_level.isChargeFee ())
|
||||
addFees(l_level);
|
||||
}
|
||||
|
||||
return "@C_Invoice_ID@ #" + inv + " - @C_Payment_ID@=" + pay;
|
||||
} // doIt
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Add Invoices to Run
|
||||
* @return no of invoices
|
||||
* @param level the Dunning level
|
||||
* @return no of invoices
|
||||
*/
|
||||
private int addInvoices()
|
||||
private int addInvoices(MDunningLevel level)
|
||||
{
|
||||
int count = 0;
|
||||
String sql = "SELECT i.C_Invoice_ID, i.C_Currency_ID,"
|
||||
|
@ -164,9 +169,9 @@ 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 ()) {
|
||||
if (level.getParent ().isCreateLevelsSequentially ()) {
|
||||
// Build a list of all topmost Dunning Levels
|
||||
previousLevels = m_level.getPreviousLevels();
|
||||
previousLevels = level.getPreviousLevels();
|
||||
if (previousLevels!=null && previousLevels.length>0) {
|
||||
String sqlAppend = "";
|
||||
for (int i=0; i<previousLevels.length; i++)
|
||||
|
@ -186,8 +191,8 @@ public class DunningRunCreate extends SvrProcess
|
|||
+ "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();
|
||||
BigDecimal DaysAfterDue = level.getDaysAfterDue();
|
||||
int DaysBetweenDunning = level.getDaysBetweenDunning();
|
||||
|
||||
PreparedStatement pstmt = null;
|
||||
PreparedStatement pstmt2 = null;
|
||||
|
@ -199,7 +204,7 @@ public class DunningRunCreate extends SvrProcess
|
|||
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.setInt(5, level.getC_DunningLevel_ID());
|
||||
pstmt.setTimestamp(6, m_run.getDunningDate());
|
||||
if (p_C_BPartner_ID != 0)
|
||||
pstmt.setInt (7, p_C_BPartner_ID);
|
||||
|
@ -219,13 +224,13 @@ public class DunningRunCreate extends SvrProcess
|
|||
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("DaysAfterDue: " + DaysAfterDue.intValue() + " isShowAllDue: " + 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;
|
||||
if (DaysDue < DaysAfterDue.intValue() && !m_level.isShowAllDue ())
|
||||
if (DaysDue < DaysAfterDue.intValue() && !level.isShowAllDue())
|
||||
continue;
|
||||
if (Env.ZERO.compareTo(Open) == 0)
|
||||
continue;
|
||||
|
@ -243,21 +248,22 @@ public class DunningRunCreate extends SvrProcess
|
|||
DaysAfterLast = rs2.getInt(2);
|
||||
}
|
||||
rs2.close();
|
||||
if(previousLevels != null){
|
||||
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()) {
|
||||
if (level.getParent().isCreateLevelsSequentially() && previousLevels!=null && TimesDunned>previousLevels.length
|
||||
&& !level.isShowAllDue() && !level.isShowNotDue())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
log.fine(DaysBetweenDunning + " - " + DaysAfterLast);
|
||||
if (DaysBetweenDunning != 0 && DaysAfterLast < DaysBetweenDunning && !m_level.isShowAllDue () && !m_level.isShowNotDue ())
|
||||
if (DaysBetweenDunning != 0 && DaysAfterLast < DaysBetweenDunning && !level.isShowAllDue() && !level.isShowNotDue())
|
||||
continue;
|
||||
//
|
||||
if (createInvoiceLine (C_Invoice_ID, C_InvoicePaySchedule_ID, C_Currency_ID, GrandTotal, Open,
|
||||
DaysDue, IsInDispute, C_BPartner_ID,
|
||||
TimesDunned, DaysAfterLast))
|
||||
if (createInvoiceLine(C_Invoice_ID, C_InvoicePaySchedule_ID, C_Currency_ID, GrandTotal, Open,
|
||||
DaysDue, IsInDispute, C_BPartner_ID,
|
||||
TimesDunned, DaysAfterLast, level.getC_DunningLevel_ID()))
|
||||
{
|
||||
count++;
|
||||
}
|
||||
|
@ -288,16 +294,17 @@ public class DunningRunCreate extends SvrProcess
|
|||
* @param C_BPartner_ID
|
||||
* @param TimesDunned
|
||||
* @param DaysAfterLast
|
||||
* @param c_DunningLevel_ID
|
||||
*/
|
||||
private boolean 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)
|
||||
int C_BPartner_ID, int TimesDunned, int DaysAfterLast, int c_DunningLevel_ID)
|
||||
{
|
||||
MDunningRunEntry entry = null;
|
||||
try
|
||||
{
|
||||
entry = m_run.getEntry (C_BPartner_ID, p_C_Currency_ID, p_SalesRep_ID);
|
||||
entry = m_run.getEntry (C_BPartner_ID, p_C_Currency_ID, p_SalesRep_ID, c_DunningLevel_ID);
|
||||
}
|
||||
catch (BPartnerNoAddressException e)
|
||||
{
|
||||
|
@ -322,7 +329,7 @@ public class DunningRunCreate extends SvrProcess
|
|||
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());
|
||||
invoice.setC_DunningLevel_ID(c_DunningLevel_ID);
|
||||
if (!invoice.save())
|
||||
throw new IllegalStateException("Cannot update dunning level information in invoice");
|
||||
|
||||
|
@ -332,9 +339,10 @@ public class DunningRunCreate extends SvrProcess
|
|||
|
||||
/**************************************************************************
|
||||
* Add Payments to Run
|
||||
* @param level the Dunning level
|
||||
* @return no of payments
|
||||
*/
|
||||
private int addPayments()
|
||||
private int addPayments(MDunningLevel level)
|
||||
{
|
||||
String sql = "SELECT C_Payment_ID, C_Currency_ID, PayAmt,"
|
||||
+ " paymentAvailable(C_Payment_ID), C_BPartner_ID "
|
||||
|
@ -364,7 +372,7 @@ public class DunningRunCreate extends SvrProcess
|
|||
{
|
||||
pstmt = DB.prepareStatement (sql, get_TrxName());
|
||||
pstmt.setInt (1, getAD_Client_ID());
|
||||
pstmt.setInt (2, m_run.getC_DunningLevel_ID());
|
||||
pstmt.setInt (2, level.getC_DunningLevel_ID());
|
||||
if (p_C_BPartner_ID != 0)
|
||||
pstmt.setInt (3, p_C_BPartner_ID);
|
||||
else if (p_C_BP_Group_ID != 0)
|
||||
|
@ -383,7 +391,7 @@ public class DunningRunCreate extends SvrProcess
|
|||
continue;
|
||||
//
|
||||
if (createPaymentLine (C_Payment_ID, C_Currency_ID, PayAmt, OpenAmt,
|
||||
C_BPartner_ID))
|
||||
C_BPartner_ID, level.getC_DunningLevel_ID()))
|
||||
{
|
||||
count++;
|
||||
}
|
||||
|
@ -409,13 +417,14 @@ public class DunningRunCreate extends SvrProcess
|
|||
* @param PayAmt
|
||||
* @param OpenAmt
|
||||
* @param C_BPartner_ID
|
||||
* @param c_DunningLevel_ID
|
||||
*/
|
||||
private boolean 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, int c_DunningLevel_ID)
|
||||
{
|
||||
MDunningRunEntry entry = null;
|
||||
try {
|
||||
entry = m_run.getEntry (C_BPartner_ID, p_C_Currency_ID, p_SalesRep_ID);
|
||||
entry = m_run.getEntry (C_BPartner_ID, p_C_Currency_ID, p_SalesRep_ID, c_DunningLevel_ID);
|
||||
} catch (BPartnerNoAddressException e) {
|
||||
MPayment payment = new MPayment(getCtx(), C_Payment_ID, null);
|
||||
String msg = "@Skip@ @C_Payment_ID@ " + payment.getDocumentInfo()
|
||||
|
@ -435,13 +444,13 @@ public class DunningRunCreate extends SvrProcess
|
|||
return true;
|
||||
} // createPaymentLine
|
||||
|
||||
private void addFees()
|
||||
private void addFees(MDunningLevel level)
|
||||
{
|
||||
MDunningRunEntry [] entries = m_run.getEntries (true);
|
||||
if (entries!=null && entries.length>0) {
|
||||
for (int i=0;i<entries.length;i++) {
|
||||
MDunningRunLine line = new MDunningRunLine (entries[i]);
|
||||
line.setFee (p_C_Currency_ID, m_level.getFeeAmt ());
|
||||
line.setFee (p_C_Currency_ID, level.getFeeAmt());
|
||||
if (!line.save())
|
||||
throw new IllegalStateException("Cannot save MDunningRunLine");
|
||||
entries[i].setQty (entries[i].getQty ().subtract (new BigDecimal(1)));
|
||||
|
|
|
@ -21,8 +21,8 @@ SELECT dr.AD_Client_ID, dr.AD_Org_ID, dr.IsActive, dr.Created, dr.CreatedBy, dr.
|
|||
bpl.C_Location_ID, bp.ReferenceNo, l.Postal || l.Postal_Add AS Postal,
|
||||
dre.Amt, dre.Qty, dre.Note, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID
|
||||
FROM C_DunningRun dr
|
||||
INNER JOIN C_DunningLevel dl ON (dr.C_DunningLevel_ID=dl.C_DunningLevel_ID)
|
||||
INNER JOIN C_DunningRunEntry dre ON (dr.C_DunningRun_ID=dre.C_DunningRun_ID)
|
||||
INNER JOIN C_DunningLevel dl ON (dre.C_DunningLevel_ID=dl.C_DunningLevel_ID)
|
||||
INNER JOIN C_BPartner bp ON (dre.C_BPartner_ID=bp.C_BPartner_ID)
|
||||
LEFT OUTER JOIN C_Greeting bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID)
|
||||
INNER JOIN C_BPartner_Location bpl ON (dre.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID)
|
||||
|
|
|
@ -21,9 +21,9 @@ SELECT dr.AD_Client_ID, dr.AD_Org_ID, dr.IsActive, dr.Created, dr.CreatedBy, dr.
|
|||
bpl.C_Location_ID, bp.ReferenceNo, l.Postal || l.Postal_Add AS Postal,
|
||||
dre.Amt, dre.Qty, dre.Note, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID
|
||||
FROM C_DunningRun dr
|
||||
INNER JOIN C_DunningLevel dl ON (dr.C_DunningLevel_ID=dl.C_DunningLevel_ID)
|
||||
INNER JOIN C_DunningLevel_Trl dlt ON (dl.C_DunningLevel_ID=dlt.C_DunningLevel_ID)
|
||||
INNER JOIN C_DunningRunEntry dre ON (dr.C_DunningRun_ID=dre.C_DunningRun_ID)
|
||||
INNER JOIN C_DunningLevel dl ON (dre.C_DunningLevel_ID=dl.C_DunningLevel_ID)
|
||||
INNER JOIN C_DunningLevel_Trl dlt ON (dl.C_DunningLevel_ID=dlt.C_DunningLevel_ID)
|
||||
INNER JOIN C_BPartner bp ON (dre.C_BPartner_ID=bp.C_BPartner_ID)
|
||||
LEFT OUTER JOIN C_Greeting_Trl bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID
|
||||
AND dlt.AD_Language=bpg.AD_Language)
|
||||
|
|
|
@ -23,8 +23,8 @@ SELECT dr.AD_Client_ID, dr.AD_Org_ID, dr.IsActive, dr.Created, dr.CreatedBy, dr.
|
|||
bpl.C_Location_ID, bp.ReferenceNo, l.Postal || l.Postal_Add AS Postal,
|
||||
dre.Amt, dre.Qty, dre.Note, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID
|
||||
FROM C_DunningRun dr
|
||||
INNER JOIN C_DunningLevel dl ON (dr.C_DunningLevel_ID=dl.C_DunningLevel_ID)
|
||||
INNER JOIN C_DunningRunEntry dre ON (dr.C_DunningRun_ID=dre.C_DunningRun_ID)
|
||||
INNER JOIN C_DunningLevel dl ON (dre.C_DunningLevel_ID=dl.C_DunningLevel_ID)
|
||||
INNER JOIN C_BPartner bp ON (dre.C_BPartner_ID=bp.C_BPartner_ID)
|
||||
LEFT OUTER JOIN C_Greeting bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID)
|
||||
INNER JOIN C_BPartner_Location bpl ON (dre.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID)
|
||||
|
|
|
@ -23,9 +23,9 @@ SELECT dr.AD_Client_ID, dr.AD_Org_ID, dr.IsActive, dr.Created, dr.CreatedBy, dr.
|
|||
bpl.C_Location_ID, bp.ReferenceNo, l.Postal || l.Postal_Add AS Postal,
|
||||
dre.Amt, dre.Qty, dre.Note, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID
|
||||
FROM C_DunningRun dr
|
||||
INNER JOIN C_DunningLevel dl ON (dr.C_DunningLevel_ID=dl.C_DunningLevel_ID)
|
||||
INNER JOIN C_DunningLevel_Trl dlt ON (dl.C_DunningLevel_ID=dlt.C_DunningLevel_ID)
|
||||
INNER JOIN C_DunningRunEntry dre ON (dr.C_DunningRun_ID=dre.C_DunningRun_ID)
|
||||
INNER JOIN C_DunningLevel dl ON (dre.C_DunningLevel_ID=dl.C_DunningLevel_ID)
|
||||
INNER JOIN C_DunningLevel_Trl dlt ON (dl.C_DunningLevel_ID=dlt.C_DunningLevel_ID)
|
||||
INNER JOIN C_BPartner bp ON (dre.C_BPartner_ID=bp.C_BPartner_ID)
|
||||
LEFT OUTER JOIN C_Greeting_Trl bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID
|
||||
AND dlt.AD_Language=bpg.AD_Language)
|
||||
|
|
|
@ -0,0 +1,276 @@
|
|||
-- Oct 3, 2009 9:06:52 AM COT
|
||||
-- FR2872010-Dunning Run for a complete Dunning (not just level)
|
||||
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,58559,838,0,19,526,'C_Dunning_ID',TO_DATE('2009-10-03 09:06:47','YYYY-MM-DD HH24:MI:SS'),100,'Dunning Rules for overdue invoices','D',22,'The Dunning indicates the rules and method of dunning for past due payments.','Y','Y','N','N','N','N','N','Y','N','N','N','N','N','Dunning',0,TO_DATE('2009-10-03 09:06:47','YYYY-MM-DD HH24:MI:SS'),100,1)
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:06:52 AM COT
|
||||
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=58559 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID)
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:07:19 AM COT
|
||||
UPDATE AD_Column SET IsMandatory='N',Updated=TO_DATE('2009-10-03 09:07:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=58559
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:07:21 AM COT
|
||||
ALTER TABLE C_DunningRun ADD C_Dunning_ID NUMBER(10) DEFAULT NULL
|
||||
;
|
||||
|
||||
-- Fill dunning_id to make the column mandatory
|
||||
UPDATE c_dunningrun
|
||||
SET c_dunning_id = (SELECT c_dunning_id
|
||||
FROM c_dunninglevel
|
||||
WHERE c_dunninglevel.c_dunninglevel_id=c_dunningrun.c_dunninglevel_id
|
||||
)
|
||||
;
|
||||
|
||||
|
||||
-- Oct 3, 2009 9:09:09 AM COT
|
||||
UPDATE AD_Column SET IsMandatory='Y',Updated=TO_DATE('2009-10-03 09:09:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=58559
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:09:12 AM COT
|
||||
ALTER TABLE C_DunningRun MODIFY C_Dunning_ID NUMBER(10)
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:09:12 AM COT
|
||||
ALTER TABLE C_DunningRun MODIFY C_Dunning_ID NOT NULL
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:09:19 AM COT
|
||||
UPDATE AD_Column SET IsMandatory='N',Updated=TO_DATE('2009-10-03 09:09:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=7684
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:09:22 AM COT
|
||||
ALTER TABLE C_DunningRun MODIFY C_DunningLevel_ID NUMBER(10) DEFAULT NULL
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:09:22 AM COT
|
||||
ALTER TABLE C_DunningRun MODIFY C_DunningLevel_ID NULL
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:10:14 AM COT
|
||||
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,EntityType,Help,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,Updated,UpdatedBy) VALUES (0,58559,58047,0,633,TO_DATE('2009-10-03 09:10:14','YYYY-MM-DD HH24:MI:SS'),100,'Dunning Rules for overdue invoices',14,'D','The Dunning indicates the rules and method of dunning for past due payments.','Y','Y','Y','N','N','N','N','N','Dunning',45,TO_DATE('2009-10-03 09:10:14','YYYY-MM-DD HH24:MI:SS'),100)
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:10:14 AM COT
|
||||
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=58047 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID)
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:10:31 AM COT
|
||||
UPDATE AD_Field SET SeqNo=50,IsDisplayed='Y' WHERE AD_Field_ID=58047
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:10:31 AM COT
|
||||
UPDATE AD_Field SET SeqNo=60,IsDisplayed='Y' WHERE AD_Field_ID=9808
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:10:31 AM COT
|
||||
UPDATE AD_Field SET SeqNo=70,IsDisplayed='Y' WHERE AD_Field_ID=10637
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:10:31 AM COT
|
||||
UPDATE AD_Field SET SeqNo=80,IsDisplayed='Y' WHERE AD_Field_ID=10620
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:10:31 AM COT
|
||||
UPDATE AD_Field SET SeqNo=90,IsDisplayed='Y' WHERE AD_Field_ID=10619
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:10:31 AM COT
|
||||
UPDATE AD_Field SET SeqNo=100,IsDisplayed='Y' WHERE AD_Field_ID=10618
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:12:29 AM COT
|
||||
INSERT INTO AD_Val_Rule (AD_Client_ID,AD_Org_ID,AD_Val_Rule_ID,Code,Created,CreatedBy,EntityType,IsActive,Name,Type,Updated,UpdatedBy) VALUES (0,0,52069,'C_Dunning_ID=@C_Dunning_ID@',TO_DATE('2009-10-03 09:12:28','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','C_DunningLevel of Dunning','S',TO_DATE('2009-10-03 09:12:28','YYYY-MM-DD HH24:MI:SS'),100)
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:12:50 AM COT
|
||||
UPDATE AD_Val_Rule SET Code='C_DunningLevel.C_Dunning_ID=@C_Dunning_ID@',Updated=TO_DATE('2009-10-03 09:12:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=52069
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:13:00 AM COT
|
||||
UPDATE AD_Column SET AD_Val_Rule_ID=52069,Updated=TO_DATE('2009-10-03 09:13:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=7684
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:16:04 AM COT
|
||||
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,AD_Val_Rule_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,58560,1075,0,19,527,52069,'C_DunningLevel_ID',TO_DATE('2009-10-03 09:16:04','YYYY-MM-DD HH24:MI:SS'),100,'D',22,'Y','Y','N','N','N','N','N','N','Y','N','N','N','N','Dunning Level',0,TO_DATE('2009-10-03 09:16:04','YYYY-MM-DD HH24:MI:SS'),100,1)
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:16:04 AM COT
|
||||
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=58560 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID)
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:16:06 AM COT
|
||||
ALTER TABLE C_DunningRunEntry ADD C_DunningLevel_ID NUMBER(10) DEFAULT NULL
|
||||
;
|
||||
|
||||
-- Fill dunning level to make the column mandatory
|
||||
UPDATE c_dunningrunentry
|
||||
SET c_dunninglevel_id = (SELECT c_dunninglevel_id
|
||||
FROM c_dunningrun
|
||||
WHERE c_dunningrun.c_dunningrun_id = c_dunningrunentry.c_dunningrun_id
|
||||
)
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:19:17 AM COT
|
||||
UPDATE AD_Column SET IsMandatory='Y', IsUpdateable='N',Updated=TO_DATE('2009-10-03 09:19:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=58560
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:19:20 AM COT
|
||||
ALTER TABLE C_DunningRunEntry MODIFY C_DunningLevel_ID NUMBER(10)
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:19:20 AM COT
|
||||
ALTER TABLE C_DunningRunEntry MODIFY C_DunningLevel_ID NOT NULL
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:20:47 AM COT
|
||||
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,DisplayLength,EntityType,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SortNo,Updated,UpdatedBy) VALUES (0,58560,58048,0,634,TO_DATE('2009-10-03 09:20:46','YYYY-MM-DD HH24:MI:SS'),100,14,'D','Y','Y','Y','N','N','N','N','N','Dunning Level',140,0,TO_DATE('2009-10-03 09:20:46','YYYY-MM-DD HH24:MI:SS'),100)
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:20:47 AM COT
|
||||
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=58048 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID)
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:21:12 AM COT
|
||||
UPDATE AD_Field SET SeqNo=40,IsDisplayed='Y' WHERE AD_Field_ID=58048
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:21:12 AM COT
|
||||
UPDATE AD_Field SET SeqNo=50,IsDisplayed='Y' WHERE AD_Field_ID=9818
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:21:12 AM COT
|
||||
UPDATE AD_Field SET SeqNo=60,IsDisplayed='Y' WHERE AD_Field_ID=9814
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:21:12 AM COT
|
||||
UPDATE AD_Field SET SeqNo=70,IsDisplayed='Y' WHERE AD_Field_ID=10623
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:21:12 AM COT
|
||||
UPDATE AD_Field SET SeqNo=80,IsDisplayed='Y' WHERE AD_Field_ID=10625
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:21:12 AM COT
|
||||
UPDATE AD_Field SET SeqNo=90,IsDisplayed='Y' WHERE AD_Field_ID=10624
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:21:12 AM COT
|
||||
UPDATE AD_Field SET SeqNo=100,IsDisplayed='Y' WHERE AD_Field_ID=9816
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:21:12 AM COT
|
||||
UPDATE AD_Field SET SeqNo=110,IsDisplayed='Y' WHERE AD_Field_ID=10621
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:21:12 AM COT
|
||||
UPDATE AD_Field SET SeqNo=120,IsDisplayed='Y' WHERE AD_Field_ID=9820
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:21:12 AM COT
|
||||
UPDATE AD_Field SET SeqNo=130,IsDisplayed='Y' WHERE AD_Field_ID=10626
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:21:12 AM COT
|
||||
UPDATE AD_Field SET SeqNo=140,IsDisplayed='Y' WHERE AD_Field_ID=10622
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:22:02 AM COT
|
||||
UPDATE AD_Column SET DefaultValue='@C_DunningLevel_ID@', IsUpdateable='N',Updated=TO_DATE('2009-10-03 09:22:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=58560
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:28:51 AM COT
|
||||
INSERT INTO AD_Val_Rule (AD_Client_ID,AD_Org_ID,AD_Val_Rule_ID,Code,Created,CreatedBy,EntityType,IsActive,Name,Type,Updated,UpdatedBy) VALUES (0,0,52070,'C_DunningLevel.C_Dunning_ID=@C_Dunning_ID@ AND
|
||||
((SELECT C_DunningLevel_ID FROM C_DunningRun WHERE C_DunningRun.C_DunningRun_ID=@C_DunningRun_ID@) IS NULL OR
|
||||
C_DunningLevel.C_DunningLevel_ID IN (SELECT C_DunningLevel_ID FROM C_DunningRun WHERE C_DunningRun.C_DunningRun_ID=@C_DunningRun_ID@))',TO_DATE('2009-10-03 09:28:49','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','C_DunningLevel of Dunning - restrict to level of dunning','S',TO_DATE('2009-10-03 09:28:49','YYYY-MM-DD HH24:MI:SS'),100)
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:28:59 AM COT
|
||||
UPDATE AD_Column SET AD_Val_Rule_ID=52070, IsUpdateable='N',Updated=TO_DATE('2009-10-03 09:28:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=58560
|
||||
;
|
||||
|
||||
-- Oct 4, 2009 6:58:01 PM COT
|
||||
UPDATE AD_Column SET IsIdentifier='Y', SeqNo=2,Updated=TO_DATE('2009-10-04 18:58:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=58559
|
||||
;
|
||||
|
||||
-- Oct 4, 2009 6:58:05 PM COT
|
||||
UPDATE AD_Column SET IsIdentifier='Y', SeqNo=3,Updated=TO_DATE('2009-10-04 18:58:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=7684
|
||||
;
|
||||
|
||||
CREATE OR REPLACE VIEW C_DUNNING_HEADER_V
|
||||
(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY,
|
||||
UPDATED, UPDATEDBY, AD_LANGUAGE, C_DUNNINGRUN_ID, C_DUNNINGRUNENTRY_ID,
|
||||
DUNNINGDATE, PRINTNAME, DOCUMENTNOTE, C_BPARTNER_ID, BPVALUE,
|
||||
BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID,
|
||||
SALESREP_ID, SALESREP_NAME, BPGREETING, NAME, NAME2,
|
||||
BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, C_LOCATION_ID,
|
||||
REFERENCENO, POSTAL, AMT, QTY, NOTE, LOGO_ID)
|
||||
AS
|
||||
SELECT dr.AD_Client_ID, dr.AD_Org_ID, dr.IsActive, dr.Created, dr.CreatedBy, dr.Updated, dr.UpdatedBy,
|
||||
cast('en_US' as varchar2(6)) AS AD_Language, dr.C_DunningRun_ID, C_DunningRunEntry_ID,
|
||||
dr.DunningDate, dl.PrintName, dl.Note AS DocumentNote,
|
||||
dre.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS,
|
||||
oi.C_Location_ID AS Org_Location_ID, oi.TaxID,
|
||||
dre.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name,
|
||||
bpg.Greeting AS BPGreeting,
|
||||
bp.Name, bp.Name2,
|
||||
bpcg.Greeting AS BPContactGreeting,
|
||||
bpc.Title, bpc.Phone,
|
||||
NULLIF (bpc.Name, bp.Name) AS ContactName,
|
||||
bpl.C_Location_ID, bp.ReferenceNo, l.Postal || l.Postal_Add AS Postal,
|
||||
dre.Amt, dre.Qty, dre.Note, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID
|
||||
FROM C_DunningRun dr
|
||||
INNER JOIN C_DunningRunEntry dre ON (dr.C_DunningRun_ID=dre.C_DunningRun_ID)
|
||||
INNER JOIN C_DunningLevel dl ON (dre.C_DunningLevel_ID=dl.C_DunningLevel_ID)
|
||||
INNER JOIN C_BPartner bp ON (dre.C_BPartner_ID=bp.C_BPartner_ID)
|
||||
LEFT OUTER JOIN C_Greeting bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID)
|
||||
INNER JOIN C_BPartner_Location bpl ON (dre.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID)
|
||||
INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID)
|
||||
LEFT OUTER JOIN AD_User bpc ON (dre.AD_User_ID=bpc.AD_User_ID)
|
||||
LEFT OUTER JOIN C_Greeting bpcg on (bpc.C_Greeting_ID=bpcg.C_Greeting_ID)
|
||||
INNER JOIN AD_OrgInfo oi ON (dr.AD_Org_ID=oi.AD_Org_ID)
|
||||
INNER JOIN AD_ClientInfo ci ON (dr.AD_Client_ID=ci.AD_Client_ID)
|
||||
LEFT OUTER JOIN AD_User u ON (dre.SalesRep_ID=u.AD_User_ID)
|
||||
LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID)
|
||||
;
|
||||
|
||||
CREATE OR REPLACE VIEW C_DUNNING_HEADER_VT
|
||||
(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY,
|
||||
UPDATED, UPDATEDBY, AD_LANGUAGE, C_DUNNINGRUN_ID, C_DUNNINGRUNENTRY_ID,
|
||||
DUNNINGDATE, PRINTNAME, DOCUMENTNOTE, C_BPARTNER_ID, BPVALUE,
|
||||
BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID,
|
||||
SALESREP_ID, SALESREP_NAME, BPGREETING, NAME, NAME2,
|
||||
BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, C_LOCATION_ID,
|
||||
REFERENCENO, POSTAL, AMT, QTY, NOTE, LOGO_ID)
|
||||
AS
|
||||
SELECT dr.AD_Client_ID, dr.AD_Org_ID, dr.IsActive, dr.Created, dr.CreatedBy, dr.Updated, dr.UpdatedBy,
|
||||
dlt.AD_Language, dr.C_DunningRun_ID, C_DunningRunEntry_ID,
|
||||
dr.DunningDate, dlt.PrintName, dlt.Note AS DocumentNote,
|
||||
dre.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS,
|
||||
oi.C_Location_ID AS Org_Location_ID, oi.TaxID,
|
||||
dre.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name,
|
||||
bpg.Greeting AS BPGreeting,
|
||||
bp.Name, bp.Name2,
|
||||
bpcg.Greeting AS BPContactGreeting,
|
||||
bpc.Title, bpc.Phone,
|
||||
NULLIF (bpc.Name, bp.Name) AS ContactName,
|
||||
bpl.C_Location_ID, bp.ReferenceNo, l.Postal || l.Postal_Add AS Postal,
|
||||
dre.Amt, dre.Qty, dre.Note, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID
|
||||
FROM C_DunningRun dr
|
||||
INNER JOIN C_DunningRunEntry dre ON (dr.C_DunningRun_ID=dre.C_DunningRun_ID)
|
||||
INNER JOIN C_DunningLevel dl ON (dre.C_DunningLevel_ID=dl.C_DunningLevel_ID)
|
||||
INNER JOIN C_DunningLevel_Trl dlt ON (dl.C_DunningLevel_ID=dlt.C_DunningLevel_ID)
|
||||
INNER JOIN C_BPartner bp ON (dre.C_BPartner_ID=bp.C_BPartner_ID)
|
||||
LEFT OUTER JOIN C_Greeting_Trl bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID
|
||||
AND dlt.AD_Language=bpg.AD_Language)
|
||||
INNER JOIN C_BPartner_Location bpl ON (dre.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID)
|
||||
INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID)
|
||||
LEFT OUTER JOIN AD_User bpc ON (dre.AD_User_ID=bpc.AD_User_ID)
|
||||
LEFT OUTER JOIN C_Greeting_Trl bpcg on (bpc.C_Greeting_ID=bpcg.C_Greeting_ID
|
||||
AND dlt.AD_Language=bpcg.AD_Language)
|
||||
INNER JOIN AD_OrgInfo oi ON (dr.AD_Org_ID=oi.AD_Org_ID)
|
||||
INNER JOIN AD_ClientInfo ci ON (dr.AD_Client_ID=ci.AD_Client_ID)
|
||||
LEFT OUTER JOIN AD_User u ON (dre.SalesRep_ID=u.AD_User_ID)
|
||||
LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID)
|
||||
;
|
|
@ -0,0 +1,261 @@
|
|||
-- Oct 3, 2009 9:06:52 AM COT
|
||||
-- FR2872010-Dunning Run for a complete Dunning (not just level)
|
||||
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,58559,838,0,19,526,'C_Dunning_ID',TO_TIMESTAMP('2009-10-03 09:06:47','YYYY-MM-DD HH24:MI:SS'),100,'Dunning Rules for overdue invoices','D',22,'The Dunning indicates the rules and method of dunning for past due payments.','Y','Y','N','N','N','N','N','Y','N','N','N','N','N','Dunning',0,TO_TIMESTAMP('2009-10-03 09:06:47','YYYY-MM-DD HH24:MI:SS'),100,1)
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:06:52 AM COT
|
||||
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=58559 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID)
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:07:19 AM COT
|
||||
UPDATE AD_Column SET IsMandatory='N',Updated=TO_TIMESTAMP('2009-10-03 09:07:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=58559
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:07:21 AM COT
|
||||
ALTER TABLE C_DunningRun ADD COLUMN C_Dunning_ID NUMERIC(10) DEFAULT NULL
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:09:09 AM COT
|
||||
UPDATE AD_Column SET IsMandatory='Y',Updated=TO_TIMESTAMP('2009-10-03 09:09:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=58559
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:09:12 AM COT
|
||||
insert into t_alter_column values('c_dunningrun','C_Dunning_ID','NUMERIC(10)',null,null)
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:09:12 AM COT
|
||||
insert into t_alter_column values('c_dunningrun','C_Dunning_ID',null,'NOT NULL',null)
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:09:19 AM COT
|
||||
UPDATE AD_Column SET IsMandatory='N',Updated=TO_TIMESTAMP('2009-10-03 09:09:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=7684
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:09:22 AM COT
|
||||
insert into t_alter_column values('c_dunningrun','C_DunningLevel_ID','NUMERIC(10)',null,'NULL')
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:09:22 AM COT
|
||||
insert into t_alter_column values('c_dunningrun','C_DunningLevel_ID',null,'NULL',null)
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:10:14 AM COT
|
||||
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,EntityType,Help,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,Updated,UpdatedBy) VALUES (0,58559,58047,0,633,TO_TIMESTAMP('2009-10-03 09:10:14','YYYY-MM-DD HH24:MI:SS'),100,'Dunning Rules for overdue invoices',14,'D','The Dunning indicates the rules and method of dunning for past due payments.','Y','Y','Y','N','N','N','N','N','Dunning',45,TO_TIMESTAMP('2009-10-03 09:10:14','YYYY-MM-DD HH24:MI:SS'),100)
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:10:14 AM COT
|
||||
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=58047 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID)
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:10:31 AM COT
|
||||
UPDATE AD_Field SET SeqNo=50,IsDisplayed='Y' WHERE AD_Field_ID=58047
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:10:31 AM COT
|
||||
UPDATE AD_Field SET SeqNo=60,IsDisplayed='Y' WHERE AD_Field_ID=9808
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:10:31 AM COT
|
||||
UPDATE AD_Field SET SeqNo=70,IsDisplayed='Y' WHERE AD_Field_ID=10637
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:10:31 AM COT
|
||||
UPDATE AD_Field SET SeqNo=80,IsDisplayed='Y' WHERE AD_Field_ID=10620
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:10:31 AM COT
|
||||
UPDATE AD_Field SET SeqNo=90,IsDisplayed='Y' WHERE AD_Field_ID=10619
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:10:31 AM COT
|
||||
UPDATE AD_Field SET SeqNo=100,IsDisplayed='Y' WHERE AD_Field_ID=10618
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:12:29 AM COT
|
||||
INSERT INTO AD_Val_Rule (AD_Client_ID,AD_Org_ID,AD_Val_Rule_ID,Code,Created,CreatedBy,EntityType,IsActive,Name,Type,Updated,UpdatedBy) VALUES (0,0,52069,'C_Dunning_ID=@C_Dunning_ID@',TO_TIMESTAMP('2009-10-03 09:12:28','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','C_DunningLevel of Dunning','S',TO_TIMESTAMP('2009-10-03 09:12:28','YYYY-MM-DD HH24:MI:SS'),100)
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:12:50 AM COT
|
||||
UPDATE AD_Val_Rule SET Code='C_DunningLevel.C_Dunning_ID=@C_Dunning_ID@',Updated=TO_TIMESTAMP('2009-10-03 09:12:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=52069
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:13:00 AM COT
|
||||
UPDATE AD_Column SET AD_Val_Rule_ID=52069,Updated=TO_TIMESTAMP('2009-10-03 09:13:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=7684
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:16:04 AM COT
|
||||
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,AD_Val_Rule_ID,ColumnName,Created,CreatedBy,EntityType,FieldLength,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,58560,1075,0,19,527,52069,'C_DunningLevel_ID',TO_TIMESTAMP('2009-10-03 09:16:04','YYYY-MM-DD HH24:MI:SS'),100,'D',22,'Y','Y','N','N','N','N','N','N','Y','N','N','N','N','Dunning Level',0,TO_TIMESTAMP('2009-10-03 09:16:04','YYYY-MM-DD HH24:MI:SS'),100,1)
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:16:04 AM COT
|
||||
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=58560 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID)
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:16:06 AM COT
|
||||
ALTER TABLE C_DunningRunEntry ADD COLUMN C_DunningLevel_ID NUMERIC(10) DEFAULT NULL
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:19:17 AM COT
|
||||
UPDATE AD_Column SET IsMandatory='Y', IsUpdateable='N',Updated=TO_TIMESTAMP('2009-10-03 09:19:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=58560
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:19:20 AM COT
|
||||
insert into t_alter_column values('c_dunningrunentry','C_DunningLevel_ID','NUMERIC(10)',null,null)
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:19:20 AM COT
|
||||
insert into t_alter_column values('c_dunningrunentry','C_DunningLevel_ID',null,'NOT NULL',null)
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:20:47 AM COT
|
||||
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,DisplayLength,EntityType,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SortNo,Updated,UpdatedBy) VALUES (0,58560,58048,0,634,TO_TIMESTAMP('2009-10-03 09:20:46','YYYY-MM-DD HH24:MI:SS'),100,14,'D','Y','Y','Y','N','N','N','N','N','Dunning Level',140,0,TO_TIMESTAMP('2009-10-03 09:20:46','YYYY-MM-DD HH24:MI:SS'),100)
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:20:47 AM COT
|
||||
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=58048 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID)
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:21:12 AM COT
|
||||
UPDATE AD_Field SET SeqNo=40,IsDisplayed='Y' WHERE AD_Field_ID=58048
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:21:12 AM COT
|
||||
UPDATE AD_Field SET SeqNo=50,IsDisplayed='Y' WHERE AD_Field_ID=9818
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:21:12 AM COT
|
||||
UPDATE AD_Field SET SeqNo=60,IsDisplayed='Y' WHERE AD_Field_ID=9814
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:21:12 AM COT
|
||||
UPDATE AD_Field SET SeqNo=70,IsDisplayed='Y' WHERE AD_Field_ID=10623
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:21:12 AM COT
|
||||
UPDATE AD_Field SET SeqNo=80,IsDisplayed='Y' WHERE AD_Field_ID=10625
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:21:12 AM COT
|
||||
UPDATE AD_Field SET SeqNo=90,IsDisplayed='Y' WHERE AD_Field_ID=10624
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:21:12 AM COT
|
||||
UPDATE AD_Field SET SeqNo=100,IsDisplayed='Y' WHERE AD_Field_ID=9816
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:21:12 AM COT
|
||||
UPDATE AD_Field SET SeqNo=110,IsDisplayed='Y' WHERE AD_Field_ID=10621
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:21:12 AM COT
|
||||
UPDATE AD_Field SET SeqNo=120,IsDisplayed='Y' WHERE AD_Field_ID=9820
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:21:12 AM COT
|
||||
UPDATE AD_Field SET SeqNo=130,IsDisplayed='Y' WHERE AD_Field_ID=10626
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:21:12 AM COT
|
||||
UPDATE AD_Field SET SeqNo=140,IsDisplayed='Y' WHERE AD_Field_ID=10622
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:22:02 AM COT
|
||||
UPDATE AD_Column SET DefaultValue='@C_DunningLevel_ID@', IsUpdateable='N',Updated=TO_TIMESTAMP('2009-10-03 09:22:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=58560
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:28:51 AM COT
|
||||
INSERT INTO AD_Val_Rule (AD_Client_ID,AD_Org_ID,AD_Val_Rule_ID,Code,Created,CreatedBy,EntityType,IsActive,Name,Type,Updated,UpdatedBy) VALUES (0,0,52070,'C_DunningLevel.C_Dunning_ID=@C_Dunning_ID@ AND
|
||||
((SELECT C_DunningLevel_ID FROM C_DunningRun WHERE C_DunningRun.C_DunningRun_ID=@C_DunningRun_ID@) IS NULL OR
|
||||
C_DunningLevel.C_DunningLevel_ID IN (SELECT C_DunningLevel_ID FROM C_DunningRun WHERE C_DunningRun.C_DunningRun_ID=@C_DunningRun_ID@))',TO_TIMESTAMP('2009-10-03 09:28:49','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','C_DunningLevel of Dunning - restrict to level of dunning','S',TO_TIMESTAMP('2009-10-03 09:28:49','YYYY-MM-DD HH24:MI:SS'),100)
|
||||
;
|
||||
|
||||
-- Oct 3, 2009 9:28:59 AM COT
|
||||
UPDATE AD_Column SET AD_Val_Rule_ID=52070, IsUpdateable='N',Updated=TO_TIMESTAMP('2009-10-03 09:28:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=58560
|
||||
;
|
||||
|
||||
-- Oct 4, 2009 6:58:01 PM COT
|
||||
UPDATE AD_Column SET IsIdentifier='Y', SeqNo=2,Updated=TO_TIMESTAMP('2009-10-04 18:58:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=58559
|
||||
;
|
||||
|
||||
-- Oct 4, 2009 6:58:05 PM COT
|
||||
UPDATE AD_Column SET IsIdentifier='Y', SeqNo=3,Updated=TO_TIMESTAMP('2009-10-04 18:58:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=7684
|
||||
;
|
||||
|
||||
CREATE OR REPLACE VIEW C_DUNNING_HEADER_V
|
||||
(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY,
|
||||
UPDATED, UPDATEDBY, AD_LANGUAGE, C_DUNNINGRUN_ID, C_DUNNINGRUNENTRY_ID,
|
||||
DUNNINGDATE, PRINTNAME, DOCUMENTNOTE, C_BPARTNER_ID, BPVALUE,
|
||||
BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID,
|
||||
SALESREP_ID, SALESREP_NAME, BPGREETING, NAME, NAME2,
|
||||
BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, C_LOCATION_ID,
|
||||
REFERENCENO, POSTAL, AMT, QTY, NOTE, LOGO_ID)
|
||||
AS
|
||||
SELECT dr.AD_Client_ID, dr.AD_Org_ID, dr.IsActive, dr.Created, dr.CreatedBy, dr.Updated, dr.UpdatedBy,
|
||||
cast('en_US' as varchar) AS AD_Language, dr.C_DunningRun_ID, C_DunningRunEntry_ID,
|
||||
dr.DunningDate, dl.PrintName, dl.Note AS DocumentNote,
|
||||
dre.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS,
|
||||
oi.C_Location_ID AS Org_Location_ID, oi.TaxID,
|
||||
dre.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name,
|
||||
bpg.Greeting AS BPGreeting,
|
||||
bp.Name, bp.Name2,
|
||||
bpcg.Greeting AS BPContactGreeting,
|
||||
bpc.Title, bpc.Phone,
|
||||
NULLIF (bpc.Name, bp.Name) AS ContactName,
|
||||
bpl.C_Location_ID, bp.ReferenceNo, l.Postal || l.Postal_Add AS Postal,
|
||||
dre.Amt, dre.Qty, dre.Note, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID
|
||||
FROM C_DunningRun dr
|
||||
INNER JOIN C_DunningRunEntry dre ON (dr.C_DunningRun_ID=dre.C_DunningRun_ID)
|
||||
INNER JOIN C_DunningLevel dl ON (dre.C_DunningLevel_ID=dl.C_DunningLevel_ID)
|
||||
INNER JOIN C_BPartner bp ON (dre.C_BPartner_ID=bp.C_BPartner_ID)
|
||||
LEFT OUTER JOIN C_Greeting bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID)
|
||||
INNER JOIN C_BPartner_Location bpl ON (dre.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID)
|
||||
INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID)
|
||||
LEFT OUTER JOIN AD_User bpc ON (dre.AD_User_ID=bpc.AD_User_ID)
|
||||
LEFT OUTER JOIN C_Greeting bpcg on (bpc.C_Greeting_ID=bpcg.C_Greeting_ID)
|
||||
INNER JOIN AD_OrgInfo oi ON (dr.AD_Org_ID=oi.AD_Org_ID)
|
||||
INNER JOIN AD_ClientInfo ci ON (dr.AD_Client_ID=ci.AD_Client_ID)
|
||||
LEFT OUTER JOIN AD_User u ON (dre.SalesRep_ID=u.AD_User_ID)
|
||||
LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID)
|
||||
;
|
||||
|
||||
|
||||
CREATE OR REPLACE VIEW C_DUNNING_HEADER_VT
|
||||
(AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, CREATED, CREATEDBY,
|
||||
UPDATED, UPDATEDBY, AD_LANGUAGE, C_DUNNINGRUN_ID, C_DUNNINGRUNENTRY_ID,
|
||||
DUNNINGDATE, PRINTNAME, DOCUMENTNOTE, C_BPARTNER_ID, BPVALUE,
|
||||
BPTAXID, NAICS, DUNS, ORG_LOCATION_ID, TAXID,
|
||||
SALESREP_ID, SALESREP_NAME, BPGREETING, NAME, NAME2,
|
||||
BPCONTACTGREETING, TITLE, PHONE, CONTACTNAME, C_LOCATION_ID,
|
||||
REFERENCENO, POSTAL, AMT, QTY, NOTE, LOGO_ID)
|
||||
AS
|
||||
SELECT dr.AD_Client_ID, dr.AD_Org_ID, dr.IsActive, dr.Created, dr.CreatedBy, dr.Updated, dr.UpdatedBy,
|
||||
dlt.AD_Language, dr.C_DunningRun_ID, C_DunningRunEntry_ID,
|
||||
dr.DunningDate, dlt.PrintName, dlt.Note AS DocumentNote,
|
||||
dre.C_BPartner_ID, bp.Value AS BPValue, bp.TaxID AS BPTaxID, bp.NAICS, bp.DUNS,
|
||||
oi.C_Location_ID AS Org_Location_ID, oi.TaxID,
|
||||
dre.SalesRep_ID, COALESCE(ubp.Name, u.Name) AS SalesRep_Name,
|
||||
bpg.Greeting AS BPGreeting,
|
||||
bp.Name, bp.Name2,
|
||||
bpcg.Greeting AS BPContactGreeting,
|
||||
bpc.Title, bpc.Phone,
|
||||
NULLIF (bpc.Name, bp.Name) AS ContactName,
|
||||
bpl.C_Location_ID, bp.ReferenceNo, l.Postal || l.Postal_Add AS Postal,
|
||||
dre.Amt, dre.Qty, dre.Note, COALESCE(oi.Logo_ID, ci.Logo_ID) AS Logo_ID
|
||||
FROM C_DunningRun dr
|
||||
INNER JOIN C_DunningRunEntry dre ON (dr.C_DunningRun_ID=dre.C_DunningRun_ID)
|
||||
INNER JOIN C_DunningLevel dl ON (dre.C_DunningLevel_ID=dl.C_DunningLevel_ID)
|
||||
INNER JOIN C_DunningLevel_Trl dlt ON (dl.C_DunningLevel_ID=dlt.C_DunningLevel_ID)
|
||||
INNER JOIN C_BPartner bp ON (dre.C_BPartner_ID=bp.C_BPartner_ID)
|
||||
LEFT OUTER JOIN C_Greeting_Trl bpg on (bp.C_Greeting_ID=bpg.C_Greeting_ID
|
||||
AND dlt.AD_Language=bpg.AD_Language)
|
||||
INNER JOIN C_BPartner_Location bpl ON (dre.C_BPartner_Location_ID=bpl.C_BPartner_Location_ID)
|
||||
INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID)
|
||||
LEFT OUTER JOIN AD_User bpc ON (dre.AD_User_ID=bpc.AD_User_ID)
|
||||
LEFT OUTER JOIN C_Greeting_Trl bpcg on (bpc.C_Greeting_ID=bpcg.C_Greeting_ID
|
||||
AND dlt.AD_Language=bpcg.AD_Language)
|
||||
INNER JOIN AD_OrgInfo oi ON (dr.AD_Org_ID=oi.AD_Org_ID)
|
||||
INNER JOIN AD_ClientInfo ci ON (dr.AD_Client_ID=ci.AD_Client_ID)
|
||||
LEFT OUTER JOIN AD_User u ON (dre.SalesRep_ID=u.AD_User_ID)
|
||||
LEFT OUTER JOIN C_BPartner ubp ON (u.C_BPartner_ID=ubp.C_BPartner_ID)
|
||||
;
|
||||
|
Loading…
Reference in New Issue