@furkot/export-expense-report 0.0.3 → 0.0.4

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.
@@ -55,7 +55,8 @@ function* expenseReport(options) {
55
55
  metadata: {
56
56
  currency,
57
57
  units,
58
- mileageRate
58
+ mileageRate,
59
+ mode: tripMode
59
60
  },
60
61
  routes
61
62
  } = options;
@@ -80,6 +81,7 @@ function* expenseReport(options) {
80
81
  costRoute,
81
82
  day,
82
83
  distance,
84
+ mode,
83
85
  name,
84
86
  nights,
85
87
  notes,
@@ -88,15 +90,16 @@ function* expenseReport(options) {
88
90
  } = steps[i];
89
91
  const to = name || address;
90
92
  const date = format.date(new Date(arrival_time));
93
+ const inTripMode = mode === undefined || mode === tripMode;
91
94
  const lines = [];
92
95
 
93
- if (mileageRate && distance) {
96
+ if (mileageRate && distance && inTripMode) {
94
97
  const line = [];
95
98
 
96
99
  line.push(format.description(
97
100
  [from, to].join(' - '),
98
101
  format.distance(distance, 1, units, true),
99
- format.amount(mileageRate / 100, 2, currency)
102
+ format.amount(mileageRate / 100, 3, currency)
100
103
  ));
101
104
  line.push(date);
102
105
  line.push(format.distance(distance * mileageRate / 100, 2, units));
@@ -112,7 +115,7 @@ function* expenseReport(options) {
112
115
  line.push(date);
113
116
  line.push(format.amount(costRoute / 100, 2));
114
117
  line.push(currency);
115
- line.push('tolls');
118
+ line.push(inTripMode ? 'tolls' : 'transportation');
116
119
 
117
120
  lines.push(prepare(line));
118
121
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@furkot/export-expense-report",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "Generate CSV expense report from Furkot trip data.",
5
5
  "author": {
6
6
  "name": "Natalia Kowalczyk",