From e72dfd66c079672493aade401fd7d63198e56188 Mon Sep 17 00:00:00 2001 From: Deepak Pansheriya Date: Tue, 8 Sep 2020 16:29:19 +0530 Subject: [PATCH] =?UTF-8?q?IDEMPIERE-4067=20:=20Support=20for=20Under/Over?= =?UTF-8?q?=20line=20and=20Blank=20line=20in=20finaci=E2=80=A6=20(#244)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * IDEMPIERE-4067 : Support for Under/Over line and Blank line in finacial report line. * IDEMPIERE-4067 : Adding support for blank line export in CSV, HTML, Excel. Also allowing to show description if provided. fixed all review comments fron Carlos Ruiz --- .../oracle/201912301800_IDEMPIERE-4067.sql | 72 ++++++++++ .../201912301800_IDEMPIERE-4067.sql | 69 +++++++++ .../org/compiere/model/I_PA_ReportLine.java | 18 +++ .../org/compiere/model/X_PA_ReportLine.java | 64 ++++++++- .../src/org/compiere/print/DataEngine.java | 28 +++- .../src/org/compiere/print/PrintData.java | 36 ++++- .../compiere/print/layout/LayoutEngine.java | 40 ++++-- .../compiere/print/layout/TableElement.java | 132 ++++++++++++++++-- .../src/org/compiere/report/FinReport.java | 2 +- .../src/org/compiere/report/MReportLine.java | 118 +++++++++++++++- 10 files changed, 551 insertions(+), 28 deletions(-) create mode 100644 migration/i7.1z/oracle/201912301800_IDEMPIERE-4067.sql create mode 100644 migration/i7.1z/postgresql/201912301800_IDEMPIERE-4067.sql diff --git a/migration/i7.1z/oracle/201912301800_IDEMPIERE-4067.sql b/migration/i7.1z/oracle/201912301800_IDEMPIERE-4067.sql new file mode 100644 index 0000000000..061b1614f7 --- /dev/null +++ b/migration/i7.1z/oracle/201912301800_IDEMPIERE-4067.sql @@ -0,0 +1,72 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Adding Over/Under line in Report +-- Oct 16, 2019 2:39:54 PM IST +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (203371,0,0,'Y',TO_DATE('2019-10-16 14:39:53','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-10-16 14:39:53','YYYY-MM-DD HH24:MI:SS'),100,'OverlineStrokeType','Overline Stroke Type','Overline Stroke Type','D','18f9193c-b4a9-4dc2-ba69-8dcefc4d8e88') +; + +-- Oct 16, 2019 2:40:47 PM IST +INSERT INTO AD_Reference (AD_Reference_ID,Name,ValidationType,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,IsOrderByValue,AD_Reference_UU) VALUES (200174,'PA_ReportLine Line Stroke Type','L',0,0,'Y',TO_DATE('2019-10-16 14:40:46','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-10-16 14:40:46','YYYY-MM-DD HH24:MI:SS'),100,'D','N','a66f38f4-feeb-472f-a561-0f2134214e66') +; + +-- Oct 16, 2019 2:41:10 PM IST +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200477,'Dotted',200174,'DT',0,0,'Y',TO_DATE('2019-10-16 14:41:10','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-10-16 14:41:10','YYYY-MM-DD HH24:MI:SS'),100,'D','e61955b1-37f0-45ed-8bd3-d7b72f5f730b') +; + +-- Oct 16, 2019 2:41:45 PM IST +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200478,'Dashed',200174,'DS',0,0,'Y',TO_DATE('2019-10-16 14:41:44','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-10-16 14:41:44','YYYY-MM-DD HH24:MI:SS'),100,'D','035f9d9e-4650-43e8-a0ec-e931e07270d8') +; + +-- Oct 16, 2019 2:42:08 PM IST +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200479,'Double Dotted',200174,'DDT',0,0,'Y',TO_DATE('2019-10-16 14:42:07','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-10-16 14:42:07','YYYY-MM-DD HH24:MI:SS'),100,'D','011c9ad0-34a9-4bd4-9af3-50615790ffb6') +; + +-- Oct 16, 2019 2:42:22 PM IST +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200480,'Double Dashed',200174,'DDS',0,0,'Y',TO_DATE('2019-10-16 14:42:22','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-10-16 14:42:22','YYYY-MM-DD HH24:MI:SS'),100,'D','13cd13e4-af78-4252-957e-3b1e45f33497') +; + +-- Oct 16, 2019 2:42:38 PM IST +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200481,'Double Solid',200174,'DSD',0,0,'Y',TO_DATE('2019-10-16 14:42:37','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-10-16 14:42:37','YYYY-MM-DD HH24:MI:SS'),100,'D','e39cde64-0d54-4cf9-93c1-5068c0e97ee6') +; + +-- Oct 16, 2019 2:42:53 PM IST +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200482,'Solid',200174,'SD',0,0,'Y',TO_DATE('2019-10-16 14:42:52','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-10-16 14:42:52','YYYY-MM-DD HH24:MI:SS'),100,'D','9e450ade-e54b-46e1-b96f-36c02b3090eb') +; + +-- Oct 16, 2019 2:43:26 PM IST +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) VALUES (214088,0,'Overline Stroke Type',448,'OverlineStrokeType',3,'N','N','N','N','N',0,'N',17,200174,0,0,'Y',TO_DATE('2019-10-16 14:43:26','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-10-16 14:43:26','YYYY-MM-DD HH24:MI:SS'),100,203371,'Y','N','D','N','N','N','Y','b1529a0e-96a5-43e6-94b6-d78feea8e8c8','Y',0,'N','N') +; + +-- Oct 16, 2019 2:43:31 PM IST +ALTER TABLE PA_ReportLine ADD OverlineStrokeType VARCHAR2(3 CHAR) DEFAULT NULL +; + +-- Oct 16, 2019 2:44:08 PM IST +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (203372,0,0,'Y',TO_DATE('2019-10-16 14:44:08','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-10-16 14:44:08','YYYY-MM-DD HH24:MI:SS'),100,'UnderlineStrokeType','Underline Stroke Type','Underline Stroke Type','D','36e60c3b-2eff-4d58-a530-101b2d060f4a') +; + +-- Oct 16, 2019 2:45:23 PM IST +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) VALUES (214089,0,'Underline Stroke Type',448,'UnderlineStrokeType',3,'N','N','N','N','N',0,'N',17,200174,0,0,'Y',TO_DATE('2019-10-16 14:45:23','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-10-16 14:45:23','YYYY-MM-DD HH24:MI:SS'),100,203372,'Y','N','D','N','N','N','Y','d3504292-068e-4126-944c-dc3d165019c0','Y',0,'N','N') +; + +-- Oct 16, 2019 2:45:39 PM IST +ALTER TABLE PA_ReportLine ADD UnderlineStrokeType VARCHAR2(3 CHAR) DEFAULT NULL +; + +-- Oct 16, 2019 2:48:07 PM IST +INSERT INTO AD_Field (AD_Field_ID,Name,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 (206214,'Overline Stroke Type',376,214088,'Y',0,200,0,'N','N','N','N',0,0,'Y',TO_DATE('2019-10-16 14:48:06','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-10-16 14:48:06','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','04733ecb-3dc6-4fde-82ab-33434b230ca5','Y',215,1,2,1,'N','N','N') +; + +-- Oct 16, 2019 2:48:25 PM IST +INSERT INTO AD_Field (AD_Field_ID,Name,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 (206215,'Underline Stroke Type',376,214089,'Y',0,210,0,'N','N','N','N',0,0,'Y',TO_DATE('2019-10-16 14:48:24','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-10-16 14:48:24','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','e5614dd4-9884-4053-99d5-1cb59540e412','Y',225,4,2,1,'N','N','N') +; + +-- Added Line Type Blank Line +-- Oct 16, 2019 5:29:02 PM IST +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200483,'Blank line',241,'B',0,0,'Y',TO_DATE('2019-10-16 17:29:01','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-10-16 17:29:01','YYYY-MM-DD HH24:MI:SS'),100,'D','bb000455-9057-4c8a-a656-b0f1074e3fd3') +; + +SELECT register_migration_script('201912301800_IDEMPIERE-4067.sql') FROM dual +; + diff --git a/migration/i7.1z/postgresql/201912301800_IDEMPIERE-4067.sql b/migration/i7.1z/postgresql/201912301800_IDEMPIERE-4067.sql new file mode 100644 index 0000000000..ed1de1e313 --- /dev/null +++ b/migration/i7.1z/postgresql/201912301800_IDEMPIERE-4067.sql @@ -0,0 +1,69 @@ +-- Adding Over/Under line in Report +-- Oct 16, 2019 2:39:54 PM IST +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (203371,0,0,'Y',TO_TIMESTAMP('2019-10-16 14:39:53','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-10-16 14:39:53','YYYY-MM-DD HH24:MI:SS'),100,'OverlineStrokeType','Overline Stroke Type','Overline Stroke Type','D','18f9193c-b4a9-4dc2-ba69-8dcefc4d8e88') +; + +-- Oct 16, 2019 2:40:47 PM IST +INSERT INTO AD_Reference (AD_Reference_ID,Name,ValidationType,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,IsOrderByValue,AD_Reference_UU) VALUES (200174,'PA_ReportLine Line Stroke Type','L',0,0,'Y',TO_TIMESTAMP('2019-10-16 14:40:46','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-10-16 14:40:46','YYYY-MM-DD HH24:MI:SS'),100,'D','N','a66f38f4-feeb-472f-a561-0f2134214e66') +; + +-- Oct 16, 2019 2:41:10 PM IST +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200477,'Dotted',200174,'DT',0,0,'Y',TO_TIMESTAMP('2019-10-16 14:41:10','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-10-16 14:41:10','YYYY-MM-DD HH24:MI:SS'),100,'D','e61955b1-37f0-45ed-8bd3-d7b72f5f730b') +; + +-- Oct 16, 2019 2:41:45 PM IST +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200478,'Dashed',200174,'DS',0,0,'Y',TO_TIMESTAMP('2019-10-16 14:41:44','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-10-16 14:41:44','YYYY-MM-DD HH24:MI:SS'),100,'D','035f9d9e-4650-43e8-a0ec-e931e07270d8') +; + +-- Oct 16, 2019 2:42:08 PM IST +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200479,'Double Dotted',200174,'DDT',0,0,'Y',TO_TIMESTAMP('2019-10-16 14:42:07','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-10-16 14:42:07','YYYY-MM-DD HH24:MI:SS'),100,'D','011c9ad0-34a9-4bd4-9af3-50615790ffb6') +; + +-- Oct 16, 2019 2:42:22 PM IST +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200480,'Double Dashed',200174,'DDS',0,0,'Y',TO_TIMESTAMP('2019-10-16 14:42:22','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-10-16 14:42:22','YYYY-MM-DD HH24:MI:SS'),100,'D','13cd13e4-af78-4252-957e-3b1e45f33497') +; + +-- Oct 16, 2019 2:42:38 PM IST +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200481,'Double Solid',200174,'DSD',0,0,'Y',TO_TIMESTAMP('2019-10-16 14:42:37','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-10-16 14:42:37','YYYY-MM-DD HH24:MI:SS'),100,'D','e39cde64-0d54-4cf9-93c1-5068c0e97ee6') +; + +-- Oct 16, 2019 2:42:53 PM IST +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200482,'Solid',200174,'SD',0,0,'Y',TO_TIMESTAMP('2019-10-16 14:42:52','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-10-16 14:42:52','YYYY-MM-DD HH24:MI:SS'),100,'D','9e450ade-e54b-46e1-b96f-36c02b3090eb') +; + +-- Oct 16, 2019 2:43:26 PM IST +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) VALUES (214088,0,'Overline Stroke Type',448,'OverlineStrokeType',3,'N','N','N','N','N',0,'N',17,200174,0,0,'Y',TO_TIMESTAMP('2019-10-16 14:43:26','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-10-16 14:43:26','YYYY-MM-DD HH24:MI:SS'),100,203371,'Y','N','D','N','N','N','Y','b1529a0e-96a5-43e6-94b6-d78feea8e8c8','Y',0,'N','N') +; + +-- Oct 16, 2019 2:43:31 PM IST +ALTER TABLE PA_ReportLine ADD COLUMN OverlineStrokeType VARCHAR(3) DEFAULT NULL +; + +-- Oct 16, 2019 2:44:08 PM IST +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (203372,0,0,'Y',TO_TIMESTAMP('2019-10-16 14:44:08','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-10-16 14:44:08','YYYY-MM-DD HH24:MI:SS'),100,'UnderlineStrokeType','Underline Stroke Type','Underline Stroke Type','D','36e60c3b-2eff-4d58-a530-101b2d060f4a') +; + +-- Oct 16, 2019 2:45:23 PM IST +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) VALUES (214089,0,'Underline Stroke Type',448,'UnderlineStrokeType',3,'N','N','N','N','N',0,'N',17,200174,0,0,'Y',TO_TIMESTAMP('2019-10-16 14:45:23','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-10-16 14:45:23','YYYY-MM-DD HH24:MI:SS'),100,203372,'Y','N','D','N','N','N','Y','d3504292-068e-4126-944c-dc3d165019c0','Y',0,'N','N') +; + +-- Oct 16, 2019 2:45:39 PM IST +ALTER TABLE PA_ReportLine ADD COLUMN UnderlineStrokeType VARCHAR(3) DEFAULT NULL +; + +-- Oct 16, 2019 2:48:07 PM IST +INSERT INTO AD_Field (AD_Field_ID,Name,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 (206214,'Overline Stroke Type',376,214088,'Y',0,200,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2019-10-16 14:48:06','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-10-16 14:48:06','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','04733ecb-3dc6-4fde-82ab-33434b230ca5','Y',215,1,2,1,'N','N','N') +; + +-- Oct 16, 2019 2:48:25 PM IST +INSERT INTO AD_Field (AD_Field_ID,Name,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 (206215,'Underline Stroke Type',376,214089,'Y',0,210,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2019-10-16 14:48:24','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-10-16 14:48:24','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','e5614dd4-9884-4053-99d5-1cb59540e412','Y',225,4,2,1,'N','N','N') +; + +-- Added Line Type Blank Line +-- Oct 16, 2019 5:29:02 PM IST +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200483,'Blank line',241,'B',0,0,'Y',TO_TIMESTAMP('2019-10-16 17:29:01','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-10-16 17:29:01','YYYY-MM-DD HH24:MI:SS'),100,'D','bb000455-9057-4c8a-a656-b0f1074e3fd3') +; + +SELECT register_migration_script('201912301800_IDEMPIERE-4067.sql') FROM dual +; + 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 aaf9a269ca..98e0c099ef 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 @@ -301,6 +301,24 @@ public interface I_PA_ReportLine lowest number comes first */ public int getSeqNo(); + + /** Column name OverlineStrokeType */ + public static final String COLUMNNAME_OverlineStrokeType = "OverlineStrokeType"; + + /** Set Overline Stroke Type */ + public void setOverlineStrokeType (String OverlineStrokeType); + + /** Get Overline Stroke Type */ + public String getOverlineStrokeType(); + + /** Column name UnderlineStrokeType */ + public static final String COLUMNNAME_UnderlineStrokeType = "UnderlineStrokeType"; + + /** Set Underline Stroke Type */ + public void setUnderlineStrokeType (String UnderlineStrokeType); + + /** Get Underline Stroke Type */ + public String getUnderlineStrokeType(); /** Column name Updated */ public static final String COLUMNNAME_Updated = "Updated"; 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 b9057b314f..0bcaabe181 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,9 +30,9 @@ public class X_PA_ReportLine extends PO implements I_PA_ReportLine, I_Persistent /** * */ - private static final long serialVersionUID = 20200413L; + private static final long serialVersionUID = -3681187042653339433L; - /** Standard Constructor */ + /** Standard Constructor */ public X_PA_ReportLine (Properties ctx, int PA_ReportLine_ID, String trxName) { super (ctx, PA_ReportLine_ID, trxName); @@ -227,6 +227,8 @@ public class X_PA_ReportLine extends PO implements I_PA_ReportLine, I_Persistent public static final String LINETYPE_SegmentValue = "S"; /** Calculation = C */ public static final String LINETYPE_Calculation = "C"; + /** Blank line = B */ + public static final String LINETYPE_BlankLine = "B"; /** Set Line Type. @param LineType Line Type */ public void setLineType (String LineType) @@ -491,4 +493,62 @@ public class X_PA_ReportLine extends PO implements I_PA_ReportLine, I_Persistent return 0; return ii.intValue(); } + + /** OverlineStrokeType AD_Reference_ID=200174 */ + public static final int OVERLINESTROKETYPE_AD_Reference_ID=200174; + /** Dotted = DT */ + public static final String OVERLINESTROKETYPE_Dotted = "DT"; + /** Dashed = DS */ + public static final String OVERLINESTROKETYPE_Dashed = "DS"; + /** Double Dotted = DDT */ + public static final String OVERLINESTROKETYPE_DoubleDotted = "DDT"; + /** Double Dashed = DDS */ + public static final String OVERLINESTROKETYPE_DoubleDashed = "DDS"; + /** Double Solid = DSD */ + public static final String OVERLINESTROKETYPE_DoubleSolid = "DSD"; + /** Solid = SD */ + public static final String OVERLINESTROKETYPE_Solid = "SD"; + /** Set Overline Stroke Type. + @param OverlineStrokeType Overline Stroke Type */ + public void setOverlineStrokeType (String OverlineStrokeType) + { + + set_Value (COLUMNNAME_OverlineStrokeType, OverlineStrokeType); + } + + /** Get Overline Stroke Type. + @return Overline Stroke Type */ + public String getOverlineStrokeType () + { + return (String)get_Value(COLUMNNAME_OverlineStrokeType); + } + + /** UnderlineStrokeType AD_Reference_ID=200174 */ + public static final int UNDERLINESTROKETYPE_AD_Reference_ID=200174; + /** Dotted = DT */ + public static final String UNDERLINESTROKETYPE_Dotted = "DT"; + /** Dashed = DS */ + public static final String UNDERLINESTROKETYPE_Dashed = "DS"; + /** Double Dotted = DDT */ + public static final String UNDERLINESTROKETYPE_DoubleDotted = "DDT"; + /** Double Dashed = DDS */ + public static final String UNDERLINESTROKETYPE_DoubleDashed = "DDS"; + /** Double Solid = DSD */ + public static final String UNDERLINESTROKETYPE_DoubleSolid = "DSD"; + /** Solid = SD */ + public static final String UNDERLINESTROKETYPE_Solid = "SD"; + /** Set Underline Stroke Type. + @param UnderlineStrokeType Underline Stroke Type */ + public void setUnderlineStrokeType (String UnderlineStrokeType) + { + + set_Value (COLUMNNAME_UnderlineStrokeType, UnderlineStrokeType); + } + + /** Get Underline Stroke Type. + @return Underline Stroke Type */ + public String getUnderlineStrokeType () + { + return (String)get_Value(COLUMNNAME_UnderlineStrokeType); + } } \ No newline at end of file diff --git a/org.adempiere.base/src/org/compiere/print/DataEngine.java b/org.adempiere.base/src/org/compiere/print/DataEngine.java index a3f74b2719..c074ee75ac 100644 --- a/org.adempiere.base/src/org/compiere/print/DataEngine.java +++ b/org.adempiere.base/src/org/compiere/print/DataEngine.java @@ -20,6 +20,7 @@ import java.io.Serializable; import java.sql.Clob; import java.sql.PreparedStatement; import java.sql.ResultSet; +import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.sql.Timestamp; import java.util.ArrayList; @@ -657,6 +658,9 @@ public class DataEngine hasLevelNo = true; if (sqlSELECT.indexOf("LevelNo") == -1) sqlSELECT.append("LevelNo,"); + + if (tableName.equals("T_Report") && sqlSELECT.indexOf("PA_ReportLine_ID") == -1) + sqlSELECT.append("PA_ReportLine_ID,"); } /** @@ -836,6 +840,7 @@ public class DataEngine PrintDataColumn pdc = null; boolean hasLevelNo = pd.hasLevelNo(); int levelNo = 0; + int reportLineID = 0; // PreparedStatement pstmt = null; ResultSet rs = null; @@ -843,11 +848,30 @@ public class DataEngine { pstmt = DB.prepareNormalReadReplicaStatement(pd.getSQL(), m_trxName); rs = pstmt.executeQuery(); + + boolean isExistsT_Report_PA_ReportLine_ID = false; + if (pd.getTableName().equals("T_Report")) + { + ResultSetMetaData rsmd = rs.getMetaData(); + for (int i = 1; i <= rsmd.getColumnCount(); i++) + { + if (rsmd.getColumnLabel(i).equalsIgnoreCase("PA_ReportLine_ID")) + { + isExistsT_Report_PA_ReportLine_ID = true; + break; + } + } + } + // Row Loop while (rs.next()) { if (hasLevelNo) + { levelNo = rs.getInt("LevelNo"); + if (isExistsT_Report_PA_ReportLine_ID) + reportLineID = rs.getInt("PA_ReportLine_ID"); + } else levelNo = 0; // Check Group Change ---------------------------------------- @@ -923,8 +947,8 @@ public class DataEngine printRunningTotal(pd, levelNo, rowNo++); /** Report Summary FR [ 2011569 ]**/ - if(!m_summary) - pd.addRow(false, levelNo); + if (!m_summary) + pd.addRow(false, levelNo, reportLineID); int counter = 1; // get columns for (int i = 0; i < pd.getColumnInfo().length; i++) diff --git a/org.adempiere.base/src/org/compiere/print/PrintData.java b/org.adempiere.base/src/org/compiere/print/PrintData.java index 723760c46f..04dba3809d 100644 --- a/org.adempiere.base/src/org/compiere/print/PrintData.java +++ b/org.adempiere.base/src/org/compiere/print/PrintData.java @@ -35,6 +35,7 @@ import javax.xml.transform.stream.StreamResult; import org.compiere.Adempiere; import org.compiere.print.util.SerializableMatrix; import org.compiere.print.util.SerializableMatrixImpl; +import org.compiere.report.MReportLine; import org.compiere.util.CLogger; import org.compiere.util.DisplayType; import org.compiere.util.Trace; @@ -57,7 +58,7 @@ public class PrintData implements Serializable /** * */ - private static final long serialVersionUID = -5013410697934610197L; + private static final long serialVersionUID = 3493453909439452289L; /** * Data Parent Constructor @@ -802,5 +803,38 @@ public class PrintData implements Serializable System.out.println(""); pd1.dump(); } // main + + public MReportLine getMReportLine() + { + List nodes = m_matrix.getRowData(); + + if (nodes == null || !m_hasLevelNo) + return null; + + for (int i = 0; i < nodes.size(); i++) + { + Object o = nodes.get(i); + if (o instanceof PrintDataElement) + { + PrintDataElement pde = (PrintDataElement) o; + if (MReportLine.COLUMNNAME_PA_ReportLine_ID.equals(pde.getColumnName())) + { + Integer ii = (Integer) pde.getValue(); + if (ii > 0) + { + return new MReportLine(m_ctx, ii, null); + } + } + } + } + return null; + } // getMReportLine + + public void addRow(boolean functionRow, int levelNo, int reportLineID) + { + addRow(functionRow, levelNo); + if (m_hasLevelNo && reportLineID != 0) + addNode(new PrintDataElement("PA_ReportLine_ID", reportLineID, DisplayType.Integer, null)); + } } // PrintData diff --git a/org.adempiere.base/src/org/compiere/print/layout/LayoutEngine.java b/org.adempiere.base/src/org/compiere/print/layout/LayoutEngine.java index 9fdc70b62f..6b7f7a819a 100644 --- a/org.adempiere.base/src/org/compiere/print/layout/LayoutEngine.java +++ b/org.adempiere.base/src/org/compiere/print/layout/LayoutEngine.java @@ -67,6 +67,7 @@ import org.compiere.print.PrintData; import org.compiere.print.PrintDataElement; import org.compiere.print.util.SerializableMatrix; import org.compiere.print.util.SerializableMatrixImpl; +import org.compiere.report.MReportLine; import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.util.DisplayType; @@ -1599,6 +1600,11 @@ public class LayoutEngine implements Pageable, Printable, Doc // HashMap rowColBackground = new HashMap(); rowColBackground.put(new Point(TableElement.HEADER_ROW,TableElement.ALL), tf.getHeaderBG_Color()); + // + HashMap rowColReportLine = new HashMap (); + // + HashMap colPositions = new HashMap (); + // Sizes boolean multiLineHeader = tf.isMultiLineHeader(); int pageNoStart = m_pageNo; @@ -1649,6 +1655,7 @@ public class LayoutEngine implements Pageable, Printable, Doc } columnHeader[col] = new ValueNamePair(item.getColumnName(), item.getPrintName(format.getLanguage())); + colPositions.put(item.getPrintName(), col); columnMaxWidth[col] = item.getMaxWidth(); fixedWidth[col] = (columnMaxWidth[col] != 0 && item.isFixedWidth()); colSuppressRepeats[col] = item.isSuppressRepeats(); @@ -1698,10 +1705,13 @@ public class LayoutEngine implements Pageable, Printable, Doc String pkColumnName = null; ArrayList functionRows = new ArrayList(); ArrayList pageBreak = new ArrayList(); + ArrayList finReportSumRows = new ArrayList(); + int lastLevelNo = 0; // for all rows for (int row = 0; row < rows; row++) { + int levelNo = 0; ArrayList columns = new ArrayList(); printData.setRowIndex(row); if (printData.isFunctionRow()) @@ -1717,23 +1727,32 @@ public class LayoutEngine implements Pageable, Printable, Doc log.finer("PageBreak row=" + row); } } - // Summary/Line Levels for Finanial Reports + // Summary/Line Levels for Financial Reports else { - int levelNo = printData.getLineLevelNo(); + levelNo = printData.getLineLevelNo(); + if (levelNo < 0) + levelNo = -levelNo; + + if (levelNo < lastLevelNo) + finReportSumRows.add(row); + if (levelNo != 0) { - if (levelNo < 0) - levelNo = -levelNo; Font base = printFont.getFont(); if (levelNo == 1) - rowColFont.put(new Point(row, TableElement.ALL), new Font (base.getName(), - Font.ITALIC, base.getSize()-levelNo)); + rowColFont.put(new Point(row, TableElement.ALL), + new Font(base.getName(), Font.ITALIC, base.getSize() - levelNo)); else if (levelNo == 2) - rowColFont.put(new Point(row, TableElement.ALL), new Font (base.getName(), - Font.PLAIN, base.getSize()-levelNo)); + rowColFont.put(new Point(row, TableElement.ALL), + new Font(base.getName(), Font.PLAIN, base.getSize() - levelNo)); } + + lastLevelNo = levelNo; } + + MReportLine rLine = printData.getMReportLine(); + // for all columns for (int c = 0; c < format.getItemCount(); c++) { @@ -1742,6 +1761,9 @@ public class LayoutEngine implements Pageable, Printable, Doc Serializable dataElement = null; if (item.isPrinted()) // Text Columns { + if (rLine != null && levelNo == 0 && item.getColumnName().startsWith("Col_")) + rowColReportLine.put(new Point(row, colPositions.get(item.getPrintName())), rLine); + if ( !PrintDataEvaluatee.hasPageLogic(item.getDisplayLogic()) && !isDisplayed(printData, item) ) { ; @@ -1813,7 +1835,7 @@ public class LayoutEngine implements Pageable, Printable, Doc elements, pk, pkColumnName, pageNoStart, firstPage, nextPages, repeatedColumns, additionalLines, rowColFont, rowColColor, rowColBackground, - tf, pageBreak, colSuppressRepeats); + tf, pageBreak, colSuppressRepeats, rowColReportLine, finReportSumRows); table.layout(0,0,false, MPrintFormatItem.FIELDALIGNMENTTYPE_LeadingLeft); if (m_tableElement == null) m_tableElement = table; diff --git a/org.adempiere.base/src/org/compiere/print/layout/TableElement.java b/org.adempiere.base/src/org/compiere/print/layout/TableElement.java index 05042b0dd1..88d1ffcab8 100644 --- a/org.adempiere.base/src/org/compiere/print/layout/TableElement.java +++ b/org.adempiere.base/src/org/compiere/print/layout/TableElement.java @@ -46,6 +46,7 @@ import org.compiere.print.MPrintTableFormat; import org.compiere.print.PrintData; import org.compiere.print.util.SerializableMatrix; import org.compiere.print.util.SerializableMatrixImpl; +import org.compiere.report.MReportLine; import org.compiere.util.Evaluator; import org.compiere.util.KeyNamePair; import org.compiere.util.NamePair; @@ -80,7 +81,7 @@ public class TableElement extends PrintElement /** * */ - private static final long serialVersionUID = 4185521888252077894L; + private static final long serialVersionUID = -4144554863262696285L; /** @@ -115,6 +116,10 @@ public class TableElement extends PrintElement * @param rowColBackground HashMap with Point as key with background Color overwrite * @param tFormat table format * @param pageBreak Arraylist of rows with page break + * + * @param colSuppressRepeats + * @param rowColReportLine + * @param finReportSumRows */ public TableElement (ValueNamePair[] columnHeader, int[] columnMaxWidth, int[] columnMaxHeight, String[] columnJustification, @@ -122,7 +127,8 @@ public class TableElement extends PrintElement SerializableMatrix data, KeyNamePair[] pk, String pkColumnName, int pageNoStart, Rectangle firstPage, Rectangle nextPages, int repeatedColumns, HashMap additionalLines, HashMap rowColFont, HashMap rowColColor, HashMap rowColBackground, - MPrintTableFormat tFormat, ArrayList pageBreak, Boolean[] colSuppressRepeats) + MPrintTableFormat tFormat, ArrayList pageBreak, Boolean[] colSuppressRepeats, HashMap rowColReportLine, + ArrayList finReportSumRows) { super(); if (log.isLoggable(Level.FINE)) @@ -162,6 +168,8 @@ public class TableElement extends PrintElement if (m_baseBackground == null) m_baseBackground = Color.white; m_tFormat = tFormat; + m_finReportSumRows = finReportSumRows; + m_rowColReportLine = rowColReportLine; // Page Break - not two after each other m_pageBreak = pageBreak; @@ -258,6 +266,11 @@ public class TableElement extends PrintElement /** Key: Integer (original Column) - Value: Integer (below column) */ private HashMap m_additionalLines; + /** List of Fin Report Summary Rows */ + private ArrayList m_finReportSumRows; + /** HashMap with Point as key with report line */ + private HashMap m_rowColReportLine; + /*************************************************************************/ /** Header Row Indicator */ @@ -334,6 +347,9 @@ public class TableElement extends PrintElement { dimensions.add(null); } + + Font font = getFont(row, dataCol); + Serializable dataItem = m_data.getRowData().get(dataCol); if (dataItem == null) { @@ -346,7 +362,19 @@ public class TableElement extends PrintElement } else { - dimensions.set(dataCol, new Dimension2DImpl()); + // Set Blank line height + if (getReportLine(row, dataCol) != null && getReportLine(row, dataCol).isLineTypeBlankLine()) + { + dimensions.set(dataCol, new Dimension2DImpl()); + TextLayout layout = new TextLayout(" ", font, frc); + float height = layout.getAscent() + layout.getDescent() + layout.getLeading(); + dimensions.get(dataCol).height = height; + dimensions.get(dataCol).roundUp(); + } + else + { + dimensions.set(dataCol, new Dimension2DImpl()); + } continue; } } @@ -356,7 +384,6 @@ public class TableElement extends PrintElement dimensions.set(dataCol, new Dimension2DImpl()); continue; } - Font font = getFont(row, dataCol); // Print below existing column = (col != dataCol) addPrintLines(row, col, dataItem); @@ -585,13 +612,26 @@ public class TableElement extends PrintElement for (int row = 0; row < rows; row++) { float rowHeight = 0f; + float over = 0f; + float under = 0f; dataSizes.setRowIndex(row); List dimensions = dataSizes.getRowData(); for (int col = 0; col < cols; col++) { if (dimensions.get(col).height > rowHeight) // max rowHeight = (float)dimensions.get(col).height; + + if (getReportLine(row, col) != null) + { + if (getReportLine(row, col).getOverline() > over) + over = getReportLine(row, col).getOverline(); + if (getReportLine(row, col).getUnderline() > under) + under = getReportLine(row, col).getUnderline(); + } } // for all columns + over = over == 2 ? over * m_tFormat.getLineStroke().floatValue() + V_GAP : over * m_tFormat.getLineStroke().floatValue(); + under = under == 2 ? under * m_tFormat.getLineStroke().floatValue() + V_GAP : under * m_tFormat.getLineStroke().floatValue(); + rowHeight += over + under; rowHeight += m_tFormat.getLineStroke().floatValue() + (2*V_GAP); m_rowHeights.add(Float.valueOf(rowHeight)); p_height += rowHeight; @@ -1434,6 +1474,29 @@ public class TableElement extends PrintElement (int)(colWidth-m_tFormat.getVLineStroke().floatValue()), (int)(rowHeight-m_tFormat.getLineStroke().floatValue()) ); } + + // Over Line + MReportLine rLine = getReportLine(row, col); + if (rLine != null) + { + if (rLine.getOverline() > 1) + { + curY -= V_GAP + m_tFormat.getVLineStroke().floatValue(); + g2D.setPaint(m_tFormat.getHeaderLine_Color()); + g2D.setStroke(rLine.getOverlineStroke(m_tFormat.getVLineStroke())); + g2D.drawLine(curX, (int) (curY + m_tFormat.getVLineStroke().floatValue()), + (int) (curX + colWidth - m_tFormat.getVLineStroke().floatValue()), (int) (curY + m_tFormat.getVLineStroke().floatValue())); + curY += V_GAP + m_tFormat.getVLineStroke().floatValue(); + } + if (rLine.getOverline() > 0) + { + g2D.setPaint(m_tFormat.getHeaderLine_Color()); + g2D.setStroke(rLine.getOverlineStroke(m_tFormat.getVLineStroke())); + g2D.drawLine(curX, curY, (int) (curX + colWidth - m_tFormat.getVLineStroke().floatValue()), curY); + curY += m_tFormat.getVLineStroke().floatValue(); + } + } + curX += H_GAP; // upper left gap curY += V_GAP; @@ -1607,9 +1670,37 @@ public class TableElement extends PrintElement curX, (int)(rowYstart+rowHeight-m_tFormat.getLineStroke().floatValue())); curX += m_tFormat.getVLineStroke().floatValue(); + // Under Line + if (rLine != null && rLine.getUnderline() > 0) + { + if (rLine.getUnderline() > 1) + { + curY -= V_GAP + m_tFormat.getVLineStroke().floatValue(); + g2D.setPaint(m_tFormat.getHeaderLine_Color()); + g2D.setStroke(rLine.getUnderlineStroke(m_tFormat.getVLineStroke())); + g2D.drawLine(origX, curY, (int) (origX + colWidth - m_tFormat.getVLineStroke().floatValue()), curY); + curY += V_GAP + m_tFormat.getVLineStroke().floatValue(); + } + if (rLine.getUnderline() > 0) + { + g2D.setPaint(m_tFormat.getHeaderLine_Color()); + g2D.setStroke(rLine.getUnderlineStroke(m_tFormat.getVLineStroke())); + g2D.drawLine(origX, curY, (int) (origX + colWidth - m_tFormat.getVLineStroke().floatValue()), curY); + } + } + + // Maintain financial report detail and column section Y position + if ((int) (rowYstart + rowHeight) > curY) + { + curY = (int) (rowYstart + rowHeight); + } + // X end line if (row == m_data.getRowCount()-1) // last Line { + // left some space between underline and last line + curY += 2 * V_GAP; + /** * Bug fix - Bottom line was always displayed whether or not header lines was set to be visible * @author ashley @@ -1633,13 +1724,16 @@ public class TableElement extends PrintElement boolean nextIsFunction = m_functionRows.contains(Integer.valueOf(row+1)); if (nextIsFunction && m_functionRows.contains(Integer.valueOf(row))) nextIsFunction = false; // this is a function line too - if (nextIsFunction) - { - g2D.setPaint(m_tFormat.getFunctFG_Color()); - g2D.setStroke(m_tFormat.getHLine_Stroke()); - g2D.drawLine(origX, curY, // -> - (bottom) - (int)(origX+colWidth-m_tFormat.getVLineStroke().floatValue()), curY); - } + MReportLine nextLine = getReportLine(row + 1, col); + if (nextIsFunction || (m_finReportSumRows.contains(Integer.valueOf(row + 1)) && nextLine != null + && nextLine.getOverline() == 0)) + { + g2D.setPaint(m_tFormat.getFunctFG_Color()); + g2D.setStroke(m_tFormat.getHLine_Stroke()); + + g2D.drawLine(origX, curY, // -> - (bottom) + (int) (origX + colWidth - m_tFormat.getVLineStroke().floatValue()), curY); + } else if (m_tFormat.isPaintHLines()) { g2D.setPaint(m_tFormat.getHLine_Color()); @@ -1725,6 +1819,22 @@ public class TableElement extends PrintElement return coordinate.toArray(); } // getPrintItems + /** + * Get Report Line. + * + * @param row row + * @param col column + * @return ReportLine for row/col + */ + private MReportLine getReportLine(int row, int col) + { + // First specific position + MReportLine rLine = (MReportLine) m_rowColReportLine.get(new Point(row, col)); + if (rLine != null) + return rLine; + + return null; + } // getReportLine public void setPageLogics(ArrayList pageLogics) { diff --git a/org.adempiere.base/src/org/compiere/report/FinReport.java b/org.adempiere.base/src/org/compiere/report/FinReport.java index ff48223684..7ed505ce8d 100644 --- a/org.adempiere.base/src/org/compiere/report/FinReport.java +++ b/org.adempiere.base/src/org/compiere/report/FinReport.java @@ -313,7 +313,7 @@ public class FinReport extends SvrProcess int PA_ReportLineSet_ID = m_report.getLineSet().getPA_ReportLineSet_ID(); StringBuilder sql = new StringBuilder ("INSERT INTO T_Report " + "(AD_PInstance_ID, PA_ReportLine_ID, Record_ID,Fact_Acct_ID, SeqNo,LevelNo, Name,Description) " - + "SELECT ").append(getAD_PInstance_ID()).append(", rl.PA_ReportLine_ID, 0,0, rl.SeqNo,0, NVL(trl.Name, rl.Name) as Name, NVL(trl.Description,rl.Description) as Description " + + "SELECT ").append(getAD_PInstance_ID()).append(", rl.PA_ReportLine_ID, 0,0, rl.SeqNo,0, CASE WHEN LineType='B' THEN '' ELSE NVL(trl.Name, rl.Name) END as Name, NVL(trl.Description,rl.Description) as Description " + "FROM PA_ReportLine rl " + "LEFT JOIN PA_ReportLine_Trl trl ON trl.PA_ReportLine_ID = rl.PA_ReportLine_ID AND trl.AD_Language = '" + Env.getAD_Language(Env.getCtx()) + "' " + "WHERE rl.IsActive='Y' AND rl.PA_ReportLineSet_ID=").append(PA_ReportLineSet_ID); diff --git a/org.adempiere.base/src/org/compiere/report/MReportLine.java b/org.adempiere.base/src/org/compiere/report/MReportLine.java index d957154f38..2e49a197bc 100644 --- a/org.adempiere.base/src/org/compiere/report/MReportLine.java +++ b/org.adempiere.base/src/org/compiere/report/MReportLine.java @@ -16,6 +16,9 @@ *****************************************************************************/ package org.compiere.report; +import java.awt.BasicStroke; +import java.awt.Stroke; +import java.math.BigDecimal; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.ArrayList; @@ -38,7 +41,10 @@ public class MReportLine extends X_PA_ReportLine /** * */ - private static final long serialVersionUID = -3957315092529097396L; + private static final long serialVersionUID = -6310984172477566729L; + + private BasicStroke overline_Stroke; + private Stroke underline_Stroke; /** * Constructor @@ -345,7 +351,16 @@ public class MReportLine extends X_PA_ReportLine { return LINETYPE_SegmentValue.equals(getLineType()); } - + + /** + * Line Type Blank Line + * @return true if Blank Line + */ + public boolean isLineTypeBlankLine() + { + return LINETYPE_BlankLine.equals(getLineType()); + } + /** * Calculation Type Range * @return true if range @@ -422,5 +437,104 @@ public class MReportLine extends X_PA_ReportLine return retValue; } // copy + /** + * Get overline style 0 - none, 1 - single, 2 - double + * + * @return int - Style No + */ + public int getOverline( ) + { + if (OVERLINESTROKETYPE_Dotted.equals(getOverlineStrokeType()) || OVERLINESTROKETYPE_Solid.equals(getOverlineStrokeType()) + || OVERLINESTROKETYPE_Dashed.equals(getOverlineStrokeType())) + return 1; + else if (OVERLINESTROKETYPE_DoubleDotted.equals(getOverlineStrokeType()) || OVERLINESTROKETYPE_DoubleSolid.equals(getOverlineStrokeType()) + || OVERLINESTROKETYPE_DoubleDashed.equals(getOverlineStrokeType())) + return 2; + return 0; + } // getOverline + + /** + * Get OverLine Stroke + * + * @return line based on line (1/2 of) width and stroke (default dotted 1/2p + */ + public Stroke getOverlineStroke(BigDecimal stroke) + { + if (overline_Stroke == null) + { + float width = stroke.floatValue() / 2; + // . . . + if (UNDERLINESTROKETYPE_Dotted.equals(getOverlineStrokeType()) || UNDERLINESTROKETYPE_DoubleDotted.equals(getOverlineStrokeType())) + overline_Stroke = new BasicStroke(width, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 1.0f, getPatternDotted(width), 0.0f); + // - + else if (UNDERLINESTROKETYPE_Solid.equals(getOverlineStrokeType()) || UNDERLINESTROKETYPE_DoubleSolid.equals(getOverlineStrokeType())) + overline_Stroke = new BasicStroke(width); + // - - + else if (UNDERLINESTROKETYPE_Dashed.equals(getOverlineStrokeType()) || UNDERLINESTROKETYPE_DoubleDashed.equals(getOverlineStrokeType())) + overline_Stroke = new BasicStroke(width, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 1.0f, getPatternDashed(width), 0.0f); + } + return overline_Stroke; + } // getUnderine_Stroke + + /** + * Get underline style 0 - none 1 - single 2 - double + * + * @return int - Style No + */ + public int getUnderline( ) + { + if (UNDERLINESTROKETYPE_Dotted.equals(getUnderlineStrokeType()) || UNDERLINESTROKETYPE_Solid.equals(getUnderlineStrokeType()) + || UNDERLINESTROKETYPE_Dashed.equals(getUnderlineStrokeType())) + return 1; + else if (UNDERLINESTROKETYPE_DoubleDotted.equals(getUnderlineStrokeType()) || UNDERLINESTROKETYPE_DoubleSolid.equals(getUnderlineStrokeType()) + || UNDERLINESTROKETYPE_DoubleDashed.equals(getUnderlineStrokeType())) + return 2; + return 0; + } // getUnderline + + /** + * Get UnderLine Stroke + * + * @return line based on line (1/2 of) width and stroke (default dotted 1/2p + */ + public Stroke getUnderlineStroke(BigDecimal stroke) + { + if (underline_Stroke == null) + { + float width = stroke.floatValue() / 2; + // . . . + if (UNDERLINESTROKETYPE_Dotted.equals(getUnderlineStrokeType()) || UNDERLINESTROKETYPE_DoubleDotted.equals(getUnderlineStrokeType())) + underline_Stroke = new BasicStroke(width, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 1.0f, getPatternDotted(width), 0.0f); + // - + else if (UNDERLINESTROKETYPE_Solid.equals(getUnderlineStrokeType()) || UNDERLINESTROKETYPE_DoubleSolid.equals(getUnderlineStrokeType())) + underline_Stroke = new BasicStroke(width); + // - - + else if (UNDERLINESTROKETYPE_Dashed.equals(getUnderlineStrokeType()) || UNDERLINESTROKETYPE_DoubleDashed.equals(getUnderlineStrokeType())) + underline_Stroke = new BasicStroke(width, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 1.0f, getPatternDashed(width), 0.0f); + } + return underline_Stroke; + } // getUnderine_Stroke + + /** + * Get Pattern Dotted . . . . + * + * @param width - Width of line + * @return pattern + */ + private float[] getPatternDotted(float width) + { + return new float[] { 2 * width, 2 * width }; + } // getPatternDotted + + /** + * Get Pattern Dashed - - - - + * + * @param width - Width of line + * @return pattern + */ + private float[] getPatternDashed(float width) + { + return new float[] { 10 * width, 4 * width }; + } // getPatternDashed } // MReportLine