From 79d050b34c6cf55d6c45c0f088aded0c81b70f98 Mon Sep 17 00:00:00 2001 From: Deepak Pansheriya Date: Fri, 14 Feb 2020 23:09:17 +0530 Subject: [PATCH] IDEMPIERE-4065: Making report configurable to reverse value (#13) --- .../oracle/201912301640_IDEMPIERE-4065.sql | 42 +++++++++++++++++++ .../201912301640_IDEMPIERE-4065.sql | 39 +++++++++++++++++ .../org/compiere/model/I_PA_ReportColumn.java | 13 ++++++ .../org/compiere/model/I_PA_ReportLine.java | 13 ++++++ .../org/compiere/model/X_PA_ReportColumn.java | 26 +++++++++++- .../org/compiere/model/X_PA_ReportLine.java | 26 +++++++++++- .../src/org/compiere/report/FinReport.java | 33 +++++++++++++++ 7 files changed, 190 insertions(+), 2 deletions(-) create mode 100644 migration/i7.1z/oracle/201912301640_IDEMPIERE-4065.sql create mode 100644 migration/i7.1z/postgresql/201912301640_IDEMPIERE-4065.sql diff --git a/migration/i7.1z/oracle/201912301640_IDEMPIERE-4065.sql b/migration/i7.1z/oracle/201912301640_IDEMPIERE-4065.sql new file mode 100644 index 0000000000..bfd83a3fd4 --- /dev/null +++ b/migration/i7.1z/oracle/201912301640_IDEMPIERE-4065.sql @@ -0,0 +1,42 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Show opposite sign on financial report +-- Sep 26, 2019 4:27:52 PM IST +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 (203365,0,0,'Y',TO_DATE('2019-09-26 16:27:52','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-09-26 16:27:52','YYYY-MM-DD HH24:MI:SS'),100,'IsAllowOppositeSign','Allow Opposite Sign','Allow column values to be displayed with the opposite sign','Allows values to be displayed with the opposite sign to the calculated value if the "Show Opposite Sign" flag is set on the Report Line. Note that all report calculations are performed before the sign is reversed.','Allow Opposite Sign','D','67b0805b-dd29-4619-a31f-e831216830f9') +; + +-- Sep 26, 2019 4:28:49 PM IST +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_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) VALUES (214054,0,'Allow Opposite Sign','Allow column values to be displayed with the opposite sign','Allows values to be displayed with the opposite sign to the calculated value if the "Show Opposite Sign" flag is set on the Report Line. Note that all report calculations are performed before the sign is reversed.',446,'IsAllowOppositeSign','N',1,'N','N','N','N','N',0,'N',20,0,0,'Y',TO_DATE('2019-09-26 16:28:49','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-09-26 16:28:49','YYYY-MM-DD HH24:MI:SS'),100,203365,'Y','N','D','N','N','N','Y','ba253ecf-6fab-487a-9555-b1e8a78963ab','Y',0,'N','N') +; + +-- Sep 26, 2019 4:28:52 PM IST +ALTER TABLE PA_ReportColumn ADD IsAllowOppositeSign CHAR(1) DEFAULT 'N' CHECK (IsAllowOppositeSign IN ('Y','N')) +; + +-- Sep 26, 2019 4:29:17 PM IST +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField) VALUES (206181,'Allow Opposite Sign','Allow column values to be displayed with the opposite sign','Allows values to be displayed with the opposite sign to the calculated value if the "Show Opposite Sign" flag is set on the Report Line. Note that all report calculations are performed before the sign is reversed.',374,214054,'Y',0,460,0,'N','N','N','N',0,0,'Y',TO_DATE('2019-09-26 16:29:17','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-09-26 16:29:17','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','fa4bf151-debd-446f-9c2c-1045e0047cb9','Y',480,1,1,1,'N','N','N') +; + +-- Sep 26, 2019 4:30:39 PM IST +UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=2, ColumnSpan=2, IsToolbarButton=NULL,Updated=TO_DATE('2019-09-26 16:30:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206181 +; + +-- Sep 26, 2019 4:32:22 PM IST +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 (203366,0,0,'Y',TO_DATE('2019-09-26 16:32:21','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-09-26 16:32:21','YYYY-MM-DD HH24:MI:SS'),100,'IsShowOppositeSign','Show Opposite Sign','Display values with the opposite sign','Displays values for a Report Line with the opposite sign to the calculated value. The "Allow Opposite Sign" flag on Report Column must also be set for this to take effect. Note that all report calculations are performed before the sign is reversed.','Show Opposite Sign','D','affbda16-f11c-40c9-bdd6-7b7dbcce23ba') +; + +-- Sep 26, 2019 4:33:16 PM IST +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_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) VALUES (214055,0,'Show Opposite Sign','Display values with the opposite sign','Displays values for a Report Line with the opposite sign to the calculated value. The "Allow Opposite Sign" flag on Report Column must also be set for this to take effect. Note that all report calculations are performed before the sign is reversed.',448,'IsShowOppositeSign','N',1,'N','N','N','N','N',0,'N',20,0,0,'Y',TO_DATE('2019-09-26 16:33:16','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-09-26 16:33:16','YYYY-MM-DD HH24:MI:SS'),100,203366,'Y','N','D','N','N','N','Y','8a3f8b94-6f5f-4966-a222-93a08e660254','Y',0,'N','N') +; + +-- Sep 26, 2019 4:33:18 PM IST +ALTER TABLE PA_ReportLine ADD IsShowOppositeSign CHAR(1) DEFAULT 'N' CHECK (IsShowOppositeSign IN ('Y','N')) +; + +-- Sep 26, 2019 4:33:44 PM IST +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField) VALUES (206182,'Show Opposite Sign','Display values with the opposite sign','Displays values for a Report Line with the opposite sign to the calculated value. The "Allow Opposite Sign" flag on Report Column must also be set for this to take effect. Note that all report calculations are performed before the sign is reversed.',376,214055,'Y',0,190,0,'N','N','N','N',0,0,'Y',TO_DATE('2019-09-26 16:33:43','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-09-26 16:33:43','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','5ed1ddfb-f4e2-46f7-ab04-e7045011ee23','Y',205,2,2,1,'N','N','N') +; + +SELECT register_migration_script('201912301640_IDEMPIERE-4065.sql') FROM dual +; diff --git a/migration/i7.1z/postgresql/201912301640_IDEMPIERE-4065.sql b/migration/i7.1z/postgresql/201912301640_IDEMPIERE-4065.sql new file mode 100644 index 0000000000..9644d1c7f3 --- /dev/null +++ b/migration/i7.1z/postgresql/201912301640_IDEMPIERE-4065.sql @@ -0,0 +1,39 @@ +-- Show opposite sign on financial report +-- Sep 26, 2019 4:27:52 PM IST +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 (203365,0,0,'Y',TO_TIMESTAMP('2019-09-26 16:27:52','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-09-26 16:27:52','YYYY-MM-DD HH24:MI:SS'),100,'IsAllowOppositeSign','Allow Opposite Sign','Allow column values to be displayed with the opposite sign','Allows values to be displayed with the opposite sign to the calculated value if the "Show Opposite Sign" flag is set on the Report Line. Note that all report calculations are performed before the sign is reversed.','Allow Opposite Sign','D','67b0805b-dd29-4619-a31f-e831216830f9') +; + +-- Sep 26, 2019 4:28:49 PM IST +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_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) VALUES (214054,0,'Allow Opposite Sign','Allow column values to be displayed with the opposite sign','Allows values to be displayed with the opposite sign to the calculated value if the "Show Opposite Sign" flag is set on the Report Line. Note that all report calculations are performed before the sign is reversed.',446,'IsAllowOppositeSign','N',1,'N','N','N','N','N',0,'N',20,0,0,'Y',TO_TIMESTAMP('2019-09-26 16:28:49','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-09-26 16:28:49','YYYY-MM-DD HH24:MI:SS'),100,203365,'Y','N','D','N','N','N','Y','ba253ecf-6fab-487a-9555-b1e8a78963ab','Y',0,'N','N') +; + +-- Sep 26, 2019 4:28:52 PM IST +ALTER TABLE PA_ReportColumn ADD COLUMN IsAllowOppositeSign CHAR(1) DEFAULT 'N' CHECK (IsAllowOppositeSign IN ('Y','N')) +; + +-- Sep 26, 2019 4:29:17 PM IST +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField) VALUES (206181,'Allow Opposite Sign','Allow column values to be displayed with the opposite sign','Allows values to be displayed with the opposite sign to the calculated value if the "Show Opposite Sign" flag is set on the Report Line. Note that all report calculations are performed before the sign is reversed.',374,214054,'Y',0,460,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2019-09-26 16:29:17','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-09-26 16:29:17','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','fa4bf151-debd-446f-9c2c-1045e0047cb9','Y',480,1,1,1,'N','N','N') +; + +-- Sep 26, 2019 4:30:39 PM IST +UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=2, ColumnSpan=2, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-09-26 16:30:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206181 +; + +-- Sep 26, 2019 4:32:22 PM IST +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 (203366,0,0,'Y',TO_TIMESTAMP('2019-09-26 16:32:21','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-09-26 16:32:21','YYYY-MM-DD HH24:MI:SS'),100,'IsShowOppositeSign','Show Opposite Sign','Display values with the opposite sign','Displays values for a Report Line with the opposite sign to the calculated value. The "Allow Opposite Sign" flag on Report Column must also be set for this to take effect. Note that all report calculations are performed before the sign is reversed.','Show Opposite Sign','D','affbda16-f11c-40c9-bdd6-7b7dbcce23ba') +; + +-- Sep 26, 2019 4:33:16 PM IST +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_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) VALUES (214055,0,'Show Opposite Sign','Display values with the opposite sign','Displays values for a Report Line with the opposite sign to the calculated value. The "Allow Opposite Sign" flag on Report Column must also be set for this to take effect. Note that all report calculations are performed before the sign is reversed.',448,'IsShowOppositeSign','N',1,'N','N','N','N','N',0,'N',20,0,0,'Y',TO_TIMESTAMP('2019-09-26 16:33:16','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-09-26 16:33:16','YYYY-MM-DD HH24:MI:SS'),100,203366,'Y','N','D','N','N','N','Y','8a3f8b94-6f5f-4966-a222-93a08e660254','Y',0,'N','N') +; + +-- Sep 26, 2019 4:33:18 PM IST +ALTER TABLE PA_ReportLine ADD COLUMN IsShowOppositeSign CHAR(1) DEFAULT 'N' CHECK (IsShowOppositeSign IN ('Y','N')) +; + +-- Sep 26, 2019 4:33:44 PM IST +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField) VALUES (206182,'Show Opposite Sign','Display values with the opposite sign','Displays values for a Report Line with the opposite sign to the calculated value. The "Allow Opposite Sign" flag on Report Column must also be set for this to take effect. Note that all report calculations are performed before the sign is reversed.',376,214055,'Y',0,190,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2019-09-26 16:33:43','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-09-26 16:33:43','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','5ed1ddfb-f4e2-46f7-ab04-e7045011ee23','Y',205,2,2,1,'N','N','N') +; + +SELECT register_migration_script('201912301640_IDEMPIERE-4065.sql') FROM dual +; diff --git a/org.adempiere.base/src/org/compiere/model/I_PA_ReportColumn.java b/org.adempiere.base/src/org/compiere/model/I_PA_ReportColumn.java index 26de370384..87b11a0d16 100644 --- a/org.adempiere.base/src/org/compiere/model/I_PA_ReportColumn.java +++ b/org.adempiere.base/src/org/compiere/model/I_PA_ReportColumn.java @@ -331,6 +331,19 @@ public interface I_PA_ReportColumn */ public boolean isAdhocConversion(); + /** Column name IsAllowOppositeSign */ + public static final String COLUMNNAME_IsAllowOppositeSign = "IsAllowOppositeSign"; + + /** Set Allow Opposite Sign. + * Allow column values to be displayed with the opposite sign + */ + public void setIsAllowOppositeSign (boolean IsAllowOppositeSign); + + /** Get Allow Opposite Sign. + * Allow column values to be displayed with the opposite sign + */ + public boolean isAllowOppositeSign(); + /** Column name IsIncludeNullsActivity */ public static final String COLUMNNAME_IsIncludeNullsActivity = "IsIncludeNullsActivity"; diff --git a/org.adempiere.base/src/org/compiere/model/I_PA_ReportLine.java b/org.adempiere.base/src/org/compiere/model/I_PA_ReportLine.java index df7daeb988..aaf9a269ca 100644 --- a/org.adempiere.base/src/org/compiere/model/I_PA_ReportLine.java +++ b/org.adempiere.base/src/org/compiere/model/I_PA_ReportLine.java @@ -154,6 +154,19 @@ public interface I_PA_ReportLine */ public boolean isPrinted(); + /** Column name IsShowOppositeSign */ + public static final String COLUMNNAME_IsShowOppositeSign = "IsShowOppositeSign"; + + /** Set Show Opposite Sign. + * Display values with the opposite sign + */ + public void setIsShowOppositeSign (boolean IsShowOppositeSign); + + /** Get Show Opposite Sign. + * Display values with the opposite sign + */ + public boolean isShowOppositeSign(); + /** Column name LineType */ public static final String COLUMNNAME_LineType = "LineType"; diff --git a/org.adempiere.base/src/org/compiere/model/X_PA_ReportColumn.java b/org.adempiere.base/src/org/compiere/model/X_PA_ReportColumn.java index d85c7ea4c0..570c17bb96 100644 --- a/org.adempiere.base/src/org/compiere/model/X_PA_ReportColumn.java +++ b/org.adempiere.base/src/org/compiere/model/X_PA_ReportColumn.java @@ -32,7 +32,7 @@ public class X_PA_ReportColumn extends PO implements I_PA_ReportColumn, I_Persis /** * */ - private static final long serialVersionUID = 20191121L; + private static final long serialVersionUID = 20191122L; /** Standard Constructor */ public X_PA_ReportColumn (Properties ctx, int PA_ReportColumn_ID, String trxName) @@ -586,6 +586,30 @@ public class X_PA_ReportColumn extends PO implements I_PA_ReportColumn, I_Persis return false; } + /** Set Allow Opposite Sign. + @param IsAllowOppositeSign + Allow column values to be displayed with the opposite sign + */ + public void setIsAllowOppositeSign (boolean IsAllowOppositeSign) + { + set_Value (COLUMNNAME_IsAllowOppositeSign, Boolean.valueOf(IsAllowOppositeSign)); + } + + /** Get Allow Opposite Sign. + @return Allow column values to be displayed with the opposite sign + */ + public boolean isAllowOppositeSign () + { + Object oo = get_Value(COLUMNNAME_IsAllowOppositeSign); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + /** Set Include Nulls in Activity. @param IsIncludeNullsActivity Include nulls in the selection of the activity diff --git a/org.adempiere.base/src/org/compiere/model/X_PA_ReportLine.java b/org.adempiere.base/src/org/compiere/model/X_PA_ReportLine.java index 8fbb674ee5..b36143ac06 100644 --- a/org.adempiere.base/src/org/compiere/model/X_PA_ReportLine.java +++ b/org.adempiere.base/src/org/compiere/model/X_PA_ReportLine.java @@ -30,7 +30,7 @@ public class X_PA_ReportLine extends PO implements I_PA_ReportLine, I_Persistent /** * */ - private static final long serialVersionUID = 20191121L; + private static final long serialVersionUID = 20191122L; /** Standard Constructor */ public X_PA_ReportLine (Properties ctx, int PA_ReportLine_ID, String trxName) @@ -197,6 +197,30 @@ public class X_PA_ReportLine extends PO implements I_PA_ReportLine, I_Persistent return false; } + /** Set Show Opposite Sign. + @param IsShowOppositeSign + Display values with the opposite sign + */ + public void setIsShowOppositeSign (boolean IsShowOppositeSign) + { + set_Value (COLUMNNAME_IsShowOppositeSign, Boolean.valueOf(IsShowOppositeSign)); + } + + /** Get Show Opposite Sign. + @return Display values with the opposite sign + */ + public boolean isShowOppositeSign () + { + Object oo = get_Value(COLUMNNAME_IsShowOppositeSign); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + /** LineType AD_Reference_ID=241 */ public static final int LINETYPE_AD_Reference_ID=241; /** Segment Value = S */ diff --git a/org.adempiere.base/src/org/compiere/report/FinReport.java b/org.adempiere.base/src/org/compiere/report/FinReport.java index e0f90063d9..7fc00af44f 100644 --- a/org.adempiere.base/src/org/compiere/report/FinReport.java +++ b/org.adempiere.base/src/org/compiere/report/FinReport.java @@ -942,6 +942,39 @@ public class FinReport extends SvrProcess } } // for all columns + // allow opposite sign + boolean hasOpposites = false; + StringBuffer sb = new StringBuffer("UPDATE T_Report SET "); + for (int col = 0; col < m_columns.length; col++) + { + if (m_columns[col].isAllowOppositeSign()) + { + if (hasOpposites) + sb.append(", "); + else + hasOpposites = true; + + // Column to set + sb.append("Col_").append(col).append("= -1 * Col_").append(col); + } + } + + if (hasOpposites) + { + sb.append(" WHERE AD_PInstance_ID = ").append(getAD_PInstance_ID()); + // 0=Line 1=Acct + sb.append(" AND ABS(LevelNo) < 2 "); + sb.append(" AND EXISTS (SELECT 1 FROM PA_ReportLine rl WHERE rl.PA_ReportLine_ID=T_Report.PA_ReportLine_ID AND rl.IsShowOppositeSign='Y' AND rl.IsActive='Y') "); + int no = DB.executeUpdate(sb.toString(), get_TrxName()); + if (no < 1) + log.severe("#=" + no + " for setting opposite sign" + " - " + sb.toString()); + else + { + log.fine("Set opposite sign: " + no); + log.finest(sb.toString()); + } + } + } // doCalculations /**