diff options
author | Abyss777 <abyss@fox5.ru> | 2017-03-15 16:56:55 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2017-03-15 16:56:55 +0500 |
commit | 975d2850e245c880e9105b68746cb535ea09fa90 (patch) | |
tree | 195fc2b97ed9ff698b0d2a349209f559e09b77af /src/org/traccar/reports/Summary.java | |
parent | 38c12eb011e47c131a9b1e47e2b29901270057b1 (diff) | |
download | trackermap-server-975d2850e245c880e9105b68746cb535ea09fa90.tar.gz trackermap-server-975d2850e245c880e9105b68746cb535ea09fa90.tar.bz2 trackermap-server-975d2850e245c880e9105b68746cb535ea09fa90.zip |
Use timezone from preferences for excel reports
Diffstat (limited to 'src/org/traccar/reports/Summary.java')
-rw-r--r-- | src/org/traccar/reports/Summary.java | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/org/traccar/reports/Summary.java b/src/org/traccar/reports/Summary.java index cacb4d1d6..543392e05 100644 --- a/src/org/traccar/reports/Summary.java +++ b/src/org/traccar/reports/Summary.java @@ -24,8 +24,9 @@ import java.sql.SQLException; import java.util.ArrayList; import java.util.Collection; import java.util.Date; +import java.util.Locale; -import org.joda.time.DateTime; +import org.apache.velocity.tools.generic.DateTool; import org.jxls.transform.poi.PoiTransformer; import org.jxls.util.JxlsHelper; import org.traccar.Context; @@ -79,8 +80,8 @@ 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")) { @@ -90,7 +91,10 @@ public final class Summary { jxlsContext.putVar("to", to); jxlsContext.putVar("distanceUnit", ReportUtils.getDistanceUnit(userId)); jxlsContext.putVar("speedUnit", ReportUtils.getSpeedUnit(userId)); - jxlsContext.putVar("timezone", from.getZone()); + 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); } |