Last active
August 4, 2022 07:14
-
-
Save Falciighol/e5974142f953f1056036c9271494347b to your computer and use it in GitHub Desktop.
[Excel PAGO Func] Función PAGO de Excel en Javascript #js #bp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Basado en la formula de matemática financiera: | |
// https://luismasanchezmaestre.files.wordpress.com/2014/08/calculo-anualidad.jpg | |
var a = 0; | |
// Monto | |
var co = 5700; | |
// Años | |
var n = 13; | |
// Pagos Anuales | |
var m = 12; | |
// Tasa Interes | |
var ti = 7.5; | |
// Tipo de interés fraccionado (del periodo) | |
var im = ti / m / 100; | |
var im2 = Math.pow((1 + im), -(m * n)); | |
// Cuota Cap. + Int. | |
a = (co * im) / (1 - im2); | |
console.log("Cuota Cap + Int: " + a.toFixed(2)); |
export class FinancialClass{
private value: number;
private periods: number;
private rate: number;
private payment: number
constructor(value: number, periods: number, rate: number) {
this.value = value;
this.periods = periods;
this.rate = rate;
this.payment = ((rate * Math.pow(1 + rate, periods)) * value)/(Math.pow(1 + rate, periods) - 1);
}
getPayment() {
return this.payment;
}
getInterest() {
return this.value * this.rate;
}
getCapital() {
var interest = this.value * this.rate;
return this.payment - interest;
}
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
que pasa si el tiempo que decide pagarlo es en semanas y no años?