aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/reports/Summary.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-03-16 19:01:05 +1300
committerGitHub <noreply@github.com>2017-03-16 19:01:05 +1300
commit308d00b7f72b7455c58a98013fff06e227360097 (patch)
tree55367dae3f7e85c65432dfbf91adc4496df16254 /src/org/traccar/reports/Summary.java
parent2f782faaf27ffdae3753e06a6386c1cd49b2ed16 (diff)
parentf7a668371769a7b4c176e57626f23314e3838e1c (diff)
downloadtrackermap-server-308d00b7f72b7455c58a98013fff06e227360097.tar.gz
trackermap-server-308d00b7f72b7455c58a98013fff06e227360097.tar.bz2
trackermap-server-308d00b7f72b7455c58a98013fff06e227360097.zip
Merge pull request #3011 from Abyss777/reports_timezone
Use timezone from preferences for excel reports
Diffstat (limited to 'src/org/traccar/reports/Summary.java')
-rw-r--r--src/org/traccar/reports/Summary.java11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/org/traccar/reports/Summary.java b/src/org/traccar/reports/Summary.java
index cacb4d1d6..abe0277da 100644
--- a/src/org/traccar/reports/Summary.java
+++ b/src/org/traccar/reports/Summary.java
@@ -25,8 +25,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
-import org.joda.time.DateTime;
-import org.jxls.transform.poi.PoiTransformer;
import org.jxls.util.JxlsHelper;
import org.traccar.Context;
import org.traccar.model.Position;
@@ -79,18 +77,15 @@ public final class Summary {
public static void getExcel(OutputStream outputStream,
long userId, Collection<Long> deviceIds, Collection<Long> groupIds,
- DateTime from, DateTime to) throws SQLException, IOException {
- Collection<SummaryReport> summaries = getObjects(userId, deviceIds, groupIds, from.toDate(), to.toDate());
+ Date from, Date to) throws SQLException, IOException {
+ Collection<SummaryReport> summaries = getObjects(userId, deviceIds, groupIds, from, to);
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("timezone", from.getZone());
JxlsHelper.getInstance().setUseFastFormulaProcessor(false)
.processTemplate(inputStream, outputStream, jxlsContext);
}