fleetmap-reports 1.0.587 → 1.0.589
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
CHANGED
package/src/activity-report.js
CHANGED
|
@@ -337,7 +337,7 @@ function exportActivityReportToPDFDriver (doc, translations, reportData, userDat
|
|
|
337
337
|
d.driver.name,
|
|
338
338
|
d.summary[0].startTime ? new Date(d.summary[0].startTime).toLocaleString() : '',
|
|
339
339
|
d.summary[0].endTime ? new Date(d.summary[0].endTime).toLocaleString() : '',
|
|
340
|
-
Number((d.summary[0].distance / 1000).toFixed(
|
|
340
|
+
Number((d.summary[0].distance / 1000).toFixed(1)),
|
|
341
341
|
Math.round(d.summary[0].averageSpeed * 1.85200),
|
|
342
342
|
Math.round(d.summary[0].maxSpeed * 1.85200),
|
|
343
343
|
convertMS(d.summary[0].engineHours)
|
|
@@ -381,9 +381,9 @@ function exportActivityReportToPDFVehicle (doc, translations, reportData, userDa
|
|
|
381
381
|
group ? group.name : '',
|
|
382
382
|
d.summary[0].startTime ? new Date(d.summary[0].startTime).toLocaleString() : '',
|
|
383
383
|
d.summary[0].endTime ? new Date(d.summary[0].endTime).toLocaleString() : '',
|
|
384
|
-
Number((d.summary[0].distance / 1000).toFixed(
|
|
385
|
-
Number((d.summary[0].startOdometer / 1000).toFixed(
|
|
386
|
-
Number((d.summary[0].endOdometer / 1000).toFixed(
|
|
384
|
+
Number((d.summary[0].distance / 1000).toFixed(1)),
|
|
385
|
+
Number((d.summary[0].startOdometer / 1000).toFixed(1)),
|
|
386
|
+
Number((d.summary[0].endOdometer / 1000).toFixed(1)),
|
|
387
387
|
Math.round(d.summary[0].averageSpeed * 1.85200),
|
|
388
388
|
Math.round(d.summary[0].maxSpeed * 1.85200),
|
|
389
389
|
convertMS(d.summary[0].engineHours),
|
|
@@ -460,9 +460,9 @@ function exportActivityReportToPDFVehicleGroupByDay (doc, translations, reportDa
|
|
|
460
460
|
new Date(s.date).toLocaleDateString() + ' - ' + weekDays[s.date.getDay()],
|
|
461
461
|
s.startTime ? new Date(s.startTime).toLocaleTimeString() : '',
|
|
462
462
|
s.endTime ? new Date(s.endTime).toLocaleTimeString() : '',
|
|
463
|
-
Number((s.distance / 1000).toFixed(
|
|
464
|
-
Number((s.startOdometer / 1000).toFixed(
|
|
465
|
-
Number((s.endOdometer / 1000).toFixed(
|
|
463
|
+
Number((s.distance / 1000).toFixed(1)),
|
|
464
|
+
Number((s.startOdometer / 1000).toFixed(1)),
|
|
465
|
+
Number((s.endOdometer / 1000).toFixed(1)),
|
|
466
466
|
Math.round(s.averageSpeed * 1.85200),
|
|
467
467
|
Math.round(s.maxSpeed * 1.85200),
|
|
468
468
|
convertMS(s.engineHours),
|
|
@@ -596,7 +596,7 @@ function exportActivityReportToPDFDriverGroupByDay (doc, translations, reportDat
|
|
|
596
596
|
new Date(s.date).toLocaleDateString() + ' - ' + weekDays[s.date.getDay()],
|
|
597
597
|
s.startTime ? new Date(s.startTime).toLocaleTimeString() : '',
|
|
598
598
|
s.endTime ? new Date(s.endTime).toLocaleTimeString() : '',
|
|
599
|
-
Number((s.distance / 1000).toFixed(
|
|
599
|
+
Number((s.distance / 1000).toFixed(1)),
|
|
600
600
|
Math.round(s.averageSpeed * 1.85200),
|
|
601
601
|
Math.round(s.maxSpeed * 1.85200),
|
|
602
602
|
convertMS(s.engineHours)
|
|
@@ -144,11 +144,11 @@ function exportFuelConsumptionReportToExcel (userData, reportData) {
|
|
|
144
144
|
return {
|
|
145
145
|
name: d.device.name,
|
|
146
146
|
date: r.date,
|
|
147
|
-
kms: (r.distance / 1000).toFixed(
|
|
147
|
+
kms: (r.distance / 1000).toFixed(1),
|
|
148
148
|
consumption: r.spentFuel > 0 ? r.spentFuel : 0,
|
|
149
149
|
avg_consumption: lang === 'pt-BR' ? r.avgConsumption.byLiters : r.avgConsumption.byKms,
|
|
150
150
|
duration: new Date(r.duration).toLocaleTimeString(),
|
|
151
|
-
accumulated_kms: (r.endOdometer / 1000).toFixed(
|
|
151
|
+
accumulated_kms: (r.endOdometer / 1000).toFixed(1),
|
|
152
152
|
refueling: r.refueling
|
|
153
153
|
}
|
|
154
154
|
}))
|
|
@@ -167,6 +167,7 @@ async function exportFuelConsumptionReportToPDF (userData, reportData) {
|
|
|
167
167
|
const translations = getTranslations(userData)
|
|
168
168
|
const lang = getLanguage(userData)
|
|
169
169
|
|
|
170
|
+
// eslint-disable-next-line new-cap
|
|
170
171
|
const doc = new jsPDF.jsPDF('l')
|
|
171
172
|
await headerFromUser(doc, translations.report.titleFuelConsumptionReport, userData.user)
|
|
172
173
|
|
|
@@ -201,11 +202,11 @@ async function exportFuelConsumptionReportToPDF (userData, reportData) {
|
|
|
201
202
|
d.days.forEach(r =>
|
|
202
203
|
data.push([
|
|
203
204
|
r.date,
|
|
204
|
-
(r.distance / 1000).toFixed(
|
|
205
|
+
(r.distance / 1000).toFixed(1),
|
|
205
206
|
r.spentFuel > 0 ? r.spentFuel : 0,
|
|
206
207
|
lang === 'pt-BR' ? r.avgConsumption.byLiters : r.avgConsumption.byKms,
|
|
207
208
|
new Date(r.duration).toLocaleTimeString(),
|
|
208
|
-
(r.endOdometer / 1000).toFixed(
|
|
209
|
+
(r.endOdometer / 1000).toFixed(1),
|
|
209
210
|
r.refueling
|
|
210
211
|
]))
|
|
211
212
|
console.log(data)
|
package/src/trip-report.js
CHANGED
|
@@ -262,7 +262,7 @@ async function exportTripReportToPDF (userData, reportData) {
|
|
|
262
262
|
]
|
|
263
263
|
|
|
264
264
|
if (tripsData) {
|
|
265
|
-
const withFuelData = tripsData.
|
|
265
|
+
const withFuelData = tripsData.find(t => t.totalFuelConsumption !== undefined)
|
|
266
266
|
|
|
267
267
|
if (withFuelData) {
|
|
268
268
|
headers.push(translations.report.consumption,
|
|
@@ -320,12 +320,13 @@ async function exportTripReportToPDF (userData, reportData) {
|
|
|
320
320
|
|
|
321
321
|
temp.push(convertMS(a.stopEngineHours),
|
|
322
322
|
convertMS(a.stopDuration),
|
|
323
|
-
Intl.NumberFormat(userData.user.attributes.lang, { maximumFractionDigits:
|
|
323
|
+
Intl.NumberFormat(userData.user.attributes.lang, { maximumFractionDigits: 1 }).format(a.totalKms),
|
|
324
324
|
Math.round(a.averageSpeed * 1.85200),
|
|
325
325
|
Math.round(a.maxSpeed * 1.85200))
|
|
326
326
|
|
|
327
327
|
if (withFuelData) {
|
|
328
|
-
temp.push(a.fuelConsumption
|
|
328
|
+
temp.push(a.fuelConsumption && a.fuelConsumption.toFixed(1),
|
|
329
|
+
a.avgFuelConsumption && a.avgFuelConsumption.toFixed(1))
|
|
329
330
|
}
|
|
330
331
|
|
|
331
332
|
if (userData.byDriver) {
|
|
@@ -398,7 +399,7 @@ function exportTripReportToExcel (userData, reportData) {
|
|
|
398
399
|
|
|
399
400
|
let data = []
|
|
400
401
|
if (tripsData) {
|
|
401
|
-
const withFuelData = tripsData.
|
|
402
|
+
const withFuelData = tripsData.find(b => b.totalFuelConsumption !== undefined)
|
|
402
403
|
|
|
403
404
|
if (withFuelData) {
|
|
404
405
|
headers.push({ label: translations.report.consumption, value: 'consumption' },
|
|
@@ -425,7 +426,7 @@ function exportTripReportToExcel (userData, reportData) {
|
|
|
425
426
|
tripTime: convertMS(a.duration),
|
|
426
427
|
idleTime: convertMS(a.stopEngineHours),
|
|
427
428
|
stopTime: convertMS(a.stopDuration),
|
|
428
|
-
distance: Number(a.totalKms.toFixed(
|
|
429
|
+
distance: Number(a.totalKms.toFixed(1)),
|
|
429
430
|
averageSpeed: Math.round(a.averageSpeed * 1.85200),
|
|
430
431
|
maxSpeed: Math.round(a.maxSpeed * 1.85200),
|
|
431
432
|
consumption: a.fuelConsumption.toFixed(1),
|
|
@@ -485,7 +486,7 @@ function getSumTotalKms (user, data) {
|
|
|
485
486
|
const values = data.map(item => {
|
|
486
487
|
return item.totalKms ? parseFloat(item.totalKms) : 0
|
|
487
488
|
})
|
|
488
|
-
return Intl.NumberFormat(user.attributes.lang, { maximumFractionDigits:
|
|
489
|
+
return Intl.NumberFormat(user.attributes.lang, { maximumFractionDigits: 1 }).format(values.reduce((a, b) => a + b, 0))
|
|
489
490
|
}
|
|
490
491
|
|
|
491
492
|
function getSumAvgSpeed (data) {
|