<style>
a[href="#msum"] , a[href="#ovsum"] {pointer-events:none;}
</style>
<script>
$( document ).ready(function() {
//Значение процента
var percent = 10;
$(".tn-atom__form").on('input', ".t-range", function() {
setTimeout(function(){
let summa = $('input[name="summa"]').next('.t-range__value-txt').html();
let srok = $('input[name="srok"]').next('.t-range__value-txt').html();
let monthPercent = percent/100/12;
//Возведение в степень
let degree = Math.pow( 1+monthPercent , -srok);
let monthCredit = summa*(monthPercent/(1-degree));
let overCredit = monthCredit*srok-summa
//Выводим итоги в текст
monthCredit = monthCredit.toFixed();
overCredit = overCredit.toFixed();
monthCredit = monthCredit.replace(/(\d)(?=(\d\d\d)+([^\d]|$))/g, '$1 ');
overCredit = overCredit.replace(/(\d)(?=(\d\d\d)+([^\d]|$))/g, '$1 ');
$('a[href="#msum"]').html(monthCredit+' руб.');
$('a[href="#ovsum"]').html(overCredit+' руб.');
//Добавляем данные в форму
$('input[name="Ssumma"]').val(summa);
$('input[name="Ssrok"]').val(srok);
$('input[name="Spercent"]').val(percent);
$('input[name="Smsum"]').val(monthCredit);
$('input[name="Sovsum"]').val(overCredit);
}, 100);
});
});
</script>
<script>
$(document).ready(function(){
$('.investform').on('input','.t-range', function(){
let st = 10;
let summ = $('input[name="contribution"]').val();
let term = $('input[name="term"]').val();
let finalArr = [];
finalArr.push( summ*((1+st/100/12)**term ) ); //Итоговая сумма
finalArr.push( finalArr[0] - summ ); //Процентный доход
finalArr.push( (finalArr[1] - 42500)*0.13 ); //Налог
finalArr.push( finalArr[0] - finalArr[2] ); //Выплата
$.each(finalArr,function(index,value){
finalArr[index] = divide(finalArr[index].toFixed())+' руб';
});
$('.finalsumm .tn-atom').text( finalArr[0]);
$('.interest-income .tn-atom').text( finalArr[1]);
$('.tax .tn-atom').text( finalArr[2]);
$('.payment .tn-atom').text( finalArr[3]);
$('input[name="finalsumm"]').val('Итоговая сумма: '+finalArr[0]+'; Процентный доход: '+finalArr[1]+'; Налог: '+finalArr[2]+'; Выплата: '+ finalArr[3]);
});
function divide(x, delimiter) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, delimiter || " ");
};
});
</script>
<style>
a[href="#msum"] , a[href="#ovsum"] {pointer-events:none;}
</style>
<script>
$( document ).ready(function() {
//Значение процента
var percent = 9.9;
$(".tn-atom__form").on('input', ".t-range", function() {
setTimeout(function(){
let summa = $('input[name="summa"]').next('.t-range__value-txt').html();
let srok = $('input[name="srok"]').next('.t-range__value-txt').html();
let vznosPercent = $('input[name="vznos"]').val();
let vznosrub = (summa*vznosPercent)/100;
let obsumma = summa-vznosrub;
let monthPercent = percent/100/12;
//Возведение в степень
let degree = Math.pow( 1+monthPercent , -srok);
let monthCredit = summa*(monthPercent/(1-degree));
let overCredit = monthCredit*srok-summa
//Выводим итоги в текст
monthCredit = monthCredit.toFixed();
overCredit = overCredit.toFixed();
monthCredit = monthCredit.replace(/(\d)(?=(\d\d\d)+([^\d]|$))/g, '$1 ');
overCredit = overCredit.replace(/(\d)(?=(\d\d\d)+([^\d]|$))/g, '$1 ');
$('a[href="#vznosrub"]').html(vznosrub+' руб.');
$('a[href="#obsumma"]').html(obsumma+' руб.');
$('a[href="#msum"]').html(monthCredit+' руб.');
$('a[href="#ovsum"]').html(overCredit+' руб.');
//Добавляем данные в форму
$('input[name="Ssumma"]').val(summa);
$('input[name="Svznosrub"]').val(vznosrub);
$('input[name="Sobsumma"]').val(obsumma);
$('input[name="Ssrok"]').val(srok);
$('input[name="Spercent"]').val(percent);
$('input[name="Smsum"]').val(monthCredit);
$('input[name="Sovsum"]').val(overCredit);
}, 100);
});
});
</script>