fleetmap-reports 1.0.319 → 1.0.323

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetmap-reports",
3
- "version": "1.0.319",
3
+ "version": "1.0.323",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -25,7 +25,7 @@ async function createEventsReport(from, to, userData, traccar) {
25
25
  xpert: devices.filter(d => d.attributes.xpert).length > 0
26
26
  }
27
27
 
28
- const data = await getReportData(from, to, devices, userData.eventTypes)
28
+ const data = await getReportData(from, to, devices, userData.eventTypes, traccar)
29
29
 
30
30
  devices.sort((a, b) => (a.name > b.name) ? 1 : -1)
31
31
 
package/src/kms-report.js CHANGED
@@ -103,7 +103,7 @@ async function createKmsReportByGroup(from, to, userData, traccarInstance) {
103
103
  }
104
104
  }
105
105
 
106
- const withoutGroupData = await createKmsReportByDevice(from, to)
106
+ const withoutGroupData = await createKmsReportByDevice(from, to, userData, traccarInstance)
107
107
  reportData.push(withoutGroupData)
108
108
 
109
109
  return reportData
@@ -411,6 +411,8 @@ function exportKmsReportToExcel(userData, reportData) {
411
411
  }
412
412
  })
413
413
 
414
+ data.concat({licenseplate: 'Total', distance: data.reduce((prev, curr) => prev + curr.distance)})
415
+
414
416
  return {
415
417
  headers,
416
418
  data,
@@ -63,7 +63,7 @@ async function createSpeedingReportByGroup(from, to, userData, traccarInstance){
63
63
  const groupIds = userData.groups.map(g => g.id)
64
64
  const withoutGroupDevices = userData.devices.filter(d => !groupIds.includes(d.groupId))
65
65
 
66
- const withoutGroupData = await createSpeedingReportByDevice(from, to, withoutGroupDevices)
66
+ const withoutGroupData = await createSpeedingReportByDevice(from, to, withoutGroupDevices, userData, traccarInstance)
67
67
  reportData.push(withoutGroupData)
68
68
 
69
69
  return reportData
package/src/word/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  const {Document, Paragraph, Packer, TableRow, TableCell, Table, WidthType, ImageRun, Header, TextRun, HeadingLevel,
2
- AlignmentType
2
+ AlignmentType, Footer
3
3
  } = require("docx")
4
4
  const { saveAs } = require('file-saver')
5
5
  const utils = require('../util/utils')
6
6
  const {getPartnerData} = require("fleetmap-partners");
7
- const colWidth = 3505
7
+ const colWidth = 2000
8
8
 
9
9
  function formatCellValue(value) {
10
10
  return value.toLocaleDateString ? value.toLocaleDateString() : value + ''
@@ -61,6 +61,17 @@ exports.reportToWord = async (userData, dateRange, excel, title) => {
61
61
  ]
62
62
  })
63
63
  },
64
+ footers: {
65
+ default: new Footer({
66
+ children: [
67
+ new Paragraph({
68
+ children: [
69
+ new TextRun('Relatório gerado a ' + new Date().toLocaleString())
70
+ ]
71
+ })
72
+ ]
73
+ })
74
+ },
64
75
  properties: {},
65
76
  children: [
66
77
  new Paragraph({