support loans with 0% rate (#30658)
math is simple in this case: capital divided by remaining payment count #30657
This commit is contained in:
parent
9757e18960
commit
04793197c0
1 changed files with 6 additions and 2 deletions
|
|
@ -419,8 +419,12 @@ class LoanSchedule extends CommonObject
|
|||
{
|
||||
$result = '';
|
||||
|
||||
if (!empty($capital) && !empty($rate) && !empty($nbterm)) {
|
||||
$result = ($capital * ($rate / 12)) / (1 - pow((1 + ($rate / 12)), ($nbterm * -1)));
|
||||
if (!empty($capital) && !empty($nbterm)) {
|
||||
if (!empty($rate)) {
|
||||
$result = ($capital * ($rate / 12)) / (1 - pow((1 + ($rate / 12)), ($nbterm * -1)));
|
||||
} else {
|
||||
$result = $capital / $nbterm;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
|
|
|
|||
Loading…
Reference in a new issue