FR [ 2148808 ] Suppress repeated values in printed tables

https://sourceforge.net/tracker/index.php?func=detail&aid=2148808&group_id=176962&atid=879335
This commit is contained in:
phib 2008-10-06 04:55:25 +00:00
parent c447821639
commit eeda6734f1
7 changed files with 274 additions and 134 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Adempiere_stable</name>
<name>adempiereStable</name>
<comment></comment>
<projects>
</projects>

View File

@ -517,6 +517,19 @@ public interface I_AD_PrintFormatItem
*/
public boolean isSuppressNull();
/** Column name IsSuppressRepeats */
public static final String COLUMNNAME_IsSuppressRepeats = "IsSuppressRepeats";
/** Set Suppress Repeats.
* Suppress repeated elements in column.
*/
public void setIsSuppressRepeats (boolean IsSuppressRepeats);
/** Get Suppress Repeats.
* Suppress repeated elements in column.
*/
public boolean isSuppressRepeats();
/** Column name IsVarianceCalc */
public static final String COLUMNNAME_IsVarianceCalc = "IsVarianceCalc";

View File

@ -1060,6 +1060,30 @@ public class X_AD_PrintFormatItem extends PO implements I_AD_PrintFormatItem, I_
return false;
}
/** Set Suppress Repeats.
@param IsSuppressRepeats
Suppress repeated elements in column.
*/
public void setIsSuppressRepeats (boolean IsSuppressRepeats)
{
set_Value (COLUMNNAME_IsSuppressRepeats, Boolean.valueOf(IsSuppressRepeats));
}
/** Get Suppress Repeats.
@return Suppress repeated elements in column.
*/
public boolean isSuppressRepeats ()
{
Object oo = get_Value(COLUMNNAME_IsSuppressRepeats);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Calculate Variance (?<EFBFBD>).
@param IsVarianceCalc
Calculate Variance

View File

@ -1508,6 +1508,7 @@ public class LayoutEngine implements Pageable, Printable, Doc
int[] columnMaxWidth = new int[columnCount];
int[] columnMaxHeight = new int[columnCount];
boolean[] fixedWidth = new boolean [columnCount];
boolean[] colSuppressRepeats = new boolean[columnCount];
String[] columnJustification = new String[columnCount];
HashMap<Integer,Integer> additionalLines = new HashMap<Integer,Integer>();
@ -1530,6 +1531,7 @@ public class LayoutEngine implements Pageable, Printable, Doc
item.getPrintName(format.getLanguage()));
columnMaxWidth[col] = item.getMaxWidth();
fixedWidth[col] = (columnMaxWidth[col] != 0 && item.isFixedWidth());
colSuppressRepeats[col] = item.isSuppressRepeats();
if (item.isSuppressNull())
{
if (columnMaxWidth[col] == 0)
@ -1718,7 +1720,7 @@ public class LayoutEngine implements Pageable, Printable, Doc
data, pk, pkColumnName,
pageNoStart, firstPage, nextPages, repeatedColumns, additionalLines,
rowColFont, rowColColor, rowColBackground,
tf, pageBreak);
tf, pageBreak, colSuppressRepeats);
table.layout(0,0,false, MPrintFormatItem.FIELDALIGNMENTTYPE_LeadingLeft);
if (m_tableElement == null)
m_tableElement = table;

View File

@ -32,6 +32,7 @@ import java.awt.geom.Point2D;
import java.text.AttributedCharacterIterator;
import java.text.AttributedString;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Properties;
import java.util.logging.Level;
@ -111,10 +112,11 @@ public class TableElement extends PrintElement
Object[][] data, KeyNamePair[] pk, String pkColumnName,
int pageNoStart, Rectangle firstPage, Rectangle nextPages, int repeatedColumns, HashMap<Integer,Integer> additionalLines,
HashMap<Point,Font> rowColFont, HashMap<Point,Color> rowColColor, HashMap<Point,Color> rowColBackground,
MPrintTableFormat tFormat, ArrayList<Integer> pageBreak)
MPrintTableFormat tFormat, ArrayList<Integer> pageBreak, boolean[] colSuppressRepeats)
{
super();
log.fine("Cols=" + columnHeader.length + ", Rows=" + data.length);
m_colSuppressRepeats = colSuppressRepeats;
m_columnHeader = columnHeader;
m_columnMaxWidth = columnMaxWidth;
m_columnMaxHeight = columnMaxHeight;
@ -199,6 +201,8 @@ public class TableElement extends PrintElement
/** Bounds of next Pages */
private Rectangle m_nextPages;
private boolean[] m_colSuppressRepeats;
/** repeat first x columns on - X Axis follow pages */
private int m_repeatedColumns;
@ -1369,7 +1373,21 @@ public class TableElement extends PrintElement
// actual data
Object[] printItems = getPrintItems(row,col);
float penY = curY;
// suppress repeated values
boolean suppress = false;
if (m_colSuppressRepeats[col] && row > 0 && row != firstRow)
{
Object[] lastItems = {};
lastItems = getPrintItems(row-1, col);
if (Arrays.equals(lastItems,printItems) )
suppress = true;
}
if ( !suppress )
{
for (int index = 0; index < printItems.length; index++)
{
if (printItems[index] == null )
@ -1494,6 +1512,7 @@ public class TableElement extends PrintElement
} // length > 0
} // non boolean
} // for all print items
} // not suppressed
curY += netHeight + V_GAP;
curX += netWidth + H_GAP;

View File

