diff --git a/migration/i2.1z/oracle/201502161604_IDEMPIERE-2389.sql b/migration/i2.1z/oracle/201502161604_IDEMPIERE-2389.sql new file mode 100644 index 0000000000..7a06c76dd9 --- /dev/null +++ b/migration/i2.1z/oracle/201502161604_IDEMPIERE-2389.sql @@ -0,0 +1,12 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Feb 16, 2015 9:52:26 AM ICT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,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 (211837,0,'Summary Level','This is a summary entity','A summary entity represents a branch in a tree rather than an end-node. Summary entities are used for reporting and do not have own values.',282,'IsSummary',1,'N','N','N','N','N',0,'N',20,0,0,'Y',TO_DATE('2015-02-16 09:52:25','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-02-16 09:52:25','YYYY-MM-DD HH24:MI:SS'),100,416,'Y','N','D','N','N','N','N','d7123c51-3508-4264-be07-7d6c48216795','Y',0,'N','N') +; + +-- Feb 16, 2015 9:52:42 AM ICT +ALTER TABLE AD_PInstance ADD IsSummary CHAR(1) DEFAULT NULL CHECK (IsSummary IN ('Y','N')) +; +SELECT register_migration_script('201502161604_IDEMPIERE-2389.sql') FROM dual +; diff --git a/migration/i2.1z/postgresql/201502161604_IDEMPIERE-2389.sql b/migration/i2.1z/postgresql/201502161604_IDEMPIERE-2389.sql new file mode 100644 index 0000000000..ed7a718af9 --- /dev/null +++ b/migration/i2.1z/postgresql/201502161604_IDEMPIERE-2389.sql @@ -0,0 +1,11 @@ +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator + +-- Feb 16, 2015 9:52:26 AM ICT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,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 (211837,0,'Summary Level','This is a summary entity','A summary entity represents a branch in a tree rather than an end-node. Summary entities are used for reporting and do not have own values.',282,'IsSummary',1,'N','N','N','N','N',0,'N',20,0,0,'Y',TO_TIMESTAMP('2015-02-16 09:52:25','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-02-16 09:52:25','YYYY-MM-DD HH24:MI:SS'),100,416,'Y','N','D','N','N','N','N','d7123c51-3508-4264-be07-7d6c48216795','Y',0,'N','N') +; + +-- Feb 16, 2015 9:52:42 AM ICT +ALTER TABLE AD_PInstance ADD COLUMN IsSummary CHAR(1) DEFAULT NULL CHECK (IsSummary IN ('Y','N')) +; +SELECT register_migration_script('201502161604_IDEMPIERE-2389.sql') FROM dual +; diff --git a/org.adempiere.base/src/org/compiere/model/I_AD_PInstance.java b/org.adempiere.base/src/org/compiere/model/I_AD_PInstance.java index 3c6186cae4..2446f85f8a 100644 --- a/org.adempiere.base/src/org/compiere/model/I_AD_PInstance.java +++ b/org.adempiere.base/src/org/compiere/model/I_AD_PInstance.java @@ -96,6 +96,19 @@ public interface I_AD_PInstance * Data Print Format */ public int getAD_PrintFormat_ID(); + + /** Column name IsSummary */ + public static final String COLUMNNAME_IsSummary = "IsSummary"; + + /** Set IsSummary. + * Data IsSummary + */ + public void setIsSummary (boolean isSummary); + + /** Get IsSummary. + * Data IsSummary + */ + public boolean getIsSummary(); public org.compiere.model.I_AD_PrintFormat getAD_PrintFormat() throws RuntimeException; diff --git a/org.adempiere.base/src/org/compiere/model/X_AD_PInstance.java b/org.adempiere.base/src/org/compiere/model/X_AD_PInstance.java index 38db3309ab..701f0f46d1 100644 --- a/org.adempiere.base/src/org/compiere/model/X_AD_PInstance.java +++ b/org.adempiere.base/src/org/compiere/model/X_AD_PInstance.java @@ -149,6 +149,30 @@ public class X_AD_PInstance extends PO implements I_AD_PInstance, I_Persistent return 0; return ii.intValue(); } + + /** Set IsSummary. + @param IsSummary + Data IsSummary + */ + public void setIsSummary (boolean isSummary) + { + set_Value (COLUMNNAME_IsSummary, Boolean.valueOf(isSummary)); + } + + /** Get IsSummary. + @return Data IsSummary + */ + public boolean getIsSummary () + { + Object oo = get_Value(COLUMNNAME_IsSummary); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } public org.compiere.model.I_AD_Process getAD_Process() throws RuntimeException { diff --git a/org.adempiere.base/src/org/compiere/print/ReportEngine.java b/org.adempiere.base/src/org/compiere/print/ReportEngine.java index 6a28842cad..dab724fb61 100644 --- a/org.adempiere.base/src/org/compiere/print/ReportEngine.java +++ b/org.adempiere.base/src/org/compiere/print/ReportEngine.java @@ -118,6 +118,7 @@ import org.eevolution.model.X_PP_Order; */ public class ReportEngine implements PrintServiceAttributeListener { + /** * Constructor * @param ctx context @@ -130,16 +131,43 @@ public class ReportEngine implements PrintServiceAttributeListener this(ctx, pf, query, info, null); } // ReportEngine + /** + * Set report engine with summary and null transaction + * @param ctx + * @param pf + * @param query + * @param info + * @param isSummary + */ + public ReportEngine (Properties ctx, MPrintFormat pf, MQuery query, PrintInfo info, boolean isSummary) + { + this(ctx, pf, query, info, isSummary, null); + } // ReportEngine + + /** + * Set report engine with summary = false + * @param ctx + * @param pf + * @param query + * @param info + * @param trxName + */ + public ReportEngine (Properties ctx, MPrintFormat pf, MQuery query, PrintInfo info, String trxName){ + this(ctx, pf, query, info, false, trxName); + } + /** * Constructor * @param ctx context * @param pf Print Format * @param query Optional Query * @param info print info + * @param isSummary * @param trxName */ - public ReportEngine (Properties ctx, MPrintFormat pf, MQuery query, PrintInfo info, String trxName) + public ReportEngine (Properties ctx, MPrintFormat pf, MQuery query, PrintInfo info, boolean isSummary, String trxName) { + m_summary = isSummary; if (pf == null) throw new IllegalArgumentException("ReportEngine - no PrintFormat"); if (log.isLoggable(Level.INFO)) log.info(pf + " -- " + query); @@ -1310,7 +1338,7 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount) PrintInfo info = new PrintInfo (pi); info.setAD_Table_ID(AD_Table_ID); - return new ReportEngine(ctx, format, query, info, pi.getTransactionName()); + return new ReportEngine(ctx, format, query, info, pi.isSummary(), pi.getTransactionName()); } // get /*************************************************************************/ @@ -1763,6 +1791,11 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount) m_summary = summary; } + public boolean isSummary() + { + return m_summary; + } + private String reportType; public void setReportType(String type) diff --git a/org.adempiere.base/src/org/compiere/process/ProcessInfo.java b/org.adempiere.base/src/org/compiere/process/ProcessInfo.java index 80d79f8cf3..4528740331 100644 --- a/org.adempiere.base/src/org/compiere/process/ProcessInfo.java +++ b/org.adempiere.base/src/org/compiere/process/ProcessInfo.java @@ -146,6 +146,8 @@ public class ProcessInfo implements Serializable private String reportType = null; + private boolean isSummary = false; + public String getReportType() { return reportType; } @@ -153,6 +155,14 @@ public class ProcessInfo implements Serializable public void setReportType(String reportType) { this.reportType = reportType; } + + public void setIsSummary(boolean isSummary) { + this.isSummary = isSummary; + } + + public boolean isSummary() { + return this.isSummary; + } /** * String representation diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessDialog.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessDialog.java index 10cd6b6408..6140dcacff 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessDialog.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessDialog.java @@ -29,6 +29,7 @@ import java.util.logging.Level; import org.adempiere.util.Callback; import org.adempiere.webui.LayoutUtils; import org.adempiere.webui.component.Button; +import org.adempiere.webui.component.Checkbox; import org.adempiere.webui.component.Combobox; import org.adempiere.webui.component.ConfirmPanel; import org.adempiere.webui.component.DocumentLink; @@ -314,6 +315,13 @@ public class ProcessDialog extends AbstractProcessDialog implements EventListene hBox.appendChild(freportType); row1.appendChild(hBox1); row.appendChild(hBox); + + hBox = new Hbox(); + hBox1 = new Hbox(); + hBox1.appendChild(lIsSummary); + hBox.appendChild(chbIsSummary); + row1.appendChild(hBox1); + row.appendChild(hBox); } if(!showLastRun) @@ -362,6 +370,8 @@ public class ProcessDialog extends AbstractProcessDialog implements EventListene private Listbox freportType = new Listbox(); private Label lPrintFormat = new Label(Msg.translate(Env.getCtx(), "AD_PrintFormat_ID")); private Label lreportType = new Label(Msg.translate(Env.getCtx(), "view.report")); + private Label lIsSummary = new Label(Msg.translate(Env.getCtx(), "Summary")); + private Checkbox chbIsSummary = new Checkbox(); /** * Set Visible @@ -406,6 +416,8 @@ public class ProcessDialog extends AbstractProcessDialog implements EventListene getProcessInfo().setSerializableObject(format); } } + + getProcessInfo().setIsSummary(chbIsSummary.isChecked()); if (isParameterPage) startProcess(); @@ -430,6 +442,7 @@ public class ProcessDialog extends AbstractProcessDialog implements EventListene getParameterPanel().saveParameters(); savedParams.get(i).setAD_PrintFormat_ID((Integer)fPrintFormat.getValue()); savedParams.get(i).setReportType(freportType.getSelectedItem().getValue().toString()); + savedParams.get(i).setIsSummary(chbIsSummary.isSelected()); savedParams.get(i).saveEx(); } } @@ -442,7 +455,8 @@ public class ProcessDialog extends AbstractProcessDialog implements EventListene getProcessInfo().getAD_Process_ID(), getProcessInfo().getRecord_ID()); instance.setName(saveName); instance.setAD_PrintFormat_ID((Integer) fPrintFormat.getValue()); - instance.setReportType(freportType.getSelectedItem().getValue().toString()); + instance.setReportType(freportType.getSelectedItem().getValue().toString()); + instance.setIsSummary(chbIsSummary.isSelected()); instance.saveEx(); getProcessInfo().setAD_PInstance_ID(instance.getAD_PInstance_ID()); // Get Parameters @@ -525,6 +539,9 @@ public class ProcessDialog extends AbstractProcessDialog implements EventListene else freportType.setValue(instance.getReportType()); } + + if (instance != null) + chbIsSummary.setSelected(instance.getIsSummary()); } private void loadSavedParams(MPInstance instance) { diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java index 028789de16..7d28ca81ba 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java @@ -306,7 +306,7 @@ public class ZkReportViewer extends Window implements EventListener, ITab summary.setText(Msg.getMsg(Env.getCtx(), "Summary")); toolBar.appendChild(summary); - + summary.setChecked(m_reportEngine.isSummary()); toolBar.appendChild(new Separator("vertical")); bCustomize.setName("Customize"); diff --git a/org.adempiere.ui/src/org/compiere/print/ReportCtl.java b/org.adempiere.ui/src/org/compiere/print/ReportCtl.java index 13ccb24ce2..34257f6556 100644 --- a/org.adempiere.ui/src/org/compiere/print/ReportCtl.java +++ b/org.adempiere.ui/src/org/compiere/print/ReportCtl.java @@ -132,6 +132,7 @@ public class ReportCtl instance.setReportType(pi.getReportType()); if (pi.getSerializableObject() != null) instance.setAD_PrintFormat_ID(((MPrintFormat)pi.getSerializableObject()).getAD_PrintFormat_ID()); + instance.setIsSummary(pi.isSummary()); instance.saveEx(); /** @@ -242,7 +243,7 @@ public class ReportCtl String TableName = MTable.getTableName(ctx, format.getAD_Table_ID()); MQuery query = MQuery.get (ctx, pi.getAD_PInstance_ID(), TableName); PrintInfo info = new PrintInfo(pi); - re = new ReportEngine(ctx, format, query, info); + re = new ReportEngine(ctx, format, query, info, pi.isSummary()); } // // Create Report Engine normally @@ -258,6 +259,7 @@ public class ReportCtl if (pi.getReportType() != null) { re.setReportType(pi.getReportType()); } + re.setWindowNo(WindowNo); createOutput(re, pi.isPrintPreview(), null); return true;