aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/reports/Trips.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-11-24 18:50:29 +1300
committerGitHub <noreply@github.com>2016-11-24 18:50:29 +1300
commit3e1a25b54ab342bedc8d688bb6ccb3c2d6c60d0c (patch)
treefc2122a934e80ba7d7e5670dd1540e72a7dfc8ae /src/org/traccar/reports/Trips.java
parentebe64e810bd8e57a805a571cfd6110fbc3cd57c1 (diff)
parent0bbf8f554638cdc89d5dd618c500839554602dee (diff)
downloadtrackermap-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/Trips.java')
-rw-r--r--src/org/traccar/reports/Trips.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/org/traccar/reports/Trips.java b/src/org/traccar/reports/Trips.java
index 91a080d45..1c2ba3fe3 100644
--- a/src/org/traccar/reports/Trips.java
+++ b/src/org/traccar/reports/Trips.java
@@ -26,6 +26,7 @@ import java.util.Collection;
import java.util.Date;
import java.util.List;
+import org.joda.time.DateTime;
import org.jxls.area.Area;
import org.jxls.builder.xls.XlsCommentAreaBuilder;
import org.jxls.common.CellRef;
@@ -175,12 +176,12 @@ public final class Trips {
public static void getExcel(OutputStream outputStream,
long userId, Collection<Long> deviceIds, Collection<Long> groupIds,
- Date from, Date to) throws SQLException, IOException {
+ DateTime from, DateTime to) throws SQLException, IOException {
ArrayList<DeviceReport> devicesTrips = new ArrayList<>();
ArrayList<String> sheetNames = new ArrayList<>();
for (long deviceId: ReportUtils.getDeviceList(deviceIds, groupIds)) {
Context.getPermissionsManager().checkDevice(userId, deviceId);
- Collection<TripReport> trips = detectTrips(deviceId, from, to);
+ Collection<TripReport> trips = detectTrips(deviceId, from.toDate(), to.toDate());
DeviceReport deviceTrips = new DeviceReport();
Device device = Context.getIdentityManager().getDeviceById(deviceId);
deviceTrips.setDeviceName(device.getName());
@@ -204,6 +205,7 @@ public final class Trips {
jxlsContext.putVar("to", to);
jxlsContext.putVar("distanceUnit", ReportUtils.getDistanceUnit(userId));
jxlsContext.putVar("speedUnit", ReportUtils.getSpeedUnit(userId));
+ jxlsContext.putVar("timezone", from.getZone());
Transformer transformer = TransformerFactory.createTransformer(inputStream, outputStream);
List<Area> xlsAreas = new XlsCommentAreaBuilder(transformer).build();
for (Area xlsArea : xlsAreas) {