fleetmap-reports 1.0.783 → 1.0.784
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/activity-report.js +34 -29
- package/src/partnerReports/afriquia.js +2 -4
package/package.json
CHANGED
package/src/activity-report.js
CHANGED
|
@@ -83,15 +83,16 @@ async function createActivityReportByDevice (from, to, userData, traccarInstance
|
|
|
83
83
|
to
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
const sliced = automaticReports.sliceArray(allDevices,
|
|
86
|
+
const sliced = automaticReports.sliceArray(allDevices, 4)
|
|
87
87
|
let deviceCount = 0
|
|
88
88
|
for (const devices of sliced) {
|
|
89
89
|
let summaries = []
|
|
90
|
+
const needRoute = userData.groupByDay || !userData.allWeek
|
|
90
91
|
const {
|
|
91
92
|
trips,
|
|
92
93
|
route,
|
|
93
94
|
summary
|
|
94
|
-
} = await traccar.getAllInOne(traccarInstance, from, to, devices,
|
|
95
|
+
} = await traccar.getAllInOne(traccarInstance, from, to, devices, needRoute, true, false, !userData.groupByDay, deviceCount, allDevices.length)
|
|
95
96
|
|
|
96
97
|
if (userData.groupByDay) {
|
|
97
98
|
console.log('trips:' + trips.length)
|
|
@@ -400,20 +401,22 @@ function exportActivityReportToPDFVehicle (doc, translations, reportData, userDa
|
|
|
400
401
|
reportData.devices.forEach(d => {
|
|
401
402
|
const group = userData.groups.find(g => d.device.groupId === g.id)
|
|
402
403
|
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
404
|
+
if (d.summary) {
|
|
405
|
+
const temp = [
|
|
406
|
+
d.device.name,
|
|
407
|
+
group ? group.name : '',
|
|
408
|
+
d.summary[0].startTime ? new Date(d.summary[0].startTime).toLocaleString() : '',
|
|
409
|
+
d.summary[0].endTime ? new Date(d.summary[0].endTime).toLocaleString() : '',
|
|
410
|
+
Number((d.summary[0].distance / 1000).toFixed(1)),
|
|
411
|
+
Number((d.summary[0].startOdometer / 1000).toFixed(1)),
|
|
412
|
+
Number((d.summary[0].endOdometer / 1000).toFixed(1)),
|
|
413
|
+
Math.round(d.summary[0].averageSpeed * 1.85200),
|
|
414
|
+
Math.round(d.summary[0].maxSpeed * 1.85200),
|
|
415
|
+
convertMS(d.summary[0].engineHours),
|
|
416
|
+
d.summary[0].convertedSpentFuel >= 0 ? d.summary[0].convertedSpentFuel : 0
|
|
417
|
+
]
|
|
418
|
+
data.push(temp)
|
|
419
|
+
}
|
|
417
420
|
})
|
|
418
421
|
|
|
419
422
|
const footValues = ['Total:' + reportData.devices.length,
|
|
@@ -718,19 +721,21 @@ function exportActivityReportToExcelVehicle (settings, translations, reportData,
|
|
|
718
721
|
reportData.devices.forEach(d => {
|
|
719
722
|
const group = userData.groups.find(g => d.device.groupId === g.id)
|
|
720
723
|
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
724
|
+
if (d.summary) {
|
|
725
|
+
data = data.concat([{
|
|
726
|
+
name: d.device.name,
|
|
727
|
+
group: group ? group.name : '',
|
|
728
|
+
start: d.summary[0].startTime ? new Date(d.summary[0].startTime).toLocaleString() : '',
|
|
729
|
+
end: d.summary[0].endTime ? new Date(d.summary[0].endTime).toLocaleString() : '',
|
|
730
|
+
distance: Number((d.summary[0].distance / 1000).toFixed(0)),
|
|
731
|
+
startOdometer: Number((d.summary[0].startOdometer / 1000).toFixed(0)),
|
|
732
|
+
endOdometer: Number((d.summary[0].endOdometer / 1000).toFixed(0)),
|
|
733
|
+
avgSpeed: Math.round(d.summary[0].averageSpeed * 1.85200),
|
|
734
|
+
maxSpeed: Math.round(d.summary[0].maxSpeed * 1.85200),
|
|
735
|
+
engineHours: convertMS(d.summary[0].engineHours),
|
|
736
|
+
spentFuel: d.summary[0].convertedSpentFuel >= 0 ? d.summary[0].convertedSpentFuel : 0
|
|
737
|
+
}])
|
|
738
|
+
}
|
|
734
739
|
})
|
|
735
740
|
console.log(data)
|
|
736
741
|
return {
|
|
@@ -7,10 +7,6 @@ function calculateLastStopTime (stopTime, to, time) {
|
|
|
7
7
|
return stopTime + (to.getTime() - new Date(time).getTime())
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
function calculateFirstStopTime (stopTime, from, time) {
|
|
11
|
-
return stopTime + (new Date(time).getTime() - from.getTime())
|
|
12
|
-
}
|
|
13
|
-
|
|
14
10
|
async function createActivityReport (from, to, userData, traccarInstance) {
|
|
15
11
|
const unauthorizedGeofences = []
|
|
16
12
|
const authorizedGeofences = []
|
|
@@ -126,4 +122,6 @@ async function createActivityReport (from, to, userData, traccarInstance) {
|
|
|
126
122
|
return reportData
|
|
127
123
|
}
|
|
128
124
|
|
|
125
|
+
|
|
126
|
+
|
|
129
127
|
exports.createActivityReport = createActivityReport
|