IDEMPIERE-5669 - Display Row Count of Executed Reports (#1781)
This commit is contained in:
parent
eb78bd4ee9
commit
3a01dc8aa9
|
@ -0,0 +1,10 @@
|
|||
-- IDEMPIERE-5669
|
||||
SELECT register_migration_script('202304141228_IDEMPIERE-5669.sql') FROM dual;
|
||||
|
||||
SET SQLBLANKLINES ON
|
||||
SET DEFINE OFF
|
||||
|
||||
-- Apr 14, 2023, 12:28:05 PM CEST
|
||||
INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Row count: {0}',0,0,'Y',TO_TIMESTAMP('2023-04-14 12:28:05','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-04-14 12:28:05','YYYY-MM-DD HH24:MI:SS'),100,200833,'RowCount','D','50409fb4-405e-4370-8256-c15a56204c45')
|
||||
;
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
-- IDEMPIERE-5669
|
||||
SELECT register_migration_script('202304141228_IDEMPIERE-5669.sql') FROM dual;
|
||||
|
||||
-- Apr 14, 2023, 12:28:05 PM CEST
|
||||
INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Row count: {0}',0,0,'Y',TO_TIMESTAMP('2023-04-14 12:28:05','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2023-04-14 12:28:05','YYYY-MM-DD HH24:MI:SS'),100,200833,'RowCount','D','50409fb4-405e-4370-8256-c15a56204c45')
|
||||
;
|
||||
|
|
@ -57,6 +57,6 @@ Copyright (C) 2007 Ashley G Ramdass (ADempiere WebUI).
|
|||
|
||||
<!-- this js module doesn't actually exists and it is here for default theme version -->
|
||||
<!-- since loading of js module is on demand, it doesn't cause any error as long as you don't try to load it -->
|
||||
<javascript-module name="idempiere.theme.default" version="202303211500" />
|
||||
<javascript-module name="idempiere.theme.default" version="202304141300" />
|
||||
|
||||
</language>
|
||||
|
|
|
@ -46,6 +46,7 @@ import org.adempiere.webui.apps.graph.WPAWidget;
|
|||
import org.adempiere.webui.apps.graph.WPerformanceDetail;
|
||||
import org.adempiere.webui.apps.graph.WPerformanceIndicator;
|
||||
import org.adempiere.webui.apps.graph.model.ChartModel;
|
||||
import org.adempiere.webui.component.Label;
|
||||
import org.adempiere.webui.component.ToolBarButton;
|
||||
import org.adempiere.webui.dashboard.DashboardPanel;
|
||||
import org.adempiere.webui.dashboard.DashboardRunnable;
|
||||
|
@ -827,6 +828,7 @@ public class DashboardController implements EventListener<Event> {
|
|||
{
|
||||
addDrillAcrossEventListener(AD_Process_ID, parentComponent);
|
||||
String processParameters = dashboardContent.getProcessParameters();
|
||||
ReportData reportData = generateReport(AD_Process_ID, dashboardContent.getAD_PrintFormat_ID(), processParameters, parentComponent, contextPath);
|
||||
|
||||
Div layout = new Div();
|
||||
layout.setHeight("100%");
|
||||
|
@ -835,13 +837,14 @@ public class DashboardController implements EventListener<Event> {
|
|||
Iframe iframe = new Iframe();
|
||||
iframe.setSclass("dashboard-report-iframe");
|
||||
iframe.setStyle("flex-grow: 1;");
|
||||
iframe.setContent(generateReport(AD_Process_ID, dashboardContent.getAD_PrintFormat_ID(), processParameters, parentComponent, contextPath));
|
||||
iframe.setContent(reportData.getContent());
|
||||
if(iframe.getContent() != null)
|
||||
layout.appendChild(iframe);
|
||||
else
|
||||
layout.appendChild(createFillMandatoryLabel(dashboardContent));
|
||||
|
||||
Toolbar toolbar = new Toolbar();
|
||||
LayoutUtils.addSclass("dashboard-report-toolbar", toolbar);
|
||||
layout.appendChild(toolbar);
|
||||
btn.setLabel(Msg.getMsg(Env.getCtx(), "OpenRunDialog"));
|
||||
toolbar.appendChild(btn);
|
||||
|
@ -864,8 +867,17 @@ public class DashboardController implements EventListener<Event> {
|
|||
else
|
||||
btn.setImage(ThemeManager.getThemeResource("images/Refresh16.png"));
|
||||
|
||||
btn.addEventListener(Events.ON_CLICK, e -> iframe.setContent(generateReport(AD_Process_ID, dashboardContent.getAD_PrintFormat_ID(), processParameters, parentComponent, contextPath)));
|
||||
toolbar.appendChild(btn);
|
||||
|
||||
Label rowCountLabel = new Label(Msg.getMsg(Env.getCtx(), "RowCount", new Object[] {reportData.getRowCount()}));
|
||||
LayoutUtils.addSclass("rowcount-label", rowCountLabel);
|
||||
toolbar.appendChild(rowCountLabel);
|
||||
|
||||
btn.addEventListener(Events.ON_CLICK, e -> {
|
||||
ReportData refreshedData = generateReport(AD_Process_ID, dashboardContent.getAD_PrintFormat_ID(), processParameters, parentComponent, contextPath);
|
||||
iframe.setContent(refreshedData.getContent());
|
||||
rowCountLabel.setValue(Msg.getMsg(Env.getCtx(), "RowCount", new Object[] {refreshedData.getRowCount()}));
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1635,14 +1647,14 @@ public class DashboardController implements EventListener<Event> {
|
|||
* @return {@link AMedia}
|
||||
* @throws Exception
|
||||
*/
|
||||
private AMedia generateReport(int AD_Process_ID, int AD_PrintFormat_ID, String parameters, Component component, String contextPath) throws Exception {
|
||||
private ReportData generateReport(int AD_Process_ID, int AD_PrintFormat_ID, String parameters, Component component, String contextPath) throws Exception {
|
||||
ReportEngine re = runReport(AD_Process_ID, AD_PrintFormat_ID, parameters);
|
||||
if(re == null)
|
||||
return null;
|
||||
File file = FileUtil.createTempFile(re.getName(), ".html");
|
||||
re.createHTML(file, false, AEnv.getLanguage(Env.getCtx()), new HTMLExtension(contextPath, "rp",
|
||||
component.getUuid(), String.valueOf(AD_Process_ID)));
|
||||
return new AMedia(re.getName(), "html", "text/html", file, false);
|
||||
return new ReportData(new AMedia(re.getName(), "html", "text/html", file, false), re);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1926,4 +1938,41 @@ public class DashboardController implements EventListener<Event> {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds information about the report: Report Content, Row Count
|
||||
*/
|
||||
public class ReportData {
|
||||
/** Report content */
|
||||
private AMedia content;
|
||||
/** Report Row Count */
|
||||
private int rowCount = 0;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param content
|
||||
* @param rowCount
|
||||
*/
|
||||
public ReportData(AMedia content, ReportEngine reportEngine) {
|
||||
this.content = content;
|
||||
if(reportEngine.getPrintData() != null)
|
||||
this.rowCount = reportEngine.getPrintData().getRowCount();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get report content
|
||||
* @return AMedia content
|
||||
*/
|
||||
public AMedia getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get report row count
|
||||
* @return int row count
|
||||
*/
|
||||
public int getRowCount() {
|
||||
return rowCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,6 +47,7 @@ import org.adempiere.webui.apps.ProcessModalDialog;
|
|||
import org.adempiere.webui.apps.WReport;
|
||||
import org.adempiere.webui.apps.form.WReportCustomization;
|
||||
import org.adempiere.webui.component.Checkbox;
|
||||
import org.adempiere.webui.component.Label;
|
||||
import org.adempiere.webui.component.ListItem;
|
||||
import org.adempiere.webui.component.Listbox;
|
||||
import org.adempiere.webui.component.Mask;
|
||||
|
@ -781,9 +782,15 @@ public class ZkReportViewer extends Window implements EventListener<Event>, IRep
|
|||
reportLink = new A();
|
||||
reportLink.setTarget("_blank");
|
||||
Div linkDiv = new Div();
|
||||
linkDiv.setStyle("width:100%; height: 40px; padding-top: 4px; padding-bottom: 4px;");
|
||||
linkDiv.setStyle("width:100%; height: 40px; padding: 4px;");
|
||||
linkDiv.appendChild(reportLink);
|
||||
|
||||
Label rowCount = new Label(Msg.getMsg(m_ctx, "RowCount", new Object[] {m_reportEngine.getPrintData().getRowCount()}));
|
||||
rowCount.setStyle("float: right;");
|
||||
linkDiv.appendChild(rowCount);
|
||||
|
||||
south.appendChild(linkDiv);
|
||||
|
||||
//m_WindowNo
|
||||
int AD_Window_ID = Env.getContextAsInt(Env.getCtx(), m_reportEngine.getWindowNo(), "_WinInfo_AD_Window_ID", true);
|
||||
if (AD_Window_ID == 0)
|
||||
|
|
|
@ -133,6 +133,16 @@
|
|||
display: inline-flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.dashboard-report-toolbar .z-toolbar-content {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.dashboard-report-toolbar .rowcount-label {
|
||||
float: right;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.recentitems-box .trash-toolbarbutton .z-toolbarbutton-content {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue