Skip to content

Commit

Permalink
Add default report for no print format
Browse files Browse the repository at this point in the history
  • Loading branch information
yamelsenih committed Nov 24, 2019
1 parent 31e751c commit 2b7081e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -740,16 +740,38 @@ private ReportOutput.Builder getReportOutput(Properties context, GetReportOutput
query.addRestriction(criteria.getWhereClause());
}
//
PrintInfo printInformation = new PrintInfo(request.getReportName(), table.getAD_Table_ID(), 102, 0);
MPrintFormat printFormat = MPrintFormat.get(Env.getCtx(), 102, false);
ReportEngine reportEngine = new ReportEngine(Env.getCtx(), printFormat, query, printInformation);
PrintInfo printInformation = new PrintInfo(request.getReportName(), table.getAD_Table_ID(), 0, 0);
// Get Print Format
MPrintFormat printFormat = null;
MReportView reportView = null;
if(!Util.isEmpty(request.getPrintFormatUuid())) {
printFormat = new Query(context, I_AD_PrintFormat.Table_Name, I_AD_PrintFormat.COLUMNNAME_UUID + " = ?", null)
.setParameters(request.getPrintFormatUuid())
.first();
}
// Get Report View
if(!Util.isEmpty(request.getReportViewUuid())) {
MReportView reportView = new Query(context, I_AD_ReportView.Table_Name, I_AD_ReportView.COLUMNNAME_UUID + " = ?", null)
reportView = new Query(context, I_AD_ReportView.Table_Name, I_AD_ReportView.COLUMNNAME_UUID + " = ?", null)
.setParameters(request.getReportViewUuid())
.first();
}
// Get Default
if(printFormat == null) {
int reportViewId = 0;
if(reportView != null) {
reportEngine.setAD_ReportView_ID(reportView.getAD_ReportView_ID());
reportViewId = reportView.getAD_ReportView_ID();
}
printFormat = MPrintFormat.get(context, reportViewId, table.getAD_Table_ID());
}
// Validate print format
if(printFormat == null) {
throw new AdempiereException("@AD_PrintGormat_ID@ @NotFound@");
}
// Run report engine
ReportEngine reportEngine = new ReportEngine(Env.getCtx(), printFormat, query, printInformation);
// Set report view
if(reportView != null) {
reportEngine.setAD_ReportView_ID(reportView.getAD_ReportView_ID());
}
// Set Summary
reportEngine.setSummary(request.getIsSummary());
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/spin/grpc/util/DataClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public void getReportOutput() {
.setCriteria(criteria)
.setPrintFormatUuid("5788e4a4-b253-11e9-aedf-0242ac110003")
.setReportName("Test")
.setReportType("html")
.setReportType("pdf")
.build();
ReportOutput response;
try {
Expand Down

0 comments on commit 2b7081e

Please sign in to comment.