//相続人についての選択 var select_01 = document.getElementById( "select_01" ); var select_02 = document.getElementById( "select_02" ); var select_03 = document.getElementById( "select_03" ); var select_wariai = document.getElementById( "select_wariai" ); select_01.value = "1"; select_02.value = "0"; select_03.value = "0"; //相続財産についての入力 var input_01 = document.getElementById( "input_01" ); var input_02 = document.getElementById( "input_02" ); var input_03 = document.getElementById( "input_03" ); var input_04 = document.getElementById( "input_04" ); var input_05 = document.getElementById( "input_05" ); var input_06 = document.getElementById( "input_06" ); var input_07 = document.getElementById( "input_07" ); input_01.value = "0"; input_02.value = "0"; input_03.value = "0"; input_04.value = "0"; input_05.value = "0"; input_06.value = "0"; input_07.value = "0"; var input2_01 = document.getElementById( "input2_01" ); var input2_02 = document.getElementById( "input2_02" ); var input2_03 = document.getElementById( "input2_03" ); var input2_04 = document.getElementById( "input2_04" ); input2_01.value = "0"; input2_02.value = "0"; input2_03.value = "0"; input2_04.value = "0"; //相続財産直接入力 var total_s = document.getElementById( "total_s" ); total_s.value = "0"; var numberFormat = function(num){ return num.toString().replace(/^\d+[^\.]/, function(t){return t.replace(/([\d]+?)(?=(?:\d{3})+$)/g, function(t){ return t + ','; });}); } function goukei_01() { if((input_01.value!="0" || input_02.value!="0" || input_03.value!="0" || input_04.value!="0" || input_05.value!="0" || input_06.value!="0" || input_07.value!="0" || input2_01.value!="0" || input2_02.value!="0" || input2_03.value!="0" || input2_04.value!="0" )&&(total_s.value!="0")){ window.alert("相続財産は「a」か「b」どちらかに入力してください"); }else{ //課税価格の計算 if((parseInt( total_s.value, 10 ) != "0") || (parseInt( total_s.value, 10 ) != "")){ var answer_01 = parseInt( total_s.value, 10 ); var answer_02 = parseInt( total_s.value, 10 ); }else{ var total_01 = parseInt( input_01.value, 10 ) + parseInt( input_02.value, 10 ) + parseInt( input_03.value, 10 ) + parseInt( input_04.value, 10 ) + parseInt( input_05.value, 10 ) + parseInt( input_06.value, 10 ) + parseInt( input_07.value, 10 ); var total_02 = parseInt( input2_01.value, 10 ) + parseInt( input2_02.value, 10 ) + parseInt( input2_03.value, 10 ) + parseInt( input2_04.value, 10 ); total1.innerHTML = numberFormat(total_01); total2.innerHTML = numberFormat(total_02); if((total_01 - total_02) < "0"){ var answer_01 = "0"; }else{ var answer_01 = total_01 - total_02; } if((total_01 - total_02) < "0"){ var answer_02 = "0"; }else{ var answer_02 = total_01 - total_02; } } answer1.innerHTML = numberFormat(answer_01); answer2.innerHTML = numberFormat(answer_02); //基礎控除の計算 var koujo_01 = 5000 + 1000 * (parseInt( select_01.value, 10 ) + parseInt( select_03.value, 10 )); koujo1.innerHTML = numberFormat(koujo_01); var koujo_02 = 3000 + 600 * (parseInt( select_01.value, 10 ) + parseInt( select_03.value, 10 )); koujo2.innerHTML = numberFormat(koujo_02); //課税遺産総額の計算 if((answer_01 - koujo_01) < "0"){ var S_H26 = "0"; }else{ var S_H26 = answer_01 - koujo_01; } if((answer_02 - koujo_02) < "0"){ var U_H27 = "0"; }else{ var U_H27 = answer_02 - koujo_02; } kazei_total1.innerHTML = numberFormat(S_H26); kazei_total2.innerHTML = numberFormat(U_H27); //相続税額の計算 //S×A、S×B÷C、U×A、U×B÷Cの計算 if(parseInt( select_01.value, 10 )=="1"){ if(parseInt( select_02.value, 10 ) == "0"){ var S_A = S_H26; var U_A = U_H27; var S_B_C = "0"; var U_B_C = "0"; }else if(parseInt( select_02.value, 10 ) == "1"){ var S_A = Math.round(S_H26 * 0.5); var U_A = Math.round(U_H27 * 0.5); var S_B_C = Math.round(S_H26 * 0.5 / parseInt( select_03.value, 10 )); var U_B_C = Math.round(U_H27 * 0.5 / parseInt( select_03.value, 10 )); }else if(parseInt( select_02.value, 10 ) == "2"){ var S_A = Math.round(S_H26 / 3) * 2; var U_A = Math.round(U_H27 / 3) * 2; var S_B_C = Math.round(S_H26 / 3 / parseInt( select_03.value, 10 )); var U_B_C = Math.round(U_H27 / 3 / parseInt( select_03.value, 10 )); }else if(parseInt( select_02.value, 10 ) == "3"){ var S_A = Math.round(S_H26 * 0.75); var U_A = Math.round(U_H27 * 0.75); var S_B_C = Math.round(S_H26 * 0.25 / parseInt( select_03.value, 10 )); var U_B_C = Math.round(U_H27 * 0.25 / parseInt( select_03.value, 10 )); } }else if(parseInt( select_01.value, 10 )=="0"){ if(parseInt( select_02.value, 10 ) == "1"){ var S_A = "0"; var U_A = "0"; var S_B_C = Math.round(S_H26 / parseInt( select_03.value, 10 )); var U_B_C = Math.round(U_H27 / parseInt( select_03.value, 10 )); }else if(parseInt( select_02.value, 10 ) == "2"){ var S_A = "0"; var U_A = "0"; var S_B_C = Math.round(S_H26 / parseInt( select_03.value, 10 )); var U_B_C = Math.round(U_H27 / parseInt( select_03.value, 10 )); }else if(parseInt( select_02.value, 10 ) == "3"){ var S_A = "0"; var U_A = "0"; var S_B_C = Math.round(S_H26 / parseInt( select_03.value, 10 )); var U_B_C = Math.round(U_H27 / parseInt( select_03.value, 10 )); } } //AA、BB、HH、IIの計算 if(S_A <= "1000"){ var AA = Math.round(S_A * 0.1); }else if((S_A > "1000")&&(S_A <= "3000")){ var AA = Math.round(S_A * 0.15) - 50; }else if((S_A > "3000")&&(S_A <= "5000")){ var AA = Math.round(S_A * 0.2) - 200; }else if((S_A > "5000")&&(S_A <= "10000")){ var AA = Math.round(S_A * 0.3) - 700; }else if((S_A > "10000")&&(S_A <= "30000")){ var AA = Math.round(S_A * 0.4) - 1700; }else if(S_A > "30000"){ var AA = Math.round(S_A * 0.5) - 4700; } if(S_B_C <= "1000"){ var BB = Math.round(S_B_C * 0.1); }else if((S_B_C > "1000")&&(S_B_C <= "3000")){ var BB = Math.round(S_B_C * 0.15) - 50; }else if((S_B_C > "3000")&&(S_B_C <= "5000")){ var BB = Math.round(S_B_C * 0.2) - 200; }else if((S_B_C > "5000")&&(S_B_C <= "10000")){ var BB = Math.round(S_B_C * 0.3) - 700; }else if((S_B_C > "10000")&&(S_B_C <= "30000")){ var BB = Math.round(S_B_C * 0.4) - 1700; }else if(S_B_C > "30000"){ var BB = Math.round(S_B_C * 0.5) - 4700; } if(U_A <= "1000"){ var HH = Math.round(U_A * 0.1); }else if((U_A > "1000")&&(U_A <= "3000")){ var HH = Math.round(U_A * 0.15) - 50; }else if((U_A > "3000")&&(U_A <= "5000")){ var HH = Math.round(U_A * 0.2) - 200; }else if((U_A > "5000")&&(U_A <= "10000")){ var HH = Math.round(U_A * 0.3) - 700; }else if((U_A > "10000")&&(U_A <= "20000")){ var HH = Math.round(U_A * 0.4) - 1700; }else if((U_A > "20000")&&(U_A <= "30000")){ var HH = Math.round(U_A * 0.45) - 2700; }else if((U_A > "30000")&&(U_A <= "60000")){ var HH = Math.round(U_A * 0.5) - 4200; }else if(U_A > "60000"){ var HH = Math.round(U_A * 0.55) - 7200; } if(U_B_C <= "1000"){ var II = Math.round(U_B_C * 0.1); }else if((U_B_C > "1000")&&(U_B_C <= "3000")){ var II = Math.round(U_B_C * 0.15) - 50; }else if((U_B_C > "3000")&&(U_B_C <= "5000")){ var II = Math.round(U_B_C * 0.2) - 200; }else if((U_B_C > "5000")&&(U_B_C <= "10000")){ var II = Math.round(U_B_C * 0.3) - 700; }else if((U_B_C > "10000")&&(U_B_C <= "20000")){ var II = Math.round(U_B_C * 0.4) - 1700; }else if((U_B_C > "20000")&&(U_B_C <= "30000")){ var II = Math.round(U_B_C * 0.45) - 2700; }else if((U_B_C > "30000")&&(U_B_C <= "60000")){ var II = Math.round(U_B_C * 0.5) - 4200; }else if(U_B_C > "60000"){ var II = Math.round(U_B_C * 0.55) - 7200; } var zeisougaku_H26 = (AA * parseInt(select_01.value, 10)) + (BB * parseInt(select_03.value, 10)); var zeisougaku_H27 = (HH * parseInt(select_01.value, 10)) + (II * parseInt(select_03.value, 10)); var zouka_01 = numberFormat(HH - AA); var zouka_02 = numberFormat(II - BB); souzoku1.innerHTML = numberFormat(AA); souzoku2.innerHTML = numberFormat(HH); souzoku3.innerHTML = numberFormat(BB); souzoku4.innerHTML = numberFormat(II); zouka1.innerHTML = numberFormat(zouka_01); zouka2.innerHTML = numberFormat(zouka_02); noufu1.innerHTML = numberFormat(zeisougaku_H26); noufu2.innerHTML = numberFormat(zeisougaku_H27); zouka_sougaku.innerHTML = numberFormat(zeisougaku_H27 - zeisougaku_H26); window.location.href="#result"; } }