-
Notifications
You must be signed in to change notification settings - Fork 0
/
table.html
509 lines (466 loc) · 17.6 KB
/
table.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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Tables</title>
<script src="./internet_fee.js"></script>
<style>
/*
table {
width: 100%;
border-top: 1px solid #444444;
border-collapse: collapse;
}
th, td {
border-bottom: 1px solid #444444;
padding: 10px;
text-align: center;
}
thead tr {
background-color: #0d47a1;
color: #ffffff;
}
tbody tr:nth-child(2n) {
background-color: #bbdefb;
}
tbody tr:nth-child(2n+1) {
background-color: #e3f2fd;
}
*/
/* 테이블 스타일 */
.tg {border-collapse:collapse;border-spacing:0;}
.tg td{font-family:Arial, sans-serif;font-size:14px;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:black;}
.tg th{font-family:Arial, sans-serif;font-size:14px;font-weight:normal;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:black;}
.tg .tg-0lax{text-align:left;vertical-align:top}
</style>
</head>
<script type="text/javascript">
window.onload = pageLoad;
function pageLoad(){
select_changed();
};
function get_values() {
var ret = {
speed:0,
num:0,
contract:0,
addition:0,
fee1:0,
device1:0,
phonenum1:0,
fee2:0,
device2:0,
phonenum2:0,
phonenum2:0,
tv:0,
numtv:0
};
var selected = document.getElementById("speed");
ret.speed = selected.options[selected.selectedIndex].value;
var selected = document.getElementById("num");
ret.num = selected.options[selected.selectedIndex].value;
var selected = document.getElementById("contract");
ret.contract = selected.options[selected.selectedIndex].value;
var selected = document.getElementById("addition");
ret.addition = selected.options[selected.selectedIndex].value;
var selected = document.getElementById("fee1");
ret.fee1 = selected.options[selected.selectedIndex].value;
var selected = document.getElementById("device1");
ret.device1 = selected.options[selected.selectedIndex].value;
var selected = document.getElementById("phonenum1");
ret.phonenum1 = selected.options[selected.selectedIndex].value;
var selected = document.getElementById("fee2");
ret.fee2 = selected.options[selected.selectedIndex].value;
var selected = document.getElementById("device2");
ret.device2 = selected.options[selected.selectedIndex].value;
var selected = document.getElementById("phonenum2");
ret.phonenum2 = selected.options[selected.selectedIndex].value;
var selected = document.getElementById("tv");
ret.tv = selected.options[selected.selectedIndex].value;
var selected = document.getElementById("numtv");
ret.numtv = selected.options[selected.selectedIndex].value;
return ret;
}
//numberWithCommas, 세자리마다 콤마찍기
function comma(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
// 선택값 변경될 때마다 호출
function select_changed() {
var v = get_values()
var array1 = [ // 요금 테이블 [100MB, 500MB, 1GB]
[ 39000, 49000, 59000 ], // 무약정
[ 39000, 49000, 59000 ], // 1년
[ 39000, 49000, 59000 ], // 2년
[ 39000, 49000, 59000 ], // 3년
[ 39000, 49000, 59000 ], // 결합
];
var array2 = [ // 약정 할인 테이블
[ 0, 0, 0 ], // 무약정
[ 8000, 6000, 7000 ], // 1년
[ 13000, 13200, 16000 ], // 2년
[ 19000, 21000, 24000 ], // 3년
[ 19000, 21000, 24000 ], // 결합
];
var array3 = [ // 결합 할인 테이블
[ 0, 0, 0 ], // 무약정
[ 0, 0, 0 ], // 1년
[ 0, 0, 0 ], // 2년
[ 0, 0, 0 ], // 3년
[ 0, 5000, 5000 ], // 결합
];
var array4 = [ 5000, 9000, 10000, 12000 ]; // 추가결합할인
var array5 = [ // 전화 요금 테이블 [일반형, 고급형C]
[ 2000, 5000 ], // 무약정
[ 2000, 5000 ], // 1년
[ 2000, 5000 ], // 2년
[ 2000, 5000 ], // 3년
[ 2000, 5000 ], // 결합
];
var array6 = [ // 전화 할인금액 테이블 [일반형, 고급형C]
[ 1000, 0 ], // 무약정
[ 1000, 1000 ], // 1년
[ 1000, 1500 ], // 2년
[ 1000, 2000 ], // 3년
[ 1000, 2000 ], // 결합
];
var array7 = [ // TV 요금 테이블 [보급형, 일반형, 고급형]
[ 12000, 15000, 19000 ], // 무약정
[ 12000, 15000, 19000 ], // 1년
[ 12000, 15000, 19000 ], // 2년
[ 12000, 15000, 19000 ], // 3년
[ 12000, 15000, 19000 ], // 결합
];
var array8 = [ // TV 할인금액 테이블 [보급형, 일반형, 고급형]
[ 0 , 0 , 0 ], // 무약정
[ 1500, 1500, 1500 ], // 1년
[ 3500, 3500, 3500 ], // 2년
[ 5000, 5000, 5000 ], // 3년
[ 5000, 5000, 5000 ], // 결합
];
var array9 = [ // 전화단말기 테이블 [IP455, IP450, WPI8800, CPG402ON]
[ 99000, 102000, 105000, 36000 ], // 무약정
[ 69000, 72000, 75000, 36000 ], // 1년
[ 69000, 72000, 75000, 36000 ], // 2년
[ 60000, 70000, 75000, 36000 ], // 3년
[ 30000, 35000, 40000, 36000 ], // 결합
];
var array10 = [ // 전화 매월 납입금액 테이블 [IP455, IP450, WPI8800, CPG402ON]
[ 99000, 89000, 105000, 36000 ], // 무약정
[ 5750, 4910, 6250, 1000 ], // 1년
[ 2880, 2460, 3120, 1000 ], // 2년
[ 1660, 1380, 2080, 1000 ], // 3년
[ 830, 550, 1110, 1000 ], // 결합
];
var array11 = [ // 모바일 결합 테이블 [12000, 14900, 19000]
[ 0 , 0 , 0 ], // 1
[ 1500, 1500, 1500 ], // 2
[ 3500, 3500, 3500 ], // 3
[ 5000, 5000, 5000 ], // 4~10
];
var aone = array1[v.contract][v.speed] * v.num;
var atwo = array2[v.contract][v.speed] * v.num;
var athree = array3[v.contract][v.speed] * v.num;
var afour = array4[v.addition];
var afive = parseInt((aone - atwo - athree - afour) * 0.07);
var asix = aone - atwo - athree - afour - afive
document.getElementById('a_one').innerHTML = comma(aone);
document.getElementById('a_two').innerHTML = comma(atwo);
document.getElementById('a_three').innerHTML = comma(athree);
document.getElementById('a_four').innerHTML = comma(afour);
document.getElementById('a_five').innerHTML = comma(afive);
document.getElementById('a_six').innerHTML = comma(asix);
var bone = (array5[v.contract][v.fee1] * v.phonenum1) + (array5[v.contract][v.fee2] * v.phonenum2)
var btwo = (array6[v.contract][v.fee1] * v.phonenum1) + (array6[v.contract][v.fee2] * v.phonenum2)
var bthree = (array10[v.contract][v.fee1] * v.phonenum1)+ (array10[v.contract][v.fee2] * v.phonenum2)
var bfour = bone - btwo + bthree
document.getElementById('b_one').innerHTML = comma(bone);
document.getElementById('b_two').innerHTML = comma(btwo);
document.getElementById('b_three').innerHTML = comma(bthree);
document.getElementById('b_four').innerHTML = comma(bfour);
var cone = array7[v.contract][v.tv] * v.numtv
var ctwo = array8[v.contract][v.tv] * v.numtv
var cthree = parseInt((cone - ctwo) * 0.07);
var cfour = v.numtv * 4000;
var cfive = cone - ctwo - cthree + cfour;
document.getElementById('c_one').innerHTML = comma(cone);
document.getElementById('c_two').innerHTML = comma(ctwo);
document.getElementById('c_three').innerHTML = comma(cthree);
document.getElementById('c_four').innerHTML = comma(cfour);
document.getElementById('c_five').innerHTML = comma(cfive);
var monthtable = [0, 12, 24, 36, 36];
var done = atwo * monthtable[v.contract];
var dtwo = athree * monthtable[v.contract];
var dthree = afour * monthtable[v.contract];
var dfour = afive * monthtable[v.contract];
document.getElementById('d_one').innerHTML = comma(done);
document.getElementById('d_two').innerHTML = comma(dtwo);
document.getElementById('d_three').innerHTML = comma(dthree);
document.getElementById('d_four').innerHTML = comma(dfour);
var eone = bthree * monthtable[v.contract];
var etwo = ctwo * monthtable[v.contract];
var ethree = cthree * monthtable[v.contract];
document.getElementById('e_one').innerHTML = comma(eone);
document.getElementById('e_two').innerHTML = comma(etwo);
document.getElementById('e_three').innerHTML = comma(ethree);
var fone = aone + atwo + athree + afour + btwo + ctwo + cthree;
document.getElementById('f_one').innerHTML = comma(fone);
document.getElementById('g_one').innerHTML = comma(aone + bone + cone);
document.getElementById('g_two').innerHTML = comma(atwo + athree + afour + afive + btwo + ctwo + cthree);
document.getElementById('g_three').innerHTML = comma(asix + bfour + cfive);
}
/*
var internet_speed_changed = function (select_obj){
// 우선 selectbox에서 선택된 index를 찾고
var selected_index = select_obj.selectedIndex;
// 선택된 index의 value를 찾고
var selected_value = select_obj.options[selected_index].value;
// 원하는 동작을 수행한다. 여기서는 그냥 alert해주는 식으로만 처리함.
alert(selected_value);
*/
</script>
<body>
<h3>■ 요금셋팅 (입력구간)</h3>
<table class="tg">
<tr>
<th class="tg-0lax" style="text-align:center;width:150px;">인터넷속도</th>
<th class="tg-0lax" style="text-align:center;width:150px;">인터넷수</th>
<th class="tg-0lax" style="text-align:center;width:150px;">약정</th>
<th class="tg-0lax" style="text-align:center;width:200px;">추가결합할인 <br> <가무사> <가끼모> <참가결></th>
<th class="tg-0lax" style="text-align:center;width:150px;">7%할인</th>
</tr>
<tr>
<td class="tg-0lax">
<select id="speed" onchange="select_changed()" style="text-align:center;width:130px;">
<option value="0">100MB</option>
<option value="1">500MB</option>
<option value="2">1GB</option>
</select>
</td>
<td class="tg-0lax">
<select id="num" onchange="select_changed()" style="width:100px;">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</td>
<td class="tg-0lax">
<select id="contract" onchange="select_changed()" style="width:100px;">
<option value="0">무약정</option>
<option value="1">1년</option>
<option value="2">2년</option>
<option value="3">3년</option>
<option value="4">결합</option>
</select>
</td>
<td class="tg-0lax">
<select id="addition" onchange="select_changed()" style="width:100px;">
<option value="0">5000</option>
<option value="1">9000</option>
<option value="2">10000</option>
<option value="3">12000</option>
</select>
</td>
<td class="tg-0lax">7%</td>
</tr>
</table>
<br>
<table class="tg">
<tr>
<th class="tg-0lax" style="text-align:center;width:150px;">인터넷/전화<br>요금제</th>
<th class="tg-0lax" style="text-align:center;width:150px;">단말기명</th>
<th class="tg-0lax" style="text-align:center;width:150px;">전화댓수</th>
<th class="tg-0lax" style="text-align:center;width:200px;">인터넷 전화 요금제</th>
<th class="tg-0lax" style="text-align:center;width:150px;">단말기명</th>
<th class="tg-0lax" style="text-align:center;width:150px;">전화댓수</th>
<th class="tg-0lax" style="text-align:center;width:150px;">TV요금제</th>
<th class="tg-0lax" style="text-align:center;width:150px;">TV댓수</th>
<th class="tg-0lax" style="text-align:center;width:150px;">7%할인</th>
</tr>
<tr>
<td class="tg-0lax">
<select id="fee1" onchange="select_changed()" style="width:100px;">
<option value="0">일반형</option>
<option value="1">고급형C</option>
</select>
</td>
<td class="tg-0lax">
<select id="device1" onchange="select_changed()" style="width:100px;">
<option value="0">IP445</option>
<option value="1">IP450</option>
<option value="2">WPI8800</option>
<option value="3">CPG402ON</option>
</select>
</td>
<td class="tg-0lax">
<select id="phonenum1" onchange="select_changed()" style="width:100px;">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
</td>
<td class="tg-0lax">
<select id="fee2" onchange="select_changed()" style="width:100px;">
<option value="0">일반형</option>
<option value="1">고급형C</option>
</select>
</td>
<td class="tg-0lax">
<select id="device2" onchange="select_changed()" style="width:100px;">
<option value="0">IP445</option>
<option value="1">IP450</option>
<option value="2">WPI8800</option>
<option value="3">CPG402ON</option>
</select>
</td>
<td class="tg-0lax">
<select id="phonenum2" onchange="select_changed()" style="width:100px;">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
</td>
<td class="tg-0lax">
<select id="tv" onchange="select_changed()" style="width:100px;">
<option value="0">보급형</option>
<option value="1">일반형</option>
<option value="2">고급형</option>
</select>
</td>
<td class="tg-0lax">
<select id="numtv" onchange="select_changed()" style="width:100px;">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</td>
<td class="tg-0lax">7%</td>
</tr>
</table>
<h3>■ 인터넷요금</h3>
<table class="tg">
<tr>
<th class="tg-ne9s" colspan="11" style="text-align:center;">인터넷</th>
</tr>
<tr>
<td class="tg-0lax" style="text-align:center;width:150px;">인터넷요금</td>
<td class="tg-0lax" style="text-align:center;width:150px;">약정할인</td>
<td class="tg-0lax" style="text-align:center;width:150px;">결합할인</td>
<td class="tg-0lax" style="text-align:center;width:150px;">추가결합할인</td>
<td class="tg-0lax" style="text-align:center;width:150px;">7% 할인</td>
<td class="tg-0lax" style="text-align:center;width:150px;">최종 납부 금액</td>
</tr>
<tr>
<td class="tg-0lax"><span id="a_one"></span></td>
<td class="tg-0lax"><span id="a_two"></td>
<td class="tg-0lax"><span id="a_three"></span></td>
<td class="tg-0lax"><span id="a_four"></span></td>
<td class="tg-0lax"><span id="a_five"></span></td>
<td class="tg-0lax"><span id="a_six"></span></td>
</tr>
</table>
<br>
<table class="tg">
<tr>
<th class="tg-ne9s" colspan="11" style="text-align:center;">전화</th>
</tr>
<tr>
<td class="tg-0lax" style="text-align:center;width:150px;">전화요금</td>
<td class="tg-0lax" style="text-align:center;width:150px;">약정/결합할인</td>
<td class="tg-0lax" style="text-align:center;width:150px;">단말기할부금+임대료</td>
<td class="tg-0lax" style="text-align:center;width:150px;">최종 납부 금액</td>
</tr>
<tr>
<td class="tg-0lax"><span id="b_one"></span></td>
<td class="tg-0lax"><span id="b_two"></td>
<td class="tg-0lax"><span id="b_three"></span></td>
<td class="tg-0lax"><span id="b_four"></span></td>
</tr>
</table>
<br>
<table class="tg">
<tr>
<th class="tg-ne9s" colspan="11" style="text-align:center;">TV</th>
</tr>
<tr>
<td class="tg-0lax" style="text-align:center;width:150px;">TV요금</td>
<td class="tg-0lax" style="text-align:center;width:150px;">약정/결합할인</td>
<td class="tg-0lax" style="text-align:center;width:150px;">7% 할인</td>
<td class="tg-0lax" style="text-align:center;width:150px;">셋탑이용료</td>
<td class="tg-0lax" style="text-align:center;width:150px;">최종 납부 금액</td>
</tr>
<tr>
<td class="tg-0lax"><span id="c_one"></span></td>
<td class="tg-0lax"><span id="c_two"></td>
<td class="tg-0lax"><span id="c_three"></span></td>
<td class="tg-0lax"><span id="c_four"></span></td>
<td class="tg-0lax"><span id="c_five"></span></td>
</tr>
</table>
<h3>■ 약정기간 총 할인</h3>
<table class="tg">
<tr>
<th class="tg-ne9s" colspan="11" style="text-align:center;">인터넷</th>
</tr>
<tr>
<td class="tg-0lax" style="text-align:center;width:150px;">약정할인</td>
<td class="tg-0lax" style="text-align:center;width:150px;">결합할인</td>
<td class="tg-0lax" style="text-align:center;width:150px;">추가결합할인</td>
<td class="tg-0lax" style="text-align:center;width:150px;">7% 할인</td>
</tr>
<tr>
<td class="tg-0lax"><span id="d_one"></span></td>
<td class="tg-0lax"><span id="d_two"></td>
<td class="tg-0lax"><span id="d_three"></span></td>
<td class="tg-0lax"><span id="d_four"></span></td>
</tr>
</table>
<br>
<table class="tg">
<tr>
<th class="tg-ne9s" colspan="11" style="text-align:center;">전화 / TV</th>
</tr>
<tr>
<td class="tg-0lax" style="text-align:center;width:150px;">약정/결합할인</td>
<td class="tg-0lax" style="text-align:center;width:150px;">약정/결합할인</td>
<td class="tg-0lax" style="text-align:center;width:150px;">7% 할인</td>
</tr>
<tr>
<td class="tg-0lax"><span id="e_one"></span></td>
<td class="tg-0lax"><span id="e_two"></td>
<td class="tg-0lax"><span id="e_three"></span></td>
</tr>
</table>
<br>
<table class="tg">
<tr>
<th class="tg-ne9s" colspan="11" style="text-align:center;">최종</th>
</tr>
<tr>
<td class="tg-0lax" style="text-align:center;width:150px;">총할인</td>
</tr>
<tr>
<td class="tg-0lax"><span id="f_one"></span></td>
</tr>
</table>
<h3>■ 최종</h3>
<table class="tg">
<tr>
<th class="tg-ne9s" colspan="11" style="text-align:center;">최종</th>
</tr>
<tr>
<td class="tg-0lax" style="text-align:center;width:150px;">할인전금액</td>
<td class="tg-0lax" style="text-align:center;width:150px;">총할인</td>
<td class="tg-0lax" style="text-align:center;width:150px;">납부금액</td>
</tr>
<tr>
<td class="tg-0lax"><span id="g_one"></span></td>
<td class="tg-0lax"><span id="g_two"></td>
<td class="tg-0lax"><span id="g_three"></span></td>
</tr>
</table>
</body>
</html>