-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.de.html
191 lines (167 loc) · 6.23 KB
/
index.de.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
<!doctype html>
<html lang="de">
<head>
<meta charset="utf-8">
<title>DriveNow Kostenrechner</title>
<script>
function calculate(){
var driveDuration=parseFloat(document.getElementById('driveDuration').value);
var distance=parseFloat(document.getElementById('distance').value);
var driveCost=parseFloat(document.getElementById('driveCost').value);
var prePaid=parseFloat(document.getElementById('prePaid').value);
if(distance > 200) {
var addCost=(distance-200)*0.29;
var deltaDistance=distance-200;
} else {
var addCost=0;
var deltaDistance=0;
}
// flexible price + savings package
if (prePaid > driveDuration) {
var deductPrePaid=driveDuration;
} else {
var deductPrePaid=prePaid;
}
var leftPrePaid=prePaid-driveDuration;
if (leftPrePaid < 0) {
leftPrePaid=0;
}
var cost=((driveDuration-deductPrePaid)*driveCost)+addCost;
cost=cost.toFixed(2);
var fullCost=(deductPrePaid*0.28)+((driveDuration-deductPrePaid)*driveCost)+addCost;
var deltaDuration=driveDuration-deductPrePaid;
// hourly package
// if you go over the pre-paid values its 0.29 Euro per km and $driveCost Euro per minute
var totalDuration=driveDuration;
// 3 hours / 80 km / 29 EUR
if (totalDuration > 180) {
var overChargeTime3=(totalDuration-180)*driveCost;
} else {
var overChargeTime3=0;
}
if (distance > 80) {
var overChargeKm3=(distance-80)*0.29;
} else {
var overChargeKm3=0;
}
var overCharge3=overChargeTime3+overChargeKm3;
var total3=29+overCharge3;
// 6 hours / 120 km / 54 EUR
if (totalDuration > 360) {
var overChargeTime6=(totalDuration-360)*driveCost;
} else {
var overChargeTime6=0;
}
if (distance > 120) {
var overChargeKm6=(distance-120)*0.29;
} else {
var overChargeKm6=0;
}
var overCharge6=overChargeTime6+overChargeKm6;
var total6=54+overCharge6;
// 9 hours / 200 km / 79 EUR
if (totalDuration > 540) {
var overChargeTime9=(totalDuration-540)*driveCost;
} else {
var overChargeTime9=0;
}
if (distance > 200) {
var overChargeKm9=(distance-200)*0.29;
} else {
var overChargeKm9=0;
}
var overCharge9=overChargeTime9+overChargeKm9;
var total9=79+overCharge9;
// 24 hours / 200 km / 109
if (totalDuration > 1440) {
var overChargeTime24=(totalDuration-1440)*driveCost;
} else {
var overChargeTime24=0;
}
if (distance > 200) {
var overChargeKm24=(distance-200)*0.29;
} else {
var overChargeKm24=0;
}
var overCharge24=overChargeTime24+overChargeKm24;
var total24=109+overCharge24;
// 48 hours / 400 km / 199
if (totalDuration > 2880) {
var overChargeTime48=(totalDuration-2880)*driveCost;
} else {
var overChargeTime48=0;
}
if (distance > 400) {
var overChargeKm48=(distance-400)*0.29;
} else {
var overChargeKm48=0;
}
var overCharge48=overChargeTime48+overChargeKm48;
var total48=199+overCharge48;
// what if you bought pre-paid minutes before the trip?
// only makes sense if there weren't enough prepaid minutes in the account to
// cover the whole trip
var extraPrePaidText='';
if ( deltaDuration > 0 ) {
var extraPrePaidCost=(driveDuration*0.28)+addCost;
extraPrePaidText='<del>Wenn du ein pre-paid Paket kaufen würdest, würden sich die Gesamtkosten reduzieren auf <b>' + extraPrePaidCost.toFixed(2) + ' Euro</b>: <br>' +
'( ' + driveDuration + ' pre-paid Minuten * 0.28 Euro ) + ( ' + deltaDistance + ' km welche nicht inklusive sind * 0.29 Euro )</del> <br>' +
'Pre-paid Pakete sind nicht mehr buchbar.<br>';
}
// results
var text='Dieser Trip kostet dich ca. <b>' + cost + ' Euro</b>.<br>' +
'Du hättest ' + leftPrePaid + ' pre-paid Minuten noch übrig danach.<br>' +
'<br>' +
'Der Trip würde ingesamt <b>' + fullCost.toFixed(2) + ' Euro</b> kosten: <br>' +
'( ' + deductPrePaid + ' pre-paid Minuten * 0.28 Euro ) + ( ' + deltaDuration + ' standard fahr-Minuten * ' + driveCost + ' Euro ) + ( ' + deltaDistance + ' km welche nicht inklusive sind * 0.29 Euro ) <br>' +
'<br>' +
//var fullCost=(deductPrePaid*0.28)+((driveDuration-deductPrePaid)*driveCost)+addCost;
extraPrePaidText +
'<br>' +
'Das 3 Stunden Paket würde dich 29.00 Euro + ' + overCharge3.toFixed(2) + ' Euro Überziehungskosten kosten, insgesamt: <b>' + total3.toFixed(2) + ' Euro</b> <br>' +
'Das 6 Stunden Paket würde dich 54.00 Euro + ' + overCharge6.toFixed(2) + ' Euro Überziehungskosten kosten, insgesamt: <b>' + total6.toFixed(2) + ' Euro</b> <br>' +
'Das 9 Stunden Paket würde dich 79.00 Euro + ' + overCharge9.toFixed(2) + ' Euro Überziehungskosten kosten, insgesamt: <b>' + total9.toFixed(2) + ' Euro</b> <br>' +
'Das 24 Stunden Paket würde dich 109.00 Euro + ' + overCharge24.toFixed(2) + ' Euro Überziehungskosten kosten, insgesamt: <b>' + total24.toFixed(2) + ' Euro</b> <br>' +
'Das 48 Stunden Paket würde dich 199.00 Euro + ' + overCharge48.toFixed(2) + ' Euro Überziehungskosten kosten, insgesamt: <b>' + total48.toFixed(2) + ' Euro</b> <br>' +
'<br>';
//'((' + driveDuration + '-' + deductPrePaid + ')*' + driveCost + ')+' + addCost;
document.getElementById('result').innerHTML=text;
return false
}
</script>
</head>
<body>
<h1>DriveNow Kostenrechner</h1>
<b>Dieser Kostenrechner ist noch eine alpha version!<br>
Bitte nicht 100%ig auf das Ergebnis verlassen!</b><br>
<br>
<br>
<form>
Fahrzeit: <input type="number" id="driveDuration" size="5" value="0"> Minuten <br>
Distanz: <input type="number" id="distance" size="5" value="0"> kilometer <br>
<br>
Fahrzeit des Autos kostet: <input type="number" id="driveCost" size="4" value="0.33"> Euro pro Minute<br>
<br>
Ich habe noch <input type="number" id="prePaid" size="4" value="0"> pre-paid Minuten in meinem Account.<br>
<br>
<input type="button" value="Calculate" onClick="calculate()" >
</form>
<br>
<br>
<div id="result"></div>
<br>
<br>
<br>
<br>
<br>
Prices as of 2019-09-15 / German structure.<br>
The prices are calculated as to my best understanding of the price structure.<br>
It does not consider the "Savings Packages" as those are reoccurring fees that can only booked once per month.<br>
If you found an error please create an issue on <a href="https://github.com/roman-mueller/drivenow-calculator">GitHub</a> or send an e-Mail to: drivenow AT rm-it.de<br>
No guarantees are given on the displayed prices!<br>
Always double check the prices before booking.<br>
<br>
This is a private project, I'm not affiliated with DriveNow or BMW in any way.<br>
Please don't sue me.<br>
</body>
</html>