BRR0300.js
3.07 KB
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
//文字コードはEUCで保存すること
function plan_toroku(icnt){
maxCnt = document.frm.hensai_count.value;
intTotal = 0;
intChkCnt = 0;
//入力チェック
for(i=0;i<maxCnt;i++){
txtValue = document.getElementsByName("nyu_text"+i)[0].value;
chkValue = document.getElementsByName("nyu_chk"+i)[0].checked;
//数値チェック
if(suchi_chk("返済額",txtValue) == false){
return false;
}
//チェックデータ加算
if(chkValue == true){
intTotal = intTotal + Number(txtValue);
intChkCnt = intChkCnt +1;
}
}
//チェックありの合計値チェック
if(intTotal > document.frm.START_MONEY_BRR.value){
alert("返済額の合計が不正です");
return false;
}
if(intChkCnt == maxCnt){
if(intTotal != document.frm.START_MONEY_BRR.value){
alert("返済額の合計が不正です");
return false;
}
}
if (confirm("登録します。よろしいですか?") == true){
document.frm.action = "BRR0302.php";
document.frm.method="POST";
document.frm.submit();
}
}
//一括返済 mtc)satotaka 2010.2.2
function ikkatsu_set(cnt){
maxCnt = document.frm.hensai_count.value;
hensai_all = Number(document.frm.START_MONEY_BRR.value);
intTotal = 0;
intChkCnt = 0;
amari = 0;
kintou = 0;
karikae = 0;
//入力チェック
for(i=0;i<cnt;i++){
txtValue = document.getElementsByName("nyu_text"+i)[0].value;
chkValue = document.getElementsByName("nyu_chk"+i)[0].checked;
if(suchi_chk("返済額",txtValue) == false){
return false;
}
if(suchi_chk("返済額",txtValue) == false){
return false;
}
if(chkValue == true){
intTotal = intTotal + Number(txtValue);
intChkCnt = intChkCnt +1;
}
}
//チェックありの合計値チェック
if(intTotal > hensai_all){
alert("返済額の合計が大き過ぎます");
return false;
}
//チェックなし一月あたりの金額
if ( Number(maxCnt - intChkCnt) != 0 && Number(hensai_all - intTotal) != 0){
amari = Number(hensai_all - intTotal) % Number(maxCnt - intChkCnt);
if( Number(hensai_all - intTotal - amari) != 0 ){
kintou = Number(hensai_all - intTotal - amari) / Number(maxCnt - intChkCnt);
}else{
kintou = 0;
}
}else{
kintou = 0;
}
//借り替える月の前の金額、チェック設定
for(i=0; i<cnt; i++){
chkValue = document.getElementsByName("nyu_chk"+i)[0].checked;
if (chkValue == true){
document.getElementsByName("nyu_chk"+i)[0].checked = true;
}else{
document.getElementsByName("nyu_text"+i)[0].value = kintou;
document.getElementsByName("nyu_chk"+i)[0].checked = true;
intTotal = intTotal + Number(kintou);
}
}
//借り替える月以降の金額、チェック設定
karikae = hensai_all - intTotal;
for(i=cnt;i<maxCnt;i++){
if(i == cnt){
//借り替える月の金額、チェック指定
document.getElementsByName("nyu_text"+i)[0].value = karikae;
document.getElementsByName("nyu_chk"+i)[0].checked = true;
}else{
document.getElementsByName("nyu_text"+i)[0].value = 0;
document.getElementsByName("nyu_chk"+i)[0].checked = false;
}
}
}
function chk_on(flg){
var name ="";
name = "nyu_chk"+flg;
//alert(name);
if(document.frm.elements[name].checked){
document.frm.elements[name].checked = true;
}else{
document.frm.elements[name].checked = true;
}
}