Since I could not solve my doubts, in this question I cover a little more what I need to see if they can help me.
I have this function:
function getAmortizacion(monto, tasa, cuotas, periodo, tasa_tipo) {
var valor_de_cuota = getValorDeCuotaFija(monto, tasa, cuotas, periodo, tasa_tipo);
var saldo_al_capital = monto;
var items = new Array();
for (i=0; i < cuotas; i++) {
interes = saldo_al_capital * getTasa(tasa, tasa_tipo, periodo);
abono_al_capital = valor_de_cuota - interes;
saldo_al_capital -= abono_al_capital;
numero = i + 1;
interes = interes.toFixed(2);
abono_al_capital = abono_al_capital.toFixed(2);
saldo_al_capital = saldo_al_capital.toFixed(2);
totalCredito = cuotas * valor_de_cuota;
item = [numero, interes, abono_al_capital, valor_de_cuota, saldo_al_capital];
items.push(item);
}
var div2 = document.getElementById("input-value-total");
totalCredito = totalCredito;
div2.innerHTML = totalCredito;
return items;
}
All this I paint in a table:
<table id="table-2" class="table table-striped table-sm">
<thead>
<tr class="text-center">
<th>Cuota No.</th>
<th>Interés</th>
<th>Abono al capital</th>
<th>Valor de la cuota</th>
<th>Saldo al capital</th>
</tr>
</thead>
<tbody id="tbody_1" class="text-center"></tbody>
</table>
Until there all good, but no matter how hard I look for solutions, none adapts to what I need; add a field in the table that indicates the dates of payment, these can be monthly (30 days) or biweekly (15 days):
<label for="select-interests">Intereses</label><select id="select-periods" class="form-control" name="selectPeriods"><option value="mensual">Mensual</option><option value="quincenal">Quincenal</option></select>
... until the amount of fees entered is completed ...
<label for="select-dues">Cuotas</label><input id="select-dues" type="text" placeholder="Cuotas" required class="form-control" name="dues">
and the initial date (first quota) is entered in an input:
<label>Fecha de primer pago</label><input id="input-date" type="date" name="dateFirstPayment" class="form-control">
Thank you very much.