IDEMPIERE-5669 - Report Row Count shows incorrect data (#1791)

* IDEMPIERE-5669 - Report Row Count shows incorrect data

2 issues fixed:
- row count in tab did not refresh on clicking the refresh button (only on re-run)
- row count included function rows too

* IDEMPIERE-5669 - fixes

- added private attribute to rowCount Label
- added null-check to updateRowCount() method
This commit is contained in:
Peter Takács 2023-04-25 10:24:18 +02:00 committed by GitHub
parent 4a35720457
commit 23713f6461
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 4 deletions

View File

@ -283,9 +283,18 @@ public class PrintData implements Serializable
*/
public int getRowCount()
{
return m_matrix.getRowCount();
return getRowCount(true);
} // getRowCount
/**
* Get row count
* @param includeFunctionRows
* @return row count
*/
public int getRowCount(boolean includeFunctionRows) {
return includeFunctionRows ? m_matrix.getRowCount() : m_matrix.getRowCount() - m_functionRows.size();
}
/**
* Get Current Row Index
* @return row index

View File

@ -1956,7 +1956,7 @@ public class DashboardController implements EventListener<Event> {
public ReportData(AMedia content, ReportEngine reportEngine) {
this.content = content;
if(reportEngine.getPrintData() != null)
this.rowCount = reportEngine.getPrintData().getRowCount();
this.rowCount = reportEngine.getPrintData().getRowCount(false);
}
/**
@ -1968,7 +1968,7 @@ public class DashboardController implements EventListener<Event> {
}
/**
* Get report row count
* Get report row count (function rows not included)
* @return int row count
*/
public int getRowCount() {

View File

@ -222,6 +222,8 @@ public class ZkReportViewer extends Window implements EventListener<Event>, IRep
private ToolBarButton bCloudUpload = new ToolBarButton();
protected Map<MAuthorizationAccount, IUploadService> uploadServicesMap = new HashMap<>();
/** Row count label */
private Label rowCount;
private final ExportFormat[] exportFormats = new ExportFormat[] {
new ExportFormat(POSTSCRIPT_FILE_EXT + " - " + Msg.getMsg(Env.getCtx(), "FilePS"), POSTSCRIPT_FILE_EXT, POSTSCRIPT_MIME_TYPE),
@ -785,7 +787,7 @@ public class ZkReportViewer extends Window implements EventListener<Event>, IRep
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 = new Label(Msg.getMsg(m_ctx, "RowCount", new Object[] {m_reportEngine.getPrintData().getRowCount(false)}));
rowCount.setStyle("float: right;");
linkDiv.appendChild(rowCount);
@ -1564,6 +1566,7 @@ public class ZkReportViewer extends Window implements EventListener<Event>, IRep
showBusyDialog();
setLanguage();
Events.echoEvent(ON_RENDER_REPORT_EVENT, this, null);
updateRowCount();
}
@ -2066,4 +2069,12 @@ public class ZkReportViewer extends Window implements EventListener<Event>, IRep
findWindow.setSizable(false);
findWindow.setContentStyle("background-color: #fff; width: 99%; margin: auto;");
}
/**
* Update Row Count label
*/
private void updateRowCount() {
if(rowCount != null)
rowCount.setValue(Msg.getMsg(Env.getCtx(), "RowCount", new Object[] {m_reportEngine.getPrintData().getRowCount(false)}));
}
}