diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-11-24 18:50:29 +1300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-24 18:50:29 +1300 |
commit | 3e1a25b54ab342bedc8d688bb6ccb3c2d6c60d0c (patch) | |
tree | fc2122a934e80ba7d7e5670dd1540e72a7dfc8ae /src/org/traccar/reports/Summary.java | |
parent | ebe64e810bd8e57a805a571cfd6110fbc3cd57c1 (diff) | |
parent | 0bbf8f554638cdc89d5dd618c500839554602dee (diff) | |
download | trackermap-server-3e1a25b54ab342bedc8d688bb6ccb3c2d6c60d0c.tar.gz trackermap-server-3e1a25b54ab342bedc8d688bb6ccb3c2d6c60d0c.tar.bz2 trackermap-server-3e1a25b54ab342bedc8d688bb6ccb3c2d6c60d0c.zip |
Merge pull request #2592 from Abyss777/excel_timezone
Fix excel export if timezone of client and server are different
Diffstat (limited to 'src/org/traccar/reports/Summary.java')
-rw-r--r-- | src/org/traccar/reports/Summary.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/org/traccar/reports/Summary.java b/src/org/traccar/reports/Summary.java index b404b0ed5..4d6446017 100644 --- a/src/org/traccar/reports/Summary.java +++ b/src/org/traccar/reports/Summary.java @@ -25,6 +25,7 @@ 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; @@ -78,8 +79,8 @@ public final class Summary { public static void getExcel(OutputStream outputStream, long userId, Collection<Long> deviceIds, Collection<Long> groupIds, - Date from, Date to) throws SQLException, IOException { - Collection<SummaryReport> summaries = getObjects(userId, deviceIds, groupIds, from, to); + DateTime from, DateTime to) throws SQLException, IOException { + Collection<SummaryReport> summaries = getObjects(userId, deviceIds, groupIds, from.toDate(), to.toDate()); String templatePath = Context.getConfig().getString("report.templatesPath", "templates/export/"); try (InputStream inputStream = new FileInputStream(templatePath + "/summary.xlsx")) { @@ -89,6 +90,7 @@ 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()); JxlsHelper.getInstance().setUseFastFormulaProcessor(false) .processTemplate(inputStream, outputStream, jxlsContext); } |