IDEMPIERE-4014 Aging - some lines are hidden if using C_Currency_ID as parameter

This commit is contained in:
Nicolas Micoud 2019-07-30 13:26:21 +02:00
parent 8c7ef51521
commit 497bf9d429
5 changed files with 144 additions and 6 deletions

View File

@ -0,0 +1,51 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- IDEMPIERE-4014 - Aging - some lines are hidden if using C_Currency_ID as parameter
-- 07/29/2019 06:17:48
INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,Description,Help,PrintName,EntityType,AD_Element_UU) VALUES (203350,0,0,'Y',TO_DATE('2019-07-29 18:17:35','YYYY-MM-DD HH24:MI:SS'),0,TO_DATE('2019-07-29 18:17:35','YYYY-MM-DD HH24:MI:SS'),0,'ConvertAmountsInCurrency_ID','Convert Amounts in Currency',NULL,NULL,'Convert Amounts in Currency','D','3ff194dd-160e-4362-b4e5-d0e41221c1c5')
;
-- 07/29/2019 06:18:26
INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,AD_Process_ID,SeqNo,AD_Reference_ID,AD_Reference_Value_ID,IsRange,FieldLength,IsMandatory,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200280,0,0,'Y',TO_DATE('2019-07-29 18:18:26','YYYY-MM-DD HH24:MI:SS'),0,TO_DATE('2019-07-29 18:18:26','YYYY-MM-DD HH24:MI:SS'),0,'Convert Amounts in Currency',238,45,18,112,'N',0,'N','ConvertAmountsInCurrency_ID','Y','D',203350,'a4cc6ea2-103f-4389-bf39-cda71c73028c','N')
;
-- 07/29/2019 06:18:51
UPDATE AD_Process SET Help='The aging report allows you to report on Open Items (Invoices). Select the aging buckets, you want to have in your report. If you select a currency, you get only invoices of that currency.
If you fill the "Convert Amounts in Currency", all amounts will be converted in that currency. If you do not select a Statement Date, the system date is used to calculate the buckets. If you do not list the individual invoices, the Due Date is the earliest due date for the business partner and the Due Days are the average due days of all invoices.<br>
<br>
If you select an Account Date the report will generate the Aging as of that date. The report will exclude documents after the selected date.<br>
<br>
For example: A customer has one invoice for $100 with the Account Date of 03/31/08 and one payment for $100 with the Account Date of 05/01/08. The report will show the following balances based on the Account Date selected: 03/15/08= 0; 04/15/08=100; 05/15/08 = 0.
',Updated=TO_DATE('2019-07-29 18:18:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_ID=238
;
INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Reference_Value_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,FKConstraintType,IsHtml) VALUES (213969,0,'Convert Amounts in Currency',631,'ConvertAmountsInCurrency_ID',10,'N','N','N','N','N',0,'N',30,112,0,0,'Y',TO_DATE('2019-07-29 18:34:22','YYYY-MM-DD HH24:MI:SS'),0,TO_DATE('2019-07-29 18:34:22','YYYY-MM-DD HH24:MI:SS'),0,203350,'Y','N','D','N','N','N','Y','c34b0911-52ef-4a30-a04c-b2739de87f5d','N',0,'N','N','N','N')
;
-- 07/29/2019 06:34:24
UPDATE AD_Column SET FKConstraintName='ConvertAmountsInCurrency_TAgin', FKConstraintType='N',Updated=TO_DATE('2019-07-29 18:34:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=213969
;
-- 07/29/2019 06:34:24
ALTER TABLE T_Aging ADD ConvertAmountsInCurrency_ID NUMBER(10) DEFAULT NULL
;
-- 07/29/2019 06:34:24
ALTER TABLE T_Aging ADD CONSTRAINT ConvertAmountsInCurrency_TAgin FOREIGN KEY (ConvertAmountsInCurrency_ID) REFERENCES c_currency(c_currency_id) DEFERRABLE INITIALLY DEFERRED
;
-- 07/29/2019 06:34:28
UPDATE AD_Column SET FKConstraintType='D',Updated=TO_DATE('2019-07-29 18:34:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=213969
;
-- 07/29/2019 06:34:29
ALTER TABLE T_Aging MODIFY ConvertAmountsInCurrency_ID NUMBER(10) DEFAULT NULL
;
-- 07/29/2019 06:34:29
ALTER TABLE T_Aging DROP CONSTRAINT convertamountsincurrency_tagin
;
SELECT register_migration_script('201907291830_IDEMPIERE-4014.sql') FROM dual
;

View File

@ -0,0 +1,48 @@
-- IDEMPIERE-4014 - Aging - some lines are hidden if using C_Currency_ID as parameter
-- 07/29/2019 06:17:48
INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,Description,Help,PrintName,EntityType,AD_Element_UU) VALUES (203350,0,0,'Y',TO_TIMESTAMP('2019-07-29 18:17:35','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2019-07-29 18:17:35','YYYY-MM-DD HH24:MI:SS'),0,'ConvertAmountsInCurrency_ID','Convert Amounts in Currency',NULL,NULL,'Convert Amounts in Currency','D','3ff194dd-160e-4362-b4e5-d0e41221c1c5')
;
-- 07/29/2019 06:18:26
INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,AD_Process_ID,SeqNo,AD_Reference_ID,AD_Reference_Value_ID,IsRange,FieldLength,IsMandatory,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200280,0,0,'Y',TO_TIMESTAMP('2019-07-29 18:18:26','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2019-07-29 18:18:26','YYYY-MM-DD HH24:MI:SS'),0,'Convert Amounts in Currency',238,45,18,112,'N',0,'N','ConvertAmountsInCurrency_ID','Y','D',203350,'a4cc6ea2-103f-4389-bf39-cda71c73028c','N')
;
-- 07/29/2019 06:18:51
UPDATE AD_Process SET Help='The aging report allows you to report on Open Items (Invoices). Select the aging buckets, you want to have in your report. If you select a currency, you get only invoices of that currency.
If you fill the "Convert Amounts in Currency", all amounts will be converted in that currency. If you do not select a Statement Date, the system date is used to calculate the buckets. If you do not list the individual invoices, the Due Date is the earliest due date for the business partner and the Due Days are the average due days of all invoices.<br>
<br>
If you select an Account Date the report will generate the Aging as of that date. The report will exclude documents after the selected date.<br>
<br>
For example: A customer has one invoice for $100 with the Account Date of 03/31/08 and one payment for $100 with the Account Date of 05/01/08. The report will show the following balances based on the Account Date selected: 03/15/08= 0; 04/15/08=100; 05/15/08 = 0.
',Updated=TO_TIMESTAMP('2019-07-29 18:18:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_ID=238
;
INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Reference_Value_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,FKConstraintType,IsHtml) VALUES (213969,0,'Convert Amounts in Currency',631,'ConvertAmountsInCurrency_ID',10,'N','N','N','N','N',0,'N',30,112,0,0,'Y',TO_TIMESTAMP('2019-07-29 18:34:22','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2019-07-29 18:34:22','YYYY-MM-DD HH24:MI:SS'),0,203350,'Y','N','D','N','N','N','Y','c34b0911-52ef-4a30-a04c-b2739de87f5d','N',0,'N','N','N','N')
;
-- 07/29/2019 06:34:24
UPDATE AD_Column SET FKConstraintName='ConvertAmountsInCurrency_TAgin', FKConstraintType='N',Updated=TO_TIMESTAMP('2019-07-29 18:34:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=213969
;
-- 07/29/2019 06:34:24
ALTER TABLE T_Aging ADD COLUMN ConvertAmountsInCurrency_ID NUMERIC(10) DEFAULT NULL
;
-- 07/29/2019 06:34:24
ALTER TABLE T_Aging ADD CONSTRAINT ConvertAmountsInCurrency_TAgin FOREIGN KEY (ConvertAmountsInCurrency_ID) REFERENCES c_currency(c_currency_id) DEFERRABLE INITIALLY DEFERRED
;
-- 07/29/2019 06:34:28
UPDATE AD_Column SET FKConstraintType='D',Updated=TO_TIMESTAMP('2019-07-29 18:34:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=213969
;
-- 07/29/2019 06:34:29
INSERT INTO t_alter_column values('t_aging','ConvertAmountsInCurrency_ID','NUMERIC(10)',null,'NULL')
;
-- 07/29/2019 06:34:29
ALTER TABLE T_Aging DROP CONSTRAINT convertamountsincurrency_tagin
;
SELECT register_migration_script('201907291830_IDEMPIERE-4014.sql') FROM dual
;

View File

@ -46,7 +46,7 @@ public class Aging extends SvrProcess
//FR 1933937 //FR 1933937
private boolean p_DateAcct = false; private boolean p_DateAcct = false;
private boolean p_IsSOTrx = false; private boolean p_IsSOTrx = false;
private int p_C_Currency_ID = 0; private int p_ConvertCurrencyTo_ID = 0;
private int p_AD_Org_ID = 0; private int p_AD_Org_ID = 0;
private int p_C_BP_Group_ID = 0; private int p_C_BP_Group_ID = 0;
private int p_C_BPartner_ID = 0; private int p_C_BPartner_ID = 0;
@ -72,7 +72,9 @@ public class Aging extends SvrProcess
else if (name.equals("IsSOTrx")) else if (name.equals("IsSOTrx"))
p_IsSOTrx = "Y".equals(para[i].getParameter()); p_IsSOTrx = "Y".equals(para[i].getParameter());
else if (name.equals("C_Currency_ID")) else if (name.equals("C_Currency_ID"))
p_C_Currency_ID = ((BigDecimal)para[i].getParameter()).intValue(); ;
else if (name.equals("ConvertAmountsInCurrency_ID"))
p_ConvertCurrencyTo_ID = para[i].getParameterAsInt();
else if (name.equals("AD_Org_ID")) else if (name.equals("AD_Org_ID"))
p_AD_Org_ID = ((BigDecimal)para[i].getParameter()).intValue(); p_AD_Org_ID = ((BigDecimal)para[i].getParameter()).intValue();
else if (name.equals("C_BP_Group_ID")) else if (name.equals("C_BP_Group_ID"))
@ -99,7 +101,7 @@ public class Aging extends SvrProcess
protected String doIt() throws Exception protected String doIt() throws Exception
{ {
if (log.isLoggable(Level.INFO)) log.info("StatementDate=" + p_StatementDate + ", IsSOTrx=" + p_IsSOTrx if (log.isLoggable(Level.INFO)) log.info("StatementDate=" + p_StatementDate + ", IsSOTrx=" + p_IsSOTrx
+ ", C_Currency_ID=" + p_C_Currency_ID + ", AD_Org_ID=" + p_AD_Org_ID + ", ConvertAmountsInCurrency_ID=" + p_ConvertCurrencyTo_ID + ", AD_Org_ID=" + p_AD_Org_ID
+ ", C_BP_Group_ID=" + p_C_BP_Group_ID + ", C_BPartner_ID=" + p_C_BPartner_ID + ", C_BP_Group_ID=" + p_C_BP_Group_ID + ", C_BPartner_ID=" + p_C_BPartner_ID
+ ", IsListInvoices=" + p_IsListInvoices); + ", IsListInvoices=" + p_IsListInvoices);
//FR 1933937 //FR 1933937
@ -109,7 +111,7 @@ public class Aging extends SvrProcess
sql.append("SELECT bp.C_BP_Group_ID, oi.C_BPartner_ID,oi.C_Invoice_ID,oi.C_InvoicePaySchedule_ID, " // 1..4 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.C_Currency_ID, oi.IsSOTrx, " // 5..6
+ "oi.DateInvoiced, oi.NetDays,oi.DueDate,oi.DaysDue, "); // 7..10 + "oi.DateInvoiced, oi.NetDays,oi.DueDate,oi.DaysDue, "); // 7..10
if (p_C_Currency_ID == 0) if (p_ConvertCurrencyTo_ID == 0)
{ {
if (!p_DateAcct)//FR 1933937 if (!p_DateAcct)//FR 1933937
{ {
@ -122,7 +124,7 @@ public class Aging extends SvrProcess
} }
else 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)"; String s = ",oi.C_Currency_ID," + p_ConvertCurrencyTo_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) if (!p_DateAcct)
{ {
@ -231,6 +233,7 @@ public class Aging extends SvrProcess
aging.setC_Campaign_ID(C_Campaign_ID); aging.setC_Campaign_ID(C_Campaign_ID);
aging.setC_Project_ID(C_Project_ID); aging.setC_Project_ID(C_Project_ID);
aging.setDateAcct(p_DateAcct); aging.setDateAcct(p_DateAcct);
aging.setConvertAmountsInCurrency_ID(p_ConvertCurrencyTo_ID);
} }
// Fill Buckets // Fill Buckets
aging.add (DueDate, DaysDue, GrandTotal, OpenAmt); aging.add (DueDate, DaysDue, GrandTotal, OpenAmt);

View File

@ -197,6 +197,17 @@ public interface I_T_Aging
public org.compiere.model.I_C_Project getC_Project() throws RuntimeException; public org.compiere.model.I_C_Project getC_Project() throws RuntimeException;
/** Column name ConvertAmountsInCurrency_ID */
public static final String COLUMNNAME_ConvertAmountsInCurrency_ID = "ConvertAmountsInCurrency_ID";
/** Set Convert Amounts in Currency */
public void setConvertAmountsInCurrency_ID (int ConvertAmountsInCurrency_ID);
/** Get Convert Amounts in Currency */
public int getConvertAmountsInCurrency_ID();
public org.compiere.model.I_C_Currency getConvertAmountsInCurrency() throws RuntimeException;
/** Column name Created */ /** Column name Created */
public static final String COLUMNNAME_Created = "Created"; public static final String COLUMNNAME_Created = "Created";

View File

@ -32,7 +32,7 @@ public class X_T_Aging extends PO implements I_T_Aging, I_Persistent
/** /**
* *
*/ */
private static final long serialVersionUID = 20190106L; private static final long serialVersionUID = 20190729L;
/** Standard Constructor */ /** Standard Constructor */
public X_T_Aging (Properties ctx, int T_Aging_ID, String trxName) public X_T_Aging (Properties ctx, int T_Aging_ID, String trxName)
@ -353,6 +353,31 @@ public class X_T_Aging extends PO implements I_T_Aging, I_Persistent
return ii.intValue(); return ii.intValue();
} }
public org.compiere.model.I_C_Currency getConvertAmountsInCurrency() throws RuntimeException
{
return (org.compiere.model.I_C_Currency)MTable.get(getCtx(), org.compiere.model.I_C_Currency.Table_Name)
.getPO(getConvertAmountsInCurrency_ID(), get_TrxName()); }
/** Set Convert Amounts in Currency.
@param ConvertAmountsInCurrency_ID Convert Amounts in Currency */
public void setConvertAmountsInCurrency_ID (int ConvertAmountsInCurrency_ID)
{
if (ConvertAmountsInCurrency_ID < 1)
set_Value (COLUMNNAME_ConvertAmountsInCurrency_ID, null);
else
set_Value (COLUMNNAME_ConvertAmountsInCurrency_ID, Integer.valueOf(ConvertAmountsInCurrency_ID));
}
/** Get Convert Amounts in Currency.
@return Convert Amounts in Currency */
public int getConvertAmountsInCurrency_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_ConvertAmountsInCurrency_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Account Date. /** Set Account Date.
@param DateAcct @param DateAcct
Accounting Date Accounting Date