Fix [2655587] Multi-org not supported in Aging
This commit is contained in:
parent
41b89588b9
commit
1b55b59f68
|
@ -1,5 +1,5 @@
|
|||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
|
@ -31,6 +31,11 @@ import org.compiere.util.Env;
|
|||
*/
|
||||
public class MAging extends X_T_Aging
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 3067400117623770188L;
|
||||
|
||||
/**
|
||||
* Standard Constructor
|
||||
* @param ctx context
|
||||
|
@ -89,10 +94,52 @@ public class MAging extends X_T_Aging
|
|||
* @param C_Invoice_ID invoice
|
||||
* @param C_InvoicePaySchedule_ID invoice schedule
|
||||
* @param C_BP_Group_ID group
|
||||
* @param AD_Org_ID organization
|
||||
* @param DueDate due date
|
||||
* @param IsSOTrx SO Trx
|
||||
* @param trxName transaction
|
||||
*/
|
||||
public MAging (Properties ctx, int AD_PInstance_ID, Timestamp StatementDate,
|
||||
int C_BPartner_ID, int C_Currency_ID,
|
||||
int C_Invoice_ID, int C_InvoicePaySchedule_ID,
|
||||
int C_BP_Group_ID, int AD_Org_ID, Timestamp DueDate, boolean IsSOTrx, String trxName)
|
||||
{
|
||||
this (ctx, 0, trxName);
|
||||
setAD_PInstance_ID (AD_PInstance_ID);
|
||||
setStatementDate(StatementDate);
|
||||
//
|
||||
setC_BPartner_ID (C_BPartner_ID);
|
||||
setC_Currency_ID (C_Currency_ID);
|
||||
setC_BP_Group_ID (C_BP_Group_ID);
|
||||
setAD_Org_ID(AD_Org_ID);
|
||||
setIsSOTrx (IsSOTrx);
|
||||
|
||||
// Optional
|
||||
// setC_Invoice_ID (C_Invoice_ID); // may be zero
|
||||
set_ValueNoCheck ("C_Invoice_ID", new Integer(C_Invoice_ID));
|
||||
// setC_InvoicePaySchedule_ID(C_InvoicePaySchedule_ID); // may be zero
|
||||
set_Value ("C_InvoicePaySchedule_ID", new Integer(C_InvoicePaySchedule_ID));
|
||||
setIsListInvoices(C_Invoice_ID != 0);
|
||||
//
|
||||
setDueDate(DueDate); // only sensible if List invoices
|
||||
} // MAging
|
||||
|
||||
/**
|
||||
* Partial Constructor - backward compatibility
|
||||
* @param ctx context
|
||||
* @param AD_PInstance_ID instance
|
||||
* @param StatementDate statement date
|
||||
* @param C_BPartner_ID bpartner
|
||||
* @param C_Currency_ID currency
|
||||
* @param C_Invoice_ID invoice
|
||||
* @param C_InvoicePaySchedule_ID invoice schedule
|
||||
* @param C_BP_Group_ID group
|
||||
* @param DueDate due date
|
||||
* @param IsSOTrx SO Trx
|
||||
* @param trxName transaction
|
||||
*
|
||||
* @deprecated - better use the new constructor with organization included
|
||||
*/
|
||||
public MAging (Properties ctx, int AD_PInstance_ID, Timestamp StatementDate,
|
||||
int C_BPartner_ID, int C_Currency_ID,
|
||||
int C_Invoice_ID, int C_InvoicePaySchedule_ID,
|
||||
|
@ -116,7 +163,6 @@ public class MAging extends X_T_Aging
|
|||
//
|
||||
setDueDate(DueDate); // only sensible if List invoices
|
||||
} // MAging
|
||||
|
||||
|
||||
/**
|
||||
* Load Constructor
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
|
@ -35,6 +35,8 @@ import org.compiere.util.TimeUtil;
|
|||
* @author Jorg Janke
|
||||
* @author victor.perez@e-evolution.com FR 1933937 Is necessary a new Aging to Date
|
||||
* @see http://sourceforge.net/tracker/index.php?func=detail&aid=1933937&group_id=176962&atid=879335
|
||||
* @author Carlos Ruiz - globalqss BF 2655587 Multi-org not supported in Aging
|
||||
* @see https://sourceforge.net/tracker2/?func=detail&aid=2655587&group_id=176962&atid=879332
|
||||
* @version $Id: Aging.java,v 1.5 2006/10/07 00:58:44 jjanke Exp $
|
||||
*/
|
||||
public class Aging extends SvrProcess
|
||||
|
@ -45,6 +47,7 @@ public class Aging extends SvrProcess
|
|||
private boolean p_DateAcct = false;
|
||||
private boolean p_IsSOTrx = false;
|
||||
private int p_C_Currency_ID = 0;
|
||||
private int p_AD_Org_ID = 0;
|
||||
private int p_C_BP_Group_ID = 0;
|
||||
private int p_C_BPartner_ID = 0;
|
||||
private boolean p_IsListInvoices = false;
|
||||
|
@ -70,6 +73,8 @@ public class Aging extends SvrProcess
|
|||
p_IsSOTrx = "Y".equals(para[i].getParameter());
|
||||
else if (name.equals("C_Currency_ID"))
|
||||
p_C_Currency_ID = ((BigDecimal)para[i].getParameter()).intValue();
|
||||
else if (name.equals("AD_Org_ID"))
|
||||
p_AD_Org_ID = ((BigDecimal)para[i].getParameter()).intValue();
|
||||
else if (name.equals("C_BP_Group_ID"))
|
||||
p_C_BP_Group_ID = ((BigDecimal)para[i].getParameter()).intValue();
|
||||
else if (name.equals("C_BPartner_ID"))
|
||||
|
@ -94,14 +99,14 @@ public class Aging extends SvrProcess
|
|||
protected String doIt() throws Exception
|
||||
{
|
||||
log.info("StatementDate=" + p_StatementDate + ", IsSOTrx=" + p_IsSOTrx
|
||||
+ ", C_Currency_ID=" + p_C_Currency_ID
|
||||
+ ", C_Currency_ID=" + p_C_Currency_ID + ", AD_Org_ID=" + p_AD_Org_ID
|
||||
+ ", C_BP_Group_ID=" + p_C_BP_Group_ID + ", C_BPartner_ID=" + p_C_BPartner_ID
|
||||
+ ", IsListInvoices=" + p_IsListInvoices);
|
||||
//FR 1933937
|
||||
String dateacct = DB.TO_DATE(p_StatementDate);
|
||||
|
||||
StringBuffer sql = new StringBuffer();
|
||||
sql.append("SELECT bp.C_BP_Group_ID, oi.C_BPartner_ID,oi.C_Invoice_ID,oi.C_InvoicePaySchedule_ID, "
|
||||
sql.append("SELECT bp.C_BP_Group_ID, oi.C_BPartner_ID,oi.C_Invoice_ID,oi.C_InvoicePaySchedule_ID, " // 1..4
|
||||
+ "oi.C_Currency_ID, oi.IsSOTrx, " // 5..6
|
||||
+ "oi.DateInvoiced, oi.NetDays,oi.DueDate,oi.DaysDue, "); // 7..10
|
||||
if (p_C_Currency_ID == 0)
|
||||
|
@ -118,19 +123,19 @@ public class Aging extends SvrProcess
|
|||
else
|
||||
{
|
||||
String s = ",oi.C_Currency_ID," + p_C_Currency_ID + ",oi.DateAcct,oi.C_ConversionType_ID,oi.AD_Client_ID,oi.AD_Org_ID)";
|
||||
sql.append("currencyConvert(oi.GrandTotal").append(s); // 11..
|
||||
sql.append("currencyConvert(oi.GrandTotal").append(s); // 11
|
||||
if (!p_DateAcct)
|
||||
{
|
||||
sql.append(", currencyConvert(oi.PaidAmt").append(s)
|
||||
.append(", currencyConvert(oi.OpenAmt").append(s);
|
||||
sql.append(", currencyConvert(oi.PaidAmt").append(s) // 12
|
||||
.append(", currencyConvert(oi.OpenAmt").append(s); // 13
|
||||
}
|
||||
else
|
||||
{
|
||||
sql.append(", currencyConvert(invoicePaidToDate(oi.C_Invoice_ID, oi.C_Currency_ID, 1,"+dateacct+")").append(s)
|
||||
.append(", currencyConvert(invoiceOpenToDate(oi.C_Invoice_ID,oi.C_InvoicePaySchedule_ID,"+dateacct+")").append(s);
|
||||
sql.append(", currencyConvert(invoicePaidToDate(oi.C_Invoice_ID, oi.C_Currency_ID, 1,"+dateacct+")").append(s) // 12
|
||||
.append(", currencyConvert(invoiceOpenToDate(oi.C_Invoice_ID,oi.C_InvoicePaySchedule_ID,"+dateacct+")").append(s); // 13
|
||||
}
|
||||
}
|
||||
sql.append(",oi.C_Activity_ID,oi.C_Campaign_ID,oi.C_Project_ID "); // 14
|
||||
sql.append(",oi.C_Activity_ID,oi.C_Campaign_ID,oi.C_Project_ID,oi.AD_Org_ID "); // 14..17
|
||||
if (!p_DateAcct)//FR 1933937
|
||||
{
|
||||
sql.append(" FROM RV_OpenItem oi");
|
||||
|
@ -150,6 +155,10 @@ public class Aging extends SvrProcess
|
|||
{
|
||||
sql.append(" AND bp.C_BP_Group_ID=").append(p_C_BP_Group_ID);
|
||||
}
|
||||
if (p_AD_Org_ID > 0) // BF 2655587
|
||||
{
|
||||
sql.append(" AND oi.AD_Org_ID=").append(p_AD_Org_ID);
|
||||
}
|
||||
|
||||
if (p_DateAcct)//FR 1933937
|
||||
{
|
||||
|
@ -198,6 +207,7 @@ public class Aging extends SvrProcess
|
|||
int C_Activity_ID = p_IsListInvoices ? rs.getInt(14) : 0;
|
||||
int C_Campaign_ID = p_IsListInvoices ? rs.getInt(15) : 0;
|
||||
int C_Project_ID = p_IsListInvoices ? rs.getInt(16) : 0;
|
||||
int AD_Org_ID = rs.getInt(17);
|
||||
|
||||
rows++;
|
||||
// New Aging Row
|
||||
|
@ -216,7 +226,7 @@ public class Aging extends SvrProcess
|
|||
aging = new MAging (getCtx(), AD_PInstance_ID, p_StatementDate,
|
||||
C_BPartner_ID, C_Currency_ID,
|
||||
C_Invoice_ID, C_InvoicePaySchedule_ID,
|
||||
C_BP_Group_ID, DueDate, IsSOTrx, get_TrxName());
|
||||
C_BP_Group_ID, AD_Org_ID, DueDate, IsSOTrx, get_TrxName());
|
||||
aging.setC_Activity_ID(C_Activity_ID);
|
||||
aging.setC_Campaign_ID(C_Campaign_ID);
|
||||
aging.setC_Project_ID(C_Project_ID);
|
||||
|
@ -247,4 +257,3 @@ public class Aging extends SvrProcess
|
|||
} // doIt
|
||||
|
||||
} // Aging
|
||||
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
-- Mar 2, 2009 4:54:03 PM COT
|
||||
-- Bug 2655587 Multi-org not supported in Aging
|
||||
UPDATE AD_Process_Para SET SeqNo=20,Updated=TO_DATE('2009-03-02 16:54:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=53144
|
||||
;
|
||||
|
||||
-- Mar 2, 2009 4:54:09 PM COT
|
||||
UPDATE AD_Process_Para SET SeqNo=30,Updated=TO_DATE('2009-03-02 16:54:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=396
|
||||
;
|
||||
|
||||
-- Mar 2, 2009 4:54:14 PM COT
|
||||
UPDATE AD_Process_Para SET SeqNo=40,Updated=TO_DATE('2009-03-02 16:54:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=401
|
||||
;
|
||||
|
||||
-- Mar 2, 2009 4:54:17 PM COT
|
||||
UPDATE AD_Process_Para SET SeqNo=60,Updated=TO_DATE('2009-03-02 16:54:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=397
|
||||
;
|
||||
|
||||
-- Mar 2, 2009 4:54:22 PM COT
|
||||
UPDATE AD_Process_Para SET SeqNo=70,Updated=TO_DATE('2009-03-02 16:54:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=399
|
||||
;
|
||||
|
||||
-- Mar 2, 2009 4:54:24 PM COT
|
||||
UPDATE AD_Process_Para SET SeqNo=80,Updated=TO_DATE('2009-03-02 16:54:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=400
|
||||
;
|
||||
|
||||
-- Mar 2, 2009 7:34:42 PM COT
|
||||
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,DefaultValue,Description,EntityType,FieldLength,Help,IsActive,IsCentrallyMaintained,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,113,0,238,53297,19,'AD_Org_ID',TO_DATE('2009-03-02 19:34:41','YYYY-MM-DD HH24:MI:SS'),100,'-1','Organizational entity within client','D',0,'An organization is a unit of your client or legal entity - examples are store, department. You can share data between organizations.','Y','Y','N','N','Organization',60,TO_DATE('2009-03-02 19:34:41','YYYY-MM-DD HH24:MI:SS'),100)
|
||||
;
|
||||
|
||||
-- Mar 2, 2009 7:34:42 PM COT
|
||||
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=53297 AND EXISTS (SELECT * FROM AD_Process_Para_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Process_Para_ID!=t.AD_Process_Para_ID)
|
||||
;
|
||||
|
||||
-- Mar 2, 2009 8:15:22 PM COT
|
||||
UPDATE AD_Process_Para SET AD_Val_Rule_ID=130,Updated=TO_DATE('2009-03-02 20:15:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=53297
|
||||
;
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
-- Mar 2, 2009 4:54:03 PM COT
|
||||
-- Bug 2655587 Multi-org not supported in Aging
|
||||
UPDATE AD_Process_Para SET SeqNo=20,Updated=TO_TIMESTAMP('2009-03-02 16:54:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=53144
|
||||
;
|
||||
|
||||
-- Mar 2, 2009 4:54:09 PM COT
|
||||
UPDATE AD_Process_Para SET SeqNo=30,Updated=TO_TIMESTAMP('2009-03-02 16:54:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=396
|
||||
;
|
||||
|
||||
-- Mar 2, 2009 4:54:14 PM COT
|
||||
UPDATE AD_Process_Para SET SeqNo=40,Updated=TO_TIMESTAMP('2009-03-02 16:54:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=401
|
||||
;
|
||||
|
||||
-- Mar 2, 2009 4:54:17 PM COT
|
||||
UPDATE AD_Process_Para SET SeqNo=60,Updated=TO_TIMESTAMP('2009-03-02 16:54:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=397
|
||||
;
|
||||
|
||||
-- Mar 2, 2009 4:54:22 PM COT
|
||||
UPDATE AD_Process_Para SET SeqNo=70,Updated=TO_TIMESTAMP('2009-03-02 16:54:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=399
|
||||
;
|
||||
|
||||
-- Mar 2, 2009 4:54:24 PM COT
|
||||
UPDATE AD_Process_Para SET SeqNo=80,Updated=TO_TIMESTAMP('2009-03-02 16:54:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=400
|
||||
;
|
||||
|
||||
-- Mar 2, 2009 7:34:42 PM COT
|
||||
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,DefaultValue,Description,EntityType,FieldLength,Help,IsActive,IsCentrallyMaintained,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,113,0,238,53297,19,'AD_Org_ID',TO_TIMESTAMP('2009-03-02 19:34:41','YYYY-MM-DD HH24:MI:SS'),100,'-1','Organizational entity within client','D',0,'An organization is a unit of your client or legal entity - examples are store, department. You can share data between organizations.','Y','Y','N','N','Organization',60,TO_TIMESTAMP('2009-03-02 19:34:41','YYYY-MM-DD HH24:MI:SS'),100)
|
||||
;
|
||||
|
||||
-- Mar 2, 2009 7:34:42 PM COT
|
||||
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=53297 AND EXISTS (SELECT * FROM AD_Process_Para_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Process_Para_ID!=t.AD_Process_Para_ID)
|
||||
;
|
||||
|
||||
-- Mar 2, 2009 8:15:22 PM COT
|
||||
UPDATE AD_Process_Para SET AD_Val_Rule_ID=130,Updated=TO_TIMESTAMP('2009-03-02 20:15:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=53297
|
||||
;
|
||||
|
Loading…
Reference in New Issue