fleetmap-reports 1.0.320 → 1.0.324

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.
@@ -0,0 +1,7 @@
1
+ <component name="ProjectCodeStyleConfiguration">
2
+ <code_scheme name="Project" version="173">
3
+ <ScalaCodeStyleSettings>
4
+ <option name="MULTILINE_STRING_CLOSING_QUOTES_ON_NEW_LINE" value="true" />
5
+ </ScalaCodeStyleSettings>
6
+ </code_scheme>
7
+ </component>
@@ -0,0 +1,5 @@
1
+ <component name="ProjectCodeStyleConfiguration">
2
+ <state>
3
+ <option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
4
+ </state>
5
+ </component>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="JavaScriptLibraryMappings">
4
+ <file url="file://$PROJECT_DIR$" libraries="{Node.js Core}" />
5
+ </component>
6
+ </project>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetmap-reports",
3
- "version": "1.0.320",
3
+ "version": "1.0.324",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/index.test.js CHANGED
@@ -14,7 +14,9 @@ describe('speedingReport', function() {
14
14
  const reports = await getReports()
15
15
  const userData = await reports.getUserData()
16
16
  userData.groupByDay = true
17
- await reports.kmsReport(new Date(2021, 9), new Date(2021, 10),
17
+ const report = await reports.kmsReport(new Date(2021, 9, 30), new Date(2021, 10),
18
18
  userData)
19
+ console.log('report', report)
20
+ console.log(reports.kmsReportToExcel(userData, report[0]))
19
21
  })
20
22
  })
package/src/kms-report.js CHANGED
@@ -411,6 +411,11 @@ function exportKmsReportToExcel(userData, reportData) {
411
411
  }
412
412
  })
413
413
 
414
+ data = data.concat({
415
+ licenseplate: 'Total',
416
+ distance: data.reduce((prev, curr) => curr.distance ? {distance: (prev.distance || 0) + curr.distance} : prev).distance
417
+ })
418
+ console.log('last row', data.pop())
414
419
  return {
415
420
  headers,
416
421
  data,
@@ -14,9 +14,11 @@ const traccarConfig = {
14
14
 
15
15
  axiosCookieJarSupport(axios)
16
16
 
17
- exports.getReports = async() => {
17
+ const getReports = async() => {
18
18
  await new SessionApi(traccarConfig, null, axios).sessionPost(process.env.email, process.env.password)
19
19
  return new Index(traccarConfig, axios)
20
20
  }
21
21
 
22
+ exports.getReports = getReports
23
+
22
24
 
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({
@@ -1,10 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="RunConfigurationProducerService">
4
- <option name="ignoredProducers">
5
- <set>
6
- <option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
7
- </set>
8
- </option>
9
- </component>
10
- </project>