fleetmap-reports 1.0.216 → 1.0.217

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.
@@ -144,7 +144,7 @@
144
144
  <workItem from="1637227826845" duration="1275000" />
145
145
  <workItem from="1637441942952" duration="4543000" />
146
146
  <workItem from="1637670815688" duration="2973000" />
147
- <workItem from="1637674107929" duration="12171000" />
147
+ <workItem from="1637674107929" duration="12917000" />
148
148
  </task>
149
149
  <task id="LOCAL-00001" summary="Fix getStyle">
150
150
  <created>1636983717385</created>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetmap-reports",
3
- "version": "1.0.216",
3
+ "version": "1.0.217",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/kms-report.js CHANGED
@@ -18,7 +18,9 @@ async function createKmsReportByDevice(from, to, userData) {
18
18
  const devicesToProcess = userData.byGroup ? userData.devices.filter(d => !groupIds.includes(d.groupId)) : userData.devices
19
19
 
20
20
  const allData = {
21
- devices: []
21
+ devices: [],
22
+ from: from,
23
+ to: to
22
24
  }
23
25
 
24
26
  devicesToProcess.sort((a, b) => (a.name > b.name) ? 1 : -1)
@@ -132,7 +134,7 @@ async function exportKmsReportToPDF(userData, reportData) {
132
134
  if (kmsData) {
133
135
  let first = true
134
136
  const doc = userData.groupByDay ? new jsPDF.jsPDF() : new jsPDF.jsPDF('l')
135
- await headerFromUser(doc, translations.report.titleSpeedingReport, userData.user)
137
+ await headerFromUser(doc, translations.report.titleKmsReport, userData.user)
136
138
 
137
139
  if (userData.groupByDay) {
138
140
  for (const d of kmsData) {
@@ -149,13 +151,13 @@ async function exportKmsReportToPDF(userData, reportData) {
149
151
  doc.setFontSize(13)
150
152
  doc.text(name, 20, space + 20)
151
153
  doc.setFontSize(11)
152
- doc.text(group ? translations.report.group + ': ' + group.name : '', 200, space + 20)
153
- doc.text(new Date(d.from).toLocaleString() + ' - ' + new Date(d.to).toLocaleString(), 20, space + 25)
154
+ doc.text(group ? translations.report.group + ': ' + group.name : '', 150, space + 20)
155
+ doc.text(new Date(reportData.from).toLocaleString() + ' - ' + new Date(reportData.to).toLocaleString(), 20, space + 25)
154
156
 
155
157
  const data = []
156
158
  d.days.forEach(day => {
157
159
  const temp = [
158
- new Date(day).toLocaleDateString(),
160
+ new Date(day.date).toLocaleDateString(),
159
161
  (day.kms/1000).toFixed(0)
160
162
  ]
161
163
 
@@ -173,6 +175,7 @@ async function exportKmsReportToPDF(userData, reportData) {
173
175
  addTable(doc, headers, data, footValues, style, 35)
174
176
  }
175
177
  } else {
178
+ const data = []
176
179
  if (userData.byDriver) {
177
180
  reportData.drivers.forEach(d => {
178
181
  const group = userData.groups.find(g => g.drivers.includes(d.driver.id))