-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcuota.class.php
60 lines (57 loc) · 1.35 KB
/
cuota.class.php
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
<?php
namespace BCO;
class Cuota {
private $_periodo;
private $_cuota;
private $_interes;
private $_capital;
private $_saldoFinal;
private $_saldoAntes;
private $_tasa;
public function __construct($periodo, $cuota, $saldo, $tasa)
{
// I = S * (Ti)^Pc;
// Ct = C + I
// C = Ct - I;
// SF = S - C;
$this->_saldoAntes = $saldo;
$this->_cuota = $cuota;
$this->_periodo = $periodo;
$this->_tasa = $tasa;
$this->_interes = $this->_saldoAntes * pow(($this->_tasa / 12), $periodo);
$this->_capital = $this->_cuota - $this->_interes;
if ($this->_saldoAntes - $this->_capital < 0) {
$this->_capital = $this->_saldoAntes;
}
$this->_saldoFinal = $this->_saldoAntes - $this->_capital;
}
public function getPeriodo()
{
return $this->_periodo;
}
public function getSaldoFinal()
{
return $this->_saldoFinal;
}
public function getCuota()
{
return $this->_cuota;
}
public function getInteres()
{
return $this->_interes;
}
public function getCapital()
{
return $this->_capital;
}
public function getSaldoAntes()
{
return $this->_saldoAntes;
}
public function getTasa()
{
return $this->_tasa;
}
}
?>