fleetmap-reports 1.0.588 → 1.0.590
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/fuelconsumption-report.js +1 -0
- package/src/trip-report.js +10 -6
package/package.json
CHANGED
|
@@ -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
|
|
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,7 +320,7 @@ 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
|
|
|
@@ -364,8 +364,12 @@ async function exportTripReportToPDF (userData, reportData) {
|
|
|
364
364
|
7: { halign: 'right' },
|
|
365
365
|
8: { halign: 'right' },
|
|
366
366
|
9: { halign: 'right' },
|
|
367
|
-
|
|
368
|
-
|
|
367
|
+
...(withFuelData
|
|
368
|
+
? {
|
|
369
|
+
10: { halign: 'right' },
|
|
370
|
+
11: { halign: 'right' }
|
|
371
|
+
}
|
|
372
|
+
: {})
|
|
369
373
|
})
|
|
370
374
|
})
|
|
371
375
|
return doc
|
|
@@ -399,7 +403,7 @@ function exportTripReportToExcel (userData, reportData) {
|
|
|
399
403
|
|
|
400
404
|
let data = []
|
|
401
405
|
if (tripsData) {
|
|
402
|
-
const withFuelData = tripsData.
|
|
406
|
+
const withFuelData = tripsData.find(b => b.totalFuelConsumption !== undefined)
|
|
403
407
|
|
|
404
408
|
if (withFuelData) {
|
|
405
409
|
headers.push({ label: translations.report.consumption, value: 'consumption' },
|
|
@@ -486,7 +490,7 @@ function getSumTotalKms (user, data) {
|
|
|
486
490
|
const values = data.map(item => {
|
|
487
491
|
return item.totalKms ? parseFloat(item.totalKms) : 0
|
|
488
492
|
})
|
|
489
|
-
return Intl.NumberFormat(user.attributes.lang, { maximumFractionDigits:
|
|
493
|
+
return Intl.NumberFormat(user.attributes.lang, { maximumFractionDigits: 1 }).format(values.reduce((a, b) => a + b, 0))
|
|
490
494
|
}
|
|
491
495
|
|
|
492
496
|
function getSumAvgSpeed (data) {
|