FR 2957782: Add due date to Pay selection create

Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2957782
This commit is contained in:
phib 2010-02-24 05:22:02 +00:00
parent 4907114af1
commit eb40b62629
3 changed files with 32 additions and 3 deletions

View File

@ -19,6 +19,7 @@ package org.compiere.process;
import java.math.BigDecimal;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Timestamp;
import java.util.logging.Level;
import org.compiere.model.MPaySelection;
@ -52,6 +53,8 @@ public class PaySelectionCreateFrom extends SvrProcess
/** Payment Selection */
private int p_C_PaySelection_ID = 0;
private Timestamp p_DueDate = null;
/**
* Prepare - e.g., get Parameters.
*/
@ -77,6 +80,8 @@ public class PaySelectionCreateFrom extends SvrProcess
p_C_BPartner_ID = para[i].getParameterAsInt();
else if (name.equals("C_BP_Group_ID"))
p_C_BP_Group_ID = para[i].getParameterAsInt();
else if (name.equals("DueDate"))
p_DueDate = (Timestamp) para[i].getParameter();
else
log.log(Level.SEVERE, "Unknown Parameter: " + name);
}
@ -102,6 +107,10 @@ public class PaySelectionCreateFrom extends SvrProcess
throw new IllegalArgumentException("Not found C_PaySelection_ID=" + p_C_PaySelection_ID);
if (psel.isProcessed())
throw new IllegalArgumentException("@Processed@");
if ( p_DueDate == null )
p_DueDate = psel.getPayDate();
// psel.getPayDate();
String sql = "SELECT C_Invoice_ID,"
@ -154,7 +163,7 @@ public class PaySelectionCreateFrom extends SvrProcess
else if (p_C_BP_Group_ID != 0)
sql += " AND EXISTS (SELECT * FROM C_BPartner bp "
+ "WHERE bp.C_BPartner_ID=i.C_BPartner_ID AND bp.C_BP_Group_ID=?)"; // ##
// PO Matching Requiremnent
// PO Matching Requirement
if (p_MatchRequirement.equals("P") || p_MatchRequirement.equals("B"))
{
sql += " AND EXISTS (SELECT * FROM C_InvoiceLine il "
@ -162,7 +171,7 @@ public class PaySelectionCreateFrom extends SvrProcess
+ " AND QtyInvoiced=(SELECT SUM(Qty) FROM M_MatchPO m "
+ "WHERE il.C_InvoiceLine_ID=m.C_InvoiceLine_ID))";
}
// Receipt Matching Requiremnent
// Receipt Matching Requirement
if (p_MatchRequirement.equals("R") || p_MatchRequirement.equals("B"))
{
sql += " AND EXISTS (SELECT * FROM C_InvoiceLine il "
@ -192,7 +201,7 @@ public class PaySelectionCreateFrom extends SvrProcess
if (p_OnlyDiscount)
pstmt.setTimestamp(index++, psel.getPayDate());
if (p_OnlyDue)
pstmt.setTimestamp(index++, psel.getPayDate());
pstmt.setTimestamp(index++, p_DueDate);
if (p_C_BPartner_ID != 0)
pstmt.setInt (index++, p_C_BPartner_ID);
else if (p_C_BP_Group_ID != 0)

View File

@ -0,0 +1,10 @@
-- Feb 24, 2010 4:03:13 PM EST
-- Payment selection due date parameter
INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,Description,DisplayLogic,EntityType,FieldLength,Help,IsActive,IsCentrallyMaintained,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,2000,0,156,53404,15,'DueDate',TO_DATE('2010-02-24 16:03:03','YYYY-MM-DD HH24:MI:SS'),100,'Date when the payment is due','@OnlyDue@=Y','D',7,'Date when the payment is due without deductions or discount','Y','Y','N','N','Due Date',45,TO_DATE('2010-02-24 16:03:03','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Feb 24, 2010 4:03:13 PM EST
-- Payment selection due date parameter
INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Process_Para_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_Process_Para t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_Para_ID=53404 AND NOT EXISTS (SELECT * FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID)
;

View File

@ -0,0 +1,10 @@
-- Feb 24, 2010 4:03:13 PM EST
-- Payment selection due date parameter
INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,Description,DisplayLogic,EntityType,FieldLength,Help,IsActive,IsCentrallyMaintained,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,2000,0,156,53404,15,'DueDate',TO_TIMESTAMP('2010-02-24 16:03:03','YYYY-MM-DD HH24:MI:SS'),100,'Date when the payment is due','@OnlyDue@=Y','D',7,'Date when the payment is due without deductions or discount','Y','Y','N','N','Due Date',45,TO_TIMESTAMP('2010-02-24 16:03:03','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Feb 24, 2010 4:03:13 PM EST
-- Payment selection due date parameter
INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Process_Para_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_Process_Para t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_Para_ID=53404 AND NOT EXISTS (SELECT * FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID)
;