You are here

private static function PHPExcel_Calculation_Financial::_interestAndPrincipal in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Financial.php \PHPExcel_Calculation_Financial::_interestAndPrincipal()
2 calls to PHPExcel_Calculation_Financial::_interestAndPrincipal()
PHPExcel_Calculation_Financial::IPMT in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Financial.php
* IPMT * * Returns the interest payment for a given period for an investment based on periodic, constant payments and a constant interest rate. * * Excel Function: * IPMT(rate,per,nper,pv[,fv][,type]) * *
PHPExcel_Calculation_Financial::PPMT in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Financial.php
* PPMT * * Returns the interest payment for a given period for an investment based on periodic, constant payments and a constant interest rate. * *

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Financial.php, line 153

Class

PHPExcel_Calculation_Financial
PHPExcel_Calculation_Financial

Code

private static function _interestAndPrincipal($rate = 0, $per = 0, $nper = 0, $pv = 0, $fv = 0, $type = 0) {
  $pmt = self::PMT($rate, $nper, $pv, $fv, $type);
  $capital = $pv;
  for ($i = 1; $i <= $per; ++$i) {
    $interest = $type && $i == 1 ? 0 : -$capital * $rate;
    $principal = $pmt - $interest;
    $capital += $principal;
  }
  return array(
    $interest,
    $principal,
  );
}