@ -0,0 +1,41 @@
-- 3/10/2008 16:15:23
-- Financial reporting improvements
INSERT INTO AD_Element (AD_Org_ID,AD_Client_ID,AD_Element_ID,ColumnName,Created,CreatedBy,Description,EntityType,Help,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,0,53691,'IsSuppressRepeats',TO_DATE('2008-10-03 16:15:17','YYYY-MM-DD HH24:MI:SS'),100,'Suppress repeated elements in column.','D','Determines whether repeated elements in a column are repeated in a printed table.','Y','Suppress Repeats','Suppress Repeats',TO_DATE('2008-10-03 16:15:17','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 3/10/2008 16:15:23
-- Financial reporting improvements
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=53691 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID)
;
-- 3/10/2008 16:15:52
-- Financial reporting improvements
INSERT INTO AD_Column (AD_Org_ID,AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,0,56359,53691,20,489,'IsSuppressRepeats',TO_DATE('2008-10-03 16:15:50','YYYY-MM-DD HH24:MI:SS'),100,'Suppress repeated elements in column.','D',1,'Determines whether repeated elements in a column are repeated in a printed table.','Y','Y','N','N','N','N','N','N','N','N','N','N','Y','Suppress Repeats',0,TO_DATE('2008-10-03 16:15:50','YYYY-MM-DD HH24:MI:SS'),100,1)
;
-- 3/10/2008 16:15:52
-- Financial reporting improvements
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=56359 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID)
;
-- 3/10/2008 16:19:40
-- Financial reporting improvements
INSERT INTO AD_Field (AD_Column_ID,AD_Org_ID,AD_Client_ID,AD_Field_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,DisplayLogic,EntityType,Help,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,Updated,UpdatedBy) VALUES (56359,0,0,56378,426,TO_DATE('2008-10-03 16:19:39','YYYY-MM-DD HH24:MI:SS'),100,'Suppress repeated elements in column.',1,'@IsForm@=N & @PrintFormatType@=F','D','Determines whether repeated elements in a column are repeated in a printed table.','Y','Y','Y','N','N','N','N','Y','Suppress Repeats',115,TO_DATE('2008-10-03 16:19:39','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 3/10/2008 16:19:40
-- Financial reporting improvements
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_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_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=56378 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID)
;
-- 3/10/2008 16:33:36
-- Financial reporting improvements
UPDATE AD_Column SET IsMandatory='Y',Updated=TO_DATE('2008-10-03 16:33:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=56359
;
-- 3/10/2008 16:33:41
-- Financial reporting improvements
UPDATE AD_Column SET DefaultValue='N',Updated=TO_DATE('2008-10-03 16:33:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=56359
;
alter table ad_printformatitem add column IsSuppressRepeats CHAR(1) DEFAULT 'N' CHECK (IsSuppressRepeats IN ('Y','N')) NOT NULL;

View File

@ -0,0 +1,41 @@
-- 3/10/2008 16:15:23
-- Financial reporting improvements
INSERT INTO AD_Element (AD_Org_ID,AD_Client_ID,AD_Element_ID,ColumnName,Created,CreatedBy,Description,EntityType,Help,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,0,53691,'IsSuppressRepeats',TO_TIMESTAMP('2008-10-03 16:15:17','YYYY-MM-DD HH24:MI:SS'),100,'Suppress repeated elements in column.','D','Determines whether repeated elements in a column are repeated in a printed table.','Y','Suppress Repeats','Suppress Repeats',TO_TIMESTAMP('2008-10-03 16:15:17','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 3/10/2008 16:15:23
-- Financial reporting improvements
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=53691 AND EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Element_ID!=t.AD_Element_ID)
;
-- 3/10/2008 16:15:52
-- Financial reporting improvements
INSERT INTO AD_Column (AD_Org_ID,AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,0,56359,53691,20,489,'IsSuppressRepeats',TO_TIMESTAMP('2008-10-03 16:15:50','YYYY-MM-DD HH24:MI:SS'),100,'Suppress repeated elements in column.','D',1,'Determines whether repeated elements in a column are repeated in a printed table.','Y','Y','N','N','N','N','N','N','N','N','N','N','Y','Suppress Repeats',0,TO_TIMESTAMP('2008-10-03 16:15:50','YYYY-MM-DD HH24:MI:SS'),100,1)
;
-- 3/10/2008 16:15:52
-- Financial reporting improvements
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=56359 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID)
;
-- 3/10/2008 16:19:40
-- Financial reporting improvements
INSERT INTO AD_Field (AD_Column_ID,AD_Org_ID,AD_Client_ID,AD_Field_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,DisplayLogic,EntityType,Help,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,Updated,UpdatedBy) VALUES (56359,0,0,56378,426,TO_TIMESTAMP('2008-10-03 16:19:39','YYYY-MM-DD HH24:MI:SS'),100,'Suppress repeated elements in column.',1,'@IsForm@=N & @PrintFormatType@=F','D','Determines whether repeated elements in a column are repeated in a printed table.','Y','Y','Y','N','N','N','N','Y','Suppress Repeats',115,TO_TIMESTAMP('2008-10-03 16:19:39','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 3/10/2008 16:19:40
-- Financial reporting improvements
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_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_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=56378 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID)
;
-- 3/10/2008 16:33:36
-- Financial reporting improvements
UPDATE AD_Column SET IsMandatory='Y',Updated=TO_TIMESTAMP('2008-10-03 16:33:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=56359
;
-- 3/10/2008 16:33:41
-- Financial reporting improvements
UPDATE AD_Column SET DefaultValue='N',Updated=TO_TIMESTAMP('2008-10-03 16:33:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=56359
;
alter table ad_printformatitem add column IsSuppressRepeats CHAR(1) DEFAULT 'N' CHECK (IsSuppressRepeats IN ('Y','N')) NOT NULL;