aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/reports/Summary.java
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-03-16 10:30:19 +0500
committerAbyss777 <abyss@fox5.ru>2017-03-16 10:30:19 +0500
commitf7a668371769a7b4c176e57626f23314e3838e1c (patch)
tree0ba392c2832b946cd678fb8614b13819d0b2021a /src/org/traccar/reports/Summary.java
parent975d2850e245c880e9105b68746cb535ea09fa90 (diff)
downloadtrackermap-server-f7a668371769a7b4c176e57626f23314e3838e1c.tar.gz
trackermap-server-f7a668371769a7b4c176e57626f23314e3838e1c.tar.bz2
trackermap-server-f7a668371769a7b4c176e57626f23314e3838e1c.zip
Share code in excel reports
Diffstat (limited to 'src/org/traccar/reports/Summary.java')
-rw-r--r--src/org/traccar/reports/Summary.java11
1 files changed, 1 insertions, 10 deletions
diff --git a/src/org/traccar/reports/Summary.java b/src/org/traccar/reports/Summary.java
index 543392e05..abe0277da 100644
--- a/src/org/traccar/reports/Summary.java
+++ b/src/org/traccar/reports/Summary.java
@@ -24,10 +24,7 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
-import java.util.Locale;
-import org.apache.velocity.tools.generic.DateTool;
-import org.jxls.transform.poi.PoiTransformer;
import org.jxls.util.JxlsHelper;
import org.traccar.Context;
import org.traccar.model.Position;
@@ -85,16 +82,10 @@ public final class Summary {
String templatePath = Context.getConfig().getString("report.templatesPath",
"templates/export/");
try (InputStream inputStream = new FileInputStream(templatePath + "/summary.xlsx")) {
- org.jxls.common.Context jxlsContext = PoiTransformer.createInitialContext();
+ org.jxls.common.Context jxlsContext = ReportUtils.initializeContext(userId);
jxlsContext.putVar("summaries", summaries);
jxlsContext.putVar("from", from);
jxlsContext.putVar("to", to);
- jxlsContext.putVar("distanceUnit", ReportUtils.getDistanceUnit(userId));
- jxlsContext.putVar("speedUnit", ReportUtils.getSpeedUnit(userId));
- jxlsContext.putVar("webUrl", Context.getVelocityEngine().getProperty("web.url"));
- jxlsContext.putVar("dateTool", new DateTool());
- jxlsContext.putVar("timezone", ReportUtils.getTimezone(userId));
- jxlsContext.putVar("locale", Locale.getDefault());
JxlsHelper.getInstance().setUseFastFormulaProcessor(false)
.processTemplate(inputStream, outputStream, jxlsContext);
}