34        define(
'PHPEXCEL_ROOT', dirname(__FILE__) . 
'/../../');
 
   35        require(PHPEXCEL_ROOT . 
'PHPExcel/Autoloader.php');
 
   40define(
'FINANCIAL_MAX_ITERATIONS', 128);
 
   43define(
'FINANCIAL_PRECISION', 1.0
e-08);
 
   65                return ($testDate->format(
'd') == $testDate->format(
't'));
 
   79                return ($testDate->format(
'd') == 1);
 
   85                $months = 12 / $frequency;
 
   91                        $result->modify(
'-'.$months.
' months');
 
   94                        $result->modify(
'+'.$months.
' months');
 
  107                if (($frequency == 1) || ($frequency == 2) || ($frequency == 4)) {
 
  111                        (($frequency == 6) || ($frequency == 12))) {
 
  157                for (
$i = 1; 
$i<= $per; ++
$i) {
 
  158                        $interest = (
$type && 
$i == 1) ? 0 : -$capital * $rate;
 
  159                        $principal = $pmt - $interest;
 
  160                        $capital += $principal;
 
  162                return array($interest, $principal);
 
  201        public static function ACCRINT($issue, $firstinterest, $settlement, $rate, $par=1000, $frequency=1, $basis=0)
 
  212                if ((is_numeric($rate)) && (is_numeric($par))) {
 
  213                        $rate   = (float) $rate;
 
  215                        if (($rate <= 0) || ($par <= 0)) {
 
  219                        if (!is_numeric($daysBetweenIssueAndSettlement)) {
 
  221                                return $daysBetweenIssueAndSettlement;
 
  224                        return $par * $rate * $daysBetweenIssueAndSettlement;
 
  253        public static function ACCRINTM($issue, $settlement, $rate, $par=1000, $basis=0) {
 
  261                if ((is_numeric($rate)) && (is_numeric($par))) {
 
  262                        $rate   = (float) $rate;
 
  264                        if (($rate <= 0) || ($par <= 0)) {
 
  268                        if (!is_numeric($daysBetweenIssueAndSettlement)) {
 
  270                                return $daysBetweenIssueAndSettlement;
 
  272                        return $par * $rate * $daysBetweenIssueAndSettlement;
 
  309        public static function AMORDEGRC($cost, $purchased, $firstPeriod, $salvage, $period, $rate, $basis=0) {
 
  324                $fUsePer = 1.0 / $rate;
 
  325                if ($fUsePer < 3.0) {
 
  326                        $amortiseCoeff = 1.0;
 
  327                } elseif ($fUsePer < 5.0) {
 
  328                        $amortiseCoeff = 1.5;
 
  329                } elseif ($fUsePer <= 6.0) {
 
  330                        $amortiseCoeff = 2.0;
 
  332                        $amortiseCoeff = 2.5;
 
  335                $rate *= $amortiseCoeff;
 
  338                $fRest = $cost - $salvage;
 
  340                for (
$n = 0; 
$n < $period; ++
$n) {
 
  341                        $fNRate = round($rate * $cost,0);
 
  345                                switch ($period - 
$n) {
 
  347                                        case 1  : 
return round($cost * 0.5, 0);
 
  349                                        default : 
return 0.0;
 
  385        public static function AMORLINC($cost, $purchased, $firstPeriod, $salvage, $period, $rate, $basis=0) {
 
  394                $fOneRate = $cost * $rate;
 
  395                $fCostDelta = $cost - $salvage;
 
  401                        $yearFrac *= 365 / 366;
 
  404                $f0Rate = $yearFrac * $rate * $cost;
 
  405                $nNumOfFullPeriods = intval(($cost - $salvage - $f0Rate) / $fOneRate);
 
  409                } elseif ($period <= $nNumOfFullPeriods) {
 
  411                } elseif ($period == ($nNumOfFullPeriods + 1)) {
 
  412            return ($fCostDelta - $fOneRate * $nNumOfFullPeriods - $f0Rate);
 
  451        public static function COUPDAYBS($settlement, $maturity, $frequency, $basis=0) {
 
  464                if (($settlement > $maturity) ||
 
  465                        (!self::_validFrequency($frequency)) ||
 
  466                        (($basis < 0) || ($basis > 4))) {
 
  509        public static function COUPDAYS($settlement, $maturity, $frequency, $basis=0) {
 
  522                if (($settlement > $maturity) ||
 
  523                        (!self::_validFrequency($frequency)) ||
 
  524                        (($basis < 0) || ($basis > 4))) {
 
  530                                        return 365 / $frequency;
 
  532                                        if ($frequency == 1) {
 
  534                                                return ($daysPerYear / $frequency);
 
  538                                                return ($next - $prev);
 
  541                                        return 360 / $frequency;
 
  579        public static function COUPDAYSNC($settlement, $maturity, $frequency, $basis=0) {
 
  592                if (($settlement > $maturity) ||
 
  593                        (!self::_validFrequency($frequency)) ||
 
  594                        (($basis < 0) || ($basis > 4))) {
 
  638        public static function COUPNCD($settlement, $maturity, $frequency, $basis=0) {
 
  651                if (($settlement > $maturity) ||
 
  652                        (!self::_validFrequency($frequency)) ||
 
  653                        (($basis < 0) || ($basis > 4))) {
 
  694        public static function COUPNUM($settlement, $maturity, $frequency, $basis=0) {
 
  707                if (($settlement > $maturity) ||
 
  708                        (!self::_validFrequency($frequency)) ||
 
  709                        (($basis < 0) || ($basis > 4))) {
 
  716                switch ($frequency) {
 
  718                                        return ceil($daysBetweenSettlementAndMaturity / 360);
 
  720                                        return ceil($daysBetweenSettlementAndMaturity / 180);
 
  722                                        return ceil($daysBetweenSettlementAndMaturity / 90);
 
  724                                        return ceil($daysBetweenSettlementAndMaturity / 60);
 
  726                                        return ceil($daysBetweenSettlementAndMaturity / 30);
 
  765        public static function COUPPCD($settlement, $maturity, $frequency, $basis=0) {
 
  778                if (($settlement > $maturity) ||
 
  779                        (!self::_validFrequency($frequency)) ||
 
  780                        (($basis < 0) || ($basis > 4))) {
 
  821                if ($start < 1 || $start > 
$end) {
 
  827                for ($per = $start; $per <= 
$end; ++$per) {
 
  868                if ($start < 1 || $start > 
$end) {
 
  874                for ($per = $start; $per <= 
$end; ++$per) {
 
  908        public static function DB($cost, $salvage, $life, $period, $month=12) {
 
  916                if ((is_numeric($cost)) && (is_numeric($salvage)) && (is_numeric($life)) && (is_numeric($period)) && (is_numeric($month))) {
 
  917                        $cost           = (float) $cost;
 
  918                        $salvage        = (float) $salvage;
 
  920                        $period         = (int) $period;
 
  921                        $month          = (int) $month;
 
  924                        } elseif (($cost < 0) || (($salvage / $cost) < 0) || ($life <= 0) || ($period < 1) || ($month < 1)) {
 
  928                        $fixedDepreciationRate = 1 - pow(($salvage / $cost), (1 / $life));
 
  929                        $fixedDepreciationRate = round($fixedDepreciationRate, 3);
 
  932                        $previousDepreciation = 0;
 
  933                        for ($per = 1; $per <= $period; ++$per) {
 
  935                                        $depreciation = $cost * $fixedDepreciationRate * $month / 12;
 
  936                                } elseif ($per == ($life + 1)) {
 
  937                                        $depreciation = ($cost - $previousDepreciation) * $fixedDepreciationRate * (12 - $month) / 12;
 
  939                                        $depreciation = ($cost - $previousDepreciation) * $fixedDepreciationRate;
 
  941                                $previousDepreciation += $depreciation;
 
  944                                $depreciation = round($depreciation,2);
 
  946                        return $depreciation;
 
  975        public static function DDB($cost, $salvage, $life, $period, $factor=2.0) {
 
  983                if ((is_numeric($cost)) && (is_numeric($salvage)) && (is_numeric($life)) && (is_numeric($period)) && (is_numeric($factor))) {
 
  984                        $cost           = (float) $cost;
 
  985                        $salvage        = (float) $salvage;
 
  987                        $period         = (int) $period;
 
  988                        $factor         = (float) $factor;
 
  989                        if (($cost <= 0) || (($salvage / $cost) < 0) || ($life <= 0) || ($period < 1) || ($factor <= 0.0) || ($period > $life)) {
 
  993                        $fixedDepreciationRate = 1 - pow(($salvage / $cost), (1 / $life));
 
  994                        $fixedDepreciationRate = round($fixedDepreciationRate, 3);
 
  997                        $previousDepreciation = 0;
 
  998                        for ($per = 1; $per <= $period; ++$per) {
 
  999                                $depreciation = min( ($cost - $previousDepreciation) * ($factor / $life), ($cost - $salvage - $previousDepreciation) );
 
 1000                                $previousDepreciation += $depreciation;
 
 1003                                $depreciation = round($depreciation,2);
 
 1005                        return $depreciation;
 
 1036        public static function DISC($settlement, $maturity, $price, $redemption, $basis=0) {
 
 1044                if ((is_numeric($price)) && (is_numeric($redemption)) && (is_numeric($basis))) {
 
 1045                        $price          = (float) $price;
 
 1046                        $redemption     = (float) $redemption;
 
 1047                        $basis          = (int) $basis;
 
 1048                        if (($price <= 0) || ($redemption <= 0)) {
 
 1052                        if (!is_numeric($daysBetweenSettlementAndMaturity)) {
 
 1054                                return $daysBetweenSettlementAndMaturity;
 
 1057                        return ((1 - $price / $redemption) / $daysBetweenSettlementAndMaturity);
 
 1079        public static function DOLLARDE($fractional_dollar = Null, $fraction = 0) {
 
 1084                if (is_null($fractional_dollar) || $fraction < 0) {
 
 1087                if ($fraction == 0) {
 
 1091                $dollars = floor($fractional_dollar);
 
 1092                $cents = fmod($fractional_dollar,1);
 
 1093                $cents /= $fraction;
 
 1094                $cents *= pow(10,ceil(log10($fraction)));
 
 1095                return $dollars + $cents;
 
 1115        public static function DOLLARFR($decimal_dollar = Null, $fraction = 0) {
 
 1120                if (is_null($decimal_dollar) || $fraction < 0) {
 
 1123                if ($fraction == 0) {
 
 1127                $dollars = floor($decimal_dollar);
 
 1128                $cents = fmod($decimal_dollar,1);
 
 1129                $cents *= $fraction;
 
 1130                $cents *= pow(10,-ceil(log10($fraction)));
 
 1131                return $dollars + $cents;
 
 1150        public static function EFFECT($nominal_rate = 0, $npery = 0) {
 
 1155                if ($nominal_rate <= 0 || $npery < 1) {
 
 1159                return pow((1 + $nominal_rate / $npery), $npery) - 1;
 
 1185        public static function FV($rate = 0, $nper = 0, $pmt = 0, $pv = 0, 
$type = 0) {
 
 1198                if (!is_null($rate) && $rate != 0) {
 
 1199                        return -$pv * pow(1 + $rate, $nper) - $pmt * (1 + $rate * 
$type) * (pow(1 + $rate, $nper) - 1) / $rate;
 
 1201                        return -$pv - $pmt * $nper;
 
 1223                foreach($schedule as $rate) {
 
 1224                        $principal *= 1 + $rate;
 
 1253        public static function INTRATE($settlement, $maturity, $investment, $redemption, $basis=0) {
 
 1261                if ((is_numeric($investment)) && (is_numeric($redemption)) && (is_numeric($basis))) {
 
 1262                        $investment     = (float) $investment;
 
 1263                        $redemption     = (float) $redemption;
 
 1264                        $basis          = (int) $basis;
 
 1265                        if (($investment <= 0) || ($redemption <= 0)) {
 
 1269                        if (!is_numeric($daysBetweenSettlementAndMaturity)) {
 
 1271                                return $daysBetweenSettlementAndMaturity;
 
 1274                        return (($redemption / $investment) - 1) / ($daysBetweenSettlementAndMaturity);
 
 1296        public static function IPMT($rate, $per, $nper, $pv, $fv = 0, 
$type = 0) {
 
 1308                if ($per <= 0 || $per > $nper) {
 
 1314                return $interestAndPrincipal[0];
 
 1336        public static function IRR($values, $guess = 0.1) {
 
 1347                        if (($f1 * $f2) < 0.0) 
break;
 
 1348                        if (abs($f1) < abs($f2)) {
 
 1349                                $f1 = 
self::NPV($x1 += 1.6 * ($x1 - $x2), $values);
 
 1351                                $f2 = 
self::NPV($x2 += 1.6 * ($x2 - $x1), $values);
 
 1367                        $x_mid = $rtb + $dx;
 
 1400                $interestRate = array_shift($aArgs);
 
 1401                $period = array_shift($aArgs);
 
 1402                $numberPeriods = array_shift($aArgs);
 
 1403                $principleRemaining = array_shift($aArgs);
 
 1406                $principlePayment = ($principleRemaining * 1.0) / ($numberPeriods * 1.0);
 
 1407                for(
$i=0; 
$i <= $period; ++
$i) {
 
 1408                        $returnValue = $interestRate * $principleRemaining * -1;
 
 1409                        $principleRemaining -= $principlePayment;
 
 1411                        if(
$i == $numberPeriods) {
 
 1415                return($returnValue);
 
 1435        public static function MIRR($values, $finance_rate, $reinvestment_rate) {
 
 1440                $n = count($values);
 
 1442                $rr = 1.0 + $reinvestment_rate;
 
 1443                $fr = 1.0 + $finance_rate;
 
 1445                $npv_pos = $npv_neg = 0.0;
 
 1446                foreach($values as 
$i => $v) {
 
 1448                                $npv_pos += $v / pow($rr, 
$i);
 
 1450                                $npv_neg += $v / pow($fr, 
$i);
 
 1454                if (($npv_neg == 0) || ($npv_pos == 0) || ($reinvestment_rate <= -1)) {
 
 1458                $mirr = pow((-$npv_pos * pow($rr, 
$n))
 
 1459                                / ($npv_neg * ($rr)), (1.0 / (
$n - 1))) - 1.0;
 
 1474        public static function NOMINAL($effect_rate = 0, $npery = 0) {
 
 1479                if ($effect_rate <= 0 || $npery < 1) {
 
 1484                return $npery * (pow($effect_rate + 1, 1 / $npery) - 1);
 
 1500        public static function NPER($rate = 0, $pmt = 0, $pv = 0, $fv = 0, 
$type = 0) {
 
 1513                if (!is_null($rate) && $rate != 0) {
 
 1514                        if ($pmt == 0 && $pv == 0) {
 
 1517                        return log(($pmt * (1 + $rate * 
$type) / $rate - $fv) / ($pv + $pmt * (1 + $rate * 
$type) / $rate)) / log(1 + $rate);
 
 1522                        return (-$pv -$fv) / $pmt;
 
 1533        public static function NPV() {
 
 1541                $rate = array_shift($aArgs);
 
 1542                for (
$i = 1; 
$i <= count($aArgs); ++
$i) {
 
 1544                        if (is_numeric($aArgs[
$i - 1])) {
 
 1545                                $returnValue += $aArgs[
$i - 1] / pow(1 + $rate, 
$i);
 
 1550                return $returnValue;
 
 1565        public static function PMT($rate = 0, $nper = 0, $pv = 0, $fv = 0, 
$type = 0) {
 
 1578                if (!is_null($rate) && $rate != 0) {
 
 1579                        return (-$fv - $pv * pow(1 + $rate, $nper)) / (1 + $rate * 
$type) / ((pow(1 + $rate, $nper) - 1) / $rate);
 
 1581                        return (-$pv - $fv) / $nper;
 
 1599        public static function PPMT($rate, $per, $nper, $pv, $fv = 0, 
$type = 0) {
 
 1611                if ($per <= 0 || $per > $nper) {
 
 1617                return $interestAndPrincipal[1];
 
 1621        public static function PRICE($settlement, $maturity, $rate, $yield, $redemption, $frequency, $basis=0) {
 
 1637                if (($settlement > $maturity) ||
 
 1638                        (!self::_validFrequency($frequency)) ||
 
 1639                        (($basis < 0) || ($basis > 4))) {
 
 1648                $baseYF = 1.0 + ($yield / $frequency);
 
 1649                $rfp    = 100 * ($rate / $frequency);
 
 1652                $result = $redemption / pow($baseYF, (--
$n + $de));
 
 1653                for($k = 0; $k <= 
$n; ++$k) {
 
 1654                        $result += $rfp / (pow($baseYF, ($k + $de)));
 
 1681        public static function PRICEDISC($settlement, $maturity, $discount, $redemption, $basis=0) {
 
 1689                if ((is_numeric($discount)) && (is_numeric($redemption)) && (is_numeric($basis))) {
 
 1690                        if (($discount <= 0) || ($redemption <= 0)) {
 
 1694                        if (!is_numeric($daysBetweenSettlementAndMaturity)) {
 
 1696                                return $daysBetweenSettlementAndMaturity;
 
 1699                        return $redemption * (1 - $discount * $daysBetweenSettlementAndMaturity);
 
 1725        public static function PRICEMAT($settlement, $maturity, $issue, $rate, $yield, $basis=0) {
 
 1734                if (is_numeric($rate) && is_numeric($yield)) {
 
 1735                        if (($rate <= 0) || ($yield <= 0)) {
 
 1739                        if (!is_numeric($daysPerYear)) {
 
 1740                                return $daysPerYear;
 
 1743                        if (!is_numeric($daysBetweenIssueAndSettlement)) {
 
 1745                                return $daysBetweenIssueAndSettlement;
 
 1747                        $daysBetweenIssueAndSettlement *= $daysPerYear;
 
 1749                        if (!is_numeric($daysBetweenIssueAndMaturity)) {
 
 1751                                return $daysBetweenIssueAndMaturity;
 
 1753                        $daysBetweenIssueAndMaturity *= $daysPerYear;
 
 1755                        if (!is_numeric($daysBetweenSettlementAndMaturity)) {
 
 1757                                return $daysBetweenSettlementAndMaturity;
 
 1759                        $daysBetweenSettlementAndMaturity *= $daysPerYear;
 
 1761                        return ((100 + (($daysBetweenIssueAndMaturity / $daysPerYear) * $rate * 100)) /
 
 1762                                   (1 + (($daysBetweenSettlementAndMaturity / $daysPerYear) * $yield)) -
 
 1763                                   (($daysBetweenIssueAndSettlement / $daysPerYear) * $rate * 100));
 
 1781        public static function PV($rate = 0, $nper = 0, $pmt = 0, $fv = 0, 
$type = 0) {
 
 1794                if (!is_null($rate) && $rate != 0) {
 
 1795                        return (-$pmt * (1 + $rate * 
$type) * ((pow(1 + $rate, $nper) - 1) / $rate) - $fv) / pow(1 + $rate, $nper);
 
 1797                        return -$fv - $pmt * $nper;
 
 1832        public static function RATE($nper, $pmt, $pv, $fv = 0.0, 
$type = 0, $guess = 0.1) {
 
 1842                        $y = $pv * (1 + $nper * $rate) + $pmt * (1 + $rate * 
$type) * $nper + $fv;
 
 1844                        $f = exp($nper * log(1 + $rate));
 
 1845                        $y = $pv * $f + $pmt * (1 / $rate + 
$type) * ($f - 1) + $fv;
 
 1847                $y0 = $pv + $pmt * $nper + $fv;
 
 1848                $y1 = $pv * $f + $pmt * (1 / $rate + 
$type) * ($f - 1) + $fv;
 
 1854                        $rate = ($y1 * $x0 - $y0 * $x1) / ($y1 - $y0);
 
 1857                        if (($nper * abs($pmt)) > ($pv - $fv))
 
 1861                                $y = $pv * (1 + $nper * $rate) + $pmt * (1 + $rate * 
$type) * $nper + $fv;
 
 1863                                $f = exp($nper * log(1 + $rate));
 
 1864                                $y = $pv * $f + $pmt * (1 / $rate + 
$type) * ($f - 1) + $fv;
 
 1894        public static function RECEIVED($settlement, $maturity, $investment, $discount, $basis=0) {
 
 1902                if ((is_numeric($investment)) && (is_numeric($discount)) && (is_numeric($basis))) {
 
 1903                        if (($investment <= 0) || ($discount <= 0)) {
 
 1907                        if (!is_numeric($daysBetweenSettlementAndMaturity)) {
 
 1909                                return $daysBetweenSettlementAndMaturity;
 
 1912                        return $investment / ( 1 - ($discount * $daysBetweenSettlementAndMaturity));
 
 1928        public static function SLN($cost, $salvage, $life) {
 
 1934                if ((is_numeric($cost)) && (is_numeric($salvage)) && (is_numeric($life))) {
 
 1938                        return ($cost - $salvage) / $life;
 
 1955        public static function SYD($cost, $salvage, $life, $period) {
 
 1962                if ((is_numeric($cost)) && (is_numeric($salvage)) && (is_numeric($life)) && (is_numeric($period))) {
 
 1963                        if (($life < 1) || ($period > $life)) {
 
 1966                        return (($cost - $salvage) * ($life - $period + 1) * 2) / ($life * ($life + 1));
 
 1984        public static function TBILLEQ($settlement, $maturity, $discount) {
 
 1991                if (is_string($testValue)) {
 
 2006                return (365 * $discount) / (360 - $discount * $daysBetweenSettlementAndMaturity);
 
 2022        public static function TBILLPRICE($settlement, $maturity, $discount) {
 
 2032                if (is_numeric($discount)) {
 
 2033                        if ($discount <= 0) {
 
 2040                                if (!is_numeric($daysBetweenSettlementAndMaturity)) {
 
 2042                                        return $daysBetweenSettlementAndMaturity;
 
 2048                        if ($daysBetweenSettlementAndMaturity > 360) {
 
 2052                        $price = 100 * (1 - (($discount * $daysBetweenSettlementAndMaturity) / 360));
 
 2074        public static function TBILLYIELD($settlement, $maturity, $price) {
 
 2080                if (is_numeric($price)) {
 
 2088                                if (!is_numeric($daysBetweenSettlementAndMaturity)) {
 
 2090                                        return $daysBetweenSettlementAndMaturity;
 
 2096                        if ($daysBetweenSettlementAndMaturity > 360) {
 
 2100                        return ((100 - $price) / $price) * (360 / $daysBetweenSettlementAndMaturity);
 
 2106        public static function XIRR($values, $dates, $guess = 0.1) {
 
 2119                        if (($f1 * $f2) < 0.0) 
break;
 
 2120                        if (abs($f1) < abs($f2)) {
 
 2121                                $f1 = 
self::XNPV($x1 += 1.6 * ($x1 - $x2), $values, $dates);
 
 2123                                $f2 = 
self::XNPV($x2 += 1.6 * ($x2 - $x1), $values, $dates);
 
 2139                        $x_mid = $rtb + $dx;
 
 2140                        $f_mid = 
self::XNPV($x_mid, $values, $dates);
 
 2141                        if ($f_mid <= 0.0) $rtb = $x_mid;
 
 2162        public static function XNPV($rate, $values, $dates) {
 
 2168                $valCount = count($values);
 
 2173                for (
$i = 0; 
$i < $valCount; ++
$i) {
 
 2200        public static function YIELDDISC($settlement, $maturity, $price, $redemption, $basis=0) {
 
 2208                if (is_numeric($price) && is_numeric($redemption)) {
 
 2209                        if (($price <= 0) || ($redemption <= 0)) {
 
 2213                        if (!is_numeric($daysPerYear)) {
 
 2214                                return $daysPerYear;
 
 2217                        if (!is_numeric($daysBetweenSettlementAndMaturity)) {
 
 2219                                return $daysBetweenSettlementAndMaturity;
 
 2221                        $daysBetweenSettlementAndMaturity *= $daysPerYear;
 
 2223                        return (($redemption - $price) / $price) * ($daysPerYear / $daysBetweenSettlementAndMaturity);
 
 2249        public static function YIELDMAT($settlement, $maturity, $issue, $rate, $price, $basis=0) {
 
 2258                if (is_numeric($rate) && is_numeric($price)) {
 
 2259                        if (($rate <= 0) || ($price <= 0)) {
 
 2263                        if (!is_numeric($daysPerYear)) {
 
 2264                                return $daysPerYear;
 
 2267                        if (!is_numeric($daysBetweenIssueAndSettlement)) {
 
 2269                                return $daysBetweenIssueAndSettlement;
 
 2271                        $daysBetweenIssueAndSettlement *= $daysPerYear;
 
 2273                        if (!is_numeric($daysBetweenIssueAndMaturity)) {
 
 2275                                return $daysBetweenIssueAndMaturity;
 
 2277                        $daysBetweenIssueAndMaturity *= $daysPerYear;
 
 2279                        if (!is_numeric($daysBetweenSettlementAndMaturity)) {
 
 2281                                return $daysBetweenSettlementAndMaturity;
 
 2283                        $daysBetweenSettlementAndMaturity *= $daysPerYear;
 
 2285                        return ((1 + (($daysBetweenIssueAndMaturity / $daysPerYear) * $rate) - (($price / 100) + (($daysBetweenIssueAndSettlement / $daysPerYear) * $rate))) /
 
 2286                                   (($price / 100) + (($daysBetweenIssueAndSettlement / $daysPerYear) * $rate))) *
 
 2287                                   ($daysPerYear / $daysBetweenSettlementAndMaturity);
 
const FINANCIAL_PRECISION
FINANCIAL_PRECISION.
const FINANCIAL_MAX_ITERATIONS(!defined('PHPEXCEL_ROOT'))
PHPExcel root directory.
An exception for terminatinating execution or to throw for unit testing.
static YEAR($dateValue=1)
YEAR.
static DATEDIF($startDate=0, $endDate=0, $unit='D')
DATEDIF.
static _isLeapYear($year)
Identify if a year is a leap year or not.
static YEARFRAC($startDate=0, $endDate=0, $method=0)
static _getDateValue($dateValue)
_getDateValue
static _lastDayOfMonth($testDate)
_lastDayOfMonth
static XIRR($values, $dates, $guess=0.1)
static CUMIPMT($rate, $nper, $pv, $start, $end, $type=0)
static _interestAndPrincipal($rate=0, $per=0, $nper=0, $pv=0, $fv=0, $type=0)
static DISC($settlement, $maturity, $price, $redemption, $basis=0)
static COUPPCD($settlement, $maturity, $frequency, $basis=0)
static IRR($values, $guess=0.1)
IRR.
static IPMT($rate, $per, $nper, $pv, $fv=0, $type=0)
IPMT.
static _validFrequency($frequency)
static SLN($cost, $salvage, $life)
SLN.
static _daysPerYear($year, $basis=0)
_daysPerYear
static YIELDMAT($settlement, $maturity, $issue, $rate, $price, $basis=0)
YIELDMAT.
static _coupFirstPeriodDate($settlement, $maturity, $frequency, $next)
static TBILLPRICE($settlement, $maturity, $discount)
TBILLPRICE.
static EFFECT($nominal_rate=0, $npery=0)
static AMORLINC($cost, $purchased, $firstPeriod, $salvage, $period, $rate, $basis=0)
static DDB($cost, $salvage, $life, $period, $factor=2.0)
static PRICE($settlement, $maturity, $rate, $yield, $redemption, $frequency, $basis=0)
static ACCRINTM($issue, $settlement, $rate, $par=1000, $basis=0)
static DB($cost, $salvage, $life, $period, $month=12)
static XNPV($rate, $values, $dates)
XNPV.
static RECEIVED($settlement, $maturity, $investment, $discount, $basis=0)
RECEIVED.
static TBILLEQ($settlement, $maturity, $discount)
TBILLEQ.
static INTRATE($settlement, $maturity, $investment, $redemption, $basis=0)
INTRATE.
static PRICEDISC($settlement, $maturity, $discount, $redemption, $basis=0)
PRICEDISC.
static FVSCHEDULE($principal, $schedule)
FVSCHEDULE.
static RATE($nper, $pmt, $pv, $fv=0.0, $type=0, $guess=0.1)
static COUPNCD($settlement, $maturity, $frequency, $basis=0)
static COUPDAYSNC($settlement, $maturity, $frequency, $basis=0)
static PRICEMAT($settlement, $maturity, $issue, $rate, $yield, $basis=0)
PRICEMAT.
static FV($rate=0, $nper=0, $pmt=0, $pv=0, $type=0)
static NOMINAL($effect_rate=0, $npery=0)
NOMINAL.
static TBILLYIELD($settlement, $maturity, $price)
TBILLYIELD.
static MIRR($values, $finance_rate, $reinvestment_rate)
MIRR.
static COUPDAYS($settlement, $maturity, $frequency, $basis=0)
static PMT($rate=0, $nper=0, $pv=0, $fv=0, $type=0)
PMT.
static YIELDDISC($settlement, $maturity, $price, $redemption, $basis=0)
YIELDDISC.
static DOLLARFR($decimal_dollar=Null, $fraction=0)
static AMORDEGRC($cost, $purchased, $firstPeriod, $salvage, $period, $rate, $basis=0)
static ACCRINT($issue, $firstinterest, $settlement, $rate, $par=1000, $frequency=1, $basis=0)
static PPMT($rate, $per, $nper, $pv, $fv=0, $type=0)
PPMT.
static COUPDAYBS($settlement, $maturity, $frequency, $basis=0)
static PV($rate=0, $nper=0, $pmt=0, $fv=0, $type=0)
PV.
static CUMPRINC($rate, $nper, $pv, $start, $end, $type=0)
static SYD($cost, $salvage, $life, $period)
SYD.
static COUPNUM($settlement, $maturity, $frequency, $basis=0)
static NPER($rate=0, $pmt=0, $pv=0, $fv=0, $type=0)
NPER.
static _firstDayOfMonth($testDate)
_firstDayOfMonth
static DOLLARDE($fractional_dollar=Null, $fraction=0)
static getCompatibilityMode()
static flattenSingleValue($value='')
Convert an array to a single scalar value by extracting the first element.
const COMPATIBILITY_GNUMERIC
static flattenArray($array)
Convert a multi-dimensional array to a simple 1-dimensional array.
const COMPATIBILITY_OPENOFFICE
static PHPToExcel($dateValue=0, $adjustToTimezone=FALSE, $timezone=NULL)
Convert a date from PHP to Excel.
static ExcelToPHPObject($dateValue=0)
Convert a date from Excel to a PHP Date/Time object.
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'