PrintFormat Header Description in Landscape mode
Description
Environment
None
Attachments
5
- 12 Aug 2018, 06:56 AM
- 09 Aug 2018, 08:44 PM
- 09 Aug 2018, 03:28 AM
- 09 Aug 2018, 03:26 AM
- 09 Aug 2018, 03:26 AM
Activity
Show:
Syed August 12, 2018 at 6:56 AMEdited
I have used nicolas code to display parameter list in html output.
XhtmlDocument doc = new XhtmlDocument();
String printHeaderDescription = m_printFormat.getDescription();
if (printHeaderDescription!=null && !printHeaderDescription.isEmpty()) {
doc.appendHead("<h2><center>"+printHeaderDescription+"</center></h2>");
}
doc.getHtml().setNeedClosingTag(false);
doc.getBody().setNeedClosingTag(false);
doc.appendHead("<meta charset=\"UTF-8\" />");
StringBuilder params = new StringBuilder("<p>");
for (int r = 0; r < getQuery().getRestrictionCount(); r++) {
params.append("<b>")
.append(getQuery().getInfoName(r))
.append(" ").append(getQuery().getInfoOperator(r)).append(" ")
.append(getQuery().getInfoDisplayAll(r))
.append("</b></br>");
}
params.append("</p>");
doc.appendBody(params.toString());
Nicolas Micoud August 10, 2018 at 1:36 PM
Hi @redhuan d. oon,
My2cents : you may have a look at https://idempiere.atlassian.net/browse/IDEMPIERE-3435 (its aim was to be able to display report parameters easily).
Maybe you can reuse some of the code so you can display description from PF and parameters ?
WDYT ?
Regards,
Nicolas
redhuan d. oon August 9, 2018 at 8:45 PMEdited
It can be very descriptive, done programmatically by a calling Process:
MPrintFormat printformat = new Query(Env.getCtx(),MPrintFormat.Table_Name,MPrintFormat.COLUMNNAME_Name+"=?",get_TrxName())
.setParameters(getName())
.first();
if (printformat!=null) {
printformat.setDescription(getName()+" : "+date+"<br>Printed By : "
+user.getName()+"<br>"+lines.size()
+" lines total value: $"+grandtotal);
printformat.saveEx(get_TrxName());
}
I described my motivation more http://red1.org/adempiere/viewtopic.php?f=29&t=1856
Some users complain the row format of PrintFormat in HTML mode is too plain without a descriptive header. I made a simple solution by using the PrintFormat's Description field be injected into the createHTML of ReportEngine as a Header.
Users can manipulate this Desription value externally. Any custom plugin can access a particular PrintFormat model to enhance its readibility instantly during printout.
Patch included