@furkot/export-expense-report 0.0.3 → 0.0.5

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;
@@ -79,7 +80,9 @@ function* expenseReport(options) {
79
80
  cost,
80
81
  costRoute,
81
82
  day,
83
+ dayLabel,
82
84
  distance,
85
+ mode,
83
86
  name,
84
87
  nights,
85
88
  notes,
@@ -88,15 +91,17 @@ function* expenseReport(options) {
88
91
  } = steps[i];
89
92
  const to = name || address;
90
93
  const date = format.date(new Date(arrival_time));
94
+ const inTripMode = mode === undefined || mode === tripMode;
91
95
  const lines = [];
92
96
 
93
- if (mileageRate && distance) {
97
+ if (mileageRate && distance && inTripMode) {
94
98
  const line = [];
95
99
 
96
100
  line.push(format.description(
97
101
  [from, to].join(' - '),
102
+ dayLabel,
98
103
  format.distance(distance, 1, units, true),
99
- format.amount(mileageRate / 100, 2, currency)
104
+ format.amount(mileageRate / 100, 3, currency)
100
105
  ));
101
106
  line.push(date);
102
107
  line.push(format.distance(distance * mileageRate / 100, 2, units));
@@ -108,18 +113,18 @@ function* expenseReport(options) {
108
113
  if (costRoute) {
109
114
  const line = [];
110
115
 
111
- line.push(format.description([from, to].join(' - ')));
116
+ line.push(format.description([from, to].join(' - '), dayLabel));
112
117
  line.push(date);
113
118
  line.push(format.amount(costRoute / 100, 2));
114
119
  line.push(currency);
115
- line.push('tolls');
120
+ line.push(inTripMode ? 'tolls' : 'transportation');
116
121
 
117
122
  lines.push(prepare(line));
118
123
  }
119
124
  if (cost) {
120
125
  const line = [];
121
126
 
122
- line.push(format.description(name || address, tags,
127
+ line.push(format.description(name || address, tags, dayLabel,
123
128
  nights > 1 &&
124
129
  [
125
130
  format.amount(cost / 100, 2, currency),
@@ -136,7 +141,7 @@ function* expenseReport(options) {
136
141
  if (per_diem) {
137
142
  const line = [];
138
143
 
139
- line.push(format.description(address || name, tags));
144
+ line.push(format.description(address || name, tags, dayLabel));
140
145
  line.push(date);
141
146
  line.push(format.amount(per_diem / 100, 2));
142
147
  line.push(currency);
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.5",
4
4
  "description": "Generate CSV expense report from Furkot trip data.",
5
5
  "author": {
6
6
  "name": "Natalia Kowalczyk",