From c660a0af9b26624b8315c0417f2b176e617fc8d2 Mon Sep 17 00:00:00 2001 From: allgood Date: Thu, 11 Dec 2014 01:48:23 -0200 Subject: [PATCH] IDEMPIERE-2355 - Allow to style the summary rows of HTML report --- .../src/org/compiere/print/ReportEngine.java | 20 ++++++++- .../adempiere/webui/report/HTMLExtension.java | 13 +++++- org.adempiere.ui.zk/css/report.css | 41 +++++++++++++++++-- 3 files changed, 67 insertions(+), 7 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/print/ReportEngine.java b/org.adempiere.base/src/org/compiere/print/ReportEngine.java index ebbfb2d69a..ca3f98851f 100644 --- a/org.adempiere.base/src/org/compiere/print/ReportEngine.java +++ b/org.adempiere.base/src/org/compiere/print/ReportEngine.java @@ -57,8 +57,10 @@ import org.apache.ecs.xhtml.a; import org.apache.ecs.xhtml.link; import org.apache.ecs.xhtml.script; import org.apache.ecs.xhtml.table; +import org.apache.ecs.xhtml.tbody; import org.apache.ecs.xhtml.td; import org.apache.ecs.xhtml.th; +import org.apache.ecs.xhtml.thead; import org.apache.ecs.xhtml.tr; import org.compiere.model.MClient; import org.compiere.model.MColumn; @@ -71,7 +73,9 @@ import org.compiere.model.MProject; import org.compiere.model.MQuery; import org.compiere.model.MRfQResponse; import org.compiere.model.PrintInfo; + import static org.compiere.model.SystemIDs.*; + import org.compiere.print.layout.LayoutEngine; import org.compiere.process.ProcessInfo; import org.compiere.process.ServerProcessCtl; @@ -587,6 +591,8 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount) } doc.output(w); } + thead thead = new thead(); + tbody tbody = new tbody(); // for all rows (-1 = header 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); } + 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 (int col = 0; col < m_printFormat.getItemCount(); col++) @@ -719,9 +735,11 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount) } } // printed } // for all columns - tr.output(w); } // for all rows + thead.output(w); + tbody.output(w); + w.println(); w.println(""); if (!onlyTable) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/report/HTMLExtension.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/report/HTMLExtension.java index bcfbfa902c..9c77c1f13c 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/report/HTMLExtension.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/report/HTMLExtension.java @@ -19,6 +19,7 @@ import org.apache.ecs.ConcreteElement; import org.apache.ecs.xhtml.a; import org.apache.ecs.xhtml.div; import org.apache.ecs.xhtml.img; +import org.compiere.model.MSysConfig; import org.compiere.print.IHTMLExtension; import org.compiere.print.PrintData; import org.compiere.print.PrintDataElement; @@ -35,8 +36,16 @@ public class HTMLExtension implements IHTMLExtension { private String contextPath; private String classPrefix; private String componentId; + private String reportTheme; public HTMLExtension(String contextPath, String classPrefix, String componentId) { + + String theme = MSysConfig.getValue( "HTML_REPORT_THEME" , "" ); + + if ( theme != null ) { + reportTheme = "/" + theme; + } + this.contextPath = contextPath; this.classPrefix = classPrefix; this.componentId = componentId; @@ -106,11 +115,11 @@ public class HTMLExtension implements IHTMLExtension { } public String getScriptURL() { - return contextPath + "/js/report.js"; + return contextPath + reportTheme + "/js/report.js"; } public String getStyleURL() { - return contextPath + "/css/report.css"; + return contextPath + reportTheme + "/css/report.css"; } } diff --git a/org.adempiere.ui.zk/css/report.css b/org.adempiere.ui.zk/css/report.css index 31aef0a60b..4084e2d790 100644 --- a/org.adempiere.ui.zk/css/report.css +++ b/org.adempiere.ui.zk/css/report.css @@ -8,23 +8,35 @@ border-collapse: collapse; width: 90%; background-color: #EBF1EF; + border-width: 0px; } .rp-table th { text-align: center; padding: 2px; - font-weight: normal; - font-size: 13px; + font-weight: bold; background-color: #C6D1CD; border-width: 1px; - border-color: #BBBBBB; + border-color: black; + border-width: 2px 1px 2px 0px; border-style: solid; } + +.rp-table th:last-child { + border-width: 2px 0px 2px 0px; +} + .rp-table td { border-width: 1px; border-color: #BBBBBB; border-style: solid; + border-width: 1px 1px 1px 0px; padding: 3px; } + +.rp-table td:last-child { + border-width: 1px 0px 1px 0px; +} + .rp-number { background-color: #EBF1EF; text-align: right !important; @@ -34,4 +46,25 @@ background-color: #EBF1EF; text-align: left; padding: 3px; -} \ No newline at end of file +} + +.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; +} +