IDEMPIERE-2355 - Allow to style the summary rows of HTML report

This commit is contained in:
allgood 2014-12-11 01:48:23 -02:00
parent 7d5d604095
commit c660a0af9b
3 changed files with 67 additions and 7 deletions

View File

@ -57,8 +57,10 @@ import org.apache.ecs.xhtml.a;
import org.apache.ecs.xhtml.link; import org.apache.ecs.xhtml.link;
import org.apache.ecs.xhtml.script; import org.apache.ecs.xhtml.script;
import org.apache.ecs.xhtml.table; import org.apache.ecs.xhtml.table;
import org.apache.ecs.xhtml.tbody;
import org.apache.ecs.xhtml.td; import org.apache.ecs.xhtml.td;
import org.apache.ecs.xhtml.th; import org.apache.ecs.xhtml.th;
import org.apache.ecs.xhtml.thead;
import org.apache.ecs.xhtml.tr; import org.apache.ecs.xhtml.tr;
import org.compiere.model.MClient; import org.compiere.model.MClient;
import org.compiere.model.MColumn; import org.compiere.model.MColumn;
@ -71,7 +73,9 @@ import org.compiere.model.MProject;
import org.compiere.model.MQuery; import org.compiere.model.MQuery;
import org.compiere.model.MRfQResponse; import org.compiere.model.MRfQResponse;
import org.compiere.model.PrintInfo; import org.compiere.model.PrintInfo;
import static org.compiere.model.SystemIDs.*; import static org.compiere.model.SystemIDs.*;
import org.compiere.print.layout.LayoutEngine; import org.compiere.print.layout.LayoutEngine;
import org.compiere.process.ProcessInfo; import org.compiere.process.ProcessInfo;
import org.compiere.process.ServerProcessCtl; import org.compiere.process.ServerProcessCtl;
@ -587,6 +591,8 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
} }
doc.output(w); doc.output(w);
} }
thead thead = new thead();
tbody tbody = new tbody();
// for all rows (-1 = header row) // for all rows (-1 = header row)
for (int row = -1; row < m_printData.getRowCount(); row++) for (int row = -1; row < m_printData.getRowCount(); row++)
{ {
@ -598,6 +604,16 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
{ {
extension.extendRowElement(tr, m_printData); extension.extendRowElement(tr, m_printData);
} }
if (m_printData.isFunctionRow()) {
tr.setClass(cssPrefix + "-functionrow");
} else if ( row < m_printData.getRowCount() && m_printData.isFunctionRow(row+1)) {
tr.setClass(cssPrefix + "-lastgrouprow");
}
// add row to table body
tbody.addElement(tr);
} else {
// add row to table header
thead.addElement(tr);
} }
// for all columns // for all columns
for (int col = 0; col < m_printFormat.getItemCount(); col++) for (int col = 0; col < m_printFormat.getItemCount(); col++)
@ -719,9 +735,11 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
} }
} // printed } // printed
} // for all columns } // for all columns
tr.output(w);
} // for all rows } // for all rows
thead.output(w);
tbody.output(w);
w.println(); w.println();
w.println("</table>"); w.println("</table>");
if (!onlyTable) if (!onlyTable)

View File

@ -19,6 +19,7 @@ import org.apache.ecs.ConcreteElement;
import org.apache.ecs.xhtml.a; import org.apache.ecs.xhtml.a;
import org.apache.ecs.xhtml.div; import org.apache.ecs.xhtml.div;
import org.apache.ecs.xhtml.img; import org.apache.ecs.xhtml.img;
import org.compiere.model.MSysConfig;
import org.compiere.print.IHTMLExtension; import org.compiere.print.IHTMLExtension;
import org.compiere.print.PrintData; import org.compiere.print.PrintData;
import org.compiere.print.PrintDataElement; import org.compiere.print.PrintDataElement;
@ -35,8 +36,16 @@ public class HTMLExtension implements IHTMLExtension {
private String contextPath; private String contextPath;
private String classPrefix; private String classPrefix;
private String componentId; private String componentId;
private String reportTheme;
public HTMLExtension(String contextPath, String classPrefix, String componentId) { public HTMLExtension(String contextPath, String classPrefix, String componentId) {
String theme = MSysConfig.getValue( "HTML_REPORT_THEME" , "" );
if ( theme != null ) {
reportTheme = "/" + theme;
}
this.contextPath = contextPath; this.contextPath = contextPath;
this.classPrefix = classPrefix; this.classPrefix = classPrefix;
this.componentId = componentId; this.componentId = componentId;
@ -106,11 +115,11 @@ public class HTMLExtension implements IHTMLExtension {
} }
public String getScriptURL() { public String getScriptURL() {
return contextPath + "/js/report.js"; return contextPath + reportTheme + "/js/report.js";
} }
public String getStyleURL() { public String getStyleURL() {
return contextPath + "/css/report.css"; return contextPath + reportTheme + "/css/report.css";
} }
} }

View File

@ -8,23 +8,35 @@
border-collapse: collapse; border-collapse: collapse;
width: 90%; width: 90%;
background-color: #EBF1EF; background-color: #EBF1EF;
border-width: 0px;
} }
.rp-table th { .rp-table th {
text-align: center; text-align: center;
padding: 2px; padding: 2px;
font-weight: normal; font-weight: bold;
font-size: 13px;
background-color: #C6D1CD; background-color: #C6D1CD;
border-width: 1px; border-width: 1px;
border-color: #BBBBBB; border-color: black;
border-width: 2px 1px 2px 0px;
border-style: solid; border-style: solid;
} }
.rp-table th:last-child {
border-width: 2px 0px 2px 0px;
}
.rp-table td { .rp-table td {
border-width: 1px; border-width: 1px;
border-color: #BBBBBB; border-color: #BBBBBB;
border-style: solid; border-style: solid;
border-width: 1px 1px 1px 0px;
padding: 3px; padding: 3px;
} }
.rp-table td:last-child {
border-width: 1px 0px 1px 0px;
}
.rp-number { .rp-number {
background-color: #EBF1EF; background-color: #EBF1EF;
text-align: right !important; text-align: right !important;
@ -35,3 +47,24 @@
text-align: left; text-align: left;
padding: 3px; padding: 3px;
} }
.rp-lastgrouprow td {
border-width: 0px 1px 2px 0px;
border-color: white #BBBBBB black white;
}
.rp-lastgrouprow td:last-child {
border-width: 0px 0px 2px 0px;
border-color: white #BBBBBB black white;
}
.rp-functionrow td {
background-color: #C6D1CD;
font-weight: bold;
border-width: 0px 1px 0px 0px;
}
.rp-functionrow td:last-child {
border-width: 0px 0px 0px 0px;
}