@furkot/export-expense-report 1.0.0 → 1.0.2
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/lib/expense-report.js +12 -3
- package/package.json +2 -2
package/lib/expense-report.js
CHANGED
|
@@ -53,6 +53,7 @@ export default function* expenseReport(options) {
|
|
|
53
53
|
|
|
54
54
|
const steps = routes[0].points;
|
|
55
55
|
let from;
|
|
56
|
+
let passthruDistance = 0;
|
|
56
57
|
|
|
57
58
|
function getLines(i) {
|
|
58
59
|
const {
|
|
@@ -67,27 +68,35 @@ export default function* expenseReport(options) {
|
|
|
67
68
|
name,
|
|
68
69
|
nights,
|
|
69
70
|
notes,
|
|
71
|
+
passthru,
|
|
70
72
|
per_diem,
|
|
71
73
|
tags
|
|
72
74
|
} = steps[i];
|
|
75
|
+
|
|
76
|
+
if (passthru) {
|
|
77
|
+
passthruDistance += distance;
|
|
78
|
+
return [];
|
|
79
|
+
}
|
|
80
|
+
const stepDistance = (distance ?? 0) + passthruDistance;
|
|
81
|
+
passthruDistance = 0;
|
|
73
82
|
const to = name || address;
|
|
74
83
|
const date = formatDate(new Date(arrival_time));
|
|
75
84
|
const inTripMode = mode === undefined || mode === tripMode;
|
|
76
85
|
const lines = [];
|
|
77
86
|
|
|
78
|
-
if (mileageRate &&
|
|
87
|
+
if (mileageRate && stepDistance && inTripMode) {
|
|
79
88
|
const line = [];
|
|
80
89
|
|
|
81
90
|
line.push(
|
|
82
91
|
formatDescription(
|
|
83
92
|
[from, to].join(' - '),
|
|
84
93
|
dayLabel,
|
|
85
|
-
formatDistance(
|
|
94
|
+
formatDistance(stepDistance, 1, units, true),
|
|
86
95
|
formatAmount(mileageRate / 100, 3, currency)
|
|
87
96
|
)
|
|
88
97
|
);
|
|
89
98
|
line.push(date);
|
|
90
|
-
line.push(formatDistance((
|
|
99
|
+
line.push(formatDistance((stepDistance * mileageRate) / 100, 2, units));
|
|
91
100
|
line.push(currency);
|
|
92
101
|
line.push('mileage');
|
|
93
102
|
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@furkot/export-expense-report",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Generate CSV expense report from Furkot trip data.",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"
|
|
6
|
+
"exports": "./lib/expense-report.js",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "Natalia Kowalczyk",
|
|
9
9
|
"email": "melitele@code42day.com",
